diff options
author | Matthias Koenig | 2007-11-13 16:28:38 +0100 |
---|---|---|
committer | Karel Zak | 2007-11-21 02:35:00 +0100 |
commit | a28a3ad26de38d13eadd63836494e72cba85c260 (patch) | |
tree | 577680cc097d4e2f50b661d65224f0de3c2e6a81 /disk-utils/mkfs.minix.c | |
parent | mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs (diff) | |
download | kernel-qcow2-util-linux-a28a3ad26de38d13eadd63836494e72cba85c260.tar.gz kernel-qcow2-util-linux-a28a3ad26de38d13eadd63836494e72cba85c260.tar.xz kernel-qcow2-util-linux-a28a3ad26de38d13eadd63836494e72cba85c260.zip |
mkfs.minix: add sectorsize check
Minix filesystem until version 2 has a fixed blocksize of 1024 bytes.
If you try to create a filsystem on a device with a physical sectorsize
larger than 1024 bytes, this resulting minix fs cannot be mounted,
because the physical sectorsize must be smaller than the filesystem
blocksize.
This patch adds a check for this and will refuse to create a filesystem
if the sectorsize is bigger than the blocksize.
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r-- | disk-utils/mkfs.minix.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 7cd0958fb..6fc2893ea 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -72,6 +72,7 @@ #include <mntent.h> #include <getopt.h> +#include "blkdev.h" #include "minix.h" #include "nls.h" @@ -710,9 +711,16 @@ main(int argc, char ** argv) { DEV = open(device_name,O_RDWR); if (DEV<0) die(_("unable to open %s")); - if (!S_ISBLK(statbuf.st_mode)) + if (S_ISBLK(statbuf.st_mode)) { + int sectorsize; + + if (blkdev_get_sector_size(DEV, §orsize) == -1) + die(_("cannot determine sector size for %s")); + if (BLOCK_SIZE < sectorsize) + die(_("block size smaller than physical sector size of %s")); + } else if (!S_ISBLK(statbuf.st_mode)) { check=0; - else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) + } else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) die(_("will not try to make filesystem on '%s'")); setup_tables(); if (check) |