updated on Sat Jan 21 20:03:50 UTC 2012
[aur-mirror.git] / util-linux-ng-aes / util-linux-ng-blkid.patch
blobad99d7c31262375a1222e14047206b82894b7233
1 diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8
2 index 8968bb2..b2c43a6 100644
3 --- a/misc-utils/blkid.8
4 +++ b/misc-utils/blkid.8
5 @@ -160,7 +160,12 @@ print the device name only, this output format is always enabled for \fB-L\fR
6 and \fB-U\fR options
7 .TP
8 .B udev
9 -print key="value" pairs for easy import into the udev environment
10 +print key="value" pairs for easy import into the udev environment. The keys are
11 +prefixed by ID_FS_ or ID_PART_ prefixes.
13 +The udev output returns ID_FS_AMBIVALENT tag if more superblocks are detected,
14 +and ID_PART_ENTRY_* tags are always returned for all partitions including empty
15 +partitions.
16 .TP
17 .B export
18 print key=value pairs for easy import into the environment. This output format
19 @@ -173,6 +178,9 @@ used together with \fB-i\fR option.
20 .TP
21 .BI \-p
22 Switch to low-level superblock probing mode (bypass cache).
24 +Note that low-level probing also returns information about partition table type
25 +(PTTYPE tag) and partitions (PART_ENTRY_* tags).
26 .TP
27 .BI \-s " tag"
28 For each (specified) device, show only the tags that match
29 @@ -245,9 +253,15 @@ appear in
30 are shown, if they are recognized.
31 .SH "RETURN CODE"
32 If the specified token was found, or if any tags were shown from (specified)
33 -devices, 0 is returned. If the specified token was not found, or no
34 -(specified) devices could be identified, an exit code of 2 is returned.
35 +devices, 0 is returned.
37 +If the specified token was not found, or no (specified) devices could be
38 +identified an exit code of 2 is returned.
40 For usage or other errors, an exit code of 4 is returned.
42 +If the ambivalent low-level probing result was detected an exit code of 8 is
43 +returned.
44 .SH AUTHOR
45 .B blkid
46 was written by Andreas Dilger for libblkid and improved by Theodore Ts'o
47 diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
48 index f94df06..343d05d 100644
49 --- a/misc-utils/blkid.c
50 +++ b/misc-utils/blkid.c
51 @@ -513,13 +513,28 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
52 if (rc < 0)
53 goto done;
55 - nvals = blkid_probe_numof_values(pr);
56 + if (!rc)
57 + nvals = blkid_probe_numof_values(pr);
59 + if (nvals &&
60 + !(output & OUTPUT_UDEV_LIST) &&
61 + !blkid_probe_has_value(pr, "TYPE") &&
62 + !blkid_probe_has_value(pr, "PTTYPE"))
63 + /*
64 + * Ignore probing result if there is not any filesystem or
65 + * partition table on the device and udev output is not
66 + * requested.
67 + *
68 + * The udev db stores information about partitions, so
69 + * PART_ENTRY_* values are alway important.
70 + */
71 + nvals = 0;
73 if (nvals && !first && output & (OUTPUT_UDEV_LIST | OUTPUT_EXPORT_LIST))
74 /* add extra line between output from devices */
75 fputc('\n', stdout);
77 - if (output & OUTPUT_DEVICE_ONLY) {
78 + if (nvals && (output & OUTPUT_DEVICE_ONLY)) {
79 printf("%s\n", devname);
80 goto done;
82 @@ -550,7 +565,13 @@ done:
83 devname);
85 close(fd);
86 - return !nvals ? 2 : 0;
88 + if (rc == -2)
89 + return 8; /* ambivalent probing result */
90 + if (!nvals)
91 + return 2; /* nothing detected */
93 + return 0; /* sucess */
96 /* converts comma separated list to BLKID_USAGE_* mask */