Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
util-linux.3352
util-linux-mount-reuse-loop-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-mount-reuse-loop-1.patch of Package util-linux.3352
From 6e258026754ff7db97d6ac390e26ad1cc2e866e0 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec <sbrabec@suse.cz> Date: Tue, 12 Apr 2016 20:22:36 +0200 Subject: [PATCH 1/4] libmount: Re-organize is_mounted_same_loopfile() First parse options, then initialize context. No change in function. The change is needed for loop device reuse. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> --- libmount/src/context_loopdev.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) Index: util-linux-2.25/libmount/src/context_loopdev.c =================================================================== --- util-linux-2.25.orig/libmount/src/context_loopdev.c +++ util-linux-2.25/libmount/src/context_loopdev.c @@ -137,7 +137,7 @@ is_mounted_same_loopfile(struct libmnt_c int mnt_context_setup_loopdev(struct libmnt_context *cxt) { const char *backing_file, *optstr, *loopdev = NULL; - char *val = NULL; + char *val = NULL, *loopval = NULL; size_t len; struct loopdev_cxt lc; int rc = 0, lo_flags = 0; @@ -161,10 +161,6 @@ int mnt_context_setup_loopdev(struct lib lo_flags |= LO_FLAGS_READ_ONLY; } - rc = loopcxt_init(&lc, 0); - if (rc) - return rc; - ON_DBG(CXT, loopcxt_enable_debug(&lc, 1)); optstr = mnt_fs_get_user_options(cxt->fs); @@ -174,13 +170,8 @@ int mnt_context_setup_loopdev(struct lib */ if (rc == 0 && (cxt->user_mountflags & MNT_MS_LOOP) && mnt_optstr_get_option(optstr, "loop", &val, &len) == 0 && val) { - - val = strndup(val, len); - rc = val ? loopcxt_set_device(&lc, val) : -ENOMEM; - free(val); - - if (rc == 0) - loopdev = loopcxt_get_device(&lc); + loopval = strndup(val, len); + rc = loopval ? 0 : -ENOMEM; } /* @@ -225,6 +216,15 @@ int mnt_context_setup_loopdev(struct lib rc = -EBUSY; if (rc) + goto done_no_deinit; + + rc = loopcxt_init(&lc, 0); + if (rc == 0 && loopval) { + rc = loopcxt_set_device(&lc, loopval); + if (rc == 0) + loopdev = loopcxt_get_device(&lc); + } + if (rc) goto done; /* since 2.6.37 we don't have to store backing filename to mtab @@ -308,6 +308,8 @@ int mnt_context_setup_loopdev(struct lib } done: loopcxt_deinit(&lc); +done_no_deinit: + free(loopval); return rc; }
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