diff --git a/src/mountfsd/mountwork.c b/src/mountfsd/mountwork.c index ded0f3c4bca..eaf72893aab 100644 --- a/src/mountfsd/mountwork.c +++ b/src/mountfsd/mountwork.c @@ -510,6 +510,14 @@ static int vl_method_mount_image( TAKE_FD(pp->fsmount_fd); + const char *m = partition_mountpoint_to_string(d); + _cleanup_strv_free_ char **l = NULL; + if (!isempty(m)) { + l = strv_split_nulstr(m); + if (!l) + return log_oom_debug(); + } + r = sd_json_variant_append_arraybo( &aj, SD_JSON_BUILD_PAIR("designator", SD_JSON_BUILD_STRING(partition_designator_to_string(d))), @@ -522,7 +530,8 @@ static int vl_method_mount_image( SD_JSON_BUILD_PAIR_CONDITION(!!pp->label, "partitionLabel", SD_JSON_BUILD_STRING(pp->label)), SD_JSON_BUILD_PAIR("size", SD_JSON_BUILD_INTEGER(pp->size)), SD_JSON_BUILD_PAIR("offset", SD_JSON_BUILD_INTEGER(pp->offset)), - SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx))); + SD_JSON_BUILD_PAIR("mountFileDescriptor", SD_JSON_BUILD_INTEGER(fd_idx)), + JSON_BUILD_PAIR_STRV_NON_EMPTY("mountPoint", l)); if (r < 0) return r; } diff --git a/src/shared/gpt.c b/src/shared/gpt.c index 9d7ffcecd9d..a443cc5e993 100644 --- a/src/shared/gpt.c +++ b/src/shared/gpt.c @@ -115,7 +115,7 @@ static const char *const partition_mountpoint_table[_PARTITION_DESIGNATOR_MAX] = [PARTITION_VAR] = "/var\0", }; -DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(partition_mountpoint, PartitionDesignator); +DEFINE_STRING_TABLE_LOOKUP_TO_STRING(partition_mountpoint, PartitionDesignator); #define _GPT_ARCH_SEXTET(arch, name) \ { SD_GPT_ROOT_##arch, "root-" name, ARCHITECTURE_##arch, .designator = PARTITION_ROOT }, \ diff --git a/src/shared/gpt.h b/src/shared/gpt.h index e64ba8439d3..7a67eddebee 100644 --- a/src/shared/gpt.h +++ b/src/shared/gpt.h @@ -41,6 +41,8 @@ PartitionDesignator partition_verity_sig_to_data(PartitionDesignator d); const char* partition_designator_to_string(PartitionDesignator d) _const_; PartitionDesignator partition_designator_from_string(const char *name) _pure_; +const char* partition_mountpoint_to_string(PartitionDesignator d) _const_; + const char* gpt_partition_type_uuid_to_string(sd_id128_t id); const char* gpt_partition_type_uuid_to_string_harder( sd_id128_t id, diff --git a/src/shared/varlink-io.systemd.MountFileSystem.c b/src/shared/varlink-io.systemd.MountFileSystem.c index 977552dd2d1..54f500a7c5b 100644 --- a/src/shared/varlink-io.systemd.MountFileSystem.c +++ b/src/shared/varlink-io.systemd.MountFileSystem.c @@ -42,7 +42,9 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE( SD_VARLINK_FIELD_COMMENT("The start offset of the partition in bytes."), SD_VARLINK_DEFINE_FIELD(offset, SD_VARLINK_INT, 0), SD_VARLINK_FIELD_COMMENT("A mount file descriptor to assign to a location."), - SD_VARLINK_DEFINE_FIELD(mountFileDescriptor, SD_VARLINK_INT, 0)); + SD_VARLINK_DEFINE_FIELD(mountFileDescriptor, SD_VARLINK_INT, 0), + SD_VARLINK_FIELD_COMMENT("A relative path indicating the intended mount point for this file system, if applicable. May contain multiple paths, for certain partitions that can be mounted to multiple distinct places."), + SD_VARLINK_DEFINE_FIELD(mountPoint, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY)); static SD_VARLINK_DEFINE_METHOD( MountImage,