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-11.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-loop-reuse-11.patch of Package util-linux-systemd.3352
From c444a71b1ba216b39707b41ebade2e35f6a256b7 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Thu, 4 Aug 2016 10:49:46 +0200 Subject: [PATCH 11/20] lib/loopdev: cleanup sizelimit check Signed-off-by: Karel Zak <kzak@redhat.com> --- include/loopdev.h | 6 +++--- lib/loopdev.c | 20 +++++++++++--------- libmount/src/context_loopdev.c | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) Index: util-linux-2.25/include/loopdev.h =================================================================== --- util-linux-2.25.orig/include/loopdev.h +++ util-linux-2.25/include/loopdev.h @@ -187,9 +187,9 @@ extern int loopcxt_find_by_backing_file( const char *filename, uint64_t offset, uint64_t sizelimit, int flags); -extern int loopcxt_check_conflict(struct loopdev_cxt *lc, - const char *filename, - uint64_t offset, uint64_t sizelimit); +extern int loopcxt_find_overlap(struct loopdev_cxt *lc, + const char *filename, + uint64_t offset, uint64_t sizelimit); extern int loopcxt_is_used(struct loopdev_cxt *lc, struct stat *st, Index: util-linux-2.25/lib/loopdev.c =================================================================== --- util-linux-2.25.orig/lib/loopdev.c +++ util-linux-2.25/lib/loopdev.c @@ -1,3 +1,4 @@ + /* * No copyright is claimed. This code is in the public domain; do with * it what you wish. @@ -968,9 +969,9 @@ int loopcxt_is_readonly(struct loopdev_c * @lc: context * @st: backing file stat or NULL * @backing_file: filename - * @offset: offset - * @flags: LOOPDEV_FL_OFFSET if @offset should not be ignored - * @flags: LOOPDEV_FL_SIZELIMIT if @sizelimit should not be ignored + * @offset: offset (use LOOPDEV_FL_OFFSET if specified) + * @sizelimit: size limit (use LOOPDEV_FL_SIZELIMIT if specified) + * @flags: LOOPDEV_FL_{OFFSET,SIZELIMIT} * * Returns 1 if the current @lc loopdev is associated with the given backing * file. Note that the preferred way is to use devno and inode number rather @@ -1030,8 +1031,7 @@ found: uint64_t sz; return loopcxt_get_sizelimit(lc, &sz) == 0 && sz == sizelimit; - } - else + } else return rc; } return 1; @@ -1566,9 +1566,9 @@ int loopcxt_find_by_backing_file(struct } /* - * Returns: 0 = conflict, < 0 error, 1 no conflicting device + * Returns: 0 = success, < 0 error, 1 not found */ -int loopcxt_check_conflict(struct loopdev_cxt *lc, const char *filename, +int loopcxt_find_overlap(struct loopdev_cxt *lc, const char *filename, uint64_t offset, uint64_t sizelimit) { int rc, hasst; @@ -1589,11 +1589,13 @@ int loopcxt_check_conflict(struct loopde rc = loopcxt_is_used(lc, hasst ? &st : NULL, filename, offset, sizelimit, 0); if (!rc) - continue; + continue; /* unused */ if (rc != 1) - break; + break; /* error */ + DBG(lc, loopdev_debug("found %s backed by %s", loopcxt_get_device(lc), filename)); + rc = loopcxt_get_offset(lc, &lc_offset); if (rc) { DBG(lc, loopdev_debug("failed to get offset for device %s", 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 @@ -269,8 +269,8 @@ int mnt_context_setup_loopdev(struct lib rc = loopcxt_init(&lc, 0); if (rc) goto done_no_deinit; - rc = loopcxt_check_conflict(&lc, - backing_file, offset, sizelimit); + + rc = loopcxt_find_overlap(&lc, backing_file, offset, sizelimit); if (rc < 0) goto done; if (rc == 0) {
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