LABEL=<label>). This look up method is able to reliable use /dev/disk/by-label
udev symlinks (depends on setting in /etc/blkid.conf). Avoid to use the
symlinks directly. It is not reliable to use the symlinks without verification.
-The \fB-L\fR option is portable and works on systems with and without udev.
+The \fB-L\fR option works on systems with and without udev.
+
+Unfortunately, the original
+.B blkid(8)
+from e2fsprogs use the \fB-L\fR option as a
+synonym to the \fB-o list\fR option. For better portability use "-l -o device
+-t LABEL=<label>" and "-o list" in your scripts rather than -L option.
.TP
.B \-u " list "
Restrict probing functions to defined (comma separated) list of "usage" types.
print the value of the tags
.TP
.B list
-print the devices in a user-friendly format
+print the devices in a user-friendly format, this output format is unsupported
+for low-level probing (\fB-p\fR)
.TP
.B device
-print the device name only
+print the device name only, this output format is always enabled for \fB-L\fR
+and \fB-U\fR options
.TP
.B udev
vol_id compatible mode; usable in udev rules
#include <blkid.h>
+#include "ismounted.h"
+
const char *progname = "blkid";
static void print_version(FILE *out)
static void pretty_print_dev(blkid_dev dev)
{
- fprintf(stderr, "pretty print not implemented yet\n");
-
-#ifdef NOT_IMPLEMENTED
blkid_tag_iterate iter;
const char *type, *value, *devname;
const char *uuid = "", *fs_type = "", *label = "";
- char *cp;
int len, mount_flags;
char mtpt[80];
- errcode_t retval;
+ int retval;
if (dev == NULL) {
pretty_print_line("device", "fs_type", "label",
/* Get the mount point */
mtpt[0] = 0;
- retval = ext2fs_check_mount_point(devname, &mount_flags,
- mtpt, sizeof(mtpt));
+ retval = check_mount_point(devname, &mount_flags, mtpt, sizeof(mtpt));
if (retval == 0) {
- if (mount_flags & EXT2_MF_MOUNTED) {
+ if (mount_flags & MF_MOUNTED) {
if (!mtpt[0])
strcpy(mtpt, "(mounted, mtpt unknown)");
- } else if (mount_flags & EXT2_MF_BUSY)
+ } else if (mount_flags & MF_BUSY)
strcpy(mtpt, "(in use)");
else
strcpy(mtpt, "(not mounted)");
}
pretty_print_line(devname, fs_type, label, mtpt, uuid);
-#endif
}
static void print_udev_format(const char *name, const char *value, size_t sz)
}
err = 2;
- if (output_format & OUTPUT_PRETTY_LIST)
+ if (eval == 0 && output_format & OUTPUT_PRETTY_LIST) {
+ if (lowprobe) {
+ fprintf(stderr, "The low-level probing mode does not "
+ "support 'list' output format\n");
+ exit(4);
+ }
pretty_print_dev(NULL);
+ }
if (lowprobe) {
/*
blkid_probe pr;
if (!numdev) {
- fprintf(stderr, "The low-probe option requires a device\n");
+ fprintf(stderr, "The low-level probing mode "
+ "requires a device\n");
exit(4);
}
pr = blkid_new_probe();