findmnt: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
10b4d34dc0
commit
090b5e84b2
|
@ -64,7 +64,7 @@ The search direction -
|
||||||
or
|
or
|
||||||
.IR backward .
|
.IR backward .
|
||||||
.IP "\fB\-e, \-\-evaluate\fP"
|
.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"
|
.IP "\fB\-F, \-\-tab\-file \fIpath\fP"
|
||||||
Search in an alternative file, if used with \fB\-\-fstab\fP, \fB\-\-mtab\fP
|
Search in an alternative file, if used with \fB\-\-fstab\fP, \fB\-\-mtab\fP
|
||||||
or \fB\-\-kernel\fP then overwrites the default paths.
|
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
|
Do not truncate text in columns. The default is to not truncate the
|
||||||
.BR TARGET ,
|
.BR TARGET ,
|
||||||
.BR SOURCE ,
|
.BR SOURCE ,
|
||||||
.BR UUID
|
.BR UUID ,
|
||||||
and
|
.BR LABEL ,
|
||||||
.BR LABEL
|
.BR PARTUUID ,
|
||||||
|
.BR PARTLABEL
|
||||||
columns. This option disables text truncation also in all other columns.
|
columns. This option disables text truncation also in all other columns.
|
||||||
.IP "\fB\-O, \-\-options \fIlist\fP"
|
.IP "\fB\-O, \-\-options \fIlist\fP"
|
||||||
Limit the set of printed filesystems. More than one option
|
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
|
individual items in the list. The "no" prefix interpratation could be disabled
|
||||||
by "+" prefix.
|
by "+" prefix.
|
||||||
.IP "\fB\-o, \-\-output \fIlist\fP"
|
.IP "\fB\-o, \-\-output \fIlist\fP"
|
||||||
Define output columns. Currently supported are
|
Define output columns. See the \fB\-\-help\fP output to get list of the
|
||||||
.BR ACTION,
|
currently supported columns. The
|
||||||
.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
|
|
||||||
.BR TARGET
|
.BR TARGET
|
||||||
column contains tree formatting if the
|
column contains tree formatting if the
|
||||||
.B \-\-list
|
.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
|
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.
|
default. This option has no effect for \fB\-\-mtab\fP or \fB\-\-fstab\fP.
|
||||||
.IP "\fB\-S, \-\-source \fIspec\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"
|
.IP "\fB\-T, \-\-target \fIdir\fP"
|
||||||
Explicitly define the mount target (mountpoint directory).
|
Explicitly define the mount target (mountpoint directory).
|
||||||
.IP "\fB\-w, \-\-timeout \fImilliseconds\fP"
|
.IP "\fB\-w, \-\-timeout \fImilliseconds\fP"
|
||||||
|
|
|
@ -67,6 +67,8 @@ enum {
|
||||||
COL_FS_OPTIONS,
|
COL_FS_OPTIONS,
|
||||||
COL_LABEL,
|
COL_LABEL,
|
||||||
COL_UUID,
|
COL_UUID,
|
||||||
|
COL_PARTLABEL,
|
||||||
|
COL_PARTUUID,
|
||||||
COL_MAJMIN,
|
COL_MAJMIN,
|
||||||
COL_ACTION,
|
COL_ACTION,
|
||||||
COL_OLD_TARGET,
|
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_FS_OPTIONS] = { "FS-OPTIONS", 0.10, TT_FL_TRUNC, N_("FS specific mount options") },
|
||||||
[COL_LABEL] = { "LABEL", 0.10, 0, N_("filesystem label") },
|
[COL_LABEL] = { "LABEL", 0.10, 0, N_("filesystem label") },
|
||||||
[COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID") },
|
[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_MAJMIN] = { "MAJ:MIN", 6, 0, N_("major:minor device number") },
|
||||||
[COL_ACTION] = { "ACTION", 10, TT_FL_STRICTWIDTH, N_("action detected by --poll") },
|
[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") },
|
[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:
|
case COL_UUID:
|
||||||
str = get_tag(fs, "UUID");
|
str = get_tag(fs, "UUID");
|
||||||
break;
|
break;
|
||||||
|
case COL_PARTUUID:
|
||||||
|
str = get_tag(fs, "PARTUUID");
|
||||||
|
break;
|
||||||
case COL_LABEL:
|
case COL_LABEL:
|
||||||
str = get_tag(fs, "LABEL");
|
str = get_tag(fs, "LABEL");
|
||||||
break;
|
break;
|
||||||
|
case COL_PARTLABEL:
|
||||||
|
str = get_tag(fs, "PARTLABEL");
|
||||||
|
break;
|
||||||
|
|
||||||
case COL_MAJMIN:
|
case COL_MAJMIN:
|
||||||
{
|
{
|
||||||
dev_t devno = mnt_fs_get_devno(fs);
|
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"
|
" -c, --canonicalize canonicalize printed paths\n"
|
||||||
" -D, --df imitate the output of df(1)\n"
|
" -D, --df imitate the output of df(1)\n"
|
||||||
" -d, --direction <word> direction of search, 'forward' or 'backward'\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, --tab-file <path> alternative file for --fstab, --mtab or --kernel options\n"
|
||||||
" -f, --first-only print the first found filesystem only\n"));
|
" -f, --first-only print the first found filesystem only\n"));
|
||||||
|
|
||||||
|
@ -920,7 +931,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
|
||||||
fprintf(out, _(
|
fprintf(out, _(
|
||||||
" -v, --nofsroot don't print [/dir] for bind or btrfs mounts\n"
|
" -v, --nofsroot don't print [/dir] for bind or btrfs mounts\n"
|
||||||
" -R, --submounts print all submounts for the matching filesystems\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"));
|
" -T, --target <string> the mountpoint to use\n"));
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
|
@ -1184,7 +1195,8 @@ int main(int argc, char *argv[])
|
||||||
*/
|
*/
|
||||||
const char *x = get_match(COL_SOURCE);
|
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;
|
flags |= FL_NOSWAPMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue