Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
util-linux-systemd.3352
util-linux-loop-reuse-09.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-loop-reuse-09.patch of Package util-linux-systemd.3352
From bfd4e1f75898510f93779766688cc5086404c23b Mon Sep 17 00:00:00 2001 From: Stanislav Brabec <sbrabec@suse.cz> Date: Tue, 2 Aug 2016 19:57:56 +0200 Subject: [PATCH 9/20] loopdev: Implememt loopcxt_set_status() Implement stand-alone loopcxt_set_status(). It allows manipulation with some loop device parameters even if it is initialized. Its function is limited by the kernel implementation, and only a small subset of changes is allowed. For more see linux/drivers/block/loop.c:loop_set_status() Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> --- include/loopdev.h | 1 + lib/loopdev.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) Index: util-linux-2.25/include/loopdev.h =================================================================== --- util-linux-2.25.orig/include/loopdev.h +++ util-linux-2.25/include/loopdev.h @@ -164,6 +164,7 @@ extern int loopcxt_deinit_iterator(struc extern int loopcxt_next(struct loopdev_cxt *lc); extern int loopcxt_setup_device(struct loopdev_cxt *lc); +extern int loopcxt_set_status(struct loopdev_cxt *lc); extern int loopcxt_delete_device(struct loopdev_cxt *lc); extern int loopcxt_set_capacity(struct loopdev_cxt *lc); Index: util-linux-2.25/lib/loopdev.c =================================================================== --- util-linux-2.25.orig/lib/loopdev.c +++ util-linux-2.25/lib/loopdev.c @@ -1196,7 +1196,7 @@ static int loopcxt_check_size(struct loo } /* - * @cl: context + * @lc: context * * Associate the current device (see loopcxt_{set,get}_device()) with * a file (see loopcxt_set_backing_file()). @@ -1314,6 +1314,40 @@ err: return rc; } +/* + * @lc: context + * + * Update status of the current device (see loopcxt_{set,get}_device()). + * + * Note that once initialized, kernel accepts only selected changes: + * LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN + * For more see linux/drivers/block/loop.c:loop_set_status() + * + * Returns: <0 on error, 0 on success. + */ +int loopcxt_set_status(struct loopdev_cxt *lc) +{ + int dev_fd, rc = -1; + + errno = 0; + dev_fd = loopcxt_get_fd(lc); + + if (dev_fd < 0) { + rc = -errno; + return rc; + } + DBG(lc, loopdev_debug("device open: OK")); + + if (ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info)) { + rc = -errno; + DBG(lc, loopdev_debug("LOOP_SET_STATUS64 failed: %m")); + return rc; + } + + DBG(lc, loopdev_debug("LOOP_SET_STATUS64: OK")); + return 0; +} + int loopcxt_set_capacity(struct loopdev_cxt *lc) { int fd = loopcxt_get_fd(lc);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor