From 1d481f2bf4cfb3c2e96f81c1269f9c58ba550f39dc79ec284e3705443b10f412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Sun, 10 Feb 2008 16:59:06 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=45 --- ...13.1-mkfs.minix_add_sectorsize_check.patch | 65 ------------------- 1 file changed, 65 deletions(-) delete mode 100644 util-linux-2.13.1-mkfs.minix_add_sectorsize_check.patch diff --git a/util-linux-2.13.1-mkfs.minix_add_sectorsize_check.patch b/util-linux-2.13.1-mkfs.minix_add_sectorsize_check.patch deleted file mode 100644 index f818c34..0000000 --- a/util-linux-2.13.1-mkfs.minix_add_sectorsize_check.patch +++ /dev/null @@ -1,65 +0,0 @@ -X-Gnus-Coding-System: -*- coding: utf-8; -*- - -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 ---- - - disk-utils/Makefile.am | 4 +++- - disk-utils/mkfs.minix.c | 12 ++++++++++-- - 2 files changed, 13 insertions(+), 3 deletions(-) - -Index: util-linux-ng-2.13.1/disk-utils/mkfs.minix.c -=================================================================== ---- util-linux-ng-2.13.1.orig/disk-utils/mkfs.minix.c -+++ util-linux-ng-2.13.1/disk-utils/mkfs.minix.c -@@ -78,6 +78,7 @@ - #ifndef BLKGETSIZE - #define BLKGETSIZE _IO(0x12,96) /* return device size */ - #endif -+#define BLKSSZGET _IO(0x12,104)/* get block device sector size */ - - #ifndef __GNUC__ - #error "needs gcc for the bitop-__asm__'s" -@@ -238,6 +239,16 @@ get_size(const char *file) { - return size; - } - -+/* get hardware sector size */ -+int -+blkdev_get_sector_size(int fd, int *sector_size) -+{ -+ if (ioctl(fd, BLKSSZGET, sector_size) >= 0) -+ return 0; -+ -+ return -1; -+} -+ - static void - write_tables(void) { - /* Mark the super block valid. */ -@@ -707,9 +718,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)