add blockdev patches

This commit is contained in:
kzak 2007-08-02 11:31:02 +00:00
parent ccf8f112a6
commit 6d879ad042
3 changed files with 114 additions and 2 deletions

View File

@ -0,0 +1,36 @@
commit 3281d4268a192cbd1951347a4a857b94428dc958
Author: Karel Zak <kzak@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@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;

View File

@ -0,0 +1,69 @@
--- 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));

View File

@ -253,12 +253,16 @@ Patch265: util-linux-2.13-localedir.patch
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 @@ cp %{SOURCE8} %{SOURCE9} .
%patch268 -p1
%patch269 -p1
%patch270 -p1
%patch271 -p1
%patch272 -p1
%build
unset LINGUAS || :
@ -780,6 +786,7 @@ exit 0
%changelog
* Thu Aug 2 2007 Karel Zak <kzak@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@redhat.com> 2.13-0.52
- fix #245578 - login's PAM configuration inits the keyring at an inconvenient time