From f70a59e7498381cbd9e1c0d3344b23e13cfe7a704ae45a26cd39bac3365d9f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Sun, 10 Feb 2008 16:59:07 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=46 --- ....13.1-mkfs.minix_device_size_cleanup.patch | 103 ------------------ 1 file changed, 103 deletions(-) delete mode 100644 util-linux-2.13.1-mkfs.minix_device_size_cleanup.patch diff --git a/util-linux-2.13.1-mkfs.minix_device_size_cleanup.patch b/util-linux-2.13.1-mkfs.minix_device_size_cleanup.patch deleted file mode 100644 index b42b6cb..0000000 --- a/util-linux-2.13.1-mkfs.minix_device_size_cleanup.patch +++ /dev/null @@ -1,103 +0,0 @@ -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 BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ - #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ - - #ifndef __GNUC__ -@@ -103,7 +104,7 @@ - static char * program_name = "mkfs"; - static char * device_name = NULL; - static int DEV = -1; --static long BLOCKS = 0; -+static unsigned long long BLOCKS = 0; - static int check = 0; - static int badblocks = 0; - static int namelen = 30; /* default (changed to 30, per Linus's -@@ -219,24 +220,21 @@ count_blocks (int fd) { - return (low + 1); - } - --static int --get_size(const char *file) { -- int fd; -- long size; -- -- fd = open(file, O_RDWR); -- if (fd < 0) { -- perror(file); -- exit(1); -- } -+/* get size in bytes */ -+int -+blkdev_get_size(int fd, unsigned long long *bytes) -+{ -+ unsigned long size; -+ -+ if (ioctl(fd, BLKGETSIZE64, bytes) >= 0) -+ return 0; -+ - if (ioctl(fd, BLKGETSIZE, &size) >= 0) { -- close(fd); -- return (size * 512); -+ *bytes = ((unsigned long long)size << 9); -+ return 0; - } -- -- size = count_blocks(fd); -- close(fd); -- return size; -+ -+ return -1; - } - - /* get hardware sector size */ -@@ -687,19 +685,9 @@ main(int argc, char ** argv) { - } - } - -- if (device_name && !BLOCKS) -- BLOCKS = get_size (device_name) / 1024; -- if (!device_name || BLOCKS<10) { -+ if (!device_name) { - usage(); - } -- if (version2) { -- if (namelen == 14) -- magic = MINIX2_SUPER_MAGIC; -- else -- magic = MINIX2_SUPER_MAGIC2; -- } else -- if (BLOCKS > 65535) -- BLOCKS = 65535; - check_mount(); /* is it already mounted? */ - tmp = root_block; - *(short *)tmp = 1; -@@ -725,10 +713,22 @@ main(int argc, char ** argv) { - die(_("cannot determine sector size for %s")); - if (BLOCK_SIZE < sectorsize) - die(_("block size smaller than physical sector size of %s")); -+ if (!BLOCKS && blkdev_get_size(DEV, &BLOCKS) == -1) -+ die(_("cannot determine size of %s")); - } else if (!S_ISBLK(statbuf.st_mode)) { - check=0; - } else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) - die(_("will not try to make filesystem on '%s'")); -+ if (BLOCKS < 10) -+ die(_("number of blocks too small")); -+ if (version2) { -+ if (namelen == 14) -+ magic = MINIX2_SUPER_MAGIC; -+ else -+ magic = MINIX2_SUPER_MAGIC2; -+ } else -+ if (BLOCKS > 65535) -+ BLOCKS = 65535; - setup_tables(); - if (check) - check_blocks();