diff --git a/SOURCES/2.24-blockdev-setbsz-hint.patch b/SOURCES/2.24-blockdev-setbsz-hint.patch new file mode 100644 index 0000000..6bb5957 --- /dev/null +++ b/SOURCES/2.24-blockdev-setbsz-hint.patch @@ -0,0 +1,42 @@ +From 7ab32ae64d05f018c171ba1525bc337805d84391 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 11 Oct 2013 11:16:23 +0200 +Subject: [PATCH] blockdev: add note about --setbsz usability + +Signed-off-by: Karel Zak +--- + disk-utils/blockdev.8 | 4 +++- + disk-utils/blockdev.c | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/disk-utils/blockdev.8 b/disk-utils/blockdev.8 +index 2b3d64c..f4282da 100644 +--- a/disk-utils/blockdev.8 ++++ b/disk-utils/blockdev.8 +@@ -68,7 +68,9 @@ Get size in 512-byte sectors. + .IP "\fB\-\-rereadpt\fP" + Reread partition table + .IP "\fB\-\-setbsz\fP \fIbytes\fP" +-Set blocksize. ++Set blocksize. Note that the block size is specific to the current file ++descriptor opening the block device, so the change of block size only persists ++for as long as blockdev has the device open, and is lost once blockdev exits. + .IP "\fB\-\-setfra\fP \fIsectors\fP" + Set filesystem readahead (same like --setra on 2.6 kernels). + .IP "\fB\-\-setra\fP \fIsectors\fP" +diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c +index 4543818..d030217 100644 +--- a/disk-utils/blockdev.c ++++ b/disk-utils/blockdev.c +@@ -127,7 +127,7 @@ static const struct bdc bdcms[] = + .argname = "", + .argtype = ARG_INT, + .flags = FL_NORESULT, +- .help = N_("set blocksize") ++ .help = N_("set blocksize on file descriptor opening the block device") + },{ + IOCTL_ENTRY(BLKGETSIZE), + .name = "--getsize", +-- +1.8.3.1 + diff --git a/SOURCES/2.24-fsck-fstab.patch b/SOURCES/2.24-fsck-fstab.patch new file mode 100644 index 0000000..113c52b --- /dev/null +++ b/SOURCES/2.24-fsck-fstab.patch @@ -0,0 +1,22 @@ +diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/fsck.c +--- util-linux-2.23.2/disk-utils/fsck.c.kzak 2013-06-13 09:46:10.377650254 +0200 ++++ util-linux-2.23.2/disk-utils/fsck.c 2014-03-25 12:46:59.525939425 +0100 +@@ -437,10 +437,14 @@ static void load_fs_info(void) + if (mnt_table_parse_fstab(fstab, path)) { + if (!path) + path = mnt_get_fstab_path(); +- if (errno) +- warn(_("%s: failed to parse fstab"), path); +- else +- warnx(_("%s: failed to parse fstab"), path); ++ ++ /* don't print error when there is no fstab at all */ ++ if (access(path, F_OK) == 0) { ++ if (errno) ++ warn(_("%s: failed to parse fstab"), path); ++ else ++ warnx(_("%s: failed to parse fstab"), path); ++ } + } + } + diff --git a/SOURCES/2.24-losetup-add-device.patch b/SOURCES/2.24-losetup-add-device.patch new file mode 100644 index 0000000..680d616 --- /dev/null +++ b/SOURCES/2.24-losetup-add-device.patch @@ -0,0 +1,63 @@ +diff -up util-linux-2.23.2/include/loopdev.h.kzak util-linux-2.23.2/include/loopdev.h +--- util-linux-2.23.2/include/loopdev.h.kzak 2013-06-13 09:46:10.397650425 +0200 ++++ util-linux-2.23.2/include/loopdev.h 2014-01-14 11:11:48.427643690 +0100 +@@ -149,6 +149,7 @@ extern void loopcxt_enable_debug(struct + extern int loopcxt_set_device(struct loopdev_cxt *lc, const char *device) + __attribute__ ((warn_unused_result)); + extern int loopcxt_has_device(struct loopdev_cxt *lc); ++extern int loopcxt_add_device(struct loopdev_cxt *lc); + extern char *loopcxt_strdup_device(struct loopdev_cxt *lc); + extern const char *loopcxt_get_device(struct loopdev_cxt *lc); + extern struct sysfs_cxt *loopcxt_get_sysfs(struct loopdev_cxt *lc); +diff -up util-linux-2.23.2/lib/loopdev.c.kzak util-linux-2.23.2/lib/loopdev.c +--- util-linux-2.23.2/lib/loopdev.c.kzak 2013-07-30 11:19:20.143600300 +0200 ++++ util-linux-2.23.2/lib/loopdev.c 2014-01-14 11:11:48.428643700 +0100 +@@ -1298,6 +1298,36 @@ int loopcxt_delete_device(struct loopdev + return 0; + } + ++int loopcxt_add_device(struct loopdev_cxt *lc) ++{ ++ int rc = -EINVAL; ++ int ctl, nr = -1; ++ const char *p, *dev = loopcxt_get_device(lc); ++ ++ if (!dev) ++ goto done; ++ ++ if (!(lc->flags & LOOPDEV_FL_CONTROL)) { ++ rc = -ENOSYS; ++ goto done; ++ } ++ ++ p = strrchr(dev, '/'); ++ if (!p || (sscanf(p, "/loop%d", &nr) != 1 && sscanf(p, "/%d", &nr) != 1) ++ || nr < 0) ++ goto done; ++ ++ ctl = open(_PATH_DEV_LOOPCTL, O_RDWR|O_CLOEXEC); ++ if (ctl >= 0) { ++ DBG(lc, loopdev_debug("add_device %d", nr)); ++ rc = ioctl(ctl, LOOP_CTL_ADD, nr); ++ close(ctl); ++ } ++done: ++ DBG(lc, loopdev_debug("add_device done [rc=%d]", rc)); ++ return rc; ++} ++ + /* + * Note that LOOP_CTL_GET_FREE ioctl is supported since kernel 3.1. In older + * kernels we have to check all loop devices to found unused one. +diff -up util-linux-2.23.2/sys-utils/losetup.c.kzak util-linux-2.23.2/sys-utils/losetup.c +--- util-linux-2.23.2/sys-utils/losetup.c.kzak 2013-07-30 11:20:16.987117853 +0200 ++++ util-linux-2.23.2/sys-utils/losetup.c 2014-01-14 11:11:48.428643700 +0100 +@@ -600,6 +600,8 @@ int main(int argc, char **argv) + { + int hasdev = loopcxt_has_device(&lc); + ++ if (hasdev && !is_loopdev(loopcxt_get_device(&lc))) ++ loopcxt_add_device(&lc); + do { + const char *errpre; + diff --git a/SOURCES/2.25-flock-nfs4.patch b/SOURCES/2.25-flock-nfs4.patch new file mode 100644 index 0000000..7a01332 --- /dev/null +++ b/SOURCES/2.25-flock-nfs4.patch @@ -0,0 +1,11 @@ +diff -up util-linux-2.23.2/sys-utils/flock.c.kzak util-linux-2.23.2/sys-utils/flock.c +--- util-linux-2.23.2/sys-utils/flock.c.kzak 2014-03-25 12:00:53.735361387 +0100 ++++ util-linux-2.23.2/sys-utils/flock.c 2014-03-25 12:01:44.534886083 +0100 +@@ -250,6 +250,7 @@ int main(int argc, char *argv[]) + /* otherwise try again */ + continue; + case EIO: ++ case EBADF: /* since Linux 3.4 (commit 55725513) */ + /* Probably NFSv4 where flock() is emulated by fcntl(). + * Let's try to reopen in read-write mode. + */ diff --git a/SOURCES/2.25-fsck-nohelper.patch b/SOURCES/2.25-fsck-nohelper.patch new file mode 100644 index 0000000..b8dc8fa --- /dev/null +++ b/SOURCES/2.25-fsck-nohelper.patch @@ -0,0 +1,173 @@ +diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/fsck.c +--- util-linux-2.23.2/disk-utils/fsck.c.kzak 2014-03-25 12:52:33.429389852 +0100 ++++ util-linux-2.23.2/disk-utils/fsck.c 2014-03-25 12:56:27.126804792 +0100 +@@ -79,9 +79,7 @@ static const char *really_wanted[] = { + "ext4dev", + "jfs", + "reiserfs", +- "xiafs", +- "xfs", +- NULL ++ "xiafs" + }; + + /* +@@ -167,6 +165,19 @@ static int string_to_int(const char *s) + return (int) l; + } + ++/* Do we really really want to check this fs? */ ++static int fs_check_required(const char *type) ++{ ++ size_t i; ++ ++ for(i = 0; i < ARRAY_SIZE(really_wanted); i++) { ++ if (strcmp(type, really_wanted[i]) == 0) ++ return 1; ++ } ++ ++ return 0; ++} ++ + static int is_mounted(struct libmnt_fs *fs) + { + int rc; +@@ -546,17 +557,17 @@ static void print_stats(struct fsck_inst + * Execute a particular fsck program, and link it into the list of + * child processes we are waiting for. + */ +-static int execute(const char *type, struct libmnt_fs *fs, int interactive) ++static int execute(const char *progname, const char *progpath, ++ const char *type, struct libmnt_fs *fs, int interactive) + { +- char *s, *argv[80], prog[80]; ++ char *argv[80]; + int argc, i; + struct fsck_instance *inst, *p; + pid_t pid; + + inst = xcalloc(1, sizeof(*inst)); + +- sprintf(prog, "fsck.%s", type); +- argv[0] = xstrdup(prog); ++ argv[0] = xstrdup(progname); + argc = 1; + + for (i=0; i pid = pid; +- inst->prog = xstrdup(prog); ++ inst->prog = xstrdup(progname); + inst->type = xstrdup(type); + gettimeofday(&inst->start_time, NULL); + inst->next = NULL; +@@ -822,6 +826,7 @@ static int wait_many(int flags) + */ + static int fsck_device(struct libmnt_fs *fs, int interactive) + { ++ char progname[80], *progpath; + const char *type; + int retval; + +@@ -838,15 +843,27 @@ static int fsck_device(struct libmnt_fs + else + type = DEFAULT_FSTYPE; + ++ sprintf(progname, "fsck.%s", type); ++ progpath = find_fsck(progname); ++ if (progpath == NULL) { ++ if (fs_check_required(type)) { ++ retval = ENOENT; ++ goto err; ++ } ++ return 0; ++ } ++ + num_running++; +- retval = execute(type, fs, interactive); ++ retval = execute(progname, progpath, type, fs, interactive); + if (retval) { +- warnx(_("error %d while executing fsck.%s for %s"), +- retval, type, fs_get_device(fs)); + num_running--; +- return FSCK_EX_ERROR; ++ goto err; + } + return 0; ++err: ++ warnx(_("error %d (%m) while executing fsck.%s for %s"), ++ retval, type, fs_get_device(fs)); ++ return FSCK_EX_ERROR; + } + + +@@ -1014,8 +1031,7 @@ static int fs_ignored_type(struct libmnt + /* Check if we should ignore this filesystem. */ + static int ignore(struct libmnt_fs *fs) + { +- const char **ip, *type; +- int wanted = 0; ++ const char *type; + + /* + * If the pass number is 0, ignore it. +@@ -1070,16 +1086,11 @@ static int ignore(struct libmnt_fs *fs) + if (fs_ignored_type(fs)) + return 1; + +- /* Do we really really want to check this fs? */ +- for(ip = really_wanted; *ip; ip++) +- if (strcmp(type, *ip) == 0) { +- wanted = 1; +- break; +- } ++ + + /* See if the program is available. */ + if (find_fsck(type) == NULL) { +- if (wanted) ++ if (fs_check_required(type)) + warnx(_("cannot check %s: fsck.%s not found"), + fs_get_device(fs), type); + return 1; +@@ -1557,7 +1568,6 @@ int main(int argc, char *argv[]) + fs = add_dummy_fs(devices[i]); + else if (fs_ignored_type(fs)) + continue; +- + if (ignore_mounted && is_mounted(fs)) + continue; + status |= fsck_device(fs, interactive); diff --git a/SOURCES/2.25-lib-add-path_strdup.patch b/SOURCES/2.25-lib-add-path_strdup.patch new file mode 100644 index 0000000..e3a9cc3 --- /dev/null +++ b/SOURCES/2.25-lib-add-path_strdup.patch @@ -0,0 +1,51 @@ +From dd3bc51a539ffdd5c6c6b7d0b20acd1f61bdd337 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 6 Jan 2014 16:48:13 +0100 +Subject: [PATCH] lib/path: add path_strdup() + +Signed-off-by: Karel Zak +--- + include/path.h | 2 ++ + lib/path.c | 13 +++++++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/include/path.h b/include/path.h +index 615d284..45da692 100644 +--- a/include/path.h ++++ b/include/path.h +@@ -4,6 +4,8 @@ + #include + #include + ++extern char *path_strdup(const char *path, ...) ++ __attribute__ ((__format__ (__printf__, 1, 2))); + extern FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); + extern void path_read_str(char *result, size_t len, const char *path, ...) +diff --git a/lib/path.c b/lib/path.c +index 1f7e258..42d321c 100644 +--- a/lib/path.c ++++ b/lib/path.c +@@ -49,6 +49,19 @@ path_vcreate(const char *path, va_list ap) + return pathbuf; + } + ++char * ++path_strdup(const char *path, ...) ++{ ++ const char *p; ++ va_list ap; ++ ++ va_start(ap, path); ++ p = path_vcreate(path, ap); ++ va_end(ap); ++ ++ return p ? strdup(p) : NULL; ++} ++ + static FILE * + path_vfopen(const char *mode, int exit_on_error, const char *path, va_list ap) + { +-- +1.8.4.2 + diff --git a/SOURCES/2.25-libblkid-Identify-extN-file-system-properly.patch b/SOURCES/2.25-libblkid-Identify-extN-file-system-properly.patch new file mode 100644 index 0000000..da4bcb3 --- /dev/null +++ b/SOURCES/2.25-libblkid-Identify-extN-file-system-properly.patch @@ -0,0 +1,240 @@ +diff -up util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ext.c +--- util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak 2013-06-13 09:46:10.422650639 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ext.c 2014-01-23 10:28:51.175358545 +0100 +@@ -18,7 +18,6 @@ + #endif + #include + +-#include "linux_version.h" + #include "superblocks.h" + + struct ext2_super_block { +@@ -132,140 +131,11 @@ struct ext2_super_block { + #define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP + + /* +- * Check to see if a filesystem is in /proc/filesystems. +- * Returns 1 if found, 0 if not +- */ +-static int fs_proc_check(const char *fs_name) +-{ +- FILE *f; +- char buf[80], *cp, *t; +- +- f = fopen("/proc/filesystems", "r" UL_CLOEXECSTR); +- if (!f) +- return 0; +- while (!feof(f)) { +- if (!fgets(buf, sizeof(buf), f)) +- break; +- cp = buf; +- if (!isspace(*cp)) { +- while (*cp && !isspace(*cp)) +- cp++; +- } +- while (*cp && isspace(*cp)) +- cp++; +- if ((t = strchr(cp, '\n')) != NULL) +- *t = 0; +- if ((t = strchr(cp, '\t')) != NULL) +- *t = 0; +- if ((t = strchr(cp, ' ')) != NULL) +- *t = 0; +- if (!strcmp(fs_name, cp)) { +- fclose(f); +- return 1; +- } +- } +- fclose(f); +- return (0); +-} +- +-/* +- * Check to see if a filesystem is available as a module +- * Returns 1 if found, 0 if not +- */ +-static int check_for_modules(const char *fs_name) +-{ +-#ifdef __linux__ +- struct utsname uts; +- FILE *f; +- char buf[1024], *cp; +- int namesz; +- +- if (uname(&uts)) +- return 0; +- snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep", uts.release); +- +- f = fopen(buf, "r" UL_CLOEXECSTR); +- if (!f) +- return 0; +- +- namesz = strlen(fs_name); +- +- while (!feof(f)) { +- if (!fgets(buf, sizeof(buf), f)) +- break; +- if ((cp = strchr(buf, ':')) != NULL) +- *cp = 0; +- else +- continue; +- if ((cp = strrchr(buf, '/')) == NULL) +- continue; +- cp++; +- +- if (!strncmp(cp, fs_name, namesz) && +- (!strcmp(cp + namesz, ".ko") || +- !strcmp(cp + namesz, ".ko.gz"))) { +- fclose(f); +- return 1; +- } +- } +- fclose(f); +-#endif /* __linux__ */ +- return 0; +-} +- +-/* + * Starting in 2.6.29, ext4 can be used to support filesystems + * without a journal. + */ + #define EXT4_SUPPORTS_EXT2 KERNEL_VERSION(2, 6, 29) + +-static int system_supports_ext2(void) +-{ +- static time_t last_check = 0; +- static int ret = -1; +- time_t now = time(0); +- +- if (ret != -1 || (now - last_check) < 5) +- return ret; +- last_check = now; +- ret = (fs_proc_check("ext2") || check_for_modules("ext2")); +- return ret; +-} +- +-static int system_supports_ext4(void) +-{ +- static time_t last_check = 0; +- static int ret = -1; +- time_t now = time(0); +- +- if (ret != -1 || (now - last_check) < 5) +- return ret; +- last_check = now; +- ret = (fs_proc_check("ext4") || check_for_modules("ext4")); +- return ret; +-} +- +-static int system_supports_ext4dev(void) +-{ +- static time_t last_check = 0; +- static int ret = -1; +- time_t now = time(0); +- +- if (ret != -1 || (now - last_check) < 5) +- return ret; +- last_check = now; +- ret = (fs_proc_check("ext4dev") || check_for_modules("ext4dev")); +- return ret; +-} +- +-static int system_supports_ext4_ext2(void) +-{ +-#ifdef __linux__ +- return get_linux_version() >= EXT4_SUPPORTS_EXT2; +-#else +- return 0; +-#endif +-} + /* + * reads superblock and returns: + * fc = feature_compat +@@ -355,15 +225,6 @@ static int probe_ext2(blkid_probe pr, + (fi & EXT2_FEATURE_INCOMPAT_UNSUPPORTED)) + return -BLKID_ERR_PARAM; + +- /* +- * If ext2 is not present, but ext4 or ext4dev are, then +- * disclaim we are ext2 +- */ +- if (!system_supports_ext2() && +- (system_supports_ext4() || system_supports_ext4dev()) && +- system_supports_ext4_ext2()) +- return -BLKID_ERR_PARAM; +- + ext_get_info(pr, 2, es); + return 0; + } +@@ -406,34 +267,9 @@ static int probe_ext4dev(blkid_probe pr, + if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) + return -BLKID_ERR_PARAM; + +- /* +- * If the filesystem does not have a journal and ext2 and ext4 +- * is not present, then force this to be detected as an +- * ext4dev filesystem. +- */ +- if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && +- !system_supports_ext2() && !system_supports_ext4() && +- system_supports_ext4dev() && +- system_supports_ext4_ext2()) +- goto force_ext4dev; +- +- /* +- * If the filesystem is marked as OK for use by in-development +- * filesystem code, but ext4dev is not supported, and ext4 is, +- * then don't call ourselves ext4dev, since we should be +- * detected as ext4 in that case. +- * +- * If the filesystem is marked as in use by production +- * filesystem, then it can only be used by ext4 and NOT by +- * ext4dev, so always disclaim we are ext4dev in that case. +- */ +- if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) { +- if (!system_supports_ext4dev() && system_supports_ext4()) +- return -BLKID_ERR_PARAM; +- } else ++ if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)) + return -BLKID_ERR_PARAM; + +-force_ext4dev: + ext_get_info(pr, 4, es); + return 0; + } +@@ -452,22 +288,11 @@ static int probe_ext4(blkid_probe pr, + if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) + return -BLKID_ERR_PARAM; + +- /* +- * If the filesystem does not have a journal and ext2 is not +- * present, then force this to be detected as an ext2 +- * filesystem. +- */ +- if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && +- !system_supports_ext2() && system_supports_ext4() && +- system_supports_ext4_ext2()) +- goto force_ext4; +- + /* Ext4 has at least one feature which ext3 doesn't understand */ + if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) && + !(fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) + return -BLKID_ERR_PARAM; + +-force_ext4: + /* + * If the filesystem is a OK for use by in-development + * filesystem code, and ext4dev is supported or ext4 is not +@@ -478,10 +303,8 @@ force_ext4: + * filesystem, then it can only be used by ext4 and NOT by + * ext4dev. + */ +- if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) { +- if (system_supports_ext4dev() || !system_supports_ext4()) +- return -BLKID_ERR_PARAM; +- } ++ if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) ++ return -BLKID_ERR_PARAM; + + ext_get_info(pr, 4, es); + return 0; diff --git a/SOURCES/2.25-libblkid-detect-alone-PMBR.patch b/SOURCES/2.25-libblkid-detect-alone-PMBR.patch new file mode 100644 index 0000000..fe06167 --- /dev/null +++ b/SOURCES/2.25-libblkid-detect-alone-PMBR.patch @@ -0,0 +1,100 @@ +diff -up util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak util-linux-2.23.2/libblkid/src/partitions/gpt.c +--- util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak 2013-07-30 10:39:26.206738239 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/gpt.c 2014-01-23 11:06:17.364011293 +0100 +@@ -156,13 +156,15 @@ static int last_lba(blkid_probe pr, uint + * Note that the PMBR detection is optional (enabled by default) and could be + * disabled by BLKID_PARTS_FOPCE_GPT flag (see also blkid_paertitions_set_flags()). + */ +-static int is_pmbr_valid(blkid_probe pr) ++static int is_pmbr_valid(blkid_probe pr, int *has) + { + int flags = blkid_partitions_get_flags(pr); + unsigned char *data; + struct dos_partition *p; + int i; + ++ if (has) ++ *has = 0; + if (flags & BLKID_PARTS_FORCE_GPT) + goto ok; /* skip PMBR check */ + +@@ -182,6 +184,8 @@ static int is_pmbr_valid(blkid_probe pr) + failed: + return 0; + ok: ++ if (has) ++ *has = 1; + return 1; + } + +@@ -305,7 +309,7 @@ static int probe_gpt_pt(blkid_probe pr, + if (last_lba(pr, &lastlba)) + goto nothing; + +- if (!is_pmbr_valid(pr)) ++ if (!is_pmbr_valid(pr, NULL)) + goto nothing; + + h = get_gpt_header(pr, &hdr, &e, (lba = GPT_PRIMARY_LBA), lastlba); +@@ -410,3 +414,39 @@ const struct blkid_idinfo gpt_pt_idinfo + .magics = BLKID_NONE_MAGIC + }; + ++ ++ ++/* probe for *alone* protective MBR */ ++static int probe_pmbr_pt(blkid_probe pr, ++ const struct blkid_idmag *mag __attribute__((__unused__))) ++{ ++ int has = 0; ++ struct gpt_entry *e; ++ uint64_t lastlba = 0; ++ struct gpt_header hdr; ++ ++ if (last_lba(pr, &lastlba)) ++ goto nothing; ++ ++ is_pmbr_valid(pr, &has); ++ if (!has) ++ goto nothing; ++ ++ if (!get_gpt_header(pr, &hdr, &e, GPT_PRIMARY_LBA, lastlba) && ++ !get_gpt_header(pr, &hdr, &e, lastlba, lastlba)) ++ return 0; ++nothing: ++ return 1; ++} ++ ++const struct blkid_idinfo pmbr_pt_idinfo = ++{ ++ .name = "PMBR", ++ .probefunc = probe_pmbr_pt, ++ .magics = ++ { ++ { .magic = "\x55\xAA", .len = 2, .sboff = 510 }, ++ { NULL } ++ } ++}; ++ +diff -up util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak util-linux-2.23.2/libblkid/src/partitions/partitions.c +--- util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak 2013-07-30 10:39:26.207738249 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/partitions.c 2014-01-23 11:06:17.364011293 +0100 +@@ -125,6 +125,7 @@ static const struct blkid_idinfo *idinfo + &sun_pt_idinfo, + &dos_pt_idinfo, + &gpt_pt_idinfo, ++ &pmbr_pt_idinfo, /* always after GPT */ + &mac_pt_idinfo, + &ultrix_pt_idinfo, + &bsd_pt_idinfo, +diff -up util-linux-2.23.2/libblkid/src/partitions/partitions.h.kzak util-linux-2.23.2/libblkid/src/partitions/partitions.h +--- util-linux-2.23.2/libblkid/src/partitions/partitions.h.kzak 2013-07-30 10:39:26.208738259 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/partitions.h 2014-01-23 11:06:17.364011293 +0100 +@@ -59,6 +59,7 @@ extern const struct blkid_idinfo mac_pt_ + extern const struct blkid_idinfo dos_pt_idinfo; + extern const struct blkid_idinfo minix_pt_idinfo; + extern const struct blkid_idinfo gpt_pt_idinfo; ++extern const struct blkid_idinfo pmbr_pt_idinfo; + extern const struct blkid_idinfo ultrix_pt_idinfo; + + #endif /* BLKID_PARTITIONS_H */ diff --git a/SOURCES/2.25-libblkid-io-errors.patch b/SOURCES/2.25-libblkid-io-errors.patch new file mode 100644 index 0000000..4392cf5 --- /dev/null +++ b/SOURCES/2.25-libblkid-io-errors.patch @@ -0,0 +1,2590 @@ +diff -up util-linux-2.23.2/libblkid/src/blkidP.h.kzak util-linux-2.23.2/libblkid/src/blkidP.h +--- util-linux-2.23.2/libblkid/src/blkidP.h.kzak 2014-03-28 15:11:18.334283704 +0100 ++++ util-linux-2.23.2/libblkid/src/blkidP.h 2014-03-28 15:11:44.676551975 +0100 +@@ -297,6 +297,9 @@ struct blkid_struct_cache + /* old systems */ + #define BLKID_CACHE_FILE_OLD "/etc/blkid.tab" + ++#define BLKID_PROBE_OK 0 ++#define BLKID_PROBE_NONE 1 ++ + #define BLKID_ERR_IO 5 + #define BLKID_ERR_PROC 9 + #define BLKID_ERR_MEM 12 +diff -up util-linux-2.23.2/libblkid/src/partitions/aix.c.kzak util-linux-2.23.2/libblkid/src/partitions/aix.c +--- util-linux-2.23.2/libblkid/src/partitions/aix.c.kzak 2013-05-30 15:21:43.120591308 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/aix.c 2014-03-28 15:11:44.676551975 +0100 +@@ -22,19 +22,17 @@ static int probe_aix_pt(blkid_probe pr, + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ return BLKID_PROBE_NONE; + + tab = blkid_partlist_new_parttable(ls, "aix", 0); + if (!tab) +- goto err; ++ return -ENOMEM; + +- return 0; +-err: +- return -1; ++ return BLKID_PROBE_OK; + } + + /* +diff -up util-linux-2.23.2/libblkid/src/partitions/bsd.c.kzak util-linux-2.23.2/libblkid/src/partitions/bsd.c +--- util-linux-2.23.2/libblkid/src/partitions/bsd.c.kzak 2013-07-15 10:25:46.283049056 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/bsd.c 2014-03-28 15:11:44.677551986 +0100 +@@ -113,20 +113,24 @@ static int probe_bsd_pt(blkid_probe pr, + blkid_partlist ls; + int i, nparts = BSD_MAXPARTITIONS; + unsigned char *data; ++ int rc = BLKID_PROBE_NONE; + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return rc; + + data = blkid_probe_get_sector(pr, BLKID_MAG_SECTOR(mag)); +- if (!data) ++ if (!data) { ++ if (errno) ++ rc = -errno; + goto nothing; ++ } + + l = (struct bsd_disklabel *) data + BLKID_MAG_LASTOFFSET(mag); + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + /* try to determine the real type of BSD system according to + * (parental) primary partition */ +@@ -152,8 +156,10 @@ static int probe_bsd_pt(blkid_probe pr, + } + + tab = blkid_partlist_new_parttable(ls, name, BLKID_MAG_OFFSET(mag)); +- if (!tab) +- goto err; ++ if (!tab) { ++ rc = -ENOMEM; ++ goto nothing; ++ } + + if (le16_to_cpu(l->d_npartitions) < BSD_MAXPARTITIONS) + nparts = le16_to_cpu(l->d_npartitions); +@@ -189,18 +195,18 @@ static int probe_bsd_pt(blkid_probe pr, + } + + par = blkid_partlist_add_partition(ls, tab, start, size); +- if (!par) +- goto err; ++ if (!par) { ++ rc = -ENOMEM; ++ goto nothing; ++ } + + blkid_partition_set_type(par, p->p_fstype); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; +-err: +- return -1; ++ return rc; + } + + +diff -up util-linux-2.23.2/libblkid/src/partitions/dos.c.kzak util-linux-2.23.2/libblkid/src/partitions/dos.c +--- util-linux-2.23.2/libblkid/src/partitions/dos.c.kzak 2013-07-30 10:39:26.205738229 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/dos.c 2014-03-28 15:13:23.220555797 +0100 +@@ -53,10 +53,13 @@ static int parse_dos_extended(blkid_prob + uint32_t start, size; + + if (++ct_nodata > 100) +- return 0; ++ return BLKID_PROBE_OK; + data = blkid_probe_get_sector(pr, cur_start); +- if (!data) ++ if (!data) { ++ if (errno) ++ return -errno; + goto leave; /* malformed partition? */ ++ } + + if (!is_valid_mbr_signature(data)) + goto leave; +@@ -99,7 +102,7 @@ static int parse_dos_extended(blkid_prob + + par = blkid_partlist_add_partition(ls, tab, abs_start, size); + if (!par) +- goto err; ++ return -ENOMEM; + + blkid_partition_set_type(par, p->sys_type); + blkid_partition_set_flags(par, p->boot_ind); +@@ -123,9 +126,7 @@ static int parse_dos_extended(blkid_prob + cur_size = size; + } + leave: +- return 0; +-err: +- return -1; ++ return BLKID_PROBE_OK; + } + + static int probe_dos_pt(blkid_probe pr, +@@ -140,8 +141,11 @@ static int probe_dos_pt(blkid_probe pr, + uint32_t start, size, id; + + data = blkid_probe_get_sector(pr, 0); +- if (!data) ++ if (!data) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + /* ignore disks with AIX magic number -- for more details see aix.c */ + if (memcmp(data, BLKID_AIX_MAGIC_STRING, BLKID_AIX_MAGIC_STRLEN) == 0) +@@ -152,7 +156,7 @@ static int probe_dos_pt(blkid_probe pr, + * either the boot sector of a FAT filesystem or a DOS-type + * partition table. + */ +- if (blkid_probe_is_vfat(pr)) { ++ if (blkid_probe_is_vfat(pr) == 1) { + DBG(LOWPROBE, blkid_debug("probably FAT -- ignore")); + goto nothing; + } +@@ -189,6 +193,8 @@ static int probe_dos_pt(blkid_probe pr, + return 0; + + ls = blkid_probe_get_partlist(pr); ++ if (!ls) ++ goto nothing; + + /* sector size factor (the start and size are in the real sectors, but + * we need to convert all sizes to 512 logical sectors +@@ -198,7 +204,7 @@ static int probe_dos_pt(blkid_probe pr, + /* allocate a new partition table */ + tab = blkid_partlist_new_parttable(ls, "dos", BLKID_MSDOS_PT_OFFSET); + if (!tab) +- goto err; ++ return -ENOMEM; + + id = dos_parttable_id(data); + if (id) { +@@ -224,7 +230,7 @@ static int probe_dos_pt(blkid_probe pr, + } + par = blkid_partlist_add_partition(ls, tab, start, size); + if (!par) +- goto err; ++ return -ENOMEM; + + blkid_partition_set_type(par, p->sys_type); + blkid_partition_set_flags(par, p->boot_ind); +@@ -244,13 +250,14 @@ static int probe_dos_pt(blkid_probe pr, + continue; + if (is_extended(p) && + parse_dos_extended(pr, tab, start, size, ssf) == -1) +- goto err; ++ goto nothing; + } + + /* Parse subtypes (nested partitions) on large disks */ + if (!blkid_probe_is_tiny(pr)) { + for (p = p0, i = 0; i < 4; i++, p++) { + size_t n; ++ int rc; + + if (!dos_partition_size(p) || is_extended(p)) + continue; +@@ -259,20 +266,19 @@ static int probe_dos_pt(blkid_probe pr, + if (dos_nested[n].type != p->sys_type) + continue; + +- if (blkid_partitions_do_subprobe(pr, ++ rc = blkid_partitions_do_subprobe(pr, + blkid_partlist_get_partition(ls, i), +- dos_nested[n].id) == -1) +- goto err; ++ dos_nested[n].id); ++ if (rc < 0) ++ return rc; + break; + } + } + } +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; +-err: +- return -1; ++ return BLKID_PROBE_NONE; + } + + +diff -up util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak util-linux-2.23.2/libblkid/src/partitions/gpt.c +--- util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak 2014-03-28 15:11:18.336283724 +0100 ++++ util-linux-2.23.2/libblkid/src/partitions/gpt.c 2014-03-28 15:11:44.677551986 +0100 +@@ -169,8 +169,11 @@ static int is_pmbr_valid(blkid_probe pr, + goto ok; /* skip PMBR check */ + + data = blkid_probe_get_sector(pr, 0); +- if (!data) ++ if (!data) { ++ if (errno) ++ return -errno; + goto failed; ++ } + + if (!is_valid_mbr_signature(data)) + goto failed; +@@ -305,19 +308,27 @@ static int probe_gpt_pt(blkid_probe pr, + uint64_t fu, lu; + uint32_t ssf, i; + efi_guid_t guid; ++ int ret; + + if (last_lba(pr, &lastlba)) + goto nothing; + +- if (!is_pmbr_valid(pr, NULL)) ++ ret = is_pmbr_valid(pr, NULL); ++ if (ret < 0) ++ return ret; ++ else if (ret == 0) + goto nothing; + ++ errno = 0; + h = get_gpt_header(pr, &hdr, &e, (lba = GPT_PRIMARY_LBA), lastlba); +- if (!h) ++ if (!h && !errno) + h = get_gpt_header(pr, &hdr, &e, (lba = lastlba), lastlba); + +- if (!h) ++ if (!h) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + blkid_probe_use_wiper(pr, lba * blkid_probe_get_size(pr), 8); + +@@ -388,12 +399,13 @@ static int probe_gpt_pt(blkid_probe pr, + blkid_partition_set_flags(par, e->attributes); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; ++ + err: +- return -1; ++ return -ENOMEM; + } + + +diff -up util-linux-2.23.2/libblkid/src/partitions/mac.c.kzak util-linux-2.23.2/libblkid/src/partitions/mac.c +--- util-linux-2.23.2/libblkid/src/partitions/mac.c.kzak 2013-06-13 09:46:10.418650605 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/mac.c 2014-03-28 15:11:44.677551986 +0100 +@@ -87,8 +87,11 @@ static int probe_mac_pt(blkid_probe pr, + * the first block on the disk. + */ + md = (struct mac_driver_desc *) blkid_probe_get_sector(pr, 0); +- if (!md) ++ if (!md) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + block_size = be16_to_cpu(md->block_size); + +@@ -96,8 +99,11 @@ static int probe_mac_pt(blkid_probe pr, + * the second block on the disk. + */ + p = (struct mac_partition *) get_mac_block(pr, block_size, 1); +- if (!p) ++ if (!p) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + /* check the first partition signature */ + if (!has_part_signature(p)) +@@ -109,7 +115,7 @@ static int probe_mac_pt(blkid_probe pr, + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + tab = blkid_partlist_new_parttable(ls, "mac", 0); + if (!tab) +@@ -124,15 +130,18 @@ static int probe_mac_pt(blkid_probe pr, + uint32_t size; + + p = (struct mac_partition *) get_mac_block(pr, block_size, i); +- if (!p) ++ if (!p) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + if (!has_part_signature(p)) + goto nothing; + + if (be32_to_cpu(p->map_count) != nblks) { + DBG(LOWPROBE, blkid_debug( + "mac: inconsisten map_count in partition map, " +- "entry[0]: %d, entry[%d]: %d", ++ "entry[0]: %d, entry[%d]: %d", + nblks, i - 1, + be32_to_cpu(p->map_count))); + } +@@ -157,12 +166,12 @@ static int probe_mac_pt(blkid_probe pr, + sizeof(p->type)); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + /* +diff -up util-linux-2.23.2/libblkid/src/partitions/minix.c.kzak util-linux-2.23.2/libblkid/src/partitions/minix.c +--- util-linux-2.23.2/libblkid/src/partitions/minix.c.kzak 2013-07-15 10:25:46.284049064 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/minix.c 2014-03-28 15:36:23.866715100 +0100 +@@ -26,12 +26,15 @@ static int probe_minix_pt(blkid_probe pr + int i; + + data = blkid_probe_get_sector(pr, 0); +- if (!data) ++ if (!data) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + /* Parent is required, because Minix uses the same PT as DOS and + * difference is only in primary partition (parent) type. +@@ -78,12 +81,12 @@ static int probe_minix_pt(blkid_probe pr + blkid_partition_set_flags(par, p->boot_ind); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + /* same as DOS */ +diff -up util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak util-linux-2.23.2/libblkid/src/partitions/partitions.c +--- util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak 2014-03-28 15:11:18.336283724 +0100 ++++ util-linux-2.23.2/libblkid/src/partitions/partitions.c 2014-03-28 15:12:28.036993622 +0100 +@@ -533,12 +533,13 @@ static int idinfo_probe(blkid_probe pr, + { + const struct blkid_idmag *mag = NULL; + blkid_loff_t off; +- int rc = 1; /* = nothing detected */ ++ int rc = BLKID_PROBE_NONE; /* = nothing detected */ + + if (pr->size <= 0 || (id->minsz && id->minsz > pr->size)) + goto nothing; /* the device is too small */ + +- if (blkid_probe_get_idmag(pr, id, &off, &mag)) ++ rc = blkid_probe_get_idmag(pr, id, &off, &mag); ++ if (rc != BLKID_PROBE_OK) + goto nothing; + + /* final check by probing function */ +@@ -546,14 +547,15 @@ static int idinfo_probe(blkid_probe pr, + DBG(LOWPROBE, blkid_debug( + "%s: ---> call probefunc()", id->name)); + rc = id->probefunc(pr, mag); +- if (rc == -1) { ++ if (rc < 0) { + /* reset after error */ + reset_partlist(blkid_probe_get_partlist(pr)); + if (chn && !chn->binary) + blkid_probe_chain_reset_vals(pr, chn); +- DBG(LOWPROBE, blkid_debug("%s probefunc failed", id->name)); ++ DBG(LOWPROBE, blkid_debug("%s probefunc failed, rc %d", ++ id->name, rc)); + } +- if (rc == 0 && mag && chn && !chn->binary) ++ if (rc == BLKID_PROBE_OK && mag && chn && !chn->binary) + rc = blkid_probe_set_magic(pr, off, mag->len, + (unsigned char *) mag->magic); + +@@ -569,11 +571,11 @@ nothing: + */ + static int partitions_probe(blkid_probe pr, struct blkid_chain *chn) + { +- int rc = 1; ++ int rc = BLKID_PROBE_NONE; + size_t i; + + if (!pr || chn->idx < -1) +- return -1; ++ return -EINVAL; + blkid_probe_chain_reset_vals(pr, chn); + + if (chn->binary) +@@ -597,7 +599,10 @@ static int partitions_probe(blkid_probe + continue; + + /* apply checks from idinfo */ +- if (idinfo_probe(pr, idinfos[i], chn) != 0) ++ rc = idinfo_probe(pr, idinfos[i], chn); ++ if (rc < 0) ++ break; ++ if (rc != BLKID_PROBE_OK) + continue; + + name = idinfos[i]->name; +@@ -613,20 +618,21 @@ static int partitions_probe(blkid_probe + break; + } + +- if (rc == 1) { +- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [PARTS idx=%d]", +- chn->idx)); ++ if (rc != BLKID_PROBE_OK) { ++ DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [PARTS idx=%d]", ++ rc, chn->idx)); + } + + details_only: + /* + * Gather PART_ENTRY_* values if the current device is a partition. + */ +- if (!chn->binary && ++ if ((rc == BLKID_PROBE_OK || rc == BLKID_PROBE_NONE) && !chn->binary && + (blkid_partitions_get_flags(pr) & BLKID_PARTS_ENTRY_DETAILS)) { + +- if (!blkid_partitions_probe_partition(pr)) +- rc = 0; ++ int xrc = blkid_partitions_probe_partition(pr); ++ if (xrc < 0) ++ rc = xrc; /* optional, care about errors only */ + } + + return rc; +@@ -637,7 +643,7 @@ int blkid_partitions_do_subprobe(blkid_p + const struct blkid_idinfo *id) + { + blkid_probe prc; +- int rc = 1; ++ int rc; + blkid_partlist ls; + blkid_loff_t sz, off; + +@@ -646,7 +652,7 @@ int blkid_partitions_do_subprobe(blkid_p + id->name, parent)); + + if (!pr || !parent || !parent->size) +- return -1; ++ return -EINVAL; + + /* range defined by parent */ + sz = ((blkid_loff_t) parent->size) << 9; +@@ -656,13 +662,13 @@ int blkid_partitions_do_subprobe(blkid_p + DBG(LOWPROBE, blkid_debug( + "ERROR: parts: <---- '%s' subprobe: overflow detected.", + id->name)); +- return -1; ++ return -ENOSPC; + } + + /* create private prober */ + prc = blkid_clone_probe(pr); + if (!prc) +- return -1; ++ return -ENOMEM; + + blkid_probe_set_dimension(prc, off, sz); + +@@ -695,7 +701,7 @@ int blkid_partitions_do_subprobe(blkid_p + + static int blkid_partitions_probe_partition(blkid_probe pr) + { +- int rc = 1; ++ int rc = BLKID_PROBE_NONE; + blkid_probe disk_pr = NULL; + blkid_partlist ls; + blkid_partition par; +@@ -761,7 +767,7 @@ static int blkid_partitions_probe_partit + blkid_probe_sprintf_value(pr, "PART_ENTRY_DISK", "%u:%u", + major(disk), minor(disk)); + } +- rc = 0; ++ rc = BLKID_PROBE_OK; + nothing: + return rc; + } +diff -up util-linux-2.23.2/libblkid/src/partitions/sgi.c.kzak util-linux-2.23.2/libblkid/src/partitions/sgi.c +--- util-linux-2.23.2/libblkid/src/partitions/sgi.c.kzak 2013-07-15 10:25:46.285049072 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/sgi.c 2014-03-28 15:11:44.677551986 +0100 +@@ -99,8 +99,11 @@ static int probe_sgi_pt(blkid_probe pr, + int i; + + l = (struct sgi_disklabel *) blkid_probe_get_sector(pr, 0); +- if (!l) ++ if (!l) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + if (count_checksum(l)) { + DBG(LOWPROBE, blkid_debug( +@@ -110,11 +113,11 @@ static int probe_sgi_pt(blkid_probe pr, + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + tab = blkid_partlist_new_parttable(ls, "sgi", 0); + if (!tab) +@@ -138,12 +141,12 @@ static int probe_sgi_pt(blkid_probe pr, + blkid_partition_set_type(par, type); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + const struct blkid_idinfo sgi_pt_idinfo = +diff -up util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c.kzak util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c +--- util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c.kzak 2013-06-13 09:46:10.418650605 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c 2014-03-28 15:11:44.677551986 +0100 +@@ -69,8 +69,11 @@ static int probe_solaris_pt(blkid_probe + uint16_t nparts; + + l = (struct solaris_vtoc *) blkid_probe_get_sector(pr, SOLARIS_SECTOR); +- if (!l) ++ if (!l) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + if (le32_to_cpu(l->v_version) != 1) { + DBG(LOWPROBE, blkid_debug( +@@ -81,11 +84,11 @@ static int probe_solaris_pt(blkid_probe + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + parent = blkid_partlist_get_parent(ls); + +@@ -126,12 +129,12 @@ static int probe_solaris_pt(blkid_probe + blkid_partition_set_flags(par, le16_to_cpu(p->s_flag)); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + const struct blkid_idinfo solaris_x86_pt_idinfo = +diff -up util-linux-2.23.2/libblkid/src/partitions/sun.c.kzak util-linux-2.23.2/libblkid/src/partitions/sun.c +--- util-linux-2.23.2/libblkid/src/partitions/sun.c.kzak 2013-06-13 09:46:10.419650613 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/sun.c 2014-03-28 15:11:44.678551996 +0100 +@@ -27,8 +27,11 @@ static int probe_sun_pt(blkid_probe pr, + int i, use_vtoc; + + l = (struct sun_disklabel *) blkid_probe_get_sector(pr, 0); +- if (!l) ++ if (!l) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + if (sun_pt_checksum(l)) { + DBG(LOWPROBE, blkid_debug( +@@ -38,11 +41,11 @@ static int probe_sun_pt(blkid_probe pr, + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + tab = blkid_partlist_new_parttable(ls, "sun", 0); + if (!tab) +@@ -76,7 +79,7 @@ static int probe_sun_pt(blkid_probe pr, + uint16_t type = 0, flags = 0; + blkid_partition par; + +- start = be32_to_cpu(p->start_cylinder) * spc; ++ start = be32_to_cpu(p->start_cylinder) * spc; + size = be32_to_cpu(p->num_sectors); + if (use_vtoc) { + type = be16_to_cpu(l->vtoc.infos[i].id); +@@ -96,12 +99,12 @@ static int probe_sun_pt(blkid_probe pr, + if (flags) + blkid_partition_set_flags(par, flags); + } +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + +diff -up util-linux-2.23.2/libblkid/src/partitions/ultrix.c.kzak util-linux-2.23.2/libblkid/src/partitions/ultrix.c +--- util-linux-2.23.2/libblkid/src/partitions/ultrix.c.kzak 2013-05-30 15:21:43.127591380 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/ultrix.c 2014-03-28 15:11:44.678551996 +0100 +@@ -44,8 +44,11 @@ static int probe_ultrix_pt(blkid_probe p + int i; + + data = blkid_probe_get_sector(pr, ULTRIX_SECTOR); +- if (!data) ++ if (!data) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + l = (struct ultrix_disklabel *) (data + ULTRIX_OFFSET); + +@@ -59,11 +62,11 @@ static int probe_ultrix_pt(blkid_probe p + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + tab = blkid_partlist_new_parttable(ls, "ultrix", 0); + if (!tab) +@@ -80,11 +83,11 @@ static int probe_ultrix_pt(blkid_probe p + } + } + +- return 0; ++ return BLKID_PROBE_OK; + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + const struct blkid_idinfo ultrix_pt_idinfo = +diff -up util-linux-2.23.2/libblkid/src/partitions/unixware.c.kzak util-linux-2.23.2/libblkid/src/partitions/unixware.c +--- util-linux-2.23.2/libblkid/src/partitions/unixware.c.kzak 2013-06-13 09:46:10.419650613 +0200 ++++ util-linux-2.23.2/libblkid/src/partitions/unixware.c 2014-03-28 15:11:44.678551996 +0100 +@@ -106,19 +106,22 @@ static int probe_unixware_pt(blkid_probe + + l = (struct unixware_disklabel *) + blkid_probe_get_sector(pr, UNIXWARE_SECTOR); +- if (!l) ++ if (!l) { ++ if (errno) ++ return -errno; + goto nothing; ++ } + + if (le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_VTOCMAGIC) + goto nothing; + + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ +- return 0; ++ return BLKID_PROBE_OK; + + ls = blkid_probe_get_partlist(pr); + if (!ls) +- goto err; ++ goto nothing; + + parent = blkid_partlist_get_parent(ls); + +@@ -161,12 +164,12 @@ static int probe_unixware_pt(blkid_probe + blkid_partition_set_flags(par, flg); + } + +- return 0; ++ return BLKID_PROBE_OK; + + nothing: +- return 1; ++ return BLKID_PROBE_NONE; + err: +- return -1; ++ return -ENOMEM; + } + + +diff -up util-linux-2.23.2/libblkid/src/probe.c.kzak util-linux-2.23.2/libblkid/src/probe.c +--- util-linux-2.23.2/libblkid/src/probe.c.kzak 2014-03-28 15:11:18.334283704 +0100 ++++ util-linux-2.23.2/libblkid/src/probe.c 2014-03-28 15:11:44.678551996 +0100 +@@ -559,13 +559,17 @@ unsigned char *blkid_probe_get_buffer(bl + if (!bf) { + ssize_t ret; + +- if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0) ++ if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0) { ++ errno = 0; + return NULL; ++ } + + /* allocate info and space for data by why call */ + bf = calloc(1, sizeof(struct blkid_bufinfo) + len); +- if (!bf) ++ if (!bf) { ++ errno = ENOMEM; + return NULL; ++ } + + bf->data = ((unsigned char *) bf) + sizeof(struct blkid_bufinfo); + bf->len = len; +@@ -577,7 +581,10 @@ unsigned char *blkid_probe_get_buffer(bl + + ret = read(pr->fd, bf->data, len); + if (ret != (ssize_t) len) { ++ DBG(LOWPROBE, blkid_debug("\tbuffer read: return %zd error %m", ret)); + free(bf); ++ if (ret >= 0) ++ errno = 0; + return NULL; + } + list_add_tail(&bf->bufs, &pr->buffers); +@@ -766,6 +773,17 @@ int blkid_probe_set_dimension(blkid_prob + return 0; + } + ++/** ++ * blkid_probe_get_idmag: ++ * @pr: probe ++ * @id: id information ++ * @offset: begin of probing area ++ * @res: found id information ++ * ++ * Check for matching magic value. ++ * Returns BLKID_PROBE_OK if found, BLKID_PROBE_NONE if not found ++ * or no magic present, or negative value on error. ++ */ + int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id, + blkid_loff_t *offset, const struct blkid_idmag **res) + { +@@ -784,6 +802,8 @@ int blkid_probe_get_idmag(blkid_probe pr + off = (mag->kboff + (mag->sboff >> 10)) << 10; + buf = blkid_probe_get_buffer(pr, off, 1024); + ++ if (!buf && errno) ++ return -errno; + if (buf && !memcmp(mag->magic, + buf + (mag->sboff & 0x3ff), mag->len)) { + DBG(LOWPROBE, blkid_debug("\tmagic sboff=%u, kboff=%ld", +@@ -792,16 +812,16 @@ int blkid_probe_get_idmag(blkid_probe pr + *offset = off + (mag->sboff & 0x3ff); + if (res) + *res = mag; +- return 0; ++ return BLKID_PROBE_OK; + } + mag++; + } + + if (id && id->magics[0].magic) + /* magic string(s) defined, but not found */ +- return 1; ++ return BLKID_PROBE_NONE; + +- return 0; ++ return BLKID_PROBE_OK; + } + + static inline void blkid_probe_start(blkid_probe pr) +diff -up util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c.kzak 2013-04-08 17:55:40.232855970 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c 2014-03-28 15:11:44.678551996 +0100 +@@ -80,10 +80,10 @@ static int probe_adraid(blkid_probe pr, + struct adaptec_metadata *ad; + + if (pr->size < 0x10000) +- return -1; ++ return BLKID_PROBE_NONE; + + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return BLKID_PROBE_NONE; + + off = ((pr->size / 0x200)-1) * 0x200; + ad = (struct adaptec_metadata *) +@@ -91,17 +91,19 @@ static int probe_adraid(blkid_probe pr, + off, + sizeof(struct adaptec_metadata)); + if (!ad) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE;; ++ + if (ad->smagic != be32_to_cpu(AD_SIGNATURE)) +- return -1; ++ return BLKID_PROBE_NONE; + if (ad->b0idcode != be32_to_cpu(AD_MAGIC)) +- return -1; ++ return BLKID_PROBE_NONE; + if (blkid_probe_sprintf_version(pr, "%u", ad->resver) != 0) +- return -1; ++ return BLKID_PROBE_NONE; + if (blkid_probe_set_magic(pr, off, sizeof(ad->b0idcode), + (unsigned char *) &ad->b0idcode)) +- return -1; +- return 0; ++ return BLKID_PROBE_NONE; ++ ++ return BLKID_PROBE_OK; + } + + const struct blkid_idinfo adraid_idinfo = { +diff -up util-linux-2.23.2/libblkid/src/superblocks/befs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/befs.c +--- util-linux-2.23.2/libblkid/src/superblocks/befs.c.kzak 2013-04-08 17:55:40.237856017 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/befs.c 2014-03-28 15:11:44.679552006 +0100 +@@ -261,21 +261,23 @@ static int64_t get_key_value(blkid_probe + int64_t node_pointer; + int32_t first, last, mid, cmp; + ++ errno = 0; + bh = (struct bplustree_header *) get_tree_node(pr, bs, &bi->data, 0, + sizeof(struct bplustree_header), fs_le); + if (!bh) +- return -1; ++ return errno ? -errno : -ENOENT; + + if ((int32_t) FS32_TO_CPU(bh->magic, fs_le) != BPLUSTREE_MAGIC) +- return -1; ++ return -ENOENT; + + node_pointer = FS64_TO_CPU(bh->root_node_pointer, fs_le); + + do { ++ errno = 0; + bn = (struct bplustree_node *) get_tree_node(pr, bs, &bi->data, + node_pointer, FS32_TO_CPU(bh->node_size, fs_le), fs_le); + if (!bn) +- return -1; ++ return errno ? -errno : -ENOENT; + + keylengths = (uint16_t *) ((uint8_t *) bn + + ((sizeof(struct bplustree_node) +@@ -336,10 +338,10 @@ static int get_uuid(blkid_probe pr, cons + + bi = (struct befs_inode *) get_block_run(pr, bs, &bs->root_dir, fs_le); + if (!bi) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1) +- return -1; ++ return BLKID_PROBE_NONE; + + sd = (struct small_data *) bi->small_data; + +@@ -376,24 +378,24 @@ static int get_uuid(blkid_probe pr, cons + bi = (struct befs_inode *) get_block_run(pr, bs, + &bi->attributes, fs_le); + if (!bi) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1) +- return -1; ++ return BLKID_PROBE_NONE; + + value = get_key_value(pr, bs, bi, KEY_NAME, fs_le); +- + if (value < 0) +- return value; ++ return value == -ENOENT ? BLKID_PROBE_NONE : value; ++ + else if (value > 0) { + bi = (struct befs_inode *) blkid_probe_get_buffer(pr, + value << FS32_TO_CPU(bs->block_shift, fs_le), + FS32_TO_CPU(bs->block_size, fs_le)); + if (!bi) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1) +- return -1; ++ return 1; + + if (FS32_TO_CPU(bi->type, fs_le) == B_UINT64_TYPE + && FS64_TO_CPU(bi->data.size, fs_le) == KEY_SIZE +@@ -404,7 +406,7 @@ static int get_uuid(blkid_probe pr, cons + attr_data = (uint64_t *) get_block_run(pr, bs, + &bi->data.direct[0], fs_le); + if (!attr_data) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + *uuid = *attr_data; + } +@@ -424,7 +426,7 @@ static int probe_befs(blkid_probe pr, co + mag->sboff - B_OS_NAME_LENGTH, + sizeof(struct befs_super_block)); + if (!bs) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + if (le32_to_cpu(bs->magic1) == SUPER_BLOCK_MAGIC1 + && le32_to_cpu(bs->magic2) == SUPER_BLOCK_MAGIC2 +@@ -439,11 +441,11 @@ static int probe_befs(blkid_probe pr, co + fs_le = 0; + version = "big-endian"; + } else +- return -1; ++ return BLKID_PROBE_NONE; + + ret = get_uuid(pr, bs, &volume_id, fs_le); + +- if (ret < 0) ++ if (ret != 0) + return ret; + + /* +@@ -459,7 +461,7 @@ static int probe_befs(blkid_probe pr, co + blkid_probe_sprintf_uuid(pr, (unsigned char *) &volume_id, + sizeof(volume_id), "%016" PRIx64, + FS64_TO_CPU(volume_id, fs_le)); +- return 0; ++ return BLKID_PROBE_OK; + } + + const struct blkid_idinfo befs_idinfo = +diff -up util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/btrfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak 2014-03-28 15:11:18.335283714 +0100 ++++ util-linux-2.23.2/libblkid/src/superblocks/btrfs.c 2014-03-28 15:11:44.679552006 +0100 +@@ -65,7 +65,7 @@ static int probe_btrfs(blkid_probe pr, c + + bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block); + if (!bfs) +- return -1; ++ return errno ? -errno : 1; + + if (*bfs->label) + blkid_probe_set_label(pr, +diff -up util-linux-2.23.2/libblkid/src/superblocks/cramfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/cramfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/cramfs.c.kzak 2013-04-08 17:55:40.240856046 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/cramfs.c 2014-03-28 15:11:44.679552006 +0100 +@@ -40,7 +40,7 @@ static int probe_cramfs(blkid_probe pr, + + cs = blkid_probe_get_sb(pr, mag, struct cramfs_super); + if (!cs) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_label(pr, cs->name, sizeof(cs->name)); + return 0; +diff -up util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c.kzak 2013-04-08 17:55:40.241856056 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c 2014-03-28 15:11:44.679552006 +0100 +@@ -81,7 +81,7 @@ static int probe_ddf(blkid_probe pr, + uint64_t off, lba; + + if (pr->size < 0x30000) +- return -1; ++ return 1; + + for (i = 0; i < ARRAY_SIZE(hdrs); i++) { + off = ((pr->size / 0x200) - hdrs[i]) * 0x200; +@@ -90,8 +90,7 @@ static int probe_ddf(blkid_probe pr, + off, + sizeof(struct ddf_header)); + if (!ddf) +- return -1; +- ++ return errno ? -errno : 1; + if (ddf->signature == cpu_to_be32(DDF_MAGIC) || + ddf->signature == cpu_to_le32(DDF_MAGIC)) + break; +@@ -99,7 +98,7 @@ static int probe_ddf(blkid_probe pr, + } + + if (!ddf) +- return -1; ++ return 1; + + lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ? + be64_to_cpu(ddf->primary_lba) : +@@ -111,8 +110,12 @@ static int probe_ddf(blkid_probe pr, + + buf = blkid_probe_get_buffer(pr, + lba << 9, sizeof(ddf->signature)); +- if (!buf || memcmp(buf, &ddf->signature, 4)) +- return -1; ++ if (!buf) { ++ if (errno) ++ return -errno; ++ if (memcmp(buf, &ddf->signature, 4)) ++ return 1; ++ } + } + + blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid)); +@@ -121,11 +124,11 @@ static int probe_ddf(blkid_probe pr, + *(version + sizeof(ddf->ddf_rev)) = '\0'; + + if (blkid_probe_set_version(pr, version) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, + sizeof(ddf->signature), + (unsigned char *) &ddf->signature)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/drbd.c.kzak util-linux-2.23.2/libblkid/src/superblocks/drbd.c +--- util-linux-2.23.2/libblkid/src/superblocks/drbd.c.kzak 2013-04-08 17:55:40.243856074 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/drbd.c 2014-03-28 15:11:44.679552006 +0100 +@@ -75,18 +75,18 @@ static int probe_drbd(blkid_probe pr, + + /* Small devices cannot be drbd (?) */ + if (pr->size < 0x10000) +- return -1; ++ return 1; + + md = (struct md_on_disk_08 *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct md_on_disk_08)); + if (!md) +- return -1; ++ return errno ? -errno : 1; + + if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_08 && + be32_to_cpu(md->magic) != DRBD_MD_MAGIC_84_UNCLEAN) +- return -1; ++ return 1; + + /* + * DRBD does not have "real" uuids; the following resembles DRBD's +@@ -102,7 +102,7 @@ static int probe_drbd(blkid_probe pr, + off + offsetof(struct md_on_disk_08, magic), + sizeof(md->magic), + (unsigned char *) &md->magic)) +- return -1; ++ return 1; + + return 0; + } +diff -up util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c.kzak util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c +--- util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c.kzak 2013-04-08 17:55:40.244856084 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c 2014-03-28 15:11:44.679552006 +0100 +@@ -33,7 +33,7 @@ static int probe_drbdproxy_datalog(blkid + + lh = (struct log_header_t *) blkid_probe_get_buffer(pr, 0, sizeof(*lh)); + if (!lh) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_uuid(pr, lh->uuid); + blkid_probe_sprintf_version(pr, "v%jd", le64_to_cpu(lh->version)); +diff -up util-linux-2.23.2/libblkid/src/superblocks/exfat.c.kzak util-linux-2.23.2/libblkid/src/superblocks/exfat.c +--- util-linux-2.23.2/libblkid/src/superblocks/exfat.c.kzak 2013-04-08 17:55:40.245856093 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/exfat.c 2014-03-28 15:11:44.680552016 +0100 +@@ -115,12 +115,14 @@ static int probe_exfat(blkid_probe pr, c + + sb = blkid_probe_get_sb(pr, mag, struct exfat_super_block); + if (!sb) +- return -1; ++ return errno ? -errno : BLKID_PROBE_NONE; + + label = find_label(pr, sb); + if (label) + blkid_probe_set_utf8label(pr, label->name, + min(label->length * 2, 30), BLKID_ENC_UTF16LE); ++ else if (errno) ++ return -errno; + + blkid_probe_sprintf_uuid(pr, sb->volume_serial, 4, + "%02hhX%02hhX-%02hhX%02hhX", +@@ -130,7 +132,7 @@ static int probe_exfat(blkid_probe pr, c + blkid_probe_sprintf_version(pr, "%u.%u", + sb->version.major, sb->version.minor); + +- return 0; ++ return BLKID_PROBE_OK; + } + + const struct blkid_idinfo exfat_idinfo = +diff -up util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ext.c +--- util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak 2014-03-28 15:11:18.333283694 +0100 ++++ util-linux-2.23.2/libblkid/src/superblocks/ext.c 2014-03-28 15:11:44.680552016 +0100 +@@ -198,9 +198,9 @@ static int probe_jbd(blkid_probe pr, + + es = ext_get_super(pr, NULL, &fi, NULL); + if (!es) +- return -BLKID_ERR_PARAM; ++ return errno ? -errno : 1; + if (!(fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) +- return -BLKID_ERR_PARAM; ++ return 1; + + ext_get_info(pr, 2, es); + return 0; +@@ -214,16 +214,16 @@ static int probe_ext2(blkid_probe pr, + + es = ext_get_super(pr, &fc, &fi, &frc); + if (!es) +- return -BLKID_ERR_PARAM; ++ return errno ? -errno : 1; + + /* Distinguish between ext3 and ext2 */ + if (fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) +- return -BLKID_ERR_PARAM; ++ return 1; + + /* Any features which ext2 doesn't understand */ + if ((frc & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) || + (fi & EXT2_FEATURE_INCOMPAT_UNSUPPORTED)) +- return -BLKID_ERR_PARAM; ++ return 1; + + ext_get_info(pr, 2, es); + return 0; +@@ -237,16 +237,16 @@ static int probe_ext3(blkid_probe pr, + + es = ext_get_super(pr, &fc, &fi, &frc); + if (!es) +- return -BLKID_ERR_PARAM; ++ return errno ? -errno : 1; + + /* ext3 requires journal */ + if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL)) +- return -BLKID_ERR_PARAM; ++ return 1; + + /* Any features which ext3 doesn't understand */ + if ((frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) || + (fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) +- return -BLKID_ERR_PARAM; ++ return 1; + + ext_get_info(pr, 3, es); + return 0; +@@ -261,14 +261,14 @@ static int probe_ext4dev(blkid_probe pr, + + es = ext_get_super(pr, &fc, &fi, &frc); + if (!es) +- return -BLKID_ERR_PARAM; ++ return errno ? -errno : 1; + + /* Distinguish from jbd */ + if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) +- return -BLKID_ERR_PARAM; ++ return 1; + + if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)) +- return -BLKID_ERR_PARAM; ++ return 1; + + ext_get_info(pr, 4, es); + return 0; +@@ -282,16 +282,16 @@ static int probe_ext4(blkid_probe pr, + + es = ext_get_super(pr, &fc, &fi, &frc); + if (!es) +- return -1; ++ return errno ? -errno : 1; + + /* Distinguish from jbd */ + if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) +- return -BLKID_ERR_PARAM; ++ return 1; + + /* Ext4 has at least one feature which ext3 doesn't understand */ + if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) && + !(fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) +- return -BLKID_ERR_PARAM; ++ return 1; + + /* + * If the filesystem is a OK for use by in-development +@@ -304,7 +304,7 @@ static int probe_ext4(blkid_probe pr, + * ext4dev. + */ + if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) +- return -BLKID_ERR_PARAM; ++ return 1; + + ext_get_info(pr, 4, es); + return 0; +diff -up util-linux-2.23.2/libblkid/src/superblocks/f2fs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/f2fs.c +--- util-linux-2.23.2/libblkid/src/superblocks/f2fs.c.kzak 2013-06-13 09:46:10.422650639 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/f2fs.c 2014-03-28 15:11:44.680552016 +0100 +@@ -62,7 +62,7 @@ static int probe_f2fs(blkid_probe pr, co + + sb = blkid_probe_get_sb(pr, mag, struct f2fs_super_block); + if (!sb) +- return -1; ++ return errno ? -errno : 1; + + major = le16_to_cpu(sb->major_ver); + minor = le16_to_cpu(sb->minor_ver); +diff -up util-linux-2.23.2/libblkid/src/superblocks/gfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/gfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/gfs.c.kzak 2013-04-08 17:55:40.250856141 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/gfs.c 2014-03-28 15:11:44.680552016 +0100 +@@ -64,7 +64,7 @@ static int probe_gfs(blkid_probe pr, con + + sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb); + if (!sbd) +- return -1; ++ return errno ? -errno : 1; + + if (be32_to_cpu(sbd->sb_fs_format) == GFS_FORMAT_FS && + be32_to_cpu(sbd->sb_multihost_format) == GFS_FORMAT_MULTI) +@@ -78,7 +78,7 @@ static int probe_gfs(blkid_probe pr, con + return 0; + } + +- return -1; ++ return 1; + } + + static int probe_gfs2(blkid_probe pr, const struct blkid_idmag *mag) +@@ -87,7 +87,7 @@ static int probe_gfs2(blkid_probe pr, co + + sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb); + if (!sbd) +- return -1; ++ return errno ? -errno : 1; + + if (be32_to_cpu(sbd->sb_fs_format) == GFS2_FORMAT_FS && + be32_to_cpu(sbd->sb_multihost_format) == GFS2_FORMAT_MULTI) +@@ -100,7 +100,7 @@ static int probe_gfs2(blkid_probe pr, co + blkid_probe_set_version(pr, "1"); + return 0; + } +- return -1; ++ return 1; + } + + const struct blkid_idinfo gfs_idinfo = +diff -up util-linux-2.23.2/libblkid/src/superblocks/hfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/hfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/hfs.c.kzak 2013-04-08 17:55:40.251856150 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/hfs.c 2014-03-28 15:11:44.680552016 +0100 +@@ -154,7 +154,7 @@ static int probe_hfs(blkid_probe pr, con + + hfs = blkid_probe_get_sb(pr, mag, struct hfs_mdb); + if (!hfs) +- return -1; ++ return errno ? -errno : 1; + + if ((memcmp(hfs->embed_sig, "H+", 2) == 0) || + (memcmp(hfs->embed_sig, "HX", 2) == 0)) +@@ -193,7 +193,7 @@ static int probe_hfsplus(blkid_probe pr, + + sbd = blkid_probe_get_sb(pr, mag, struct hfs_mdb); + if (!sbd) +- return -1; ++ return errno ? -errno : 1; + + /* Check for a HFS+ volume embedded in a HFS volume */ + if (memcmp(sbd->signature, "BD", 2) == 0) { +@@ -218,7 +218,7 @@ static int probe_hfsplus(blkid_probe pr, + struct hfsplus_vol_header); + + if (!hfsplus) +- return -1; ++ return errno ? -errno : 1; + + if ((memcmp(hfsplus->signature, "H+", 2) != 0) && + (memcmp(hfsplus->signature, "HX", 2) != 0)) +@@ -228,7 +228,7 @@ static int probe_hfsplus(blkid_probe pr, + + blocksize = be32_to_cpu(hfsplus->blocksize); + if (blocksize < HFSPLUS_SECTOR_SIZE) +- return -1; ++ return 1; + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); +@@ -236,7 +236,7 @@ static int probe_hfsplus(blkid_probe pr, + buf = blkid_probe_get_buffer(pr, + off + ((blkid_loff_t) cat_block * blocksize), 0x2000); + if (!buf) +- return 0; ++ return errno ? -errno : 0; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; +@@ -271,7 +271,7 @@ static int probe_hfsplus(blkid_probe pr, + (blkid_loff_t) off + leaf_off, + leaf_node_size); + if (!buf) +- return 0; ++ return errno ? -errno : 0; + + descr = (struct hfsplus_bnode_descriptor *) buf; + record_count = be16_to_cpu(descr->num_recs); +diff -up util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c.kzak 2013-04-08 17:55:40.251856150 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c 2014-03-28 15:11:44.680552016 +0100 +@@ -30,9 +30,9 @@ static int probe_highpoint45x(blkid_prob + uint32_t magic; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 11) * 0x200; + hpt = (struct hpt45x_metadata *) +@@ -40,13 +40,13 @@ static int probe_highpoint45x(blkid_prob + off, + sizeof(struct hpt45x_metadata)); + if (!hpt) +- return -1; ++ return errno ? -errno : 1; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(hpt->magic), + (unsigned char *) &hpt->magic)) +- return -1; ++ return 1; + return 0; + } + +@@ -54,7 +54,7 @@ static int probe_highpoint37x(blkid_prob + const struct blkid_idmag *mag __attribute__((__unused__))) + { + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/hpfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/hpfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/hpfs.c.kzak 2013-04-08 17:55:40.252856159 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/hpfs.c 2014-03-28 15:11:44.680552016 +0100 +@@ -68,7 +68,7 @@ static int probe_hpfs(blkid_probe pr, co + /* super block */ + hs = blkid_probe_get_sb(pr, mag, struct hpfs_super_block); + if (!hs) +- return -1; ++ return errno ? -errno : 1; + version = hs->version; + + /* spare super block */ +@@ -77,9 +77,9 @@ static int probe_hpfs(blkid_probe pr, co + HPFS_SBSPARE_OFFSET, + sizeof(struct hpfs_spare_super)); + if (!hss) +- return -1; ++ return errno ? -errno : 1; + if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0) +- return -1; ++ return 1; + + /* boot block (with UUID and LABEL) */ + hbb = (struct hpfs_boot_block *) +@@ -87,7 +87,7 @@ static int probe_hpfs(blkid_probe pr, co + 0, + sizeof(struct hpfs_boot_block)); + if (!hbb) +- return -1; ++ return errno ? -errno : 1; + if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 && + memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 && + hbb->sig_28h == 0x28) { +diff -up util-linux-2.23.2/libblkid/src/superblocks/iso9660.c.kzak util-linux-2.23.2/libblkid/src/superblocks/iso9660.c +--- util-linux-2.23.2/libblkid/src/superblocks/iso9660.c.kzak 2013-06-13 09:46:10.422650639 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/iso9660.c 2014-03-28 15:11:44.680552016 +0100 +@@ -100,7 +100,7 @@ static int probe_iso9660_hsfs(blkid_prob + + iso = blkid_probe_get_sb(pr, mag, struct high_sierra_volume_descriptor); + if (!iso) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_version(pr, "High Sierra"); + blkid_probe_set_label(pr, iso->volume_id, sizeof(iso->volume_id)); +@@ -178,7 +178,7 @@ int probe_iso9660(blkid_probe pr, const + + iso = blkid_probe_get_sb(pr, mag, struct iso_volume_descriptor); + if (!iso) +- return -1; ++ return errno ? -errno : 1; + + memcpy(label, iso->volume_id, sizeof(label)); + +diff -up util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c.kzak 2013-04-08 17:55:40.252856159 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c 2014-03-28 15:11:44.680552016 +0100 +@@ -33,9 +33,9 @@ static int probe_iswraid(blkid_probe pr, + struct isw_metadata *isw; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 2) * 0x200; + isw = (struct isw_metadata *) +@@ -43,15 +43,16 @@ static int probe_iswraid(blkid_probe pr, + off, + sizeof(struct isw_metadata)); + if (!isw) +- return -1; ++ return errno ? -errno : 1; ++ + if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) +- return -1; ++ return 1; + if (blkid_probe_sprintf_version(pr, "%6s", + &isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(isw->sig), + (unsigned char *) isw->sig)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/jfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/jfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/jfs.c.kzak 2013-04-08 17:55:40.253856169 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/jfs.c 2014-03-28 15:11:44.681552026 +0100 +@@ -40,7 +40,7 @@ static int probe_jfs(blkid_probe pr, con + + js = blkid_probe_get_sb(pr, mag, struct jfs_super_block); + if (!js) +- return -1; ++ return errno ? -errno : 1; + if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize))) + return 1; + if (le32_to_cpu(js->js_pbsize) != (1U << le16_to_cpu(js->js_l2pbsize))) +diff -up util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c.kzak 2013-04-08 17:55:40.253856169 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c 2014-03-28 15:11:44.681552026 +0100 +@@ -32,9 +32,9 @@ static int probe_jmraid(blkid_probe pr, + struct jm_metadata *jm; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 1) * 0x200; + jm = (struct jm_metadata *) +@@ -42,15 +42,16 @@ static int probe_jmraid(blkid_probe pr, + off, + sizeof(struct jm_metadata)); + if (!jm) +- return -1; ++ return errno ? -errno : 1; ++ + if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0) +- return -1; ++ return 1; + if (blkid_probe_sprintf_version(pr, "%u.%u", + jm->major_version, jm->minor_version) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(jm->signature), + (unsigned char *) jm->signature)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c.kzak 2013-04-08 17:55:40.253856169 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c 2014-03-28 15:11:44.681552026 +0100 +@@ -110,13 +110,13 @@ static int probe_raid0(blkid_probe pr, b + uint64_t size; + + if (pr->size < MD_RESERVED_BYTES) +- return -1; ++ return 1; + mdp0 = (struct mdp0_super_block *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct mdp0_super_block)); + if (!mdp0) +- return -1; ++ return errno ? -errno : 1; + + memset(uuid.ints, 0, sizeof(uuid.ints)); + +@@ -173,12 +173,12 @@ static int probe_raid0(blkid_probe pr, b + } + + if (blkid_probe_sprintf_version(pr, "%u.%u.%u", ma, mi, pa) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_uuid(pr, (unsigned char *) uuid.bytes) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(mdp0->md_magic), + (unsigned char *) &mdp0->md_magic)) +- return -1; ++ return 1; + return 0; + } + +@@ -191,24 +191,24 @@ static int probe_raid1(blkid_probe pr, o + off, + sizeof(struct mdp1_super_block)); + if (!mdp1) +- return -1; ++ return errno ? -errno : 1; + if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) +- return -1; ++ return 1; + if (le32_to_cpu(mdp1->major_version) != 1U) +- return -1; ++ return 1; + if (le64_to_cpu(mdp1->super_offset) != (uint64_t) off >> 9) +- return -1; ++ return 1; + if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_uuid_as(pr, + (unsigned char *) mdp1->device_uuid, "UUID_SUB") != 0) +- return -1; ++ return 1; + if (blkid_probe_set_label(pr, mdp1->set_name, + sizeof(mdp1->set_name)) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(mdp1->magic), + (unsigned char *) &mdp1->magic)) +- return -1; ++ return 1; + return 0; + } + +@@ -216,35 +216,44 @@ int probe_raid(blkid_probe pr, + const struct blkid_idmag *mag __attribute__((__unused__))) + { + const char *ver = NULL; ++ int ret = BLKID_PROBE_NONE; + + if (pr->size > MD_RESERVED_BYTES) { + /* version 0 at the end of the device */ + uint64_t sboff = (pr->size & ~(MD_RESERVED_BYTES - 1)) +- - MD_RESERVED_BYTES; +- if (probe_raid0(pr, sboff) == 0) +- return 0; ++ - MD_RESERVED_BYTES; ++ ret = probe_raid0(pr, sboff); ++ if (ret < 1) ++ return ret; /* error */ + + /* version 1.0 at the end of the device */ + sboff = (pr->size & ~(0x1000 - 1)) - 0x2000; +- if (probe_raid1(pr, sboff) == 0) ++ ret = probe_raid1(pr, sboff); ++ if (ret < 0) ++ return ret; /* error */ ++ if (ret == 0) + ver = "1.0"; + } + + if (!ver) { + /* version 1.1 at the start of the device */ +- if (probe_raid1(pr, 0) == 0) ++ ret = probe_raid1(pr, 0); ++ if (ret == 0) + ver = "1.1"; + + /* version 1.2 at 4k offset from the start */ +- else if (probe_raid1(pr, 0x1000) == 0) +- ver = "1.2"; ++ else if (ret == BLKID_PROBE_NONE) { ++ ret = probe_raid1(pr, 0x1000); ++ if (ret == 0) ++ ver = "1.2"; ++ } + } + + if (ver) { + blkid_probe_set_version(pr, ver); +- return 0; ++ return BLKID_PROBE_OK; + } +- return -1; ++ return ret; + } + + +diff -up util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c.kzak 2013-04-08 17:55:40.254856179 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c 2014-03-28 15:11:44.681552026 +0100 +@@ -30,9 +30,9 @@ static int probe_lsiraid(blkid_probe pr, + struct lsi_metadata *lsi; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 1) * 0x200; + lsi = (struct lsi_metadata *) +@@ -40,13 +40,13 @@ static int probe_lsiraid(blkid_probe pr, + off, + sizeof(struct lsi_metadata)); + if (!lsi) +- return -1; ++ return errno ? -errno : 1; + + if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(lsi->sig), + (unsigned char *) lsi->sig)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/luks.c.kzak util-linux-2.23.2/libblkid/src/superblocks/luks.c +--- util-linux-2.23.2/libblkid/src/superblocks/luks.c.kzak 2013-04-08 17:55:40.254856179 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/luks.c 2014-03-28 15:11:44.681552026 +0100 +@@ -45,7 +45,7 @@ static int probe_luks(blkid_probe pr, co + + header = blkid_probe_get_sb(pr, mag, struct luks_phdr); + if (header == NULL) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_strncpy_uuid(pr, (unsigned char *) header->uuid, + sizeof(header->uuid)); +diff -up util-linux-2.23.2/libblkid/src/superblocks/lvm.c.kzak util-linux-2.23.2/libblkid/src/superblocks/lvm.c +--- util-linux-2.23.2/libblkid/src/superblocks/lvm.c.kzak 2013-06-13 09:46:10.422650639 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/lvm.c 2014-03-28 15:11:44.681552026 +0100 +@@ -82,7 +82,7 @@ static int probe_lvm2(blkid_probe pr, co + mag->kboff << 10, + 512 + sizeof(struct lvm2_pv_label_header)); + if (!buf) +- return -1; ++ return errno ? -errno : 1; + + /* buf is at 0k or 1k offset; find label inside */ + if (memcmp(buf, "LABELONE", 8) == 0) { +@@ -129,7 +129,7 @@ static int probe_lvm1(blkid_probe pr, co + + label = blkid_probe_get_sb(pr, mag, struct lvm1_pv_label_header); + if (!label) +- return -1; ++ return errno ? -errno : 1; + + version = le16_to_cpu(label->version); + if (version != 1 && version != 2) +@@ -164,7 +164,7 @@ static int probe_verity(blkid_probe pr, + + sb = blkid_probe_get_sb(pr, mag, struct verity_sb); + if (sb == NULL) +- return -1; ++ return errno ? -errno : 1; + + version = le32_to_cpu(sb->version); + if (version != 1) +diff -up util-linux-2.23.2/libblkid/src/superblocks/minix.c.kzak util-linux-2.23.2/libblkid/src/superblocks/minix.c +--- util-linux-2.23.2/libblkid/src/superblocks/minix.c.kzak 2013-06-13 09:46:10.423650647 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/minix.c 2014-03-28 15:11:44.681552026 +0100 +@@ -80,17 +80,17 @@ static int probe_minix(blkid_probe pr, c + max(sizeof(struct minix_super_block), + sizeof(struct minix3_super_block))); + if (!data) +- return -1; ++ return errno ? -errno : 1; + version = get_minix_version(data, &swabme); + if (version < 1) +- return -1; ++ return 1; + + if (version <= 2) { + struct minix_super_block *sb = (struct minix_super_block *) data; + int zones, ninodes, imaps, zmaps, firstz; + + if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0) +- return -1; ++ return 1; + + zones = version == 2 ? minix_swab32(swabme, sb->s_zones) : + minix_swab16(swabme, sb->s_nzones); +@@ -101,15 +101,15 @@ static int probe_minix(blkid_probe pr, c + + /* sanity checks to be sure that the FS is really minix */ + if (imaps * MINIX_BLOCK_SIZE * 8 < ninodes + 1) +- return -1; ++ return 1; + if (zmaps * MINIX_BLOCK_SIZE * 8 < zones - firstz + 1) +- return -1; ++ return 1; + + } else if (version == 3) { + struct minix3_super_block *sb = (struct minix3_super_block *) data; + + if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0) +- return -1; ++ return 1; + } + + /* unfortunately, some parts of ext3 is sometimes possible to +@@ -117,8 +117,10 @@ static int probe_minix(blkid_probe pr, c + * string. (For extN magic string and offsets see ext.c.) + */ + ext = blkid_probe_get_buffer(pr, 0x400 + 0x38, 2); +- if (ext && memcmp(ext, "\123\357", 2) == 0) +- return -1; ++ if (!ext) ++ return errno ? -errno : 1; ++ else if (memcmp(ext, "\123\357", 2) == 0) ++ return 1; + + blkid_probe_sprintf_version(pr, "%d", version); + return 0; +diff -up util-linux-2.23.2/libblkid/src/superblocks/netware.c.kzak util-linux-2.23.2/libblkid/src/superblocks/netware.c +--- util-linux-2.23.2/libblkid/src/superblocks/netware.c.kzak 2013-04-08 17:55:40.255856188 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/netware.c 2014-03-28 15:11:44.681552026 +0100 +@@ -71,7 +71,7 @@ static int probe_netware(blkid_probe pr, + + nw = blkid_probe_get_sb(pr, mag, struct netware_super_block); + if (!nw) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_uuid(pr, nw->SBH_PoolID); + +diff -up util-linux-2.23.2/libblkid/src/superblocks/nilfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/nilfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/nilfs.c.kzak 2013-04-08 17:55:40.256856198 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/nilfs.c 2014-03-28 15:11:44.681552026 +0100 +@@ -82,7 +82,7 @@ static int probe_nilfs2(blkid_probe pr, + + sb = blkid_probe_get_sb(pr, mag, struct nilfs_super_block); + if (!sb) +- return -1; ++ return errno ? -errno : 1; + + bytes = le16_to_cpu(sb->s_bytes); + crc = crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff); +@@ -90,7 +90,7 @@ static int probe_nilfs2(blkid_probe pr, + crc = crc32(crc, (unsigned char *)sb + sumoff + 4, bytes - sumoff - 4); + + if (crc != le32_to_cpu(sb->s_sum)) +- return -1; ++ return 1; + + if (strlen(sb->s_volume_name)) + blkid_probe_set_label(pr, (unsigned char *) sb->s_volume_name, +diff -up util-linux-2.23.2/libblkid/src/superblocks/ntfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ntfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/ntfs.c.kzak 2013-06-13 09:46:10.423650647 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ntfs.c 2014-03-28 15:11:44.681552026 +0100 +@@ -91,7 +91,7 @@ static int probe_ntfs(blkid_probe pr, co + + ns = blkid_probe_get_sb(pr, mag, struct ntfs_super_block); + if (!ns) +- return -1; ++ return errno ? -errno : 1; + + /* + * Check bios parameters block +@@ -158,7 +158,7 @@ static int probe_ntfs(blkid_probe pr, co + + buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size); + if (!buf_mft) +- return 1; ++ return errno ? -errno : 1; + + if (memcmp(buf_mft, "FILE", 4)) + return 1; +@@ -167,7 +167,7 @@ static int probe_ntfs(blkid_probe pr, co + + buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size); + if (!buf_mft) +- return 1; ++ return errno ? -errno : 1; + + if (memcmp(buf_mft, "FILE", 4)) + return 1; +diff -up util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c.kzak 2013-04-08 17:55:40.257856207 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c 2014-03-28 15:11:44.682552036 +0100 +@@ -32,9 +32,9 @@ static int probe_nvraid(blkid_probe pr, + struct nv_metadata *nv; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 2) * 0x200; + nv = (struct nv_metadata *) +@@ -42,15 +42,15 @@ static int probe_nvraid(blkid_probe pr, + off, + sizeof(struct nv_metadata)); + if (!nv) +- return -1; ++ return errno ? -errno : 1; + + if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) +- return -1; ++ return 1; + if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor), + (unsigned char *) nv->vendor)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/ocfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ocfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/ocfs.c.kzak 2013-04-08 17:55:40.257856207 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ocfs.c 2014-03-28 15:11:44.682552036 +0100 +@@ -109,14 +109,14 @@ static int probe_ocfs(blkid_probe pr, co + buf = blkid_probe_get_buffer(pr, mag->kboff << 10, + sizeof(struct ocfs_volume_header)); + if (!buf) +- return -1; ++ return errno ? -errno : 1; + memcpy(&ovh, buf, sizeof(ovh)); + + /* label */ + buf = blkid_probe_get_buffer(pr, (mag->kboff << 10) + 512, + sizeof(struct ocfs_volume_label)); + if (!buf) +- return -1; ++ return errno ? -errno : 1; + memcpy(&ovl, buf, sizeof(ovl)); + + maj = ocfsmajor(ovh); +@@ -144,7 +144,7 @@ static int probe_ocfs2(blkid_probe pr, c + + osb = blkid_probe_get_sb(pr, mag, struct ocfs2_super_block); + if (!osb) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_label(pr, (unsigned char *) osb->s_label, sizeof(osb->s_label)); + blkid_probe_set_uuid(pr, osb->s_uuid); +@@ -162,7 +162,7 @@ static int probe_oracleasm(blkid_probe p + + dl = blkid_probe_get_sb(pr, mag, struct oracle_asm_disk_label); + if (!dl) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_label(pr, (unsigned char *) dl->dl_id, sizeof(dl->dl_id)); + return 0; +diff -up util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c.kzak 2013-06-13 09:46:10.423650647 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c 2014-03-28 15:11:44.682552036 +0100 +@@ -33,9 +33,9 @@ static int probe_pdcraid(blkid_probe pr, + }; + + if (pr->size < 0x40000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + for (i = 0; sectors[i] != 0; i++) { + uint64_t off; +@@ -47,18 +47,18 @@ static int probe_pdcraid(blkid_probe pr, + off, + sizeof(struct promise_metadata)); + if (!pdc) +- return -1; ++ return errno ? -errno : 1; + + if (memcmp(pdc->sig, PDC_SIGNATURE, + sizeof(PDC_SIGNATURE) - 1) == 0) { + + if (blkid_probe_set_magic(pr, off, sizeof(pdc->sig), + (unsigned char *) pdc->sig)) +- return -1; ++ return 1; + return 0; + } + } +- return -1; ++ return 1; + } + + const struct blkid_idinfo pdcraid_idinfo = { +diff -up util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c.kzak 2013-04-08 17:55:40.258856216 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c 2014-03-28 15:11:44.682552036 +0100 +@@ -45,17 +45,17 @@ static int probe_reiser(blkid_probe pr, + + rs = blkid_probe_get_sb(pr, mag, struct reiserfs_super_block); + if (!rs) +- return -1; ++ return errno ? -errno : 1; + + blocksize = le16_to_cpu(rs->rs_blocksize); + + /* The blocksize must be at least 512B */ + if ((blocksize >> 9) == 0) +- return -BLKID_ERR_PARAM; ++ return 1; + + /* If the superblock is inside the journal, we have the wrong one */ + if (mag->kboff / (blocksize >> 9) > le32_to_cpu(rs->rs_journal_block) / 2) +- return -BLKID_ERR_BIG; ++ return 1; + + /* LABEL/UUID are only valid for later versions of Reiserfs v3.6. */ + if (mag->magic[6] == '2' || mag->magic[6] == '3') { +@@ -82,7 +82,7 @@ static int probe_reiser4(blkid_probe pr, + + rs4 = blkid_probe_get_sb(pr, mag, struct reiser4_super_block); + if (!rs4) +- return -1; ++ return errno ? -errno : 1; + + if (*rs4->rs4_label) + blkid_probe_set_label(pr, rs4->rs4_label, sizeof(rs4->rs4_label)); +diff -up util-linux-2.23.2/libblkid/src/superblocks/romfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/romfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/romfs.c.kzak 2013-04-08 17:55:40.258856216 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/romfs.c 2014-03-28 15:11:44.682552036 +0100 +@@ -29,7 +29,7 @@ static int probe_romfs(blkid_probe pr, c + + ros = blkid_probe_get_sb(pr, mag, struct romfs_super_block); + if (!ros) +- return -1; ++ return errno ? -errno : 1; + + if (strlen((char *) ros->ros_volume)) + blkid_probe_set_label(pr, ros->ros_volume, +diff -up util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c.kzak 2013-06-13 09:46:10.424650656 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c 2014-03-28 15:11:44.682552036 +0100 +@@ -88,9 +88,9 @@ static int probe_silraid(blkid_probe pr, + struct silicon_metadata *sil; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200) - 1) * 0x200; + +@@ -98,27 +98,27 @@ static int probe_silraid(blkid_probe pr, + blkid_probe_get_buffer(pr, off, + sizeof(struct silicon_metadata)); + if (!sil) +- return -1; ++ return errno ? -errno : 1; + + if (le32_to_cpu(sil->magic) != SILICON_MAGIC) +- return -1; ++ return 1; + if (sil->disk_number >= 8) +- return -1; ++ return 1; + if (!checksum(sil)) { + DBG(LOWPROBE, blkid_debug("silicon raid: incorrect checksum")); +- return -1; ++ return 1; + } + + if (blkid_probe_sprintf_version(pr, "%u.%u", + le16_to_cpu(sil->major_ver), + le16_to_cpu(sil->minor_ver)) != 0) +- return -1; ++ return 1; + + if (blkid_probe_set_magic(pr, + off + offsetof(struct silicon_metadata, magic), + sizeof(sil->magic), + (unsigned char *) &sil->magic)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/squashfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/squashfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/squashfs.c.kzak 2013-04-08 17:55:40.258856216 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/squashfs.c 2014-03-28 15:11:44.682552036 +0100 +@@ -34,7 +34,7 @@ static int probe_squashfs(blkid_probe pr + + sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block); + if (!sq) +- return -1; ++ return errno ? -errno : 1; + + if (strcmp(mag->magic, "sqsh") == 0 || + strcmp(mag->magic, "qshs") == 0) +diff -up util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak util-linux-2.23.2/libblkid/src/superblocks/superblocks.c +--- util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak 2013-07-30 10:39:26.209738269 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/superblocks.c 2014-03-28 15:11:44.682552036 +0100 +@@ -331,9 +331,10 @@ int blkid_superblocks_get_name(size_t id + static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn) + { + size_t i; ++ int rc = BLKID_PROBE_NONE; + + if (!pr || chn->idx < -1) +- return -1; ++ return -EINVAL; + blkid_probe_chain_reset_vals(pr, chn); + + DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]", +@@ -351,38 +352,50 @@ static int superblocks_probe(blkid_probe + const struct blkid_idinfo *id; + const struct blkid_idmag *mag = NULL; + blkid_loff_t off = 0; +- int rc = 0; + + chn->idx = i; + id = idinfos[i]; + + if (chn->fltr && blkid_bmp_get_item(chn->fltr, i)) { + DBG(LOWPROBE, blkid_debug("filter out: %s", id->name)); ++ rc = BLKID_PROBE_NONE; + continue; + } + +- if (id->minsz && id->minsz > pr->size) ++ if (id->minsz && id->minsz > pr->size) { ++ rc = BLKID_PROBE_NONE; + continue; /* the device is too small */ ++ } + + /* don't probe for RAIDs, swap or journal on CD/DVDs */ + if ((id->usage & (BLKID_USAGE_RAID | BLKID_USAGE_OTHER)) && +- blkid_probe_is_cdrom(pr)) ++ blkid_probe_is_cdrom(pr)) { ++ rc = BLKID_PROBE_NONE; + continue; ++ } + + /* don't probe for RAIDs on floppies */ +- if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr)) ++ if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr)) { ++ rc = BLKID_PROBE_NONE; + continue; ++ } + + DBG(LOWPROBE, blkid_debug("[%zd] %s:", i, id->name)); + +- if (blkid_probe_get_idmag(pr, id, &off, &mag)) ++ rc = blkid_probe_get_idmag(pr, id, &off, &mag); ++ if (rc < 0) ++ break; ++ if (rc != BLKID_PROBE_OK) + continue; + + /* final check by probing function */ + if (id->probefunc) { + DBG(LOWPROBE, blkid_debug("\tcall probefunc()")); +- if (id->probefunc(pr, mag) != 0) { ++ rc = id->probefunc(pr, mag); ++ if (rc != BLKID_PROBE_OK) { + blkid_probe_chain_reset_vals(pr, chn); ++ if (rc < 0) ++ break; + continue; + } + } +@@ -407,13 +420,13 @@ static int superblocks_probe(blkid_probe + + DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [SUBLKS idx=%d]", + id->name, chn->idx)); +- return 0; ++ return BLKID_PROBE_OK; + } + + nothing: +- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [SUBLKS idx=%d]", +- chn->idx)); +- return 1; ++ DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [SUBLKS idx=%d]", ++ rc, chn->idx)); ++ return rc; + } + + /* +diff -up util-linux-2.23.2/libblkid/src/superblocks/swap.c.kzak util-linux-2.23.2/libblkid/src/superblocks/swap.c +--- util-linux-2.23.2/libblkid/src/superblocks/swap.c.kzak 2013-06-13 09:46:10.425650665 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/swap.c 2014-03-28 15:11:44.682552036 +0100 +@@ -44,17 +44,17 @@ static int swap_set_info(blkid_probe pr, + hdr = (struct swap_header_v1_2 *) blkid_probe_get_buffer(pr, 1024, + sizeof(struct swap_header_v1_2)); + if (!hdr) +- return -1; ++ return errno ? -errno : 1; + + /* SWAPSPACE2 - check for wrong version or zeroed pagecount */ + if (strcmp(version, "2") == 0) { + if (hdr->version != 1 && swab32(hdr->version) != 1) { + DBG(LOWPROBE, blkid_debug("incorrect swap version")); +- return -1; ++ return 1; + } + if (hdr->lastpage == 0) { + DBG(LOWPROBE, blkid_debug("not set last swap page")); +- return -1; ++ return 1; + } + } + +@@ -62,9 +62,9 @@ static int swap_set_info(blkid_probe pr, + if (hdr->padding[32] == 0 && hdr->padding[33] == 0) { + if (hdr->volume[0] && blkid_probe_set_label(pr, hdr->volume, + sizeof(hdr->volume)) < 0) +- return -1; ++ return 1; + if (blkid_probe_set_uuid(pr, hdr->uuid) < 0) +- return -1; ++ return 1; + } + + blkid_probe_set_version(pr, version); +@@ -76,12 +76,12 @@ static int probe_swap(blkid_probe pr, co + unsigned char *buf; + + if (!mag) +- return -1; ++ return 1; + + /* TuxOnIce keeps valid swap header at the end of the 1st page */ + buf = blkid_probe_get_buffer(pr, 0, TOI_MAGIC_STRLEN); + if (!buf) +- return -1; ++ return errno ? -errno : 1; + + if (memcmp(buf, TOI_MAGIC_STRING, TOI_MAGIC_STRLEN) == 0) + return 1; /* Ignore swap signature, it's TuxOnIce */ +@@ -94,13 +94,13 @@ static int probe_swap(blkid_probe pr, co + } else if (!memcmp(mag->magic, "SWAPSPACE2", mag->len)) + return swap_set_info(pr, "2"); + +- return -1; ++ return 1; + } + + static int probe_swsuspend(blkid_probe pr, const struct blkid_idmag *mag) + { + if (!mag) +- return -1; ++ return 1; + if (!memcmp(mag->magic, "S1SUSPEND", mag->len)) + return swap_set_info(pr, "s1suspend"); + if (!memcmp(mag->magic, "S2SUSPEND", mag->len)) +@@ -112,7 +112,7 @@ static int probe_swsuspend(blkid_probe p + if (!memcmp(mag->magic, "LINHIB0001", mag->len)) + return swap_set_info(pr, "linhib0001"); + +- return -1; /* no signature detected */ ++ return 1; /* no signature detected */ + } + + const struct blkid_idinfo swap_idinfo = +diff -up util-linux-2.23.2/libblkid/src/superblocks/sysv.c.kzak util-linux-2.23.2/libblkid/src/superblocks/sysv.c +--- util-linux-2.23.2/libblkid/src/superblocks/sysv.c.kzak 2013-04-08 17:55:40.261856245 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/sysv.c 2014-03-28 15:11:44.683552047 +0100 +@@ -80,7 +80,7 @@ static int probe_xenix(blkid_probe pr, c + + sb = blkid_probe_get_sb(pr, mag, struct xenix_super_block); + if (!sb) +- return -1; ++ return errno ? -errno : 1; + blkid_probe_set_label(pr, sb->s_fname, sizeof(sb->s_fname)); + return 0; + } +@@ -105,21 +105,21 @@ static int probe_sysv(blkid_probe pr, + off, + sizeof(struct sysv_super_block)); + if (!sb) +- return -1; ++ return errno ? -errno : 1; + + if (sb->s_magic == cpu_to_le32(0xfd187e20) || + sb->s_magic == cpu_to_be32(0xfd187e20)) { + + if (blkid_probe_set_label(pr, sb->s_fname, + sizeof(sb->s_fname))) +- return -1; ++ return 1; + + if (blkid_probe_set_magic(pr, + off + offsetof(struct sysv_super_block, + s_magic), + sizeof(sb->s_magic), + (unsigned char *) &sb->s_magic)) +- return -1; ++ return 1; + + return 0; + } +diff -up util-linux-2.23.2/libblkid/src/superblocks/ubifs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ubifs.c +--- util-linux-2.23.2/libblkid/src/superblocks/ubifs.c.kzak 2013-06-13 09:46:10.426650673 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ubifs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -99,7 +99,7 @@ static int probe_ubifs(blkid_probe pr, c + + sb = blkid_probe_get_sb(pr, mag, struct ubifs_sb_node); + if (!sb) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_set_uuid(pr, sb->uuid); + blkid_probe_sprintf_version(pr, "w%dr%d", +diff -up util-linux-2.23.2/libblkid/src/superblocks/udf.c.kzak util-linux-2.23.2/libblkid/src/superblocks/udf.c +--- util-linux-2.23.2/libblkid/src/superblocks/udf.c.kzak 2013-06-13 09:46:10.426650673 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/udf.c 2014-03-28 15:11:44.683552047 +0100 +@@ -85,11 +85,11 @@ static int probe_udf(blkid_probe pr, + UDF_VSD_OFFSET + b, + sizeof(*vsd)); + if (!vsd) +- return 1; ++ return errno ? -errno : 1; + if (vsd->id[0] != '\0') + goto nsr; + } +- return -1; ++ return 1; + + nsr: + /* search the list of VSDs for a NSR descriptor */ +@@ -99,15 +99,15 @@ nsr: + UDF_VSD_OFFSET + ((blkid_loff_t) b * 0x800), + sizeof(*vsd)); + if (!vsd) +- return -1; ++ return errno ? -errno : 1; + if (vsd->id[0] == '\0') +- return -1; ++ return 1; + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } +- return -1; ++ return 1; + + anchor: + /* read Anchor Volume Descriptor (AVDP), checking block size */ +@@ -115,7 +115,7 @@ anchor: + vd = (struct volume_descriptor *) + blkid_probe_get_buffer(pr, 256 * pbs[i], sizeof(*vd)); + if (!vd) +- return -1; ++ return errno ? -errno : 1; + + type = le16_to_cpu(vd->tag.id); + if (type == 2) /* TAG_ID_AVDP */ +@@ -138,7 +138,7 @@ real_blksz: + (blkid_loff_t) (loc + b) * bs, + sizeof(*vd)); + if (!vd) +- return -1; ++ return errno ? -errno : 1; + } + + /* Try extract all possible ISO9660 information -- if there is +@@ -155,7 +155,7 @@ real_blksz: + (blkid_loff_t) (loc + b) * bs, + sizeof(*vd)); + if (!vd) +- return -1; ++ return errno ? -errno : 1; + type = le16_to_cpu(vd->tag.id); + if (type == 0) + break; +diff -up util-linux-2.23.2/libblkid/src/superblocks/ufs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ufs.c +--- util-linux-2.23.2/libblkid/src/superblocks/ufs.c.kzak 2013-04-08 17:55:40.263856264 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/ufs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -185,7 +185,7 @@ static int probe_ufs(blkid_probe pr, + offsets[i] * 1024, + sizeof(struct ufs_super_block)); + if (!ufs) +- return -1; ++ return errno ? -errno : 1; + + magBE = be32_to_cpu(ufs->fs_magic); + magLE = le32_to_cpu(ufs->fs_magic); +@@ -231,7 +231,7 @@ found: + offsetof(struct ufs_super_block, fs_magic), + sizeof(ufs->fs_magic), + (unsigned char *) &ufs->fs_magic)) +- return -1; ++ return 1; + + return 0; + } +diff -up util-linux-2.23.2/libblkid/src/superblocks/vfat.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vfat.c +--- util-linux-2.23.2/libblkid/src/superblocks/vfat.c.kzak 2013-06-13 09:46:10.426650673 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/vfat.c 2014-03-28 15:12:28.036993622 +0100 +@@ -255,16 +255,20 @@ int blkid_probe_is_vfat(blkid_probe pr) + struct vfat_super_block *vs; + struct msdos_super_block *ms; + const struct blkid_idmag *mag = NULL; ++ int rc; + +- if (blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag) || !mag) ++ rc = blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag); ++ if (rc < 0) ++ return rc; /* error */ ++ if (rc != BLKID_PROBE_OK || !mag) + return 0; + + ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block); + if (!ms) +- return 0; ++ return errno ? -errno : 0; + vs = blkid_probe_get_sb(pr, mag, struct vfat_super_block); + if (!vs) +- return 0; ++ return errno ? -errno : 0; + + return fat_valid_superblock(mag, ms, vs, NULL, NULL); + } +@@ -283,10 +287,12 @@ static int probe_vfat(blkid_probe pr, co + + ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block); + if (!ms) +- return 0; ++ return errno ? -errno : 1; ++ + vs = blkid_probe_get_sb(pr, mag, struct vfat_super_block); + if (!vs) +- return 0; ++ return errno ? -errno : 1; ++ + if (!fat_valid_superblock(mag, ms, vs, &cluster_count, &fat_size)) + return 1; + +@@ -376,16 +382,16 @@ static int probe_vfat(blkid_probe pr, co + (blkid_loff_t) fsinfo_sect * sector_size, + sizeof(struct fat32_fsinfo)); + if (buf == NULL) +- return -1; ++ return errno ? -errno : 1; + + fsinfo = (struct fat32_fsinfo *) buf; + if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 && + memcmp(fsinfo->signature1, "\x52\x52\x64\x41", 4) != 0 && + memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0) +- return -1; ++ return 1; + if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 && + memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0) +- return -1; ++ return 1; + } + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/via_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/via_raid.c +--- util-linux-2.23.2/libblkid/src/superblocks/via_raid.c.kzak 2013-04-08 17:55:40.264856273 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/via_raid.c 2014-03-28 15:11:44.683552047 +0100 +@@ -52,9 +52,9 @@ static int probe_viaraid(blkid_probe pr, + struct via_metadata *v; + + if (pr->size < 0x10000) +- return -1; ++ return 1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) +- return -1; ++ return 1; + + off = ((pr->size / 0x200)-1) * 0x200; + +@@ -63,19 +63,19 @@ static int probe_viaraid(blkid_probe pr, + off, + sizeof(struct via_metadata)); + if (!v) +- return -1; ++ return errno ? -errno : 1; + if (le16_to_cpu(v->signature) != VIA_SIGNATURE) +- return -1; ++ return 1; + if (v->version_number > 2) +- return -1; ++ return 1; + if (!via_checksum(v)) +- return -1; ++ return 1; + if (blkid_probe_sprintf_version(pr, "%u", v->version_number) != 0) +- return -1; ++ return 1; + if (blkid_probe_set_magic(pr, off, + sizeof(v->signature), + (unsigned char *) &v->signature)) +- return -1; ++ return 1; + return 0; + } + +diff -up util-linux-2.23.2/libblkid/src/superblocks/vmfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vmfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/vmfs.c.kzak 2013-04-08 17:55:40.264856273 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/vmfs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -28,7 +28,7 @@ static int probe_vmfs_fs(blkid_probe pr, + + header = blkid_probe_get_sb(pr, mag, struct vmfs_fs_info); + if (header == NULL) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_sprintf_uuid(pr, (unsigned char *) header->uuid, 16, + "%02x%02x%02x%02x-%02x%02x%02x%02x-" +@@ -53,7 +53,7 @@ static int probe_vmfs_volume(blkid_probe + + header = blkid_probe_get_sb(pr, mag, struct vmfs_volume_info); + if (header == NULL) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_sprintf_value(pr, "UUID_SUB", + "%02x%02x%02x%02x-%02x%02x%02x%02x-" +diff -up util-linux-2.23.2/libblkid/src/superblocks/vxfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vxfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/vxfs.c.kzak 2013-04-08 17:55:40.264856273 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/vxfs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -20,7 +20,7 @@ static int probe_vxfs(blkid_probe pr, co + + vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super_block); + if (!vxs) +- return -1; ++ return errno ? -errno : 1; + + blkid_probe_sprintf_version(pr, "%u", (unsigned int) vxs->vs_version); + return 0; +diff -up util-linux-2.23.2/libblkid/src/superblocks/xfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/xfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/xfs.c.kzak 2013-04-08 17:55:40.265856283 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/xfs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -40,7 +40,7 @@ static int probe_xfs(blkid_probe pr, con + + xs = blkid_probe_get_sb(pr, mag, struct xfs_super_block); + if (!xs) +- return -1; ++ return errno ? -errno : 1; + + if (strlen(xs->xs_fname)) + blkid_probe_set_label(pr, (unsigned char *) xs->xs_fname, +diff -up util-linux-2.23.2/libblkid/src/superblocks/zfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/zfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/zfs.c.kzak 2013-06-13 09:46:10.427650682 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/zfs.c 2014-03-28 15:11:44.683552047 +0100 +@@ -185,7 +185,7 @@ static int probe_zfs(blkid_probe pr, + blkid_probe_get_buffer(pr, offset, + sizeof(struct zfs_uberblock)); + if (ub == NULL) +- return -1; ++ return errno ? -errno : 1; + + if (ub->ub_magic == UBERBLOCK_MAGIC) { + ub_offset = offset; +@@ -202,7 +202,7 @@ static int probe_zfs(blkid_probe pr, + } + + if (found < 4) +- return -1; ++ return 1; + + /* If we found the 4th uberblock, then we will have exited from the + * scanning loop immediately, and ub will be a valid uberblock. */ +@@ -214,7 +214,7 @@ static int probe_zfs(blkid_probe pr, + if (blkid_probe_set_magic(pr, ub_offset, + sizeof(ub->ub_magic), + (unsigned char *) &ub->ub_magic)) +- return -1; ++ return 1; + + return 0; + } diff --git a/SOURCES/2.25-libblkid-no-more-probe-for-btrfs-backup-superblock.patch b/SOURCES/2.25-libblkid-no-more-probe-for-btrfs-backup-superblock.patch new file mode 100644 index 0000000..5083b38 --- /dev/null +++ b/SOURCES/2.25-libblkid-no-more-probe-for-btrfs-backup-superblock.patch @@ -0,0 +1,68 @@ +diff -up util-linux-2.23.2/libblkid/src/blkidP.h.kzak util-linux-2.23.2/libblkid/src/blkidP.h +--- util-linux-2.23.2/libblkid/src/blkidP.h.kzak 2013-07-30 10:39:26.205738229 +0200 ++++ util-linux-2.23.2/libblkid/src/blkidP.h 2014-01-23 10:51:10.109593273 +0100 +@@ -224,9 +224,6 @@ struct blkid_struct_probe + + /* private per-probing flags */ + #define BLKID_PROBE_FL_IGNORE_PT (1 << 1) /* ignore partition table */ +-#define BLKID_PROBE_FL_IGNORE_BACKUP (1 << 2) /* ignore backup superblocks or PT */ +- +-extern int blkid_probe_ignore_backup(blkid_probe pr); + + extern blkid_probe blkid_clone_probe(blkid_probe parent); + extern blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr); +diff -up util-linux-2.23.2/libblkid/src/probe.c.kzak util-linux-2.23.2/libblkid/src/probe.c +--- util-linux-2.23.2/libblkid/src/probe.c.kzak 2013-07-30 10:39:26.208738259 +0200 ++++ util-linux-2.23.2/libblkid/src/probe.c 2014-01-23 10:51:10.109593273 +0100 +@@ -924,7 +924,8 @@ int blkid_do_probe(blkid_probe pr) + * + * This function erases the current signature detected by @pr. The @pr has to + * be open in O_RDWR mode, BLKID_SUBLKS_MAGIC or/and BLKID_PARTS_MAGIC flags +- * has to be enabled. ++ * has to be enabled (if you want to errase also superblock with broken check ++ * sums then use BLKID_SUBLKS_BADCSUM too). + * + * After successful signature removing the @pr prober will be moved one step + * back and the next blkid_do_probe() call will again call previously called +@@ -1125,8 +1126,6 @@ int blkid_do_safeprobe(blkid_probe pr) + + blkid_probe_start(pr); + +- pr->prob_flags |= BLKID_PROBE_FL_IGNORE_BACKUP; +- + for (i = 0; i < BLKID_NCHAINS; i++) { + struct blkid_chain *chn; + +@@ -1764,8 +1763,3 @@ void blkid_probe_use_wiper(blkid_probe p + blkid_probe_chain_reset_vals(pr, chn); + } + } +- +-int blkid_probe_ignore_backup(blkid_probe pr) +-{ +- return pr && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_BACKUP); +-} +diff -up util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/btrfs.c +--- util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak 2013-06-13 09:46:10.421650630 +0200 ++++ util-linux-2.23.2/libblkid/src/superblocks/btrfs.c 2014-01-23 10:51:10.109593273 +0100 +@@ -63,11 +63,6 @@ static int probe_btrfs(blkid_probe pr, c + { + struct btrfs_super_block *bfs; + +- if (mag->kboff > 64 && blkid_probe_ignore_backup(pr)) { +- DBG(LOWPROBE, blkid_debug("btrfs: found backup superblock, ignore")); +- return 1; +- } +- + bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block); + if (!bfs) + return -1; +@@ -92,8 +87,6 @@ const struct blkid_idinfo btrfs_idinfo = + .magics = + { + { .magic = "_BHRfS_M", .len = 8, .sboff = 0x40, .kboff = 64 }, +- { .magic = "_BHRfS_M", .len = 8, .sboff = 0x40, .kboff = 64 * 1024 }, +- { .magic = "_BHRfS_M", .len = 8, .sboff = 0x40, .kboff = 256 * 1024 * 1024 }, + { NULL } + } + }; diff --git a/SOURCES/2.25-lscpu-discontinuous-NUMA-nodes.patch b/SOURCES/2.25-lscpu-discontinuous-NUMA-nodes.patch new file mode 100644 index 0000000..6428857 --- /dev/null +++ b/SOURCES/2.25-lscpu-discontinuous-NUMA-nodes.patch @@ -0,0 +1,102 @@ +diff -up util-linux-2.23.2/sys-utils/lscpu.c.kzak util-linux-2.23.2/sys-utils/lscpu.c +--- util-linux-2.23.2/sys-utils/lscpu.c.kzak 2013-07-30 10:39:26.342739583 +0200 ++++ util-linux-2.23.2/sys-utils/lscpu.c 2014-01-14 11:21:51.837599200 +0100 +@@ -49,6 +49,7 @@ + /* /sys paths */ + #define _PATH_SYS_SYSTEM "/sys/devices/system" + #define _PATH_SYS_CPU _PATH_SYS_SYSTEM "/cpu" ++#define _PATH_SYS_NODE _PATH_SYS_SYSTEM "/node" + #define _PATH_PROC_XEN "/proc/xen" + #define _PATH_PROC_XENCAP _PATH_PROC_XEN "/capabilities" + #define _PATH_PROC_CPUINFO "/proc/cpuinfo" +@@ -157,6 +158,7 @@ struct lscpu_desc { + cpu_set_t *online; /* mask with online CPUs */ + + int nnodes; /* number of NUMA modes */ ++ int *idx2nodenum; /* Support for discontinuous nodes */ + cpu_set_t **nodemaps; /* array with NUMA nodes */ + + /* books -- based on book_siblings (internal kernel map of cpuX's +@@ -802,25 +804,59 @@ read_cache(struct lscpu_desc *desc, int + } + } + ++static inline int is_node_dirent(struct dirent *d) ++{ ++ return ++ d && ++#ifdef _DIRENT_HAVE_D_TYPE ++ d->d_type == DT_DIR && ++#endif ++ strncmp(d->d_name, "node", 4) == 0 && ++ isdigit_string(d->d_name + 4); ++} ++ + static void + read_nodes(struct lscpu_desc *desc) + { +- int i; ++ int i = 0; ++ DIR *dir; ++ struct dirent *d; ++ char *path; + + /* number of NUMA node */ +- while (path_exist(_PATH_SYS_SYSTEM "/node/node%d", desc->nnodes)) +- desc->nnodes++; ++ path = path_strdup(_PATH_SYS_NODE); ++ dir = opendir(path); ++ free(path); ++ ++ while (dir && (d = readdir(dir))) { ++ if (is_node_dirent(d)) ++ desc->nnodes++; ++ } + +- if (!desc->nnodes) ++ if (!desc->nnodes) { ++ if (dir) ++ closedir(dir); + return; ++ } + + desc->nodemaps = xcalloc(desc->nnodes, sizeof(cpu_set_t *)); ++ desc->idx2nodenum = xmalloc(desc->nnodes * sizeof(int)); ++ ++ if (dir) { ++ rewinddir(dir); ++ while ((d = readdir(dir)) && i < desc->nnodes) { ++ if (is_node_dirent(d)) ++ desc->idx2nodenum[i++] = strtol_or_err(((d->d_name) + 4), ++ _("Failed to extract the node number")); ++ } ++ closedir(dir); ++ } + + /* information about how nodes share different CPUs */ + for (i = 0; i < desc->nnodes; i++) + desc->nodemaps[i] = path_read_cpuset(maxcpus, + _PATH_SYS_SYSTEM "/node/node%d/cpumap", +- i); ++ desc->idx2nodenum[i]); + } + + static char * +@@ -850,7 +886,7 @@ get_cell_data(struct lscpu_desc *desc, i + case COL_NODE: + if (cpuset_ary_isset(cpu, desc->nodemaps, + desc->nnodes, setsize, &idx) == 0) +- snprintf(buf, bufsz, "%zd", idx); ++ snprintf(buf, bufsz, "%d", desc->idx2nodenum[idx]); + break; + case COL_BOOK: + if (cpuset_ary_isset(cpu, desc->bookmaps, +@@ -1250,7 +1286,7 @@ print_summary(struct lscpu_desc *desc, s + } + + for (i = 0; i < desc->nnodes; i++) { +- snprintf(buf, sizeof(buf), _("NUMA node%d CPU(s):"), i); ++ snprintf(buf, sizeof(buf), _("NUMA node%d CPU(s):"), desc->idx2nodenum[i]); + print_cpuset(buf, desc->nodemaps[i], mod->hex); + } + } diff --git a/SOURCES/2.25-lscpu-sort-NUMA.patch b/SOURCES/2.25-lscpu-sort-NUMA.patch new file mode 100644 index 0000000..2055d2d --- /dev/null +++ b/SOURCES/2.25-lscpu-sort-NUMA.patch @@ -0,0 +1,144 @@ +diff -up util-linux-2.23.2/sys-utils/lscpu.c.kzak util-linux-2.23.2/sys-utils/lscpu.c +--- util-linux-2.23.2/sys-utils/lscpu.c.kzak 2014-01-14 14:02:52.228996385 +0100 ++++ util-linux-2.23.2/sys-utils/lscpu.c 2014-01-14 14:04:08.109795733 +0100 +@@ -815,6 +815,13 @@ static inline int is_node_dirent(struct + isdigit_string(d->d_name + 4); + } + ++static int ++nodecmp(const void *ap, const void *bp) ++{ ++ int *a = (int *) ap, *b = (int *) bp; ++ return *a - *b; ++} ++ + static void + read_nodes(struct lscpu_desc *desc) + { +@@ -850,6 +857,7 @@ read_nodes(struct lscpu_desc *desc) + _("Failed to extract the node number")); + } + closedir(dir); ++ qsort(desc->idx2nodenum, desc->nnodes, sizeof(int), nodecmp); + } + + /* information about how nodes share different CPUs */ +diff -up util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu.kzak util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu +--- util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu.kzak 2013-06-13 09:46:10.551651742 +0200 ++++ util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu 2014-01-14 14:04:29.662022613 +0100 +@@ -4,7 +4,7 @@ On-line CPU(s) list: 0-63 + Thread(s) per core: 2 + Core(s) per socket: 8 + Socket(s): 4 +-NUMA node(s): 1 ++NUMA node(s): 3 + Vendor ID: GenuineIntel + CPU family: 6 + Model: 46 +@@ -18,72 +18,74 @@ L1i cache: 32K + L2 cache: 256K + L3 cache: 18432K + NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62 ++NUMA node2 CPU(s): 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 ++NUMA node3 CPU(s): 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63 + + # The following is the parsable format, which can be fed to other + # programs. Each different item in every column has an unique ID + # starting from zero. + # CPU,Core,Socket,Node,,L1d,L1i,L2,L3 + 0,0,0,0,,0,0,0,0 +-1,1,1,,,1,1,1,1 ++1,1,1,2,,1,1,1,1 + 2,2,2,0,,2,2,2,2 +-3,3,3,,,3,3,3,3 ++3,3,3,3,,3,3,3,3 + 4,4,0,0,,4,4,4,0 +-5,5,1,,,5,5,5,1 ++5,5,1,2,,5,5,5,1 + 6,6,2,0,,6,6,6,2 +-7,7,3,,,7,7,7,3 ++7,7,3,3,,7,7,7,3 + 8,8,0,0,,8,8,8,0 +-9,9,1,,,9,9,9,1 ++9,9,1,2,,9,9,9,1 + 10,10,2,0,,10,10,10,2 +-11,11,3,,,11,11,11,3 ++11,11,3,3,,11,11,11,3 + 12,12,0,0,,12,12,12,0 +-13,13,1,,,13,13,13,1 ++13,13,1,2,,13,13,13,1 + 14,14,2,0,,14,14,14,2 +-15,15,3,,,15,15,15,3 ++15,15,3,3,,15,15,15,3 + 16,16,0,0,,16,16,16,0 +-17,17,1,,,17,17,17,1 ++17,17,1,2,,17,17,17,1 + 18,18,2,0,,18,18,18,2 +-19,19,3,,,19,19,19,3 ++19,19,3,3,,19,19,19,3 + 20,20,0,0,,20,20,20,0 +-21,21,1,,,21,21,21,1 ++21,21,1,2,,21,21,21,1 + 22,22,2,0,,22,22,22,2 +-23,23,3,,,23,23,23,3 ++23,23,3,3,,23,23,23,3 + 24,24,0,0,,24,24,24,0 +-25,25,1,,,25,25,25,1 ++25,25,1,2,,25,25,25,1 + 26,26,2,0,,26,26,26,2 +-27,27,3,,,27,27,27,3 ++27,27,3,3,,27,27,27,3 + 28,28,0,0,,28,28,28,0 +-29,29,1,,,29,29,29,1 ++29,29,1,2,,29,29,29,1 + 30,30,2,0,,30,30,30,2 +-31,31,3,,,31,31,31,3 ++31,31,3,3,,31,31,31,3 + 32,0,0,0,,0,0,0,0 +-33,1,1,,,1,1,1,1 ++33,1,1,2,,1,1,1,1 + 34,2,2,0,,2,2,2,2 +-35,3,3,,,3,3,3,3 ++35,3,3,3,,3,3,3,3 + 36,4,0,0,,4,4,4,0 +-37,5,1,,,5,5,5,1 ++37,5,1,2,,5,5,5,1 + 38,6,2,0,,6,6,6,2 +-39,7,3,,,7,7,7,3 ++39,7,3,3,,7,7,7,3 + 40,8,0,0,,8,8,8,0 +-41,9,1,,,9,9,9,1 ++41,9,1,2,,9,9,9,1 + 42,10,2,0,,10,10,10,2 +-43,11,3,,,11,11,11,3 ++43,11,3,3,,11,11,11,3 + 44,12,0,0,,12,12,12,0 +-45,13,1,,,13,13,13,1 ++45,13,1,2,,13,13,13,1 + 46,14,2,0,,14,14,14,2 +-47,15,3,,,15,15,15,3 ++47,15,3,3,,15,15,15,3 + 48,16,0,0,,16,16,16,0 +-49,17,1,,,17,17,17,1 ++49,17,1,2,,17,17,17,1 + 50,18,2,0,,18,18,18,2 +-51,19,3,,,19,19,19,3 ++51,19,3,3,,19,19,19,3 + 52,20,0,0,,20,20,20,0 +-53,21,1,,,21,21,21,1 ++53,21,1,2,,21,21,21,1 + 54,22,2,0,,22,22,22,2 +-55,23,3,,,23,23,23,3 ++55,23,3,3,,23,23,23,3 + 56,24,0,0,,24,24,24,0 +-57,25,1,,,25,25,25,1 ++57,25,1,2,,25,25,25,1 + 58,26,2,0,,26,26,26,2 +-59,27,3,,,27,27,27,3 ++59,27,3,3,,27,27,27,3 + 60,28,0,0,,28,28,28,0 +-61,29,1,,,29,29,29,1 ++61,29,1,2,,29,29,29,1 + 62,30,2,0,,30,30,30,2 +-63,31,3,,,31,31,31,3 ++63,31,3,3,,31,31,31,3 diff --git a/SOURCES/2.25-mount-man-xfs.patch b/SOURCES/2.25-mount-man-xfs.patch new file mode 100644 index 0000000..b8973cd --- /dev/null +++ b/SOURCES/2.25-mount-man-xfs.patch @@ -0,0 +1,16 @@ +diff -up util-linux-2.23.2/sys-utils/mount.8.kzak util-linux-2.23.2/sys-utils/mount.8 +--- util-linux-2.23.2/sys-utils/mount.8.kzak 2014-03-12 12:35:46.532369960 +0100 ++++ util-linux-2.23.2/sys-utils/mount.8 2014-03-12 12:35:23.041126143 +0100 +@@ -2598,9 +2598,9 @@ None. + .TP + .BR allocsize=size + Sets the buffered I/O end-of-file preallocation size when +-doing delayed allocation writeout (default size is 64KiB). +-Valid values for this option are page size (typically 4KiB) +-through to 1GiB, inclusive, in power-of-2 increments. ++doing delayed allocation writeout. Valid values for this ++option are page size (typically 4KiB) through to 1GiB, ++inclusive, in power-of-2 increments. + .sp + The default behaviour is for dynamic end-of-file + preallocation size, which uses a set of heuristics to diff --git a/SOURCES/2.25-taskset-man-fix-permissions.patch b/SOURCES/2.25-taskset-man-fix-permissions.patch new file mode 100644 index 0000000..ef97f50 --- /dev/null +++ b/SOURCES/2.25-taskset-man-fix-permissions.patch @@ -0,0 +1,36 @@ +From ab0e0fa7a45bccf8304edcb2a904f30a4f3a48b1 Mon Sep 17 00:00:00 2001 +From: Rik van Riel +Date: Fri, 6 Dec 2013 16:07:54 -0500 +Subject: [PATCH] taskset: fix PERMISSIONS section of taskset man page + +A user is always allowed to change the CPU affinity of his or her +own processes. CAP_SYS_NICE is only required to change the affinity +of another user's process. + +Signed-off-by: Rik van Riel +Reported-by: Joe Mario +--- + schedutils/taskset.1 | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/schedutils/taskset.1 b/schedutils/taskset.1 +index ade202b..fb5738c 100644 +--- a/schedutils/taskset.1 ++++ b/schedutils/taskset.1 +@@ -102,10 +102,11 @@ Or set it: + .B taskset \-p + .I mask pid + .SH PERMISSIONS ++A user can change the CPU affinity of a process belonging to the same user. + A user must possess + .B CAP_SYS_NICE +-to change the CPU affinity of a process. Any user can retrieve the affinity +-mask. ++to change the CPU affinity of a process belonging to another user. ++A user can retrieve the affinity mask of any process. + .SH AUTHOR + Written by Robert M. Love. + .SH COPYRIGHT +-- +1.8.4.2 + diff --git a/SOURCES/2.25-wipefs-call-BLKRRPART-when-erase-partition-table.patch b/SOURCES/2.25-wipefs-call-BLKRRPART-when-erase-partition-table.patch new file mode 100644 index 0000000..260b1ad --- /dev/null +++ b/SOURCES/2.25-wipefs-call-BLKRRPART-when-erase-partition-table.patch @@ -0,0 +1,140 @@ +diff -up util-linux-2.23.2/misc-utils/wipefs.8.kzak util-linux-2.23.2/misc-utils/wipefs.8 +--- util-linux-2.23.2/misc-utils/wipefs.8.kzak 2013-07-30 10:39:26.232738496 +0200 ++++ util-linux-2.23.2/misc-utils/wipefs.8 2014-01-23 11:07:54.390022299 +0100 +@@ -23,6 +23,9 @@ does not erase the filesystem itself nor + When used without options \fB-a\fR or \fB-o\fR, it lists all visible filesystems + and the offsets of their basic signatures. + ++.B wipefs ++calls BLKRRPART ioctl when erase partition table to inform kernel about the change. ++ + Note that some filesystems or some partition tables store more magic strings on + the devices. The + .B wipefs +diff -up util-linux-2.23.2/misc-utils/wipefs.c.kzak util-linux-2.23.2/misc-utils/wipefs.c +--- util-linux-2.23.2/misc-utils/wipefs.c.kzak 2013-07-30 10:39:26.232738496 +0200 ++++ util-linux-2.23.2/misc-utils/wipefs.c 2014-01-23 11:12:26.786860550 +0100 +@@ -40,21 +40,24 @@ + #include "c.h" + #include "closestream.h" + #include "optutils.h" ++#include "blkdev.h" + + struct wipe_desc { + loff_t offset; /* magic string offset */ + size_t len; /* length of magic string */ + unsigned char *magic; /* magic string */ + +- int zap; /* zap this offset? */ + char *usage; /* raid, filesystem, ... */ + char *type; /* FS type */ + char *label; /* FS label */ + char *uuid; /* FS uuid */ + +- int on_disk; +- + struct wipe_desc *next; ++ ++ unsigned int zap : 1, ++ on_disk : 1, ++ is_parttable : 1; ++ + }; + + enum { +@@ -72,7 +75,7 @@ print_pretty(struct wipe_desc *wp, int l + printf("----------------------------------------------------------------\n"); + } + +- printf("0x%-17jx %s [%s]", wp->offset, wp->type, wp->usage); ++ printf("0x%-17jx %s [%s]", wp->offset, wp->type, _(wp->usage)); + + if (wp->label && *wp->label) + printf("\n%27s %s", "LABEL:", wp->label); +@@ -141,7 +144,7 @@ add_offset(struct wipe_desc *wp0, loff_t + wp = xcalloc(1, sizeof(struct wipe_desc)); + wp->offset = offset; + wp->next = wp0; +- wp->zap = zap; ++ wp->zap = zap ? 1 : 0; + return wp; + } + +@@ -164,7 +167,7 @@ get_desc_for_probe(struct wipe_desc *wp, + const char *off, *type, *mag, *p, *usage = NULL; + size_t len; + loff_t offset; +- int rc; ++ int rc, ispt = 0; + + /* superblocks */ + if (blkid_probe_lookup_value(pr, "TYPE", &type, NULL) == 0) { +@@ -181,7 +184,8 @@ get_desc_for_probe(struct wipe_desc *wp, + rc = blkid_probe_lookup_value(pr, "PTMAGIC", &mag, &len); + if (rc) + return wp; +- usage = "partition table"; ++ usage = N_("partition table"); ++ ispt = 1; + } else + return wp; + +@@ -199,6 +203,7 @@ get_desc_for_probe(struct wipe_desc *wp, + + wp->type = xstrdup(type); + wp->on_disk = 1; ++ wp->is_parttable = ispt ? 1 : 0; + + wp->magic = xmalloc(len); + memcpy(wp->magic, mag, len); +@@ -309,10 +314,25 @@ static void do_wipe_real(blkid_probe pr, + putchar('\n'); + } + ++ ++static void rereadpt(int fd, const char *devname) ++{ ++#ifdef BLKRRPART ++ struct stat st; ++ ++ if (fstat(fd, &st) || !S_ISBLK(st.st_mode)) ++ return; ++ ++ errno = 0; ++ ioctl(fd, BLKRRPART); ++ printf(_("%s: calling ioclt to re-read partition table: %m\n"), devname); ++#endif ++} ++ + static struct wipe_desc * + do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet, int force) + { +- int flags; ++ int flags, reread = 0; + blkid_probe pr; + struct wipe_desc *w, *wp0; + int zap = all ? 1 : wp->zap; +@@ -345,8 +365,11 @@ do_wipe(struct wipe_desc *wp, const char + if (!wp->on_disk) + continue; + +- if (zap) ++ if (zap) { + do_wipe_real(pr, devname, wp, noact, quiet); ++ if (wp->is_parttable) ++ reread = 1; ++ } + } + + for (w = wp0; w != NULL; w = w->next) { +@@ -355,6 +378,10 @@ do_wipe(struct wipe_desc *wp, const char + } + + fsync(blkid_probe_get_fd(pr)); ++ ++ if (reread) ++ rereadpt(blkid_probe_get_fd(pr), devname); ++ + close(blkid_probe_get_fd(pr)); + blkid_free_probe(pr); + free_wipe(wp0); diff --git a/SOURCES/rhel7.0-unshare-user.patch b/SOURCES/rhel7.0-unshare-user.patch new file mode 100644 index 0000000..56ec755 --- /dev/null +++ b/SOURCES/rhel7.0-unshare-user.patch @@ -0,0 +1,154 @@ +diff -up util-linux-2.23.2/sys-utils/nsenter.1.kzak util-linux-2.23.2/sys-utils/nsenter.1 +--- util-linux-2.23.2/sys-utils/nsenter.1.kzak 2014-03-12 12:39:19.283577293 +0100 ++++ util-linux-2.23.2/sys-utils/nsenter.1 2014-03-12 12:42:08.930336415 +0100 +@@ -47,12 +47,7 @@ flag). + will fork by default if changing the PID namespace, so that the new program + and its children share the same PID namespace and are visible to each other. + If \-\-no\-fork is used, the new program will be exec'ed without forking. +-.TP +-.B user namespace +-process will have distinct set of UIDs, GIDs and capabilities +-.RB ( CLONE_\:NEWUSER +-flag). +-.TP ++.PP + See the + .BR clone (2) + for exact semantics of the flags. +@@ -88,9 +83,6 @@ the network namespace + /proc/\fIpid\fR/ns/pid + the PID namespace + .TP +-/proc/\fIpid\fR/ns/user +-the user namespace +-.TP + /proc/\fIpid\fR/root + the root directory + .TP +@@ -124,11 +116,6 @@ Enter the PID namespace. If no file is + the target process. If file is specified enter the PID namespace specified by + file. + .TP +-\fB\-U\fR, \fB\-\-user\fR [\fIfile\fR] +-Enter the user namespace. If no file is specified enter the user namespace of +-the target process. If file is specified enter the user namespace specified by +-file. +-.TP + \fB\-r\fR, \fB\-\-root\fR [\fIdirectory\fR] + Set the root directory. If no directory is specified set the root directory to + the root directory of the target process. If directory is specified set the +diff -up util-linux-2.23.2/sys-utils/nsenter.c.kzak util-linux-2.23.2/sys-utils/nsenter.c +--- util-linux-2.23.2/sys-utils/nsenter.c.kzak 2014-03-12 12:39:10.402485179 +0100 ++++ util-linux-2.23.2/sys-utils/nsenter.c 2014-03-12 12:44:07.986570461 +0100 +@@ -42,12 +42,7 @@ static struct namespace_file { + int fd; + } namespace_files[] = { + /* Careful the order is significant in this array. +- * +- * The user namespace comes first, so that it is entered +- * first. This gives an unprivileged user the potential to +- * enter the other namespaces. + */ +- { .nstype = CLONE_NEWUSER, .name = "ns/user", .fd = -1 }, + { .nstype = CLONE_NEWIPC, .name = "ns/ipc", .fd = -1 }, + { .nstype = CLONE_NEWUTS, .name = "ns/uts", .fd = -1 }, + { .nstype = CLONE_NEWNET, .name = "ns/net", .fd = -1 }, +@@ -71,7 +66,6 @@ static void usage(int status) + fputs(_(" -i, --ipc [=] enter System V IPC namespace\n"), out); + fputs(_(" -n, --net [=] enter network namespace\n"), out); + fputs(_(" -p, --pid [=] enter pid namespace\n"), out); +- fputs(_(" -U, --user [=] enter user namespace\n"), out); + fputs(_(" -r, --root [=] set the root directory\n"), out); + fputs(_(" -w, --wd [=] set the working directory\n"), out); + fputs(_(" -F, --no-fork do not fork before exec'ing \n"), out); +@@ -168,7 +162,6 @@ int main(int argc, char *argv[]) + { "ipc", optional_argument, NULL, 'i' }, + { "net", optional_argument, NULL, 'n' }, + { "pid", optional_argument, NULL, 'p' }, +- { "user", optional_argument, NULL, 'U' }, + { "root", optional_argument, NULL, 'r' }, + { "wd", optional_argument, NULL, 'w' }, + { "no-fork", no_argument, NULL, 'F' }, +@@ -186,7 +179,7 @@ int main(int argc, char *argv[]) + atexit(close_stdout); + + while ((c = +- getopt_long(argc, argv, "hVt:m::u::i::n::p::U::r::w::F", ++ getopt_long(argc, argv, "hVt:m::u::i::n::p::r::w::F", + longopts, NULL)) != -1) { + switch (c) { + case 'h': +@@ -228,12 +221,6 @@ int main(int argc, char *argv[]) + else + namespaces |= CLONE_NEWPID; + break; +- case 'U': +- if (optarg) +- open_namespace_fd(CLONE_NEWUSER, optarg); +- else +- namespaces |= CLONE_NEWUSER; +- break; + case 'F': + do_fork = 0; + break; +diff -up util-linux-2.23.2/sys-utils/unshare.1.kzak util-linux-2.23.2/sys-utils/unshare.1 +--- util-linux-2.23.2/sys-utils/unshare.1.kzak 2014-03-12 12:39:41.367806340 +0100 ++++ util-linux-2.23.2/sys-utils/unshare.1 2014-03-12 12:40:25.186260760 +0100 +@@ -34,9 +34,6 @@ etc. (\fBCLONE_NEWNET\fP flag). + .BR "pid namespace" + children will have a distinct set of pid to process mappings than their parent. + (\fBCLONE_NEWPID\fP flag). +-.TP +-.BR "user namespace" +-process will have distinct set of uids, gids and capabilities. (\fBCLONE_NEWUSER\fP flag). + .PP + See the \fBclone\fR(2) for exact semantics of the flags. + .SH OPTIONS +@@ -58,9 +55,6 @@ Unshare the network namespace. + .TP + .BR \-p , " \-\-pid" + Unshare the pid namespace. +-.TP +-.BR \-U , " \-\-user" +-Unshare the user namespace. + .SH SEE ALSO + .BR unshare (2), + .BR clone (2) +diff -up util-linux-2.23.2/sys-utils/unshare.c.kzak util-linux-2.23.2/sys-utils/unshare.c +--- util-linux-2.23.2/sys-utils/unshare.c.kzak 2014-03-12 12:39:46.385858383 +0100 ++++ util-linux-2.23.2/sys-utils/unshare.c 2014-03-12 12:44:49.955005384 +0100 +@@ -45,7 +45,6 @@ static void usage(int status) + fputs(_(" -i, --ipc unshare System V IPC namespace\n"), out); + fputs(_(" -n, --net unshare network namespace\n"), out); + fputs(_(" -p, --pid unshare pid namespace\n"), out); +- fputs(_(" -U, --user unshare user namespace\n"), out); + + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); +@@ -65,7 +64,6 @@ int main(int argc, char *argv[]) + { "ipc", no_argument, 0, 'i' }, + { "net", no_argument, 0, 'n' }, + { "pid", no_argument, 0, 'p' }, +- { "user", no_argument, 0, 'U' }, + { NULL, 0, 0, 0 } + }; + +@@ -78,7 +76,7 @@ int main(int argc, char *argv[]) + textdomain(PACKAGE); + atexit(close_stdout); + +- while ((c = getopt_long(argc, argv, "hVmuinpU", longopts, NULL)) != -1) { ++ while ((c = getopt_long(argc, argv, "hVmuinp", longopts, NULL)) != -1) { + switch (c) { + case 'h': + usage(EXIT_SUCCESS); +@@ -100,9 +98,6 @@ int main(int argc, char *argv[]) + case 'p': + unshare_flags |= CLONE_NEWPID; + break; +- case 'U': +- unshare_flags |= CLONE_NEWUSER; +- break; + default: + usage(EXIT_FAILURE); + } diff --git a/SPECS/util-linux.spec b/SPECS/util-linux.spec index 1c7f28b..7a1ca6b 100644 --- a/SPECS/util-linux.spec +++ b/SPECS/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.23.2 -Release: 6%{?dist} +Release: 16%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -97,6 +97,34 @@ Patch8: 2.24-libmount-mem.patch Patch9: 2.24-sfdisk-y-n-miscmatch.patch # v2.24 backport: #1007885 - utmpdump is not IPv6 ready Patch10: 2.24-utmpdump-ipv6.patch +# v2.24 backport: #1024366 - losetup does not use loop-control to add device +Patch11: 2.24-losetup-add-device.patch +# v2.24 backport: 1016471 - Document that blockdev --setbsz call has never worked +Patch12: 2.24-blockdev-setbsz-hint.patch +# v2.25 backport: #1039189 - taskset man page PERMISSIONS section is incorrect +Patch13: 2.25-taskset-man-fix-permissions.patch +# v2.25 backport: #1050852 - lscpu: support discontinuous NUMA nodes +Patch14: 2.25-lib-add-path_strdup.patch +Patch15: 2.25-lscpu-discontinuous-NUMA-nodes.patch +Patch16: 2.25-lscpu-sort-NUMA.patch +# v2.25 backport: #1046849 - filesystem type is not correctly displayed by df command +Patch17: 2.25-libblkid-Identify-extN-file-system-properly.patch +# v2.25 backport: #1055490 - libblkid: Do not problem for backup btrfs superblock +Patch18: 2.25-libblkid-no-more-probe-for-btrfs-backup-superblock.patch +# v2.25 backport: #1054186 - wipefs does not clean gpt header fully, PMBR remains +Patch19: 2.25-libblkid-detect-alone-PMBR.patch +Patch20: 2.25-wipefs-call-BLKRRPART-when-erase-partition-table.patch +# v2.25 backport: #977162 - fix the description of XFS "allocsize=" +Patch21: 2.25-mount-man-xfs.patch +# rhel7.0: #1073851 - disable user namespaces +Patch22: rhel7.0-unshare-user.patch +# v2.25 backpoprt: #1078618 - flock nfs file fails on nfsv4 +Patch23: 2.25-flock-nfs4.patch +# v2.25 backport: #1047376 - blkid hangs while reading from /dev/fd0 +Patch24: 2.25-libblkid-io-errors.patch +#v2.24 and v2.25 backport: #1079931 - fsck: warning on kdump boot +Patch25: 2.24-fsck-fstab.patch +Patch26: 2.25-fsck-nohelper.patch %description The util-linux package contains a large variety of low-level system @@ -104,7 +132,6 @@ utilities that are necessary for a Linux system to function. Among others, Util-linux contains the fdisk configuration tool and the login program. - %package -n libmount Summary: Device mounting library Group: Development/Libraries @@ -209,12 +236,9 @@ SMP systems. %prep -%setup -q -n %{name}-%{upstream_version} -cp %{SOURCE8} %{SOURCE9} . +%autosetup -p1 -n %{name}-%{upstream_version} -for p in %{patches}; do - %{__patch} -p1 -F%{_default_patch_fuzz} -i "$p" -done +cp %{SOURCE8} %{SOURCE9} . %build unset LINGUAS || : @@ -813,6 +837,42 @@ fi %{_libdir}/pkgconfig/uuid.pc %changelog +* Fri Mar 28 2014 Karel Zak 2.23.2-16 +- fix bugs in patch for #1047376 + +* Tue Mar 25 2014 Karel Zak 2.23.2-15 +- fix #1078618 - flock nfs file fails on nfsv4 +- fix #1047376 - blkid hangs while reading from /dev/fd0 +- fix #1079931 - fsck: warning on kdump boot + +* Wed Mar 12 2014 Karel Zak 2.23.2-14 +- fix #1073851 - disable user namespaces at all + +* Thu Feb 20 2014 Karel Zak 2.23.2-13 +- fix #1061751 - nsenter set uid for user namespaces + +* Fri Jan 24 2014 Daniel Mach - 2.23.2-12 +- Mass rebuild 2014-01-24 + +* Thu Jan 23 2014 Karel Zak 2.23.2-11 +- fix #1046849 - filesystem type is not correctly displayed by df command +- fix #1055490 - libblkid: Do not problem for backup btrfs superblock +- fix #1054186 - wipefs does not clean gpt header fully, PMBR remains + +* Tue Jan 14 2014 Karel Zak 2.23.2-10 +- sort NOMA nodes in lscpu(1) output to improve fix for #1050852 + +* Tue Jan 14 2014 Karel Zak 2.23.2-9 +- fix #1039189 - taskset man page PERMISSIONS section is incorrect +- fix #1050852 - lscpu: support discontinuous NUMA nodes + +* Fri Dec 27 2013 Daniel Mach - 2.23.2-8 +- Mass rebuild 2013-12-27 + +* Fri Nov 15 2013 Karel Zak 2.23.2-7 +- fix #1024366 - losetup does not use loop-control to add device +- fix #1016471 - document that blockdev --setbsz call has never worked + * Mon Oct 7 2013 Karel Zak 2.23.2-6 - fix #1010193 - libmount umount issues - fix #1009349 - Joking sfdisk rewriting PT after "n"