Lines Matching refs:target
50 resource_destroy(&t->target); in transfer_free()
64 .target.type = _RESOURCE_TYPE_INVALID, in transfer_new()
435 …t", "Type", config_parse_resource_type, 0, &t->target.type }, in transfer_read_definition()
436 …t", "Path", config_parse_resource_path, 0, &t->target }, in transfer_read_definition()
437 …t", "MatchPattern", config_parse_resource_pattern, 0, &t->target.patterns }, in transfer_read_definition()
438 …t", "MatchPartitionType", config_parse_resource_ptype, 0, &t->target }, in transfer_read_definition()
468 if (t->target.type < 0) { in transfer_read_definition()
473 t->target.type = in transfer_read_definition()
474 t->target.path && path_startswith(t->target.path, "/dev/") ? in transfer_read_definition()
481 t->target.type = RESOURCE_DIRECTORY; in transfer_read_definition()
485 t->target.type = RESOURCE_SUBVOLUME; in transfer_read_definition()
493 if (!RESOURCE_IS_TARGET(t->target.type)) in transfer_read_definition()
498 !IN_SET(t->target.type, RESOURCE_PARTITION, RESOURCE_REGULAR_FILE)) || in transfer_read_definition()
500 !IN_SET(t->target.type, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME))) in transfer_read_definition()
503 … resource_type_to_string(t->source.type), resource_type_to_string(t->target.type)); in transfer_read_definition()
528 if (!t->target.path && !t->target.path_auto) in transfer_read_definition()
532 if (t->target.path && in transfer_read_definition()
533 (!path_is_absolute(t->target.path) || !path_is_normalized(t->target.path))) in transfer_read_definition()
535 … "Target path is not a normalized, absolute path: %s", t->target.path); in transfer_read_definition()
537 if (strv_isempty(t->target.patterns)) { in transfer_read_definition()
538 strv_free(t->target.patterns); in transfer_read_definition()
539 t->target.patterns = strv_copy(t->source.patterns); in transfer_read_definition()
540 if (!t->target.patterns) in transfer_read_definition()
544 …if (t->current_symlink && !RESOURCE_IS_FILESYSTEM(t->target.type) && !path_is_absolute(t->current_… in transfer_read_definition()
550 … t->instances_max = t->target.type == RESOURCE_PARTITION ? UINT64_MAX : DEFAULT_FILE_INSTANCES_MAX; in transfer_read_definition()
573 r = resource_resolve_path(&t->target, root, node); in transfer_resolve_paths()
589 if (!IN_SET(t->target.type, RESOURCE_REGULAR_FILE, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME)) in transfer_remove_temporary()
594 d = opendir(t->target.path); in transfer_remove_temporary()
599 … log_debug_errno(errno, "Failed to open target directory '%s', ignoring: %m", t->target.path); in transfer_remove_temporary()
610 … log_debug_errno(errno, "Failed to read target directory '%s', ignoring: %m", t->target.path); in transfer_remove_temporary()
621 … "Failed to remove temporary resource instance '%s/%s', ignoring: %m", t->target.path, de->d_name); in transfer_remove_temporary()
625 … log_debug("Removed temporary resource instance '%s/%s'.", t->target.path, de->d_name); in transfer_remove_temporary()
656 if (t->target.type == RESOURCE_PARTITION) { in transfer_vacuum()
662 if (t->target.n_empty + t->target.n_instances < 2) in transfer_vacuum()
665 SD_ID128_FORMAT_VAL(t->target.partition_type), in transfer_vacuum()
666 … gpt_partition_type_uuid_to_string(t->target.partition_type)); in transfer_vacuum()
667 if (space > t->target.n_empty + t->target.n_instances) in transfer_vacuum()
670 SD_ID128_FORMAT_VAL(t->target.partition_type), in transfer_vacuum()
671 … gpt_partition_type_uuid_to_string(t->target.partition_type)); in transfer_vacuum()
672 if (space == t->target.n_empty + t->target.n_instances) in transfer_vacuum()
675 SD_ID128_FORMAT_VAL(t->target.partition_type), in transfer_vacuum()
676 … gpt_partition_type_uuid_to_string(t->target.partition_type)); in transfer_vacuum()
678 rm = LESS_BY(space, t->target.n_empty); in transfer_vacuum()
679 remain = LESS_BY(t->target.n_instances, rm); in transfer_vacuum()
683 while (t->target.n_instances > limit) { in transfer_vacuum()
685 size_t p = t->target.n_instances - 1; in transfer_vacuum()
688 oldest = t->target.instances[p]; in transfer_vacuum()
712 switch (t->target.type) { in transfer_vacuum()
729 r = patch_partition(t->target.path, &pinfo, PARTITION_LABEL); in transfer_vacuum()
733 t->target.n_empty++; in transfer_vacuum()
743 …memmove(t->target.instances + p, t->target.instances + p + 1, (t->target.n_instances - p - 1) * si… in transfer_vacuum()
744 t->target.n_instances--; in transfer_vacuum()
827 existing = resource_find_instance(&t->target, i->metadata.version); in transfer_acquire_instance()
835 assert(!strv_isempty(t->target.patterns)); in transfer_acquire_instance()
839 r = pattern_format(t->target.patterns[0], &f, &formatted_pattern); in transfer_acquire_instance()
843 if (RESOURCE_IS_FILESYSTEM(t->target.type)) { in transfer_acquire_instance()
848 t->final_path = path_join(t->target.path, formatted_pattern); in transfer_acquire_instance()
859 if (t->target.type == RESOURCE_PARTITION) { in transfer_acquire_instance()
867 t->target.path, in transfer_acquire_instance()
869 t->target.partition_type_set ? &t->target.partition_type : NULL, in transfer_acquire_instance()
900 switch (t->target.type) { /* Target */ in transfer_acquire_instance()
936 t->target.path, in transfer_acquire_instance()
949 assert(IN_SET(t->target.type, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME)); in transfer_acquire_instance()
960 … t->target.type == RESOURCE_SUBVOLUME ? "--btrfs-subvol=yes" : "--btrfs-subvol=no", in transfer_acquire_instance()
968 assert(IN_SET(t->target.type, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME)); in transfer_acquire_instance()
979 … t->target.type == RESOURCE_SUBVOLUME ? "--btrfs-subvol=yes" : "--btrfs-subvol=no", in transfer_acquire_instance()
988 switch (t->target.type) { in transfer_acquire_instance()
1023 t->target.path, in transfer_acquire_instance()
1035 assert(IN_SET(t->target.type, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME)); in transfer_acquire_instance()
1044 … t->target.type == RESOURCE_SUBVOLUME ? "--btrfs-subvol=yes" : "--btrfs-subvol=no", in transfer_acquire_instance()
1058 if (RESOURCE_IS_FILESYSTEM(t->target.type)) { in transfer_acquire_instance()
1087 if (t->target.type == RESOURCE_REGULAR_FILE) in transfer_acquire_instance()
1090 … assert(IN_SET(t->target.type, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME)); in transfer_acquire_instance()
1100 if (t->target.type == RESOURCE_PARTITION) { in transfer_acquire_instance()
1151 assert(RESOURCE_IS_FILESYSTEM(t->target.type)); in transfer_install_instance()
1158 … (t->target.type == RESOURCE_REGULAR_FILE ? INSTALL_FSYNC_FULL : INSTALL_SYNCFS)); in transfer_install_instance()
1166 resource_type_to_string(t->target.type)); in transfer_install_instance()
1172 assert(t->target.type == RESOURCE_PARTITION); in transfer_install_instance()
1175 t->target.path, in transfer_install_instance()
1185 resource_type_to_string(t->target.type)); in transfer_install_instance()
1193 if (RESOURCE_IS_FILESYSTEM(t->target.type)) { in transfer_install_instance()
1195 assert(t->target.path); in transfer_install_instance()
1201 buf = path_make_absolute(t->current_symlink, t->target.path); in transfer_install_instance()
1210 } else if (t->target.type == RESOURCE_PARTITION) { in transfer_install_instance()