rpms/util-linux-ng/F-13 util-linux-ng-2.17-partx.patch, NONE, 1.1 util-linux-ng-2.13-login-lastlog.patch, 1.2, 1.3 util-linux-ng-2.15-ipcs-32bit.patch, 1.1, 1.2 util-linux-ng-2.16-blkid-cachefile.patch, 1.2, 1.3 util-linux-ng-2.17-blkid-cdrom.patch, 1.1, 1.2 util-linux-ng-2.17-blkid-raid.patch, 1.1, 1.2 util-linux-ng.spec, 1.83, 1.84
kzak
kzak at fedoraproject.org
Wed May 19 11:45:10 UTC 2010
Author: kzak
Update of /cvs/pkgs/rpms/util-linux-ng/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv10285
Modified Files:
util-linux-ng-2.13-login-lastlog.patch
util-linux-ng-2.15-ipcs-32bit.patch
util-linux-ng-2.16-blkid-cachefile.patch
util-linux-ng-2.17-blkid-cdrom.patch
util-linux-ng-2.17-blkid-raid.patch util-linux-ng.spec
Added Files:
util-linux-ng-2.17-partx.patch
Log Message:
* Wed May 19 2010 Karel Zak <kzak at redhat.com> 2.17.2-5
- fix #592958 - whole disk raid members to not be identified
- fix #592061 - partx infinite loop
- add diffstat (by quilt refresh) to some old patches
util-linux-ng-2.17-partx.patch:
partx.c | 5 +++++
1 file changed, 5 insertions(+)
--- NEW FILE util-linux-ng-2.17-partx.patch ---
Upstream patches:
From d6d9cc6ea158ef3b2525742ee3f80c4a3be8b049 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi at cfl.rr.com>
Date: Wed, 31 Mar 2010 15:52:08 +0200
Subject: [PATCH] partx: do not add nonexistent partitions
This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel. This
makes partx conform to the usual kernel behavior.
Signed-off-by: Phillip Susi <psusi at cfl.rr.com>
Signed-off-by: Karel Zak <kzak at redhat.com>
From c86dda7b36e3a6cfc63b9c03f7d275d715d35fd0 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak at redhat.com>
Date: Wed, 31 Mar 2010 16:38:51 +0200
Subject: [PATCH] partx: fix infinite loop
On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote:
> I noticed that running partx -d /dev/sda hangs so I looked into it
> and it seems that it keeps trying to delete partitions forever.
Reported-By: Phillip Susi <psusi at cfl.rr.com>
Signed-off-by: Karel Zak <kzak at redhat.com>
---
partx/partx.c | 5 +++++
1 file changed, 5 insertions(+)
--- util-linux-ng-2.17.2.orig/partx/partx.c
+++ util-linux-ng-2.17.2/partx/partx.c
@@ -178,6 +178,8 @@ main(int argc, char **argv){
while (upper == 0 || lower <= upper) {
int err;
+ if (lower > MAXSLICES)
+ break;
pt.pno = lower;
pt.start = 0;
pt.length = 0;
@@ -295,6 +297,9 @@ main(int argc, char **argv){
}
}
for (j=0; j<n; j++) {
+ /* skip unused/empty partitions */
+ if (slices[j].size == 0)
+ continue;
pt.pno = lower+j;
pt.start = 512 * (long long) slices[j].start;
pt.length = 512 * (long long) slices[j].size;
util-linux-ng-2.13-login-lastlog.patch:
login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: util-linux-ng-2.13-login-lastlog.patch
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng-2.13-login-lastlog.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- util-linux-ng-2.13-login-lastlog.patch 23 Dec 2008 00:12:56 -0000 1.2
+++ util-linux-ng-2.13-login-lastlog.patch 19 May 2010 11:45:09 -0000 1.3
@@ -1,8 +1,10 @@
-Index: util-linux-ng-2.14.2-rc1/login-utils/login.c
-===================================================================
---- util-linux-ng-2.14.2-rc1.orig/login-utils/login.c
-+++ util-linux-ng-2.14.2-rc1/login-utils/login.c
-@@ -1415,7 +1415,7 @@ dolastlog(int quiet) {
+---
+ login-utils/login.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- util-linux-ng-2.17.2.orig/login-utils/login.c
++++ util-linux-ng-2.17.2/login-utils/login.c
+@@ -1431,7 +1431,7 @@ dolastlog(int quiet) {
struct lastlog ll;
int fd;
util-linux-ng-2.15-ipcs-32bit.patch:
ipcs.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
Index: util-linux-ng-2.15-ipcs-32bit.patch
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng-2.15-ipcs-32bit.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- util-linux-ng-2.15-ipcs-32bit.patch 4 Jun 2009 15:12:50 -0000 1.1
+++ util-linux-ng-2.15-ipcs-32bit.patch 19 May 2010 11:45:09 -0000 1.2
@@ -1,7 +1,10 @@
-diff -up util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c.kzak util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c
---- util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c.kzak 2009-03-25 13:19:08.000000000 +0100
-+++ util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c 2009-06-04 15:22:48.000000000 +0200
-@@ -243,6 +243,26 @@ print_perms (int id, struct ipc_perm *ip
+---
+ sys-utils/ipcs.c | 30 +++++++++++++++++++++++++-----
+ 1 file changed, 25 insertions(+), 5 deletions(-)
+
+--- util-linux-ng-2.17.2.orig/sys-utils/ipcs.c
++++ util-linux-ng-2.17.2/sys-utils/ipcs.c
+@@ -239,6 +239,26 @@ print_perms (int id, struct ipc_perm *ip
printf(" %-10d\n", ipcp->gid);
}
@@ -28,7 +31,7 @@ diff -up util-linux-ng-2.15.1-rc1/sys-ut
void do_shm (char format)
{
-@@ -266,12 +286,12 @@ void do_shm (char format)
+@@ -262,12 +282,12 @@ void do_shm (char format)
return;
/* glibc 2.1.3 and all earlier libc's have ints as fields
of struct shminfo; glibc 2.1.91 has unsigned long; ach */
util-linux-ng-2.16-blkid-cachefile.patch:
misc-utils/blkid.8 | 4 ++--
misc-utils/blkid.c | 2 +-
shlibs/blkid/libblkid.3 | 6 +++---
shlibs/blkid/src/blkidP.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
Index: util-linux-ng-2.16-blkid-cachefile.patch
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng-2.16-blkid-cachefile.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- util-linux-ng-2.16-blkid-cachefile.patch 19 Oct 2009 12:51:04 -0000 1.2
+++ util-linux-ng-2.16-blkid-cachefile.patch 19 May 2010 11:45:09 -0000 1.3
@@ -1,6 +1,12 @@
-diff -up util-linux-ng-2.17-git5e51568/misc-utils/blkid.8.kzak util-linux-ng-2.17-git5e51568/misc-utils/blkid.8
---- util-linux-ng-2.17-git5e51568/misc-utils/blkid.8.kzak 2009-10-16 22:50:03.000000000 +0200
-+++ util-linux-ng-2.17-git5e51568/misc-utils/blkid.8 2009-10-19 14:31:10.000000000 +0200
+---
+ misc-utils/blkid.8 | 4 ++--
+ misc-utils/blkid.c | 2 +-
+ shlibs/blkid/libblkid.3 | 6 +++---
+ shlibs/blkid/src/blkidP.h | 2 +-
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+--- util-linux-ng-2.17.2.orig/misc-utils/blkid.8
++++ util-linux-ng-2.17.2/misc-utils/blkid.8
@@ -67,7 +67,7 @@ more devices.
Read from
.I cachefile
@@ -19,10 +25,9 @@ diff -up util-linux-ng-2.17-git5e51568/m
If you don't want to save the cache to the default file, specify
.IR /dev/null.
If not specified it will be the same file as that given by the
-diff -up util-linux-ng-2.17-git5e51568/misc-utils/blkid.c.kzak util-linux-ng-2.17-git5e51568/misc-utils/blkid.c
---- util-linux-ng-2.17-git5e51568/misc-utils/blkid.c.kzak 2009-10-16 22:50:03.000000000 +0200
-+++ util-linux-ng-2.17-git5e51568/misc-utils/blkid.c 2009-10-19 14:31:10.000000000 +0200
-@@ -62,7 +62,7 @@ static void usage(int error)
+--- util-linux-ng-2.17.2.orig/misc-utils/blkid.c
++++ util-linux-ng-2.17.2/misc-utils/blkid.c
+@@ -58,7 +58,7 @@ static void usage(int error)
" [-t <token>] [-w <file>] [dev ...]\n\n"
" %1$s -p [-O <offset>] [-S <size>] [-o format] <dev> [dev ...]\n\n"
"Options:\n"
@@ -31,9 +36,8 @@ diff -up util-linux-ng-2.17-git5e51568/m
" -h print this usage message and exit\n"
" -g garbage collect the blkid cache\n"
" -o <format> output format; can be one of:\n"
-diff -up util-linux-ng-2.17-git5e51568/shlibs/blkid/libblkid.3.kzak util-linux-ng-2.17-git5e51568/shlibs/blkid/libblkid.3
---- util-linux-ng-2.17-git5e51568/shlibs/blkid/libblkid.3.kzak 2009-10-16 22:50:03.000000000 +0200
-+++ util-linux-ng-2.17-git5e51568/shlibs/blkid/libblkid.3 2009-10-19 14:31:10.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/libblkid.3
++++ util-linux-ng-2.17.2/shlibs/blkid/libblkid.3
@@ -24,7 +24,7 @@ A common use is to allow use of LABEL= a
specific block device names into configuration files.
.P
@@ -61,10 +65,9 @@ diff -up util-linux-ng-2.17-git5e51568/s
caches data extracted from each recognized block device
.TP
.I /etc/blkid.conf
-diff -up util-linux-ng-2.17-git5e51568/shlibs/blkid/src/blkidP.h.kzak util-linux-ng-2.17-git5e51568/shlibs/blkid/src/blkidP.h
---- util-linux-ng-2.17-git5e51568/shlibs/blkid/src/blkidP.h.kzak 2009-10-16 22:50:03.000000000 +0200
-+++ util-linux-ng-2.17-git5e51568/shlibs/blkid/src/blkidP.h 2009-10-19 14:32:03.000000000 +0200
-@@ -267,7 +267,7 @@ extern char *blkid_strconcat(const char
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/blkidP.h
++++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
+@@ -268,7 +268,7 @@ extern char *blkid_strconcat(const char
extern int blkid_fstatat(DIR *dir, const char *dirname, const char *filename,
struct stat *st, int nofollow);
util-linux-ng-2.17-blkid-cdrom.patch:
blkidP.h | 2 ++
probe.c | 14 ++++++++++++++
superblocks/superblocks.c | 5 +++++
3 files changed, 21 insertions(+)
Index: util-linux-ng-2.17-blkid-cdrom.patch
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng-2.17-blkid-cdrom.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- util-linux-ng-2.17-blkid-cdrom.patch 4 May 2010 09:06:37 -0000 1.1
+++ util-linux-ng-2.17-blkid-cdrom.patch 19 May 2010 11:45:09 -0000 1.2
@@ -20,10 +20,15 @@ based on upstream patch:
Signed-off-by: Karel Zak <kzak at redhat.com>
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
---- util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak 2010-05-03 11:46:12.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h 2010-05-03 11:48:23.000000000 +0200
-@@ -210,6 +210,7 @@ struct blkid_struct_probe
+---
+ shlibs/blkid/src/blkidP.h | 2 ++
+ shlibs/blkid/src/probe.c | 14 ++++++++++++++
+ shlibs/blkid/src/superblocks/superblocks.c | 5 +++++
+ 3 files changed, 21 insertions(+)
+
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/blkidP.h
++++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
+@@ -209,6 +209,7 @@ struct blkid_struct_probe
/* flags */
#define BLKID_PRIVATE_FD (1 << 1) /* see blkid_new_probe_from_filename() */
#define BLKID_TINY_DEV (1 << 2) /* <= 1.47MiB (floppy or so) */
@@ -31,7 +36,7 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
/*
* Evaluation methods (for blkid_eval_* API)
-@@ -364,6 +365,7 @@ extern void blkid_free_dev(blkid_dev dev
+@@ -363,6 +364,7 @@ extern void blkid_free_dev(blkid_dev dev
/* probe.c */
extern int blkid_probe_is_tiny(blkid_probe pr);
@@ -39,9 +44,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
extern unsigned char *blkid_probe_get_buffer(blkid_probe pr,
blkid_loff_t off, blkid_loff_t len);
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/probe.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak 2010-03-22 09:14:21.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/probe.c 2010-05-03 11:48:23.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/probe.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/probe.c
@@ -77,6 +77,7 @@
#include <fcntl.h>
#include <ctype.h>
@@ -84,9 +88,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
err:
DBG(DEBUG_LOWPROBE,
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak 2010-03-22 09:14:21.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c 2010-05-03 11:48:23.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/superblocks.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
@@ -342,6 +342,11 @@ static int superblocks_probe(blkid_probe
blkid_probe_is_tiny(pr))
continue;
util-linux-ng-2.17-blkid-raid.patch:
misc-utils/blkid.c | 37 ++---
shlibs/blkid/src/blkidP.h | 11 +
shlibs/blkid/src/partitions/partitions.c | 92 ++++++++++++
shlibs/blkid/src/probe.c | 102 ++++++++++++--
shlibs/blkid/src/superblocks/adaptec_raid.c | 7
shlibs/blkid/src/superblocks/ddf_raid.c | 74 +++++++++-
shlibs/blkid/src/superblocks/drbd.c | 13 +
shlibs/blkid/src/superblocks/highpoint_raid.c | 14 +
shlibs/blkid/src/superblocks/isw_raid.c | 6
shlibs/blkid/src/superblocks/jmicron_raid.c | 6
shlibs/blkid/src/superblocks/linux_raid.c | 109 ++++++++++++---
shlibs/blkid/src/superblocks/lsi_raid.c | 6
shlibs/blkid/src/superblocks/nvidia_raid.c | 7
shlibs/blkid/src/superblocks/promise_raid.c | 9 +
shlibs/blkid/src/superblocks/silicon_raid.c | 9 +
shlibs/blkid/src/superblocks/superblocks.c | 68 ++++++---
shlibs/blkid/src/superblocks/superblocks.h | 2
shlibs/blkid/src/superblocks/sysv.c | 14 +
shlibs/blkid/src/superblocks/ufs.c | 8 +
shlibs/blkid/src/superblocks/via_raid.c | 6
tests/functions.sh | 2
util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part | 58 +++++++
util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole | 58 +++++++
util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part | 92 ++++++++++++
util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole | 88 ++++++++++++
25 files changed, 816 insertions(+), 82 deletions(-)
Index: util-linux-ng-2.17-blkid-raid.patch
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng-2.17-blkid-raid.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- util-linux-ng-2.17-blkid-raid.patch 4 May 2010 09:06:38 -0000 1.1
+++ util-linux-ng-2.17-blkid-raid.patch 19 May 2010 11:45:09 -0000 1.2
@@ -1,21 +1,34 @@
-From f3705bac52dcbdfa7000081d06cd9f7b3caf134f Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 10:12:39 +0200
-Subject: [PATCH 1/7] libblkid: add functions to get whole-disk devno
-
-Note that these functions are exported to the library API
-in the next version (2.18).
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
---
- shlibs/blkid/src/blkidP.h | 3 +++
- shlibs/blkid/src/probe.c | 42 ++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 45 insertions(+), 0 deletions(-)
-
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
---- util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak 2010-05-03 13:11:27.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h 2010-05-03 13:11:46.000000000 +0200
-@@ -193,6 +193,7 @@ struct blkid_struct_probe
+ misc-utils/blkid.c | 37 ++++----
+ shlibs/blkid/src/blkidP.h | 11 ++
+ shlibs/blkid/src/partitions/partitions.c | 92 +++++++++++++++++++++
+ shlibs/blkid/src/probe.c | 102 ++++++++++++++++++++++--
+ shlibs/blkid/src/superblocks/adaptec_raid.c | 7 +
+ shlibs/blkid/src/superblocks/ddf_raid.c | 74 ++++++++++++++++-
+ shlibs/blkid/src/superblocks/drbd.c | 13 ++-
+ shlibs/blkid/src/superblocks/highpoint_raid.c | 14 +++
+ shlibs/blkid/src/superblocks/isw_raid.c | 6 +
+ shlibs/blkid/src/superblocks/jmicron_raid.c | 6 +
+ shlibs/blkid/src/superblocks/linux_raid.c | 109 +++++++++++++++++++++-----
+ shlibs/blkid/src/superblocks/lsi_raid.c | 6 +
+ shlibs/blkid/src/superblocks/nvidia_raid.c | 7 +
+ shlibs/blkid/src/superblocks/promise_raid.c | 9 +-
+ shlibs/blkid/src/superblocks/silicon_raid.c | 9 +-
+ shlibs/blkid/src/superblocks/superblocks.c | 68 +++++++++++-----
+ shlibs/blkid/src/superblocks/superblocks.h | 2
+ shlibs/blkid/src/superblocks/sysv.c | 14 +++
+ shlibs/blkid/src/superblocks/ufs.c | 8 +
+ shlibs/blkid/src/superblocks/via_raid.c | 6 +
+ tests/expected/blkid/md-raid1-part | 58 +++++++++++++
+ tests/expected/blkid/md-raid1-whole | 58 +++++++++++++
+ tests/functions.sh | 2
+ tests/ts/blkid/md-raid1-part | 92 +++++++++++++++++++++
+ tests/ts/blkid/md-raid1-whole | 88 ++++++++++++++++++++
+ 25 files changed, 816 insertions(+), 82 deletions(-)
+
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/blkidP.h
++++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
+@@ -192,10 +192,12 @@ struct blkid_struct_probe
blkid_loff_t size; /* end of data on the device */
dev_t devno; /* device number (st.st_rdev) */
@@ -23,7 +36,26 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
unsigned int blkssz; /* sector size (BLKSSZGET ioctl) */
mode_t mode; /* struct stat.sb_mode */
-@@ -364,6 +365,8 @@ extern blkid_dev blkid_new_dev(void);
+ int flags; /* private libray flags */
++ int prob_flags; /* always zeroized by blkid_do_*() */
+
+ struct list_head buffers; /* list of buffers */
+
+@@ -206,10 +208,12 @@ struct blkid_struct_probe
+ int nvals; /* number of assigned vals */
+ };
+
+-/* flags */
++/* private flags */
+ #define BLKID_PRIVATE_FD (1 << 1) /* see blkid_new_probe_from_filename() */
+ #define BLKID_TINY_DEV (1 << 2) /* <= 1.47MiB (floppy or so) */
+ #define BLKID_CDROM_DEV (1 << 3) /* is a CD/DVD drive */
++/* private probing flags */
++#define BLKID_PARTS_IGNORE_PT (1 << 1) /* ignore partition table */
+
+ /*
+ * Evaluation methods (for blkid_eval_* API)
+@@ -363,6 +367,8 @@ extern blkid_dev blkid_new_dev(void);
extern void blkid_free_dev(blkid_dev dev);
/* probe.c */
@@ -32,10 +64,164 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
extern int blkid_probe_is_tiny(blkid_probe pr);
extern int blkid_probe_is_cdrom(blkid_probe pr);
extern unsigned char *blkid_probe_get_buffer(blkid_probe pr,
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/probe.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak 2010-05-03 13:11:27.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/probe.c 2010-05-03 13:11:46.000000000 +0200
-@@ -988,6 +988,48 @@ dev_t blkid_probe_get_devno(blkid_probe
+@@ -383,6 +389,9 @@ extern int blkid_probe_set_dimension(blk
+
+ extern blkid_partlist blkid_probe_get_partlist(blkid_probe pr);
+
++extern int blkid_probe_is_covered_by_pt(blkid_probe pr,
++ blkid_loff_t offset, blkid_loff_t size);
++
+ extern void blkid_probe_chain_reset_vals(blkid_probe pr, struct blkid_chain *chn);
+ extern int blkid_probe_chain_copy_vals(blkid_probe pr, struct blkid_chain *chn,
+ struct blkid_prval *vals, int nvals);
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/probe.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/probe.c
+@@ -288,21 +288,33 @@ struct blkid_chain *blkid_probe_get_chai
+
+ void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn)
+ {
+- int rc;
++ int rc, org_prob_flags;
++ struct blkid_chain *org_chn;
+
+ if (!pr || !chn)
+ return NULL;
+
++ /* save the current setting -- the binary API has to be completely
++ * independent on the current probing status
++ */
++ org_chn = pr->cur_chain;
++ org_prob_flags = pr->prob_flags;
++
+ pr->cur_chain = chn;
++ pr->prob_flags = 0;
+ chn->binary = TRUE;
+ blkid_probe_chain_reset_position(chn);
+
+ rc = chn->driver->probe(pr, chn);
+
+ chn->binary = FALSE;
+- pr->cur_chain = NULL;
+ blkid_probe_chain_reset_position(chn);
+
++ /* restore the original setting
++ */
++ pr->cur_chain = org_chn;
++ pr->prob_flags = org_prob_flags;
++
+ if (rc != 0)
+ return NULL;
+
+@@ -629,6 +641,13 @@ int blkid_probe_set_device(blkid_probe p
+ if (S_ISBLK(pr->mode) && ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0)
+ pr->flags |= BLKID_CDROM_DEV;
+ #endif
++
++ DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%jd, size=%jd\n",
++ pr->off, pr->size));
++ DBG(DEBUG_LOWPROBE, printf("whole-disk: %s, regfile: %s\n",
++ blkid_probe_is_wholedisk(pr) ?"YES" : "NO",
++ S_ISREG(pr->mode) ? "YES" : "NO"));
++
+ return 0;
+ err:
+ DBG(DEBUG_LOWPROBE,
+@@ -674,6 +693,22 @@ int blkid_probe_set_dimension(blkid_prob
+ return 0;
+ }
+
++static inline void blkid_probe_start(blkid_probe pr)
++{
++ if (pr) {
++ pr->cur_chain = NULL;
++ pr->prob_flags = 0;
++ }
++}
++
++static inline void blkid_probe_end(blkid_probe pr)
++{
++ if (pr) {
++ pr->cur_chain = NULL;
++ pr->prob_flags = 0;
++ }
++}
++
+ /**
+ * blkid_do_probe:
+ * @pr: prober
+@@ -725,9 +760,10 @@ int blkid_do_probe(blkid_probe pr)
+ do {
+ struct blkid_chain *chn = pr->cur_chain;
+
+- if (!chn)
++ if (!chn) {
++ blkid_probe_start(pr);
+ chn = pr->cur_chain = &pr->chains[0];
+-
++ }
+ /* we go to the next chain only when the previous probing
+ * result was nothing (rc == 1) and when the current chain is
+ * disabled or we are at end of the current chain (chain->idx +
+@@ -742,8 +778,10 @@ int blkid_do_probe(blkid_probe pr)
+
+ if (idx < BLKID_NCHAINS)
+ chn = pr->cur_chain = &pr->chains[idx];
+- else
++ else {
++ blkid_probe_end(pr);
+ return 1; /* all chains already probed */
++ }
+ }
+
+ chn->binary = FALSE; /* for sure... */
+@@ -775,7 +813,9 @@ int blkid_do_probe(blkid_probe pr)
+ *
+ * Note about suberblocks chain -- the function does not check for filesystems
+ * when a RAID signature is detected. The function also does not check for
+- * collision between RAIDs. The first detected RAID is returned.
++ * collision between RAIDs. The first detected RAID is returned. The function
++ * checks for collision between partition table and RAID signature -- it's
++ * recommended to enable partitions chain together with superblocks chain.
+ *
+ * Returns: 0 on success, 1 if nothing is detected, -2 if ambivalen result is
+ * detected and -1 on case of error.
+@@ -787,6 +827,8 @@ int blkid_do_safeprobe(blkid_probe pr)
+ if (!pr)
+ return -1;
+
++ blkid_probe_start(pr);
++
+ for (i = 0; i < BLKID_NCHAINS; i++) {
+ struct blkid_chain *chn;
+
+@@ -814,7 +856,7 @@ int blkid_do_safeprobe(blkid_probe pr)
+ }
+
+ done:
+- pr->cur_chain = NULL;
++ blkid_probe_end(pr);
+ if (rc < 0)
+ return rc;
+ return count ? 0 : 1;
+@@ -839,6 +881,8 @@ int blkid_do_fullprobe(blkid_probe pr)
+ if (!pr)
+ return -1;
+
++ blkid_probe_start(pr);
++
+ for (i = 0; i < BLKID_NCHAINS; i++) {
+ int rc;
+ struct blkid_chain *chn;
+@@ -867,7 +911,7 @@ int blkid_do_fullprobe(blkid_probe pr)
+ }
+
+ done:
+- pr->cur_chain = NULL;
++ blkid_probe_end(pr);
+ if (rc < 0)
+ return rc;
+ return count ? 0 : 1;
+@@ -988,6 +1032,48 @@ dev_t blkid_probe_get_devno(blkid_probe
}
/**
@@ -84,107 +270,21 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
* blkid_probe_get_size:
* @pr: probe
*
-
-From c5a5ec0018013b2b97b702efa1d05250d7031e44 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 09:16:36 +0200
-Subject: [PATCH 2/7] libblkid: add partial support for superblock binary API
-
-The API is used only internally.
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- shlibs/blkid/src/superblocks/superblocks.c | 101 +++++++++++++++++++++++++---
- shlibs/blkid/src/superblocks/superblocks.h | 2 +
- 2 files changed, 94 insertions(+), 9 deletions(-)
-
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak 2010-05-03 13:11:27.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c 2010-05-03 13:14:43.000000000 +0200
-@@ -71,6 +71,7 @@
-
- static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn);
- static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn);
-+static void superblocks_free(blkid_probe pr, void *data);
-
- static int blkid_probe_set_usage(blkid_probe pr, int usage);
-
-@@ -153,9 +154,23 @@ const struct blkid_chaindrv superblocks_
- .nidinfos = ARRAY_SIZE(idinfos),
- .has_fltr = TRUE,
- .probe = superblocks_probe,
-- .safeprobe = superblocks_safeprobe
-+ .safeprobe = superblocks_safeprobe,
-+ .free_data = superblocks_free
- };
-
-+/*
-+ * Private chain data
-+ *
-+ * TODO: export this data by binary interface (see topology.c or partitions.c
-+ * for more details) by blkid_probe_get_superblock() or so.
-+ */
-+struct blkid_struct_superblock {
-+ blkid_loff_t magic_off; /* offset of the magic string */
-+ int usage;
-+};
-+
-+/* TODO: move to blkid.h */
-+typedef struct blkid_struct_superblock *blkid_superblock;
-
- /**
- * blkid_probe_enable_superblocks:
-@@ -295,6 +310,39 @@ int blkid_known_fstype(const char *fstyp
- return 0;
- }
-
-+/* init and returns private data */
-+static blkid_superblock superblocks_init_data(blkid_probe pr,
-+ struct blkid_chain *chn)
-+{
-+ DBG(DEBUG_LOWPROBE, printf("initialize superblocks binary data\n"));
-+
-+ if (chn->data)
-+ memset(chn->data, 0,
-+ sizeof(struct blkid_struct_superblock));
-+ else {
-+ chn->data = calloc(1,
-+ sizeof(struct blkid_struct_superblock));
-+ if (!chn->data)
-+ return NULL;
-+ }
-+ return chn->data;
-+}
-+
-+static void superblocks_free(blkid_probe pr, void *data)
-+{
-+ free(data);
-+}
-+
-+static blkid_superblock superblocks_copy_data(blkid_superblock dest,
-+ blkid_superblock src)
-+{
-+ if (!src || !dest)
-+ return NULL;
-+
-+ memcpy(dest, src, sizeof(struct blkid_struct_superblock));
-+ return dest;
-+}
-+
- /*
- * The blkid_do_probe() backend.
- */
-@@ -316,6 +364,9 @@ static int superblocks_probe(blkid_probe
- * is 1 byte */
- goto nothing;
-
-+ if (chn->binary)
-+ superblocks_init_data(pr, chn);
-+
- i = chn->idx + 1;
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/superblocks.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
+@@ -375,8 +375,10 @@ static int superblocks_probe(blkid_probe
+ /* final check by probing function */
+ if (id->probefunc) {
+ DBG(DEBUG_LOWPROBE, printf("\tcall probefunc()\n"));
+- if (id->probefunc(pr, mag) != 0)
++ if (id->probefunc(pr, mag) != 0) {
++ blkid_probe_chain_reset_vals(pr, chn);
+ continue;
++ }
+ }
- for ( ; i < ARRAY_SIZE(idinfos); i++) {
-@@ -385,15 +436,11 @@ static int superblocks_probe(blkid_probe
+ /* all cheks passed */
+@@ -385,15 +387,11 @@ static int superblocks_probe(blkid_probe
(unsigned char *) id->name,
strlen(id->name) + 1);
@@ -204,32 +304,58 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
DBG(DEBUG_LOWPROBE,
printf("<-- leaving probing loop (type=%s) [SUBLKS idx=%d]\n",
-@@ -422,6 +469,9 @@ nothing:
- */
- static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn)
- {
-+ blkid_superblock sb = NULL;
-+ struct blkid_struct_superblock sb_buff;
-+
- struct blkid_prval vals[BLKID_NVALS_SUBLKS];
- int nvals = BLKID_NVALS_SUBLKS;
- int idx = -1;
-@@ -439,6 +489,8 @@ static int superblocks_safeprobe(blkid_p
- /* save the first result */
- nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals);
- idx = chn->idx;
-+ if (chn->data)
-+ sb = superblocks_copy_data(&sb_buff, chn->data);
- }
+@@ -435,20 +433,24 @@ static int superblocks_safeprobe(blkid_p
+ /* floppy or so -- returns the first result. */
+ return 0;
+
+- if (!count) {
+- /* save the first result */
+- nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals);
+- idx = chn->idx;
+- }
count++;
-@@ -462,11 +514,33 @@ static int superblocks_safeprobe(blkid_p
- /* restore the first result */
- blkid_probe_chain_reset_vals(pr, chn);
- blkid_probe_append_vals(pr, vals, nvals);
-+ if (sb && chn->data)
-+ superblocks_copy_data(chn->data, sb);
- chn->idx = idx;
+ if (idinfos[chn->idx]->usage & (BLKID_USAGE_RAID | BLKID_USAGE_CRYPTO))
+ break;
++
+ if (!(idinfos[chn->idx]->flags & BLKID_IDINFO_TOLERANT))
+ intol++;
++
++ if (count == 1) {
++ /* save the first result */
++ nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals);
++ idx = chn->idx;
++ }
+ }
++
+ if (rc < 0)
+ return rc; /* error */
++
+ if (count > 1 && intol) {
+ DBG(DEBUG_LOWPROBE,
+ printf("ERROR: superblocks chain: "
+@@ -459,14 +461,40 @@ static int superblocks_safeprobe(blkid_p
+ if (!count)
+ return 1; /* nothing detected */
+
+- /* restore the first result */
+- blkid_probe_chain_reset_vals(pr, chn);
+- blkid_probe_append_vals(pr, vals, nvals);
+- chn->idx = idx;
++ if (idx != -1) {
++ /* restore the first result */
++ blkid_probe_chain_reset_vals(pr, chn);
++ blkid_probe_append_vals(pr, vals, nvals);
++ chn->idx = idx;
++ }
++
++ /*
++ * The RAID device could be partitioned. The problem are RAID1 devices
++ * where the partition table is visible from underlaying devices. We
++ * have to ignore such partition tables.
++ */
++ if (chn->idx >= 0 && idinfos[chn->idx]->usage & BLKID_USAGE_RAID)
++ pr->prob_flags |= BLKID_PARTS_IGNORE_PT;
return 0;
}
@@ -247,37 +373,27 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
+ rc = blkid_probe_sprintf_value(pr, "SBMAGIC_OFFSET",
+ "%llu", offset);
+ }
-+ if (!rc && chn->data) {
-+ blkid_superblock sb = (blkid_superblock) chn->data;
-+ sb->magic_off = offset;
-+ }
+ return rc;
+}
+
int blkid_probe_set_version(blkid_probe pr, const char *version)
{
struct blkid_chain *chn = blkid_probe_get_chain(pr);
-@@ -494,8 +568,17 @@ int blkid_probe_sprintf_version(blkid_pr
+@@ -494,8 +522,12 @@ int blkid_probe_sprintf_version(blkid_pr
static int blkid_probe_set_usage(blkid_probe pr, int usage)
{
+ struct blkid_chain *chn = blkid_probe_get_chain(pr);
char *u = NULL;
-+ if (chn->data) {
-+ blkid_superblock sb = (blkid_superblock) chn->data;
-+ sb->usage = usage;
-+ }
-+
+ if (!(chn->flags & BLKID_SUBLKS_USAGE))
+ return 0;
+
if (usage & BLKID_USAGE_FILESYSTEM)
u = "filesystem";
else if (usage & BLKID_USAGE_RAID)
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.h.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.h
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.h.kzak 2010-03-22 09:05:43.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.h 2010-05-03 13:14:43.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/superblocks.h
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.h
@@ -68,6 +68,8 @@ extern const struct blkid_idinfo drbd_id
/*
* superblock functions
@@ -287,40 +403,19 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
extern int blkid_probe_set_version(blkid_probe pr, const char *version);
extern int blkid_probe_sprintf_version(blkid_probe pr, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
-
-
-From a467be9c5191083612f9fc557d16f801cc1db7ee Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 09:41:48 +0200
-Subject: [PATCH 3/7] libblkid: export magic strings from raids
-
-The library provides detected magic strings by SBMAGIC= and offsets of
-the magic strings by SBMAGIC_OFFSET= variables. This patch allows to
-support this feature for RAIDs and filesystems where the magic string
-is not on fixed position.
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- shlibs/blkid/src/superblocks/adaptec_raid.c | 4 +++-
- shlibs/blkid/src/superblocks/ddf_raid.c | 7 ++++++-
- shlibs/blkid/src/superblocks/drbd.c | 13 ++++++++++---
- shlibs/blkid/src/superblocks/highpoint_raid.c | 3 +++
- shlibs/blkid/src/superblocks/isw_raid.c | 4 +++-
- shlibs/blkid/src/superblocks/jmicron_raid.c | 4 +++-
- shlibs/blkid/src/superblocks/linux_raid.c | 8 ++++++--
- shlibs/blkid/src/superblocks/lsi_raid.c | 4 +++-
- shlibs/blkid/src/superblocks/nvidia_raid.c | 5 +++--
- shlibs/blkid/src/superblocks/promise_raid.c | 7 ++++++-
- shlibs/blkid/src/superblocks/silicon_raid.c | 7 ++++++-
- shlibs/blkid/src/superblocks/sysv.c | 14 +++++++++++++-
- shlibs/blkid/src/superblocks/ufs.c | 8 ++++++++
- shlibs/blkid/src/superblocks/via_raid.c | 4 ++++
- 14 files changed, 77 insertions(+), 15 deletions(-)
-
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/adaptec_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/adaptec_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/adaptec_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/adaptec_raid.c 2010-05-03 13:20:20.000000000 +0200
-@@ -94,7 +94,9 @@ static int probe_adraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/adaptec_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/adaptec_raid.c
+@@ -81,6 +81,9 @@ static int probe_adraid(blkid_probe pr,
+ if (pr->size < 0x10000)
+ return -1;
+
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
++
+ off = ((pr->size / 0x200)-1) * 0x200;
+ ad = (struct adaptec_metadata *)
+ blkid_probe_get_buffer(pr,
+@@ -94,7 +97,9 @@ static int probe_adraid(blkid_probe pr,
return -1;
if (blkid_probe_sprintf_version(pr, "%u", ad->resver) != 0)
return -1;
@@ -331,14 +426,73 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ddf_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ddf_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ddf_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ddf_raid.c 2010-05-03 13:20:20.000000000 +0200
-@@ -32,12 +32,13 @@ static int probe_ddf(blkid_probe pr, con
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/ddf_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ddf_raid.c
+@@ -18,12 +18,57 @@
+ /* http://www.snia.org/standards/home */
+ #define DDF_GUID_LENGTH 24
+ #define DDF_REV_LENGTH 8
++#define DDF_MAGIC 0xDE11DE11
++
+
+ struct ddf_header {
+- uint8_t signature[4];
++ uint32_t signature;
+ uint32_t crc;
+ uint8_t guid[DDF_GUID_LENGTH];
+- uint8_t ddf_rev[DDF_REV_LENGTH];
++ char ddf_rev[8]; /* 01.02.00 */
++ uint32_t seq; /* starts at '1' */
++ uint32_t timestamp;
++ uint8_t openflag;
++ uint8_t foreignflag;
++ uint8_t enforcegroups;
++ uint8_t pad0; /* 0xff */
++ uint8_t pad1[12]; /* 12 * 0xff */
++ /* 64 bytes so far */
++ uint8_t header_ext[32]; /* reserved: fill with 0xff */
++ uint64_t primary_lba;
++ uint64_t secondary_lba;
++ uint8_t type;
++ uint8_t pad2[3]; /* 0xff */
++ uint32_t workspace_len; /* sectors for vendor space -
++ * at least 32768(sectors) */
++ uint64_t workspace_lba;
++ uint16_t max_pd_entries; /* one of 15, 63, 255, 1023, 4095 */
++ uint16_t max_vd_entries; /* 2^(4,6,8,10,12)-1 : i.e. as above */
++ uint16_t max_partitions; /* i.e. max num of configuration
++ record entries per disk */
++ uint16_t config_record_len; /* 1 +ROUNDUP(max_primary_element_entries
++ *12/512) */
++ uint16_t max_primary_element_entries; /* 16, 64, 256, 1024, or 4096 */
++ uint8_t pad3[54]; /* 0xff */
++ /* 192 bytes so far */
++ uint32_t controller_section_offset;
++ uint32_t controller_section_length;
++ uint32_t phys_section_offset;
++ uint32_t phys_section_length;
++ uint32_t virt_section_offset;
++ uint32_t virt_section_length;
++ uint32_t config_section_offset;
++ uint32_t config_section_length;
++ uint32_t data_section_offset;
++ uint32_t data_section_length;
++ uint32_t bbm_section_offset;
++ uint32_t bbm_section_length;
++ uint32_t diag_space_offset;
++ uint32_t diag_space_length;
++ uint32_t vendor_offset;
++ uint32_t vendor_length;
++ /* 256 bytes so far */
++ uint8_t pad4[256]; /* 0xff */
+ } __attribute__((packed));
+
+ static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag)
+@@ -32,12 +77,13 @@ static int probe_ddf(blkid_probe pr, con
int i;
struct ddf_header *ddf = NULL;
char version[DDF_REV_LENGTH + 1];
-+ uint64_t off;
++ uint64_t off, lba;
if (pr->size < 0x30000)
return -1;
@@ -349,20 +503,51 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
ddf = (struct ddf_header *) blkid_probe_get_buffer(pr,
off,
-@@ -61,6 +62,10 @@ static int probe_ddf(blkid_probe pr, con
+@@ -45,8 +91,8 @@ static int probe_ddf(blkid_probe pr, con
+ if (!ddf)
+ return -1;
+
+- if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0 ||
+- memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0)
++ if (ddf->signature == cpu_to_be32(DDF_MAGIC) ||
++ ddf->signature == cpu_to_le32(DDF_MAGIC))
+ break;
+ ddf = NULL;
+ }
+@@ -54,6 +100,20 @@ static int probe_ddf(blkid_probe pr, con
+ if (!ddf)
+ return -1;
+
++ lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ?
++ be64_to_cpu(ddf->primary_lba) :
++ le64_to_cpu(ddf->primary_lba);
++
++ if (lba > 0) {
++ /* check primary header */
++ unsigned char *buf;
++
++ buf = blkid_probe_get_buffer(pr,
++ lba << 9, sizeof(ddf->signature));
++ if (!buf || memcmp(buf, &ddf->signature, 4))
++ return -1;
++ }
++
+ blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid));
+
+ memcpy(version, ddf->ddf_rev, sizeof(ddf->ddf_rev));
+@@ -61,6 +121,10 @@ static int probe_ddf(blkid_probe pr, con
if (blkid_probe_set_version(pr, version) != 0)
return -1;
+ if (blkid_probe_set_magic(pr, off,
+ sizeof(ddf->signature),
-+ (unsigned char *) ddf->signature))
++ (unsigned char *) &ddf->signature))
+ return -1;
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/drbd.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/drbd.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/drbd.c.kzak 2010-03-22 09:13:48.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/drbd.c 2010-05-03 13:20:21.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/drbd.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/drbd.c
@@ -14,6 +14,7 @@
#include <errno.h>
#include <ctype.h>
@@ -397,10 +582,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/highpoint_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/highpoint_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/highpoint_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/highpoint_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -41,6 +41,9 @@ static int probe_highpoint45x(blkid_prob
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/highpoint_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/highpoint_raid.c
+@@ -30,6 +30,8 @@ static int probe_highpoint45x(blkid_prob
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 11) * 0x200;
+ hpt = (struct hpt45x_metadata *)
+@@ -41,9 +43,20 @@ static int probe_highpoint45x(blkid_prob
magic = le32_to_cpu(hpt->magic);
if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
return -1;
@@ -410,10 +603,37 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/isw_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/isw_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/isw_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/isw_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -46,7 +46,9 @@ static int probe_iswraid(blkid_probe pr,
++static int probe_highpoint37x(blkid_probe pr, const struct blkid_idmag *mag)
++{
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
++ return 0;
++}
++
++
+ const struct blkid_idinfo highpoint45x_idinfo = {
+ .name = "hpt45x_raid_member",
+ .usage = BLKID_USAGE_RAID,
+@@ -54,6 +67,7 @@ const struct blkid_idinfo highpoint45x_i
+ const struct blkid_idinfo highpoint37x_idinfo = {
+ .name = "hpt37x_raid_member",
+ .usage = BLKID_USAGE_RAID,
++ .probefunc = probe_highpoint37x,
+ .magics = {
+ /*
+ * Superblok offset: 4608 bytes (9 sectors)
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/isw_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/isw_raid.c
+@@ -33,6 +33,8 @@ static int probe_iswraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 2) * 0x200;
+ isw = (struct isw_metadata *)
+@@ -46,7 +48,9 @@ static int probe_iswraid(blkid_probe pr,
if (blkid_probe_sprintf_version(pr, "%6s",
&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
return -1;
@@ -424,10 +644,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/jmicron_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/jmicron_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/jmicron_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/jmicron_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -45,7 +45,9 @@ static int probe_jmraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/jmicron_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/jmicron_raid.c
+@@ -32,6 +32,8 @@ static int probe_jmraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 1) * 0x200;
+ jm = (struct jm_metadata *)
+@@ -45,7 +47,9 @@ static int probe_jmraid(blkid_probe pr,
if (blkid_probe_sprintf_version(pr, "%u.%u",
jm->major_version, jm->minor_version) != 0)
return -1;
@@ -438,11 +666,134 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/linux_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/linux_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/linux_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/linux_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -95,7 +95,9 @@ static int probe_raid0(blkid_probe pr, o
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/linux_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/linux_raid.c
+@@ -34,15 +34,68 @@ struct mdp0_super_block {
+ uint32_t set_uuid3;
+ };
+
++/*
++ * Version-1, little-endian.
++ */
+ struct mdp1_super_block {
+- uint32_t magic;
+- uint32_t major_version;
+- uint32_t feature_map;
+- uint32_t pad0;
+- uint8_t set_uuid[16];
+- uint8_t set_name[32];
++ /* constant array information - 128 bytes */
++ uint32_t magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
++ uint32_t major_version; /* 1 */
++ uint32_t feature_map; /* 0 for now */
++ uint32_t pad0; /* always set to 0 when writing */
++
++ uint8_t set_uuid[16]; /* user-space generated. */
++ unsigned char set_name[32]; /* set and interpreted by user-space */
++
++ uint64_t ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
++ uint32_t level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
++ uint32_t layout; /* only for raid5 currently */
++ uint64_t size; /* used size of component devices, in 512byte sectors */
++
++ uint32_t chunksize; /* in 512byte sectors */
++ uint32_t raid_disks;
++ uint32_t bitmap_offset; /* sectors after start of superblock that bitmap starts
++ * NOTE: signed, so bitmap can be before superblock
++ * only meaningful of feature_map[0] is set.
++ */
++
++ /* These are only valid with feature bit '4' */
++ uint32_t new_level; /* new level we are reshaping to */
++ uint64_t reshape_position; /* next address in array-space for reshape */
++ uint32_t delta_disks; /* change in number of raid_disks */
++ uint32_t new_layout; /* new layout */
++ uint32_t new_chunk; /* new chunk size (bytes) */
++ uint8_t pad1[128-124]; /* set to 0 when written */
++
++ /* constant this-device information - 64 bytes */
++ uint64_t data_offset; /* sector start of data, often 0 */
++ uint64_t data_size; /* sectors in this device that can be used for data */
++ uint64_t super_offset; /* sector start of this superblock */
++ uint64_t recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
++ uint32_t dev_number; /* permanent identifier of this device - not role in raid */
++ uint32_t cnt_corrected_read; /* number of read errors that were corrected by re-writing */
++ uint8_t device_uuid[16]; /* user-space setable, ignored by kernel */
++ uint8_t devflags; /* per-device flags. Only one defined...*/
++ uint8_t pad2[64-57]; /* set to 0 when writing */
++
++ /* array state information - 64 bytes */
++ uint64_t utime; /* 40 bits second, 24 btes microseconds */
++ uint64_t events; /* incremented when superblock updated */
++ uint64_t resync_offset; /* data before this offset (from data_offset) known to be in sync */
++ uint32_t sb_csum; /* checksum upto dev_roles[max_dev] */
++ uint32_t max_dev; /* size of dev_roles[] array to consider */
++ uint8_t pad3[64-32]; /* set to 0 when writing */
++
++ /* device state information. Indexed by dev_number.
++ * 2 bytes per device
++ * Note there are no per-device state flags. State information is rolled
++ * into the 'roles' value. If a device is spare or faulty, then it doesn't
++ * have a meaningful role.
++ */
++ uint16_t dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
+ };
+
++
+ #define MD_RESERVED_BYTES 0x10000
+ #define MD_SB_MAGIC 0xa92b4efc
+
+@@ -53,6 +106,7 @@ static int probe_raid0(blkid_probe pr, o
+ uint32_t ints[4];
+ uint8_t bytes[16];
+ } uuid;
++ uint32_t ma, mi, pa;
+
+ if (pr->size < 0x10000)
+ return -1;
+@@ -72,11 +126,9 @@ static int probe_raid0(blkid_probe pr, o
+ uuid.ints[2] = swab32(mdp0->set_uuid2);
+ uuid.ints[3] = swab32(mdp0->set_uuid3);
+ }
+- if (blkid_probe_sprintf_version(pr, "%u.%u.%u",
+- le32_to_cpu(mdp0->major_version),
+- le32_to_cpu(mdp0->minor_version),
+- le32_to_cpu(mdp0->patch_version)) != 0)
+- return -1;
++ ma = le32_to_cpu(mdp0->major_version);
++ mi = le32_to_cpu(mdp0->minor_version);
++ pa = le32_to_cpu(mdp0->patch_version);
+
+ } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) {
+ uuid.ints[0] = mdp0->set_uuid0;
+@@ -85,17 +137,29 @@ static int probe_raid0(blkid_probe pr, o
+ uuid.ints[2] = mdp0->set_uuid2;
+ uuid.ints[3] = mdp0->set_uuid3;
+ }
+- if (blkid_probe_sprintf_version(pr, "%u.%u.%u",
+- be32_to_cpu(mdp0->major_version),
+- be32_to_cpu(mdp0->minor_version),
+- be32_to_cpu(mdp0->patch_version)) != 0)
+- return -1;
++ ma = be32_to_cpu(mdp0->major_version);
++ mi = be32_to_cpu(mdp0->minor_version);
++ pa = be32_to_cpu(mdp0->patch_version);
+ } else
+- return -1;
++ return 1;
++
++ /*
++ * Check for collisions between RAID and partition table
++ */
++ if ((S_ISREG(pr->mode) || blkid_probe_is_wholedisk(pr)) &&
++ blkid_probe_is_covered_by_pt(pr, off, 0x200)) {
++ /* ignore this superblock, it's within any partition and
++ * we are working with whole-disk now */
++ return 1;
++ }
++ if (blkid_probe_sprintf_version(pr, "%u.%u.%u", ma, mi, pa) != 0)
++ return -1;
if (blkid_probe_set_uuid(pr, (unsigned char *) uuid.bytes) != 0)
return -1;
-
@@ -452,7 +803,17 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-@@ -118,7 +120,9 @@ static int probe_raid1(blkid_probe pr, o
+@@ -113,12 +177,19 @@ static int probe_raid1(blkid_probe pr, o
+ return -1;
+ if (le32_to_cpu(mdp1->major_version) != 1)
+ return -1;
++ if (le64_to_cpu(mdp1->super_offset) != off >> 9)
++ return -1;
+ if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0)
+ return -1;
++ if (blkid_probe_set_uuid_as(pr,
++ (unsigned char *) mdp1->device_uuid, "UUID_SUB") != 0)
++ return -1;
if (blkid_probe_set_label(pr, mdp1->set_name,
sizeof(mdp1->set_name)) != 0)
return -1;
@@ -463,10 +824,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/lsi_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/lsi_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/lsi_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/lsi_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -41,7 +41,9 @@ static int probe_lsiraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/lsi_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/lsi_raid.c
+@@ -30,6 +30,8 @@ static int probe_lsiraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 1) * 0x200;
+ lsi = (struct lsi_metadata *)
+@@ -41,7 +43,9 @@ static int probe_lsiraid(blkid_probe pr,
if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
return -1;
@@ -477,10 +846,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/nvidia_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/nvidia_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/nvidia_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/nvidia_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -43,10 +43,11 @@ static int probe_nvraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/nvidia_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/nvidia_raid.c
+@@ -32,6 +32,8 @@ static int probe_nvraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 2) * 0x200;
+ nv = (struct nv_metadata *)
+@@ -43,10 +45,11 @@ static int probe_nvraid(blkid_probe pr,
if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
return -1;
@@ -494,10 +871,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/promise_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/promise_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/promise_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/promise_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -47,8 +47,13 @@ static int probe_pdcraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/promise_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/promise_raid.c
+@@ -33,6 +33,8 @@ static int probe_pdcraid(blkid_probe pr,
+
+ if (pr->size < 0x40000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ for (i = 0; sectors[i] != 0; i++) {
+ uint64_t off;
+@@ -47,8 +49,13 @@ static int probe_pdcraid(blkid_probe pr,
return -1;
if (memcmp(pdc->sig, PDC_SIGNATURE,
@@ -512,9 +897,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
}
return -1;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/silicon_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/silicon_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/silicon_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/silicon_raid.c 2010-05-03 13:20:21.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/silicon_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/silicon_raid.c
@@ -15,6 +15,7 @@
#include <errno.h>
#include <ctype.h>
@@ -523,7 +907,16 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
#include "superblocks.h"
-@@ -63,7 +64,11 @@ static int probe_silraid(blkid_probe pr,
+@@ -47,6 +48,8 @@ static int probe_silraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200) - 1) * 0x200;
+
+@@ -63,7 +66,11 @@ static int probe_silraid(blkid_probe pr,
le16_to_cpu(sil->major_ver),
le16_to_cpu(sil->minor_ver)) != 0)
return -1;
@@ -536,9 +929,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/sysv.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/sysv.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/sysv.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/sysv.c 2010-05-03 13:20:21.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/sysv.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/sysv.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <unistd.h>
@@ -567,9 +959,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ufs.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ufs.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ufs.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ufs.c 2010-05-03 13:20:21.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/ufs.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/ufs.c
@@ -15,6 +15,7 @@
#include <errno.h>
#include <ctype.h>
@@ -592,10 +983,18 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/via_raid.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/via_raid.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/via_raid.c.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/via_raid.c 2010-05-03 13:20:21.000000000 +0200
-@@ -69,6 +69,10 @@ static int probe_viaraid(blkid_probe pr,
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/superblocks/via_raid.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/via_raid.c
+@@ -52,6 +52,8 @@ static int probe_viaraid(blkid_probe pr,
+
+ if (pr->size < 0x10000)
+ return -1;
++ if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
++ return -1;
+
+ off = ((pr->size / 0x200)-1) * 0x200;
+
+@@ -69,6 +71,10 @@ static int probe_viaraid(blkid_probe pr,
return -1;
if (blkid_probe_sprintf_version(pr, "%u", v->version_number) != 0)
return -1;
@@ -606,79 +1005,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
return 0;
}
-
-From 49879b3db3c62ad2be9362e86ad94e1511863d42 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 10:35:20 +0200
-Subject: [PATCH 4/7] libblkid: fix collision between RAID and PT probing
-
-The RAID signature is usually at end of the block device. We have to
-differentiate between:
-
- - RAID signature at the end of disk, and
- - RAID signature at the end of the last partition
-
-The position of the signature is same in both cases... It means we have
-to the parse partition table and check if the area where is RAID signature
-is covered by any partition. If yes, then the RAID signature belongs to the
-partition and has to be ignored during whole-disk probing.
-
-The second problem are RAID1 underlaying disks (=raid members). The
-RAID device could be partitioned, in such a case the partition table
-is visible from underlaying devices. These partition tables has to be
-ignored. The libblkid ignores partition tables on raid members now.
-
-Note that all these changes are implemented for blkid_do_safeprobe()
-only. The others functions allow to access all detected superblocks or
-partition tables.
-
-Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=543749
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- shlibs/blkid/src/blkidP.h | 8 +++-
- shlibs/blkid/src/partitions/partitions.c | 79 ++++++++++++++++++++++++++++
- shlibs/blkid/src/probe.c | 53 ++++++++++++++++---
- shlibs/blkid/src/superblocks/superblocks.c | 36 ++++++++++++-
- 4 files changed, 164 insertions(+), 12 deletions(-)
-
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h
---- util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h.kzak 2010-05-03 13:19:22.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/blkidP.h 2010-05-03 13:21:25.000000000 +0200
-@@ -198,6 +198,7 @@ struct blkid_struct_probe
- mode_t mode; /* struct stat.sb_mode */
-
- int flags; /* private libray flags */
-+ int prob_flags; /* always zeroized by blkid_do_*() */
-
- struct list_head buffers; /* list of buffers */
-
-@@ -208,10 +209,12 @@ struct blkid_struct_probe
- int nvals; /* number of assigned vals */
- };
-
--/* flags */
-+/* private flags */
- #define BLKID_PRIVATE_FD (1 << 1) /* see blkid_new_probe_from_filename() */
- #define BLKID_TINY_DEV (1 << 2) /* <= 1.47MiB (floppy or so) */
- #define BLKID_CDROM_DEV (1 << 3) /* is a CD/DVD drive */
-+/* private probing flags */
-+#define BLKID_PARTS_IGNORE_PT (1 << 1) /* ignore partition table */
-
- /*
- * Evaluation methods (for blkid_eval_* API)
-@@ -387,6 +390,9 @@ extern int blkid_probe_set_dimension(blk
-
- extern blkid_partlist blkid_probe_get_partlist(blkid_probe pr);
-
-+extern int blkid_probe_is_covered_by_pt(blkid_probe pr,
-+ blkid_loff_t offset, blkid_loff_t size);
-+
- extern void blkid_probe_chain_reset_vals(blkid_probe pr, struct blkid_chain *chn);
- extern int blkid_probe_chain_copy_vals(blkid_probe pr, struct blkid_chain *chn,
- struct blkid_prval *vals, int nvals);
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/partitions/partitions.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/partitions/partitions.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/partitions/partitions.c.kzak 2010-03-22 09:05:43.000000000 +0100
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/partitions/partitions.c 2010-05-03 13:21:25.000000000 +0200
+--- util-linux-ng-2.17.2.orig/shlibs/blkid/src/partitions/partitions.c
++++ util-linux-ng-2.17.2/shlibs/blkid/src/partitions/partitions.c
@@ -566,6 +566,9 @@ static int partitions_probe(blkid_probe
if (chn->binary)
partitions_init_data(pr, chn);
@@ -689,7 +1017,7 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
DBG(DEBUG_LOWPROBE,
printf("--> starting probing loop [PARTS idx=%d]\n",
chn->idx));
-@@ -652,6 +655,82 @@ int blkid_partitions_do_subprobe(blkid_p
+@@ -652,6 +655,95 @@ int blkid_partitions_do_subprobe(blkid_p
return rc;
}
@@ -754,6 +1082,19 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
+ end = (offset + size) >> 9;
+ start = offset >> 9;
+
++ /* check if the partition table fits into the device */
++ for (i = 0; i < nparts; i++) {
++ blkid_partition par = &ls->parts[i];
++
++ if (par->start + par->size > pr->size) {
++ DBG(DEBUG_LOWPROBE, printf("partition #%d overflows "
++ "device (off=%lu size=%lu)\n",
++ par->partno, par->start, par->size));
++ goto done;
++ }
++ }
++
++ /* check if the requested area is covered by PT */
+ for (i = 0; i < nparts; i++) {
+ blkid_partition par = &ls->parts[i];
+
@@ -772,219 +1113,8 @@ diff -up util-linux-ng-2.17.2/shlibs/blk
/**
* blkid_known_pttype:
* @pttype: partiton name
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/probe.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/probe.c.kzak 2010-05-03 13:19:22.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/probe.c 2010-05-03 13:21:25.000000000 +0200
-@@ -288,21 +288,33 @@ struct blkid_chain *blkid_probe_get_chai
-
- void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn)
- {
-- int rc;
-+ int rc, org_prob_flags;
-+ struct blkid_chain *org_chn;
-
- if (!pr || !chn)
- return NULL;
-
-+ /* save the current setting -- the binary API has to be completely
-+ * independent on the current probing status
-+ */
-+ org_chn = pr->cur_chain;
-+ org_prob_flags = pr->prob_flags;
-+
- pr->cur_chain = chn;
-+ pr->prob_flags = 0;
- chn->binary = TRUE;
- blkid_probe_chain_reset_position(chn);
-
- rc = chn->driver->probe(pr, chn);
-
- chn->binary = FALSE;
-- pr->cur_chain = NULL;
- blkid_probe_chain_reset_position(chn);
-
-+ /* restore the original setting
-+ */
-+ pr->cur_chain = org_chn;
-+ pr->prob_flags = org_prob_flags;
-+
- if (rc != 0)
- return NULL;
-
-@@ -674,6 +686,22 @@ int blkid_probe_set_dimension(blkid_prob
- return 0;
- }
-
-+static inline void blkid_probe_start(blkid_probe pr)
-+{
-+ if (pr) {
-+ pr->cur_chain = NULL;
-+ pr->prob_flags = 0;
-+ }
-+}
-+
-+static inline void blkid_probe_end(blkid_probe pr)
-+{
-+ if (pr) {
-+ pr->cur_chain = NULL;
-+ pr->prob_flags = 0;
-+ }
-+}
-+
- /**
- * blkid_do_probe:
- * @pr: prober
-@@ -725,9 +753,10 @@ int blkid_do_probe(blkid_probe pr)
- do {
- struct blkid_chain *chn = pr->cur_chain;
-
-- if (!chn)
-+ if (!chn) {
-+ blkid_probe_start(pr);
- chn = pr->cur_chain = &pr->chains[0];
--
-+ }
- /* we go to the next chain only when the previous probing
- * result was nothing (rc == 1) and when the current chain is
- * disabled or we are at end of the current chain (chain->idx +
-@@ -742,8 +771,10 @@ int blkid_do_probe(blkid_probe pr)
-
- if (idx < BLKID_NCHAINS)
- chn = pr->cur_chain = &pr->chains[idx];
-- else
-+ else {
-+ blkid_probe_end(pr);
- return 1; /* all chains already probed */
-+ }
- }
-
- chn->binary = FALSE; /* for sure... */
-@@ -775,7 +806,9 @@ int blkid_do_probe(blkid_probe pr)
- *
- * Note about suberblocks chain -- the function does not check for filesystems
- * when a RAID signature is detected. The function also does not check for
-- * collision between RAIDs. The first detected RAID is returned.
-+ * collision between RAIDs. The first detected RAID is returned. The function
-+ * checks for collision between partition table and RAID signature -- it's
-+ * recommended to enable partitions chain together with superblocks chain.
- *
- * Returns: 0 on success, 1 if nothing is detected, -2 if ambivalen result is
- * detected and -1 on case of error.
-@@ -787,6 +820,8 @@ int blkid_do_safeprobe(blkid_probe pr)
- if (!pr)
- return -1;
-
-+ blkid_probe_start(pr);
-+
- for (i = 0; i < BLKID_NCHAINS; i++) {
- struct blkid_chain *chn;
-
-@@ -814,7 +849,7 @@ int blkid_do_safeprobe(blkid_probe pr)
- }
-
- done:
-- pr->cur_chain = NULL;
-+ blkid_probe_end(pr);
- if (rc < 0)
- return rc;
- return count ? 0 : 1;
-@@ -839,6 +874,8 @@ int blkid_do_fullprobe(blkid_probe pr)
- if (!pr)
- return -1;
-
-+ blkid_probe_start(pr);
-+
- for (i = 0; i < BLKID_NCHAINS; i++) {
- int rc;
- struct blkid_chain *chn;
-@@ -867,7 +904,7 @@ int blkid_do_fullprobe(blkid_probe pr)
- }
-
- done:
-- pr->cur_chain = NULL;
-+ blkid_probe_end(pr);
- if (rc < 0)
- return rc;
- return count ? 0 : 1;
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak 2010-05-03 13:19:22.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c 2010-05-03 13:21:25.000000000 +0200
-@@ -477,14 +477,17 @@ static int superblocks_safeprobe(blkid_p
- int idx = -1;
- int count = 0;
- int intol = 0;
-- int rc;
-+ int rc, bin_org = chn->binary;
-+
-+ chn->binary = TRUE;
-
- while ((rc = superblocks_probe(pr, chn)) == 0) {
-
-- if (blkid_probe_is_tiny(pr) && !count)
-+ if (blkid_probe_is_tiny(pr) && !count) {
- /* floppy or so -- returns the first result. */
-+ chn->binary = bin_org;
- return 0;
--
-+ }
- if (!count) {
- /* save the first result */
- nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals);
-@@ -499,6 +502,9 @@ static int superblocks_safeprobe(blkid_p
- if (!(idinfos[chn->idx]->flags & BLKID_IDINFO_TOLERANT))
- intol++;
- }
-+
-+ chn->binary = bin_org;
-+
- if (rc < 0)
- return rc; /* error */
- if (count > 1 && intol) {
-@@ -518,6 +524,30 @@ static int superblocks_safeprobe(blkid_p
- superblocks_copy_data(chn->data, sb);
- chn->idx = idx;
-
-+ /*
-+ * Check for collisions between RAID and partition table
-+ */
-+ if (sb && sb->usage == BLKID_USAGE_RAID &&
-+ sb->magic_off > pr->size / 2 &&
-+ (S_ISREG(pr->mode) || blkid_probe_is_wholedisk(pr)) &&
-+ blkid_probe_is_covered_by_pt(pr, sb->magic_off, 0x200)) {
-+ /*
-+ * Ignore the result if the detected RAID superblock is
-+ * within some existing partition (for example RAID on
-+ * the last partition).
-+ */
-+ blkid_probe_chain_reset_vals(pr, chn);
-+ return 1;
-+ }
-+
-+ /*
-+ * The RAID device could be partitioned. The problem are RAID1 devices
-+ * where the partition table is visible from underlaying devices. We
-+ * have to ignore such partition tables.
-+ */
-+ if (sb && sb->usage == BLKID_USAGE_RAID)
-+ pr->prob_flags |= BLKID_PARTS_IGNORE_PT;
-+
- return 0;
- }
-
-From 7d6d95ac9b5c84e8ff234c6bdef930d03f1e0577 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 15:16:05 +0200
-Subject: [PATCH 5/7] blkid: improve RAIDs and tiny devices probing
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- misc-utils/blkid.c | 37 +++++++++++++++++++------------------
- 1 files changed, 19 insertions(+), 18 deletions(-)
-
-
-diff -up util-linux-ng-2.17.2/misc-utils/blkid.c.kzak util-linux-ng-2.17.2/misc-utils/blkid.c
---- util-linux-ng-2.17.2/misc-utils/blkid.c.kzak 2010-05-03 13:19:04.000000000 +0200
-+++ util-linux-ng-2.17.2/misc-utils/blkid.c 2010-05-03 13:22:49.000000000 +0200
+--- util-linux-ng-2.17.2.orig/misc-utils/blkid.c
++++ util-linux-ng-2.17.2/misc-utils/blkid.c
@@ -423,33 +423,34 @@ static int lowprobe_device(blkid_probe p
if (fstat(fd, &st))
@@ -1038,56 +1168,8 @@ diff -up util-linux-ng-2.17.2/misc-utils
nvals = blkid_probe_numof_values(pr);
if (output & OUTPUT_DEVICE_ONLY) {
-
-
-From c6088bbd63f21ce586b3c3c3d894642f4f008355 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Fri, 30 Apr 2010 15:25:41 +0200
-Subject: [PATCH 6/7] libblkid: reset superblocks result after error
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- shlibs/blkid/src/superblocks/superblocks.c | 4 +++-
- 1 files changed, 3 insertions(+), 1 deletions(-)
-
-diff -up util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c
---- util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c.kzak 2010-05-03 13:21:25.000000000 +0200
-+++ util-linux-ng-2.17.2/shlibs/blkid/src/superblocks/superblocks.c 2010-05-03 13:23:38.000000000 +0200
-@@ -426,8 +426,10 @@ static int superblocks_probe(blkid_probe
- /* final check by probing function */
- if (id->probefunc) {
- DBG(DEBUG_LOWPROBE, printf("\tcall probefunc()\n"));
-- if (id->probefunc(pr, mag) != 0)
-+ if (id->probefunc(pr, mag) != 0) {
-+ blkid_probe_chain_reset_vals(pr, chn);
- continue;
-+ }
- }
-
- /* all cheks passed */
-
-
-From b4cd0e971dee03eac044a2d28f78fe638a04d8c5 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak at redhat.com>
-Date: Mon, 3 May 2010 11:20:52 +0200
-Subject: [PATCH 7/7] tests: add blkid tests for RAID1
-
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- tests/expected/blkid/md-raid1-part | 58 ++++++++++++++++++++++
- tests/expected/blkid/md-raid1-whole | 58 ++++++++++++++++++++++
- tests/functions.sh | 2 +-
- tests/ts/blkid/md-raid1-part | 92 +++++++++++++++++++++++++++++++++++
- tests/ts/blkid/md-raid1-whole | 88 +++++++++++++++++++++++++++++++++
- 5 files changed, 297 insertions(+), 1 deletions(-)
- create mode 100644 tests/expected/blkid/md-raid1-part
- create mode 100644 tests/expected/blkid/md-raid1-whole
- create mode 100755 tests/ts/blkid/md-raid1-part
- create mode 100755 tests/ts/blkid/md-raid1-whole
-
-diff -up util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part.kzak util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part
---- util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part.kzak 2010-05-03 13:24:30.000000000 +0200
-+++ util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part 2010-05-03 13:24:30.000000000 +0200
+--- /dev/null
++++ util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-part
@@ -0,0 +1,58 @@
+Create partitions
+Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
@@ -1147,9 +1229,8 @@ diff -up util-linux-ng-2.17.2/tests/expe
+
+
+ID_FS_VERSION=0.90.0
-diff -up util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole.kzak util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole
---- util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole.kzak 2010-05-03 13:24:30.000000000 +0200
-+++ util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole 2010-05-03 13:24:30.000000000 +0200
+--- /dev/null
++++ util-linux-ng-2.17.2/tests/expected/blkid/md-raid1-whole
@@ -0,0 +1,58 @@
+Initialize devices
+Create RAID device
@@ -1209,9 +1290,8 @@ diff -up util-linux-ng-2.17.2/tests/expe
+ID_FS_VERSION=0.90.0
+Stop RAID device
+Deinitialize devices
-diff -up util-linux-ng-2.17.2/tests/functions.sh.kzak util-linux-ng-2.17.2/tests/functions.sh
---- util-linux-ng-2.17.2/tests/functions.sh.kzak 2010-03-18 23:11:23.000000000 +0100
-+++ util-linux-ng-2.17.2/tests/functions.sh 2010-05-03 13:24:30.000000000 +0200
+--- util-linux-ng-2.17.2.orig/tests/functions.sh
++++ util-linux-ng-2.17.2/tests/functions.sh
@@ -256,7 +256,7 @@ function ts_image_init {
function ts_device_init {
@@ -1221,9 +1301,8 @@ diff -up util-linux-ng-2.17.2/tests/func
if [ -z "$dev" ]; then
ts_device_deinit $dev
-diff -up util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part.kzak util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part
---- util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part.kzak 2010-05-03 13:24:30.000000000 +0200
-+++ util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part 2010-05-03 13:24:30.000000000 +0200
+--- /dev/null
++++ util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-part
@@ -0,0 +1,92 @@
+#!/bin/bash
+
@@ -1317,9 +1396,8 @@ diff -up util-linux-ng-2.17.2/tests/ts/b
+sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
+
+ts_finalize
-diff -up util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole.kzak util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole
---- util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole.kzak 2010-05-03 13:24:30.000000000 +0200
-+++ util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole 2010-05-03 13:24:30.000000000 +0200
+--- /dev/null
++++ util-linux-ng-2.17.2/tests/ts/blkid/md-raid1-whole
@@ -0,0 +1,88 @@
+#!/bin/bash
+
Index: util-linux-ng.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-13/util-linux-ng.spec,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -p -r1.83 -r1.84
--- util-linux-ng.spec 4 May 2010 09:06:38 -0000 1.83
+++ util-linux-ng.spec 19 May 2010 11:45:09 -0000 1.84
@@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux-ng
Version: 2.17.2
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base
URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
@@ -113,7 +113,10 @@ Patch10: util-linux-ng-2.17-rtcwake-off.
# 588668 - F13: don't probe for RAIDs on CD-ROMs
Patch11: util-linux-ng-2.17-blkid-cdrom.patch
# 543749 - After upgrade from Fedora 11, RAID-1 mdraid assembles incorrectly
+# 592958 - whole disk raid members to not be identified
Patch12: util-linux-ng-2.17-blkid-raid.patch
+# 592061 - partx infinite loop
+Patch13: util-linux-ng-2.17-partx.patch
%description
The util-linux-ng package contains a large variety of low-level system
@@ -211,6 +214,7 @@ cp %{SOURCE8} %{SOURCE9} .
%patch10 -p1
%patch11 -p1
%patch12 -p1
+%patch13 -p1
%build
unset LINGUAS || :
@@ -730,9 +734,14 @@ fi
%changelog
+* Wed May 19 2010 Karel Zak <kzak at redhat.com> 2.17.2-5
+- fix #592958 - whole disk raid members to not be identified
+- fix #592061 - partx infinite loop
+- add diffstat (by quilt refresh) to some old patches
+
* Tue May 4 2010 Karel Zak <kzak at redhat.com> 2.17.2-4
-- #588668 - F13: don't probe for RAIDs on CD-ROMs
-- #543749 - After upgrade from Fedora 11, RAID-1 mdraid assembles incorrectly
+- fix #588668 - F13: don't probe for RAIDs on CD-ROMs
+- fix #543749 - After upgrade from Fedora 11, RAID-1 mdraid assembles incorrectly
* Mon Apr 12 2010 Karel Zak <kzak at redhat.com> 2.17.2-3
- fix #581252 - remounting tmpfs fails because of hidden rootcontext=
More information about the scm-commits
mailing list