summaryrefslogtreecommitdiffstats
path: root/sys-utils/losetup.c
diff options
context:
space:
mode:
authorKarel Zak2013-10-01 15:52:11 +0200
committerKarel Zak2013-10-01 15:52:11 +0200
commita7d5202b5e49b7e33336818e00d240b8badddbb7 (patch)
treeba623d9681b3d566dd022f033e207930fbfcc7b3 /sys-utils/losetup.c
parentMerge branch 'master' of https://github.com/yurchor/util-linux (diff)
downloadkernel-qcow2-util-linux-a7d5202b5e49b7e33336818e00d240b8badddbb7.tar.gz
kernel-qcow2-util-linux-a7d5202b5e49b7e33336818e00d240b8badddbb7.tar.xz
kernel-qcow2-util-linux-a7d5202b5e49b7e33336818e00d240b8badddbb7.zip
losetup: don't require 512-byte aligned offsets
Kernel aligns the device size, but the offset where the device starts is not required to be aligned. # losetup --offset 32 -f file.img is just fine, the final size of the look device will be (in sectors) (backing_file_size - offset) >> 9 so we have to do the same in userspace when we check for successful set capacity ioctl. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/losetup.c')
-rw-r--r--sys-utils/losetup.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index f51411570..9169f8864 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -673,11 +673,7 @@ int main(int argc, char **argv)
/* errors */
errpre = hasdev && loopcxt_get_fd(&lc) < 0 ?
loopcxt_get_device(&lc) : file;
- if (errno == ERANGE && offset && offset % 512)
- warnx(_("%s: failed to set up loop device, "
- "offset is not 512-byte aligned."), errpre);
- else
- warn(_("%s: failed to set up loop device"), errpre);
+ warn(_("%s: failed to set up loop device"), errpre);
break;
} while (hasdev == 0);