.BR \-m , " \-\-mtab"
Search in
.IR /etc/mtab .
-The output is in the list format (see \fB\-\-list\fP). The output may include user
+The output is in the list format by default (see \fB\-\-tree\fP). The output may include user
space mount options.
.TP
.BR \-N , " \-\-task \fItid\fP"
more details see
.BR mount (8).
.TP
+.BR " \-\-tree"
+Enable tree-like output if possible. The options is silently ignored for
+tables where is missing child-parent relation (e.g. fstab).
+.TP
.BR \-U , " \-\-uniq"
Ignore filesystems with duplicate mount targets, thus effectively skipping
over-mounted mount points.
fputs(_(" -S, --source <string> the device to mount (by name, maj:min, \n"
" LABEL=, UUID=, PARTUUID=, PARTLABEL=)\n"), out);
fputs(_(" -T, --target <path> the path to the filesystem to use\n"), out);
+ fputs(_(" --tree enable tree format output is possible\n"), out);
fputs(_(" -M, --mountpoint <dir> the mountpoint directory\n"), out);
fputs(_(" -t, --types <list> limit the set of filesystems by FS types\n"), out);
fputs(_(" -U, --uniq ignore filesystems with duplicate target\n"), out);
int ntabfiles = 0, tabtype = 0;
char *outarg = NULL;
size_t i;
+ int force_tree = 0, istree = 0;
struct libscols_table *table = NULL;
enum {
- FINDMNT_OPT_VERBOSE = CHAR_MAX + 1
+ FINDMNT_OPT_VERBOSE = CHAR_MAX + 1,
+ FINDMNT_OPT_TREE
};
static const struct option longopts[] = {
{ "verify", 0, 0, 'x' },
{ "version", 0, 0, 'V' },
{ "verbose", 0, 0, FINDMNT_OPT_VERBOSE },
+ { "tree", 0, 0, FINDMNT_OPT_TREE },
{ NULL, 0, 0, 0 }
};
case FINDMNT_OPT_VERBOSE:
flags |= FL_VERBOSE;
break;
+ case FINDMNT_OPT_TREE:
+ force_tree = 1;
+ break;
default:
usage(stderr);
break;
if (tabtype == TABTYPE_MTAB && tab_is_kernel(tb))
tabtype = TABTYPE_KERNEL;
- if ((flags & FL_TREE) && (ntabfiles > 1 || !tab_is_tree(tb)))
+ istree = tab_is_tree(tb);
+ if (istree && force_tree)
+ flags |= FL_TREE;
+
+ if ((flags & FL_TREE) && (ntabfiles > 1 || !istree))
flags &= ~FL_TREE;
if (!(flags & FL_NOCACHE)) {