dissect-image: Return mount point fd if requested
This commit is contained in:
@@ -3315,6 +3315,7 @@ int mount_image_privately_interactively(
|
||||
const char *image,
|
||||
DissectImageFlags flags,
|
||||
char **ret_directory,
|
||||
int *ret_dir_fd,
|
||||
LoopDevice **ret_loop_device) {
|
||||
|
||||
_cleanup_(verity_settings_done) VeritySettings verity = VERITY_SETTINGS_DEFAULT;
|
||||
@@ -3388,6 +3389,16 @@ int mount_image_privately_interactively(
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
|
||||
|
||||
if (ret_dir_fd) {
|
||||
_cleanup_close_ int dir_fd = -EBADF;
|
||||
|
||||
dir_fd = open(created_dir, O_CLOEXEC|O_DIRECTORY);
|
||||
if (dir_fd < 0)
|
||||
return log_error_errno(errno, "Failed to open mount point directory: %m");
|
||||
|
||||
*ret_dir_fd = TAKE_FD(dir_fd);
|
||||
}
|
||||
|
||||
*ret_directory = TAKE_PTR(created_dir);
|
||||
*ret_loop_device = TAKE_PTR(d);
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ bool dissected_image_verity_candidate(const DissectedImage *image, PartitionDesi
|
||||
bool dissected_image_verity_ready(const DissectedImage *image, PartitionDesignator d);
|
||||
bool dissected_image_verity_sig_ready(const DissectedImage *image, PartitionDesignator d);
|
||||
|
||||
int mount_image_privately_interactively(const char *path, DissectImageFlags flags, char **ret_directory, LoopDevice **ret_loop_device);
|
||||
int mount_image_privately_interactively(const char *path, DissectImageFlags flags, char **ret_directory, int *ret_dir_fd, LoopDevice **ret_loop_device);
|
||||
|
||||
int verity_dissect_and_mount(int src_fd, const char *src, const char *dest, const MountOptions *options, const char *required_host_os_release_id, const char *required_host_os_release_version_id, const char *required_host_os_release_sysext_level, const char *required_sysext_scope);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user