diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/blkid/libblkid.3 | 35 | ||||
-rw-r--r-- | libs/blkid/src/config.c | 3 | ||||
-rw-r--r-- | libs/blkid/src/evaluate.c | 3 | ||||
-rw-r--r-- | libs/blkid/src/probe.c | 53 | ||||
-rw-r--r-- | libs/blkid/src/probers/reiserfs.c | 2 | ||||
-rw-r--r-- | libs/blkid/src/read.c | 1 |
6 files changed, 65 insertions, 32 deletions
diff --git a/libs/blkid/libblkid.3 b/libs/blkid/libblkid.3 index 89747ecf..46eb868b 100644 --- a/libs/blkid/libblkid.3 +++ b/libs/blkid/libblkid.3 @@ -5,7 +5,7 @@ .\" This file may be copied under the terms of the GNU Public License. .\" .\" Created Wed Sep 14 12:02:12 2001, Andreas Dilger -.TH LIBBLKID 3 "February 2009" "Linux" "MAINTENANCE COMMANDS"" +.TH LIBBLKID 3 "May 2009" "util-linux-ng" .SH NAME libblkid \- block device identification library .SH SYNOPSIS @@ -45,14 +45,43 @@ some way to locate these devices without enumerating only visible devices, so the use of the cache file is .B required in this situation. +.SH CONFIGURATION FILE +The standard location of the +.I /etc/blkid.conf +config file can be overridden by the environment variable BLKID_CONF. +The following options control the libblkid library: +.TP +.I SEND_UEVENT=<yes|not> +Sends uevent when +.I /dev/disk/by-{label,uuid}/ +symlink does not match with LABEL or UUID on the device. Default is "yes". +.TP +.I CACHE_FILE=<path> +Overrides the standard location of the cache file. This setting can be +overridden by the environment variable BLKID_FILE. Default is +.I /etc/blkid.tab. +.TP +.I EVALUATE=<methods> +Defines LABEL and UUID evaluation method(s). Currently, the libblkid library +supports "udev" and "scan" methods. More than one methods may be specified in +a comma separated list. Default is "udev,scan". The "udev" method uses udev +.I /dev/disk/by-* +symlinks and the "scan" method scans all block devices from the +.I /proc/partitions +file. .SH AUTHOR .B libblkid was written by Andreas Dilger for the ext2 filesystem utilties, with input from Ted Ts'o. The library was subsequently heavily modified by Ted Ts'o. + +The low-level probing code was rewritten by Karel Zak. .SH FILES -.TP +.TP 18 .I /etc/blkid.tab -Caches data extracted from each recognized block device. +caches data extracted from each recognized block device +.TP +.I /etc/blkid.conf +configuration file .SH AVAILABILITY .B libblkid is part of the util-linux-ng package since version 2.15 and is available from diff --git a/libs/blkid/src/config.c b/libs/blkid/src/config.c index 2e592181..9091736b 100644 --- a/libs/blkid/src/config.c +++ b/libs/blkid/src/config.c @@ -24,9 +24,6 @@ #include <errno.h> #endif #include <stdint.h> -#ifdef HAVE_LIBUUID -#include <uuid/uuid.h> -#endif #include <stdarg.h> #include "blkdev.h" diff --git a/libs/blkid/src/evaluate.c b/libs/blkid/src/evaluate.c index a9c9fbab..f0ae1266 100644 --- a/libs/blkid/src/evaluate.c +++ b/libs/blkid/src/evaluate.c @@ -27,9 +27,6 @@ #include <errno.h> #endif #include <stdint.h> -#ifdef HAVE_LIBUUID -#include <uuid/uuid.h> -#endif #include <stdarg.h> #include "pathnames.h" diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index 0e4745ac..38d42762 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -160,6 +160,11 @@ static void blkid_probe_reset_vals(blkid_probe pr) pr->nvals = 0; } +static void blkid_probe_reset_idx(blkid_probe pr) +{ + pr->idx = -1; +} + void blkid_reset_probe(blkid_probe pr) { if (!pr) @@ -169,14 +174,13 @@ void blkid_reset_probe(blkid_probe pr) memset(pr->buf, 0, pr->buf_max); pr->buf_off = 0; pr->buf_len = 0; - pr->idx = 0; if (pr->sbbuf) memset(pr->sbbuf, 0, BLKID_SB_BUFSIZ); pr->sbbuf_len = 0; blkid_probe_reset_vals(pr); + blkid_probe_reset_idx(pr); } - /* * Note that we have two offsets: * @@ -263,7 +267,6 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->fd = fd; pr->off = off; pr->size = 0; - pr->idx = 0; if (size) pr->size = size; @@ -307,7 +310,7 @@ int blkid_probe_reset_filter(blkid_probe pr) return -1; if (pr->fltr) memset(pr->fltr, 0, BLKID_FLTR_SIZE * sizeof(unsigned long)); - pr->idx = 0; + blkid_probe_reset_idx(pr); return 0; } @@ -324,9 +327,10 @@ int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[]) if (!pr || !names) return -1; - if (!pr->fltr) + if (!pr->fltr) { pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long)); - else + blkid_probe_reset_idx(pr); + } else blkid_probe_reset_filter(pr); if (!pr->fltr) @@ -355,7 +359,6 @@ int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[]) } } DBG(DEBUG_LOWPROBE, printf("a new probing type-filter initialized\n")); - pr->idx = 0; return 0; } @@ -375,9 +378,10 @@ int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage) if (!pr || !usage) return -1; - if (!pr->fltr) + if (!pr->fltr) { pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long)); - else + blkid_probe_reset_idx(pr); + } else blkid_probe_reset_filter(pr); if (!pr->fltr) @@ -393,7 +397,6 @@ int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage) blkid_bmp_set_item(pr->fltr, i); } DBG(DEBUG_LOWPROBE, printf("a new probing usage-filter initialized\n")); - pr->idx = 0; return 0; } @@ -407,8 +410,8 @@ int blkid_probe_invert_filter(blkid_probe pr) for (i = 0; i < BLKID_FLTR_SIZE; i++) pr->fltr[i] = ~pr->fltr[i]; + blkid_probe_reset_idx(pr); DBG(DEBUG_LOWPROBE, printf("probing filter inverted\n")); - pr->idx = 0; return 0; } @@ -450,18 +453,16 @@ int blkid_do_probe(blkid_probe pr) { int i = 0; - if (!pr) + if (!pr || pr->idx < -1) return -1; blkid_probe_reset_vals(pr); - if (pr->idx) - i = pr->idx + 1; + DBG(DEBUG_LOWPROBE, + printf("--> starting probing loop [idx=%d]\n", + pr->idx)); - if (i < 0 && i >= ARRAY_SIZE(idinfos)) - return -1; - - DBG(DEBUG_LOWPROBE, printf("--> starting probing loop\n")); + i = pr->idx + 1; for ( ; i < ARRAY_SIZE(idinfos); i++) { const struct blkid_idinfo *id; @@ -516,10 +517,13 @@ int blkid_do_probe(blkid_probe pr) blkid_probe_set_usage(pr, id->usage); DBG(DEBUG_LOWPROBE, - printf("<-- leaving probing loop (type=%s)\n", id->name)); + printf("<-- leaving probing loop (type=%s) [idx=%d]\n", + id->name, pr->idx)); return 0; } - DBG(DEBUG_LOWPROBE, printf("<-- leaving probing loop (failed)\n")); + DBG(DEBUG_LOWPROBE, + printf("<-- leaving probing loop (failed) [idx=%d]\n", + pr->idx)); return 1; } @@ -527,6 +531,10 @@ int blkid_do_probe(blkid_probe pr) * This is the same function as blkid_do_probe(), but returns only one result * (cannot be used in while()) and checks for ambivalen results (more * filesystems on the device) -- in such case returns -2. + * + * The function does not check for filesystems when a RAID signature is + * detected. The function also does not check for collision between RAIDs. The + * first detected RAID is returned. */ int blkid_do_safeprobe(blkid_probe pr) { @@ -542,9 +550,12 @@ int blkid_do_safeprobe(blkid_probe pr) first.nvals = pr->nvals; first.idx = pr->idx; } + count++; + + if (idinfos[pr->idx]->usage & BLKID_USAGE_RAID) + break; if (!(idinfos[pr->idx]->flags & BLKID_IDINFO_TOLERANT)) intol++; - count++; } if (rc < 0) return rc; /* error */ diff --git a/libs/blkid/src/probers/reiserfs.c b/libs/blkid/src/probers/reiserfs.c index 29e1faa0..f9a46787 100644 --- a/libs/blkid/src/probers/reiserfs.c +++ b/libs/blkid/src/probers/reiserfs.c @@ -95,7 +95,7 @@ static int probe_reiser4(blkid_probe pr, const struct blkid_idmag *mag) const struct blkid_idinfo reiser_idinfo = { - .name = "reiser", + .name = "reiserfs", .usage = BLKID_USAGE_FILESYSTEM, .probefunc = probe_reiser, .magics = diff --git a/libs/blkid/src/read.c b/libs/blkid/src/read.c index 41638745..b5e9cd02 100644 --- a/libs/blkid/src/read.c +++ b/libs/blkid/src/read.c @@ -25,7 +25,6 @@ #endif #include "blkidP.h" -#include "uuid/uuid.h" #ifdef HAVE_STRTOULL #define STRTOULL strtoull /* defined in stdlib.h if you try hard enough */ |