]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: add support for PARTUUID= and PARTLABEL=
authorKarel Zak <kzak@redhat.com>
Thu, 19 Apr 2012 12:38:53 +0000 (14:38 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 19 Apr 2012 12:38:53 +0000 (14:38 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.8
misc-utils/findmnt.c

index d5a98b4e2cc267a8e42941f700c93befeaf65d9e..0c710a80d21c543c2f9130b67a7b615e04ee65cd 100644 (file)
@@ -64,7 +64,7 @@ The search direction -
 or
 .IR backward .
 .IP "\fB\-e, \-\-evaluate\fP"
-Convert all tags (LABEL or UUID) to the device names.
+Convert all tags (LABEL, UUID, PARTUUID or PARTLABEL) to the device names.
 .IP "\fB\-F, \-\-tab\-file \fIpath\fP"
 Search in an alternative file, if used with \fB\-\-fstab\fP, \fB\-\-mtab\fP
 or \fB\-\-kernel\fP then overwrites the default paths.
@@ -84,9 +84,10 @@ Do not print a header line.
 Do not truncate text in columns.  The default is to not truncate the
 .BR TARGET ,
 .BR SOURCE ,
-.BR UUID
-and
-.BR LABEL
+.BR UUID ,
+.BR LABEL ,
+.BR PARTUUID ,
+.BR PARTLABEL
 columns.  This option disables text truncation also in all other columns.
 .IP "\fB\-O, \-\-options \fIlist\fP"
 Limit the set of printed filesystems.  More than one option
@@ -102,24 +103,8 @@ at the beginning does not have global meaning. The "no" could used for
 individual items in the list. The "no" prefix interpratation could be disabled
 by "+" prefix.
 .IP "\fB\-o, \-\-output \fIlist\fP"
-Define output columns.  Currently supported are
-.BR ACTION,
-.BR SOURCE ,
-.BR TARGET ,
-.BR OLD-TARGET,
-.BR FSTYPE ,
-.BR OPTIONS ,
-.BR OLD-OPTIONS,
-.BR VFS-OPTIONS ,
-.BR FS-OPTIONS ,
-.BR SIZE ,
-.BR AVAIL ,
-.BR USED ,
-.BR USE% ,
-.BR LABEL
-and
-.BR UUID .
-The
+Define output columns. See the \fB\-\-help\fP output to get list of the
+currently supported columns. The
 .BR TARGET
 column contains tree formatting if the
 .B \-\-list
@@ -169,7 +154,8 @@ defined by options \fB\-t\fP, \fB\-O\fP, \fB\-S\fP, \fB\-T\fP and
 printed in tree-like order.  The option enables the tree-like output format by
 default.  This option has no effect for \fB\-\-mtab\fP or \fB\-\-fstab\fP.
 .IP "\fB\-S, \-\-source \fIspec\fP"
-Explicitly define the mount source.  Supported are \fIdevice\fR, \fILABEL=\fR and \fIUUID=\fR.
+Explicitly define the mount source.  Supported are \fIdevice\fR, \fILABEL=\fR,
+\fIUUID=\fR, \fIPARTLABEL=\fR or \fIPARTUUID=\fR.
 .IP "\fB\-T, \-\-target \fIdir\fP"
 Explicitly define the mount target (mountpoint directory).
 .IP "\fB\-w, \-\-timeout \fImilliseconds\fP"
index 172f38915b0ec0a49bee76a7a41ed1756aee3385..cf69c429b2b8f649dae255b035c0122b23c5cd1e 100644 (file)
@@ -67,6 +67,8 @@ enum {
        COL_FS_OPTIONS,
        COL_LABEL,
        COL_UUID,
+       COL_PARTLABEL,
+       COL_PARTUUID,
        COL_MAJMIN,
        COL_ACTION,
        COL_OLD_TARGET,
@@ -104,6 +106,8 @@ static struct colinfo infos[FINDMNT_NCOLUMNS] = {
        [COL_FS_OPTIONS]   = { "FS-OPTIONS",   0.10, TT_FL_TRUNC, N_("FS specific mount options") },
        [COL_LABEL]        = { "LABEL",        0.10, 0, N_("filesystem label") },
        [COL_UUID]         = { "UUID",           36, 0, N_("filesystem UUID") },
+       [COL_PARTLABEL]    = { "PARTLABEL",    0.10, 0, N_("partition label") },
+       [COL_PARTUUID]     = { "PARTUUID",       36, 0, N_("partition UUID") },
        [COL_MAJMIN]       = { "MAJ:MIN",         6, 0, N_("major:minor device number") },
        [COL_ACTION]       = { "ACTION",         10, TT_FL_STRICTWIDTH, N_("action detected by --poll") },
        [COL_OLD_OPTIONS]  = { "OLD-OPTIONS",  0.10, TT_FL_TRUNC, N_("old mount options saved by --poll") },
@@ -378,9 +382,16 @@ static const char *get_data(struct libmnt_fs *fs, int num)
        case COL_UUID:
                str = get_tag(fs, "UUID");
                break;
+       case COL_PARTUUID:
+               str = get_tag(fs, "PARTUUID");
+               break;
        case COL_LABEL:
                str = get_tag(fs, "LABEL");
                break;
+       case COL_PARTLABEL:
+               str = get_tag(fs, "PARTLABEL");
+               break;
+
        case COL_MAJMIN:
        {
                dev_t devno = mnt_fs_get_devno(fs);
@@ -902,7 +913,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
        " -c, --canonicalize     canonicalize printed paths\n"
        " -D, --df               imitate the output of df(1)\n"
        " -d, --direction <word> direction of search, 'forward' or 'backward'\n"
-       " -e, --evaluate         convert tags (LABEL/UUID) to device names\n"
+       " -e, --evaluate         convert tags (LABEL/UUID,PARTUUID,PARTLABEL) to device names\n"
        " -F, --tab-file <path>  alternative file for --fstab, --mtab or --kernel options\n"
        " -f, --first-only       print the first found filesystem only\n"));
 
@@ -920,7 +931,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
        fprintf(out, _(
        " -v, --nofsroot         don't print [/dir] for bind or btrfs mounts\n"
        " -R, --submounts        print all submounts for the matching filesystems\n"
-       " -S, --source <string>  the device to mount (by name, LABEL= or UUID=)\n"
+       " -S, --source <string>  the device to mount (by name, LABEL=, UUID=, PARTUUID=, ...)\n"
        " -T, --target <string>  the mountpoint to use\n"));
 
        fputs(USAGE_SEPARATOR, out);
@@ -1184,7 +1195,8 @@ int main(int argc, char *argv[])
                 */
                const char *x = get_match(COL_SOURCE);
 
-               if (!strncmp(x, "LABEL=", 6) || !strncmp(x, "UUID=", 5))
+               if (!strncmp(x, "LABEL=", 6) || !strncmp(x, "UUID=", 5) ||
+                   !strncmp(x, "PARTLABEL=", 10) || !strncmp(x, "PARTUUID=", 9))
                        flags |= FL_NOSWAPMATCH;
        }