diff options
author | Davidlohr Bueso | 2011-06-21 05:10:13 +0200 |
---|---|---|
committer | Karel Zak | 2011-06-27 16:13:02 +0200 |
commit | 4f1384353e89132b9fc0b2a160fc3351aaa6973e (patch) | |
tree | 351589ed649df0666c5215ea912afec9a577d766 /disk-utils/mkfs.minix.c | |
parent | lib: [blkdev.c] remove kernel version check from blkdev_get_sector_size() (diff) | |
download | kernel-qcow2-util-linux-4f1384353e89132b9fc0b2a160fc3351aaa6973e.tar.gz kernel-qcow2-util-linux-4f1384353e89132b9fc0b2a160fc3351aaa6973e.tar.xz kernel-qcow2-util-linux-4f1384353e89132b9fc0b2a160fc3351aaa6973e.zip |
mkfs.minix: check for misalignment
Produce a warning if the device is misaligned.
[kzak@redhat.com: - use it for block devices only]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r-- | disk-utils/mkfs.minix.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 328e285a9..24b84db78 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -653,6 +653,7 @@ int main(int argc, char ** argv) { DEV = open(device_name,O_RDWR | O_EXCL); else DEV = open(device_name,O_RDWR); + if (DEV<0) err(MKFS_ERROR, _("%s: open failed"), device_name); if (S_ISBLK(statbuf.st_mode)) { @@ -660,6 +661,10 @@ int main(int argc, char ** argv) { if (blkdev_get_sector_size(DEV, §orsize) == -1) sectorsize = DEFAULT_SECTOR_SIZE; /* kernel < 2.3.3 */ + + if (blkdev_is_misaligned(DEV)) + warnx(_("%s: device is misaligned"), device_name); + if (BLOCK_SIZE < sectorsize) errx(MKFS_ERROR, _("block size smaller than physical " "sector size of %s"), device_name); |