findmnt: add --shadowed
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
1c81dfff1a
commit
3ab4ef3ca9
|
@ -193,6 +193,9 @@ available for umount and remount actions
|
||||||
.B \-\-pseudo
|
.B \-\-pseudo
|
||||||
Print only pseudo filesystems.
|
Print only pseudo filesystems.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-\-shadowed
|
||||||
|
Print only filesystems over-mounted by another filesystem.
|
||||||
|
.TP
|
||||||
.BR \-R , " \-\-submounts"
|
.BR \-R , " \-\-submounts"
|
||||||
Print recursively all submounts for the selected filesystems. The restrictions
|
Print recursively all submounts for the selected filesystems. The restrictions
|
||||||
defined by options \fB\-t\fP, \fB\-O\fP, \fB\-S\fP, \fB\-T\fP and
|
defined by options \fB\-t\fP, \fB\-O\fP, \fB\-S\fP, \fB\-T\fP and
|
||||||
|
|
|
@ -970,6 +970,14 @@ static int match_func(struct libmnt_fs *fs,
|
||||||
if ((flags & FL_PSEUDO) && !mnt_fs_is_pseudofs(fs))
|
if ((flags & FL_PSEUDO) && !mnt_fs_is_pseudofs(fs))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
if ((flags & FL_SHADOWED)) {
|
||||||
|
struct libmnt_table *tb = NULL;
|
||||||
|
|
||||||
|
mnt_fs_get_table(fs, &tb);
|
||||||
|
if (tb && mnt_table_over_fs(tb, fs, NULL) != 0)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
return !rc;
|
return !rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,6 +1262,7 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(_(" --output-all output all available columns\n"), out);
|
fputs(_(" --output-all output all available columns\n"), out);
|
||||||
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
|
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
|
||||||
fputs(_(" --pseudo print only pseudo-filesystems\n"), out);
|
fputs(_(" --pseudo print only pseudo-filesystems\n"), out);
|
||||||
|
fputs(_(" --shadowed print only filesystems over-mounted by another filesystem\n"), out);
|
||||||
fputs(_(" -R, --submounts print all submounts for the matching filesystems\n"), out);
|
fputs(_(" -R, --submounts print all submounts for the matching filesystems\n"), out);
|
||||||
fputs(_(" -r, --raw use raw output format\n"), out);
|
fputs(_(" -r, --raw use raw output format\n"), out);
|
||||||
fputs(_(" --real print only real filesystems\n"), out);
|
fputs(_(" --real print only real filesystems\n"), out);
|
||||||
|
@ -1304,7 +1313,8 @@ int main(int argc, char *argv[])
|
||||||
FINDMNT_OPT_OUTPUT_ALL,
|
FINDMNT_OPT_OUTPUT_ALL,
|
||||||
FINDMNT_OPT_PSEUDO,
|
FINDMNT_OPT_PSEUDO,
|
||||||
FINDMNT_OPT_REAL,
|
FINDMNT_OPT_REAL,
|
||||||
FINDMNT_OPT_VFS_ALL
|
FINDMNT_OPT_VFS_ALL,
|
||||||
|
FINDMNT_OPT_SHADOWED
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
|
@ -1349,6 +1359,7 @@ int main(int argc, char *argv[])
|
||||||
{ "real", no_argument, NULL, FINDMNT_OPT_REAL },
|
{ "real", no_argument, NULL, FINDMNT_OPT_REAL },
|
||||||
{ "pseudo", no_argument, NULL, FINDMNT_OPT_PSEUDO },
|
{ "pseudo", no_argument, NULL, FINDMNT_OPT_PSEUDO },
|
||||||
{ "vfs-all", no_argument, NULL, FINDMNT_OPT_VFS_ALL },
|
{ "vfs-all", no_argument, NULL, FINDMNT_OPT_VFS_ALL },
|
||||||
|
{ "shadowed", no_argument, NULL, FINDMNT_OPT_SHADOWED },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1526,6 +1537,9 @@ int main(int argc, char *argv[])
|
||||||
case FINDMNT_OPT_VFS_ALL:
|
case FINDMNT_OPT_VFS_ALL:
|
||||||
flags |= FL_VFS_ALL;
|
flags |= FL_VFS_ALL;
|
||||||
break;
|
break;
|
||||||
|
case FINDMNT_OPT_SHADOWED:
|
||||||
|
flags |= FL_SHADOWED;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
|
|
|
@ -21,14 +21,15 @@ enum {
|
||||||
FL_PSEUDO = (1 << 17),
|
FL_PSEUDO = (1 << 17),
|
||||||
FL_REAL = (1 << 18),
|
FL_REAL = (1 << 18),
|
||||||
FL_VFS_ALL = (1 << 19),
|
FL_VFS_ALL = (1 << 19),
|
||||||
|
FL_SHADOWED = (1 << 20),
|
||||||
|
|
||||||
/* basic table settings */
|
/* basic table settings */
|
||||||
FL_ASCII = (1 << 20),
|
FL_ASCII = (1 << 21),
|
||||||
FL_RAW = (1 << 21),
|
FL_RAW = (1 << 22),
|
||||||
FL_NOHEADINGS = (1 << 22),
|
FL_NOHEADINGS = (1 << 23),
|
||||||
FL_EXPORT = (1 << 23),
|
FL_EXPORT = (1 << 24),
|
||||||
FL_TREE = (1 << 24),
|
FL_TREE = (1 << 25),
|
||||||
FL_JSON = (1 << 25),
|
FL_JSON = (1 << 26),
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct libmnt_cache *cache;
|
extern struct libmnt_cache *cache;
|
||||||
|
|
Loading…
Reference in New Issue