mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
mountfsd: add complete varlink introspection comments (#36703)
This commit is contained in:
commit
f3580b6807
1
TODO
1
TODO
@ -152,7 +152,6 @@ Features:
|
||||
- io.systemd.Hostname
|
||||
- io.systemd.Journal
|
||||
- io.systemd.ManagedOOM
|
||||
- io.systemd.MountFileSystem
|
||||
- io.systemd.Network
|
||||
- io.systemd.PCRExtend
|
||||
- io.systemd.PCRLock
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 }, \
|
||||
|
@ -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,
|
||||
|
@ -21,32 +21,57 @@ static SD_VARLINK_DEFINE_ENUM_TYPE(
|
||||
|
||||
static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
PartitionInfo,
|
||||
SD_VARLINK_DEFINE_FIELD(designator, SD_VARLINK_STRING, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The designator of this partition."),
|
||||
SD_VARLINK_DEFINE_FIELD_BY_TYPE(designator, PartitionDesignator, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("Indicates whether this partition is marked for writable (non-read-only) operations."),
|
||||
SD_VARLINK_DEFINE_FIELD(writable, SD_VARLINK_BOOL, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("Indicates whether this partition is marked for automatic growing."),
|
||||
SD_VARLINK_DEFINE_FIELD(growFileSystem, SD_VARLINK_BOOL, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("Indicates the numeric partition number of this partition, or null if the image does not carry a partition table, and this object covers the whole block device."),
|
||||
SD_VARLINK_DEFINE_FIELD(partitionNumber, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Indicates the intended CPU architecture of the partition, in case the partition type encodes such information."),
|
||||
SD_VARLINK_DEFINE_FIELD(architecture, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("The partition UUID identifying the partition."),
|
||||
SD_VARLINK_DEFINE_FIELD(partitionUuid, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("The file system type for the mount"),
|
||||
SD_VARLINK_DEFINE_FIELD(fileSystemType, SD_VARLINK_STRING, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The partition label string of this partition."),
|
||||
SD_VARLINK_DEFINE_FIELD(partitionLabel, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("The size of the partition in bytes."),
|
||||
SD_VARLINK_DEFINE_FIELD(size, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The start offset of the partition in bytes."),
|
||||
SD_VARLINK_DEFINE_FIELD(offset, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_DEFINE_FIELD(mountFileDescriptor, 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_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,
|
||||
SD_VARLINK_FIELD_COMMENT("File descriptor of the image file to mount and to assign to the user namespace. Must be a regular, i.e. non-O_PATH file descriptor."),
|
||||
SD_VARLINK_DEFINE_INPUT(imageFileDescriptor, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("File descriptor to the user namespace to assign this image to. If not specified uses the host user namespace."),
|
||||
SD_VARLINK_DEFINE_INPUT(userNamespaceFileDescriptor, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Mounts the image read-only."),
|
||||
SD_VARLINK_DEFINE_INPUT(readOnly, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Grows the contained file systems if necessary and indicated, before mounting them."),
|
||||
SD_VARLINK_DEFINE_INPUT(growFileSystems, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Takes a literal password in case of an encrypted image"),
|
||||
SD_VARLINK_DEFINE_INPUT(password, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Takes an image policy string (see systemd.image-policy(7) for details) to apply while mounting the image"),
|
||||
SD_VARLINK_DEFINE_INPUT(imagePolicy, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
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("The used image policy."),
|
||||
SD_VARLINK_DEFINE_OUTPUT(imagePolicy, SD_VARLINK_STRING, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The size of the image in bytes."),
|
||||
SD_VARLINK_DEFINE_OUTPUT(imageSize, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The sector size of the image in bytes"),
|
||||
SD_VARLINK_DEFINE_OUTPUT(sectorSize, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("The name of the image"),
|
||||
SD_VARLINK_DEFINE_OUTPUT(imageName, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("The UUID of the image"),
|
||||
SD_VARLINK_DEFINE_OUTPUT(imageUuid, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
|
||||
|
||||
static SD_VARLINK_DEFINE_ENUM_TYPE(
|
||||
@ -68,7 +93,7 @@ static SD_VARLINK_DEFINE_METHOD(
|
||||
SD_VARLINK_DEFINE_INPUT(userNamespaceFileDescriptor, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Whether to mark the resulting mount file descriptor as read-only. If not specified defaults to false."),
|
||||
SD_VARLINK_DEFINE_INPUT(readOnly, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Which kinda of UID/GID mapping to apply to the resulting mount file descriptor."),
|
||||
SD_VARLINK_FIELD_COMMENT("Which kind of UID/GID mapping to apply to the resulting mount file descriptor."),
|
||||
SD_VARLINK_DEFINE_INPUT_BY_TYPE(mode, MountMapMode, SD_VARLINK_NULLABLE),
|
||||
VARLINK_DEFINE_POLKIT_INPUT,
|
||||
SD_VARLINK_FIELD_COMMENT("The freshly allocated mount file descriptor for the mount."),
|
||||
@ -91,13 +116,19 @@ SD_VARLINK_DEFINE_INTERFACE(
|
||||
&vl_type_PartitionInfo,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Selects the type of UID/GID mapping to apply."),
|
||||
&vl_type_MountMapMode,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Takes a disk image file descriptor as input, returns a set of mount file descriptors for it."),
|
||||
SD_VARLINK_SYMBOL_COMMENT("Takes a disk image file descriptor as input, returns a set of mount file descriptors for it, plus meta information about the image and the partitions selected for mounting."),
|
||||
&vl_method_MountImage,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Takes a directory file descriptor as input, returns a mount file descriptor."),
|
||||
&vl_method_MountDirectory,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Disk image is not compatible with this service."),
|
||||
&vl_error_IncompatibleImage,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Multiple suitable root partitions found."),
|
||||
&vl_error_MultipleRootPartitionsFound,
|
||||
SD_VARLINK_SYMBOL_COMMENT("No suitable root partition found."),
|
||||
&vl_error_RootPartitionNotFound,
|
||||
SD_VARLINK_SYMBOL_COMMENT("The specified image policy disallows mounting this disk image"),
|
||||
&vl_error_DeniedByImagePolicy,
|
||||
SD_VARLINK_SYMBOL_COMMENT("The authentication key for this image is not available."),
|
||||
&vl_error_KeyNotFound,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Verity could not be set up."),
|
||||
&vl_error_VerityFailure);
|
||||
|
Loading…
x
Reference in New Issue
Block a user