]> git.ipfire.org Git - thirdparty/util-linux.git/commit - lib/loopdev.c
losetup: don't require 512-byte aligned offsets
authorKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 13:52:11 +0000 (15:52 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 13:52:11 +0000 (15:52 +0200)
commita7d5202b5e49b7e33336818e00d240b8badddbb7
treeba623d9681b3d566dd022f033e207930fbfcc7b3
parentc1d26ddbe7925522f61576ed672bd71689ae1237
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>
lib/loopdev.c
sys-utils/losetup.c