rpms/util-linux/F-7 util-linux-2.13-blockdev-errno.patch, NONE, 1.1 util-linux-2.13-blockdev-unsigned.patch, NONE, 1.1 util-linux.spec, 1.155, 1.156

Karel Zak (kzak) fedora-extras-commits at redhat.com
Thu Aug 2 11:31:35 UTC 2007


Author: kzak

Update of /cvs/pkgs/rpms/util-linux/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv789

Modified Files:
	util-linux.spec 
Added Files:
	util-linux-2.13-blockdev-errno.patch 
	util-linux-2.13-blockdev-unsigned.patch 
Log Message:
add blockdev patches

util-linux-2.13-blockdev-errno.patch:

--- NEW FILE util-linux-2.13-blockdev-errno.patch ---
commit 3281d4268a192cbd1951347a4a857b94428dc958
Author: Karel Zak <kzak at redhat.com>
Date:   Wed Aug 1 15:06:18 2007 +0200

    blockdev: fix "blockdev --getsz" for large devices
    
    The "blockdev --getsz" command doesn't try to use BLKGETSIZE64 when
    previous BLKGETSIZE failed with EFBIG. This patch fixes this problem.
    
    Signed-off-by: Karel Zak <kzak at redhat.com>

diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
index 46b7fa7..0dd531c 100644
--- a/disk-utils/blockdev.c
+++ b/disk-utils/blockdev.c
@@ -9,6 +9,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <errno.h>
 
 #include "nls.h"
 
@@ -148,8 +149,10 @@ getsize(int fd, long long *sectors) {
 	long long b;
 
 	err = ioctl (fd, BLKGETSIZE, &sz);
-	if (err)
-		return err;
+	if (err) {
+		if (errno != EFBIG)
+			return err;
+	}
 	err = ioctl(fd, BLKGETSIZE64, &b);
 	if (err || b == 0 || b == sz)
 		*sectors = sz;

util-linux-2.13-blockdev-unsigned.patch:

--- NEW FILE util-linux-2.13-blockdev-unsigned.patch ---
--- util-linux-2.13-pre7/disk-utils/blockdev.c.kzak	2007-08-02 13:24:45.000000000 +0200
+++ util-linux-2.13-pre7/disk-utils/blockdev.c	2007-08-02 13:24:45.000000000 +0200
@@ -77,6 +77,8 @@
 #define ARGINTG	4
 #define ARGLINTG 5
 #define ARGLLINTG 6
+#define ARGLU 7
+#define ARGLLU 8
 	long argval;
 	char *argname;
 	char *help;
@@ -98,10 +100,10 @@
 	{ "--setbsz", "BLKBSZSET", BLKBSZSET, ARGINTAP, 0, "BLOCKSIZE", N_("set blocksize") },
 #endif
 #ifdef BLKGETSIZE
-	{ "--getsize", "BLKGETSIZE", BLKGETSIZE, ARGLINTG, -1, NULL, N_("get 32-bit sector count") },
+	{ "--getsize", "BLKGETSIZE", BLKGETSIZE, ARGLU, -1, NULL, N_("get 32-bit sector count") },
 #endif
 #ifdef BLKGETSIZE64
-	{ "--getsize64", "BLKGETSIZE64", BLKGETSIZE64, ARGLLINTG, -1, NULL, N_("get size in bytes") },
+	{ "--getsize64", "BLKGETSIZE64", BLKGETSIZE64, ARGLLU, -1, NULL, N_("get size in bytes") },
 #endif
 #ifdef BLKRASET
 	{ "--setra", "BLKRASET", BLKRASET, ARGINTA, 0, "READAHEAD", N_("set readahead") },
@@ -286,6 +288,8 @@
 	int iarg;
 	long larg;
 	long long llarg;
+	unsigned long lu;
+	unsigned long long llu;
 	int verbose = 0;
 
 	for (i = 1; i < d; i++) {
@@ -363,6 +367,15 @@
 			llarg = bdcms[j].argval;
 			res = ioctl(fd, bdcms[j].ioc, &llarg);
 			break;
+		case ARGLU:
+			lu = bdcms[j].argval;
+			res = ioctl(fd, bdcms[j].ioc, &lu);
+			break;
+		case ARGLLU:
+			llu = bdcms[j].argval;
+			res = ioctl(fd, bdcms[j].ioc, &llu);
+			break;
+
 		}
 		if (res == -1) {
 			perror(bdcms[j].iocname);
@@ -389,6 +402,19 @@
 			else
 				printf("%lld\n", llarg);
 			break;
+		case ARGLU:
+			if (verbose)
+				printf("%s: %lu\n", _(bdcms[j].help), lu);
+			else
+				printf("%lu\n", lu);
+			break;
+		case ARGLLU:
+			if (verbose)
+				printf("%s: %llu\n", _(bdcms[j].help), llu);
+			else
+				printf("%llu\n", llu);
+			break;
+
 		default:
 			if (verbose)
 				printf(_("%s succeeded.\n"), _(bdcms[j].help));


Index: util-linux.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux/F-7/util-linux.spec,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -r1.155 -r1.156
--- util-linux.spec	2 Aug 2007 09:22:19 -0000	1.155
+++ util-linux.spec	2 Aug 2007 11:31:02 -0000	1.156
@@ -253,12 +253,16 @@
 Patch266: util-linux-2.13-sfdisk-geo.patch
 # 231192 - ipcs is not printing correct values on pLinux
 Patch267: util-linux-2.13-ipcs-32bit.patch
-# 245912: mount doesn't write the 'loop=...' option in /etc/mtab when mounting a loop device
+# 245912 - mount doesn't write the 'loop=...' option in /etc/mtab when mounting a loop device
 Patch268: util-linux-2.13-mount-loop.patch
-# 213253: "cal -3" generates improperly formatted output
+# 213253 - "cal -3" generates improperly formatted output
 Patch269: util-linux-2.13-cal-3.patch
 # 236848 - mount/fstab.c:lock_mtab() should open with proper permissions
 Patch270: util-linux-2.12a-mount-lockperm.patch
+# 238918 - blockdev --getsize does not work properly on devices with more than 2^31 sectors
+Patch271: util-linux-2.13-blockdev-errno.patch
+Patch272: util-linux-2.13-blockdev-unsigned.patch
+
 
 
 %description
@@ -365,6 +369,8 @@
 %patch268 -p1
 %patch269 -p1
 %patch270 -p1
+%patch271 -p1
+%patch272 -p1
 
 %build
 unset LINGUAS || :
@@ -780,6 +786,7 @@
 %changelog
 * Thu Aug  2  2007 Karel Zak <kzak at redhat.com> 2.13-0.53
 - fix #236848 - mount/fstab.c:lock_mtab() should open with proper permissions
+- fix #238918 - blockdev --getsize does not work properly on devices with more than 2^31 sectors
 
 * Mon Jul  9  2007 Karel Zak <kzak at redhat.com> 2.13-0.52
 - fix #245578 - login's PAM configuration inits the keyring at an inconvenient time




More information about the fedora-extras-commits mailing list