mountfsd: Communicate whether the image is a single filesystem
Various parts of the image dissection logic make use of whether the thing is a single file system or not, so communicate this info back from mountfsd.
This commit is contained in:
@@ -713,6 +713,7 @@ static int vl_method_mount_image(
|
||||
return sd_varlink_replybo(
|
||||
link,
|
||||
SD_JSON_BUILD_PAIR_VARIANT("partitions", aj),
|
||||
SD_JSON_BUILD_PAIR_BOOLEAN("singleFileSystem", di->single_file_system),
|
||||
SD_JSON_BUILD_PAIR_STRING("imagePolicy", ps),
|
||||
SD_JSON_BUILD_PAIR_UNSIGNED("imageSize", di->image_size),
|
||||
SD_JSON_BUILD_PAIR_UNSIGNED("sectorSize", di->sector_size),
|
||||
|
||||
@@ -5094,6 +5094,7 @@ static void partition_fields_done(PartitionFields *f) {
|
||||
|
||||
typedef struct MountImageReplyParameters {
|
||||
sd_json_variant *partitions;
|
||||
bool single_file_system;
|
||||
char *image_policy;
|
||||
uint64_t image_size;
|
||||
uint32_t sector_size;
|
||||
@@ -5122,11 +5123,12 @@ int mountfsd_mount_image_fd(
|
||||
_cleanup_(mount_image_reply_parameters_done) MountImageReplyParameters p = {};
|
||||
|
||||
static const sd_json_dispatch_field dispatch_table[] = {
|
||||
{ "partitions", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_variant, offsetof(struct MountImageReplyParameters, partitions), SD_JSON_MANDATORY },
|
||||
{ "imagePolicy", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(struct MountImageReplyParameters, image_policy), 0 },
|
||||
{ "imageSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(struct MountImageReplyParameters, image_size), SD_JSON_MANDATORY },
|
||||
{ "sectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint32, offsetof(struct MountImageReplyParameters, sector_size), SD_JSON_MANDATORY },
|
||||
{ "imageUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(struct MountImageReplyParameters, image_uuid), 0 },
|
||||
{ "partitions", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_variant, offsetof(struct MountImageReplyParameters, partitions), SD_JSON_MANDATORY },
|
||||
{ "singleFileSystem", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(struct MountImageReplyParameters, single_file_system), 0 },
|
||||
{ "imagePolicy", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(struct MountImageReplyParameters, image_policy), 0 },
|
||||
{ "imageSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64, offsetof(struct MountImageReplyParameters, image_size), SD_JSON_MANDATORY },
|
||||
{ "sectorSize", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint32, offsetof(struct MountImageReplyParameters, sector_size), SD_JSON_MANDATORY },
|
||||
{ "imageUuid", SD_JSON_VARIANT_STRING, sd_json_dispatch_id128, offsetof(struct MountImageReplyParameters, image_uuid), 0 },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -5307,6 +5309,7 @@ int mountfsd_mount_image_fd(
|
||||
};
|
||||
}
|
||||
|
||||
di->single_file_system = p.single_file_system;
|
||||
di->image_size = p.image_size;
|
||||
di->sector_size = p.sector_size;
|
||||
di->image_uuid = p.image_uuid;
|
||||
|
||||
@@ -75,6 +75,8 @@ static SD_VARLINK_DEFINE_METHOD(
|
||||
VARLINK_DEFINE_POLKIT_INPUT,
|
||||
SD_VARLINK_FIELD_COMMENT("An array with information about contained partitions that have been prepared for mounting, as well as their mount file descriptors."),
|
||||
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(partitions, PartitionInfo, SD_VARLINK_ARRAY),
|
||||
SD_VARLINK_FIELD_COMMENT("Indicates whether the image contains only a single file system, i.e. no partition table."),
|
||||
SD_VARLINK_DEFINE_OUTPUT(singleFileSystem, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("The used image policy."),
|
||||
SD_VARLINK_DEFINE_OUTPUT(imagePolicy, SD_VARLINK_STRING, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The size of the image in bytes."),
|
||||
|
||||
Reference in New Issue
Block a user