Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
util-linux.3352
util-linux-loop-reuse-18.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-loop-reuse-18.patch of Package util-linux.3352
From d8ba61fcb43effb310f9d59627125118a453ef74 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Wed, 17 Aug 2016 13:52:22 +0200 Subject: [PATCH 18/20] losetup: allow to use --nooverlap when device specified Signed-off-by: Karel Zak <kzak@redhat.com> --- sys-utils/losetup.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) Index: util-linux-2.25/sys-utils/losetup.c =================================================================== --- util-linux-2.25.orig/sys-utils/losetup.c +++ util-linux-2.25/sys-utils/losetup.c @@ -433,7 +433,7 @@ static int create_loop(struct loopdev_cx int hasdev = loopcxt_has_device(lc); int rc = 0; - /* Check for conflicts and re-user loop device if possible */ + /* losetup --find --noverlap file.img */ if (!hasdev && nooverlap) { rc = loopcxt_find_overlap(lc, file, offset, sizelimit); switch (rc) { @@ -480,6 +480,25 @@ static int create_loop(struct loopdev_cx if (hasdev && !is_loopdev(loopcxt_get_device(lc))) loopcxt_add_device(lc); + /* losetup --noverlap /dev/loopN file.img */ + if (hasdev && nooverlap) { + struct loopdev_cxt lc2; + + if (loopcxt_init(&lc2, 0)) { + loopcxt_deinit(lc); + err(EXIT_FAILURE, _("failed to initialize loopcxt")); + } + rc = loopcxt_find_overlap(&lc2, file, offset, sizelimit); + loopcxt_deinit(&lc2); + + if (rc) { + loopcxt_deinit(lc); + if (rc > 0) + errx(EXIT_FAILURE, _("%s: overlapping loop device exists"), file); + err(EXIT_FAILURE, _("%s: failed to check for conflicting loop devices"), file); + } + } + /* Create a new device */ do { const char *errpre;
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