.IR mountpoint
is not given, all filesystems are shown.
.PP
+The device may be specified by device name, maj:min, filesystem LABEL or UUID
+or partition PARTUUID or PARTLABEL. Note that device name may be interpreted
+as mountpoint (and vice versa) if --target or --source options are not
+specified.
+.PP
The command prints all mounted filesystems in the tree-like format by default.
.SH OPTIONS
.IP "\fB\-h, \-\-help\fP"
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,
-\fIUUID=\fR, \fIPARTLABEL=\fR or \fIPARTUUID=\fR.
+Explicitly define the mount source. Supported are \fIdevice\fR, \fImaj:min\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"
int flags; /* tt flags */
const char *help; /* column description */
const char *match; /* pattern for match_func() */
+ void *match_data; /* match specific data */
};
/* columns descriptions (don't use const, this is writable) */
return infos[id].match;
}
+static void *get_match_data(int id)
+{
+ assert(id < FINDMNT_NCOLUMNS);
+ return infos[id].match_data;
+}
+
static void set_match(int id, const char *match)
{
assert(id < FINDMNT_NCOLUMNS);
infos[id].match = match;
}
+static void set_match_data(int id, void *data)
+{
+ assert(id < FINDMNT_NCOLUMNS);
+ infos[id].match_data = data;
+}
+
+static void set_source_match(const char *data)
+{
+ int maj, min;
+
+ if (sscanf(data, "%d:%d", &maj, &min) == 2) {
+ dev_t *devno = xmalloc(sizeof(dev_t));
+
+ *devno = makedev(maj, min);
+ set_match(COL_MAJMIN, data);
+ set_match_data(COL_MAJMIN, (void *) devno);
+ } else
+ set_match(COL_SOURCE, data);
+}
+
+
static int is_tabdiff_column(int id)
{
assert(id < FINDMNT_NCOLUMNS);
return (!get_match(COL_SOURCE) &&
!get_match(COL_TARGET) &&
!get_match(COL_FSTYPE) &&
- !get_match(COL_OPTIONS));
+ !get_match(COL_OPTIONS) &&
+ !get_match(COL_MAJMIN));
}
/*
{
int rc = flags & FL_INVERT ? 1 : 0;
const char *m;
+ void *md;
m = get_match(COL_TARGET);
if (m && !mnt_fs_match_target(fs, m, cache))
if (m && !mnt_fs_match_options(fs, m))
return rc;
+ md = get_match_data(COL_MAJMIN);
+ if (md && mnt_fs_get_devno(fs) != *((dev_t *) md))
+ return rc;
+
if ((flags & FL_DF) && !(flags & FL_ALL)) {
const char *type = mnt_fs_get_fstype(fs);
get_match(COL_SOURCE) && !get_match(COL_TARGET)) {
/*
* findmnt --poll /foo
- * The '/foo' source as well as target.
+ * The '/foo' maybe source as well as target.
*/
const char *str = get_match(COL_SOURCE);
" -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,PARTUUID,PARTLABEL) to device names\n"
+ " -e, --evaluate convert tags (LABEL,UUID,PARTUUID,PARTLABEL) \n"
+ " 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"));
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=, UUID=, PARTUUID=, ...)\n"
+ " -S, --source <string> the device to mount (by name, maj:min, \n"
+ " LABEL=, UUID=, PARTUUID=, PARTLABEL=)\n"
" -T, --target <string> the mountpoint to use\n"));
fputs(USAGE_SEPARATOR, out);
flags |= FL_SUBMOUNTS;
break;
case 'S':
- set_match(COL_SOURCE, optarg);
+ set_source_match(optarg);
flags |= FL_NOSWAPMATCH;
break;
case 'T':
"with command line element that is not an option"));
if (optind < argc)
- set_match(COL_SOURCE, argv[optind++]); /* dev/tag/mountpoint */
+ set_source_match(argv[optind++]); /* dev/tag/mountpoint/maj:min */
if (optind < argc)
set_match(COL_TARGET, argv[optind++]); /* mountpoint */