summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorsluidfoe2018-05-08 20:08:47 +0200
committersluidfoe2018-05-10 18:58:30 +0200
commit4c856a471ecc75095b63861d37f2dd4daebbb571 (patch)
treeca028a58d5f7b2bfe0ec0e482ecbec17a3e6443b /misc-utils
parentMerge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetit (diff)
downloadkernel-qcow2-util-linux-4c856a471ecc75095b63861d37f2dd4daebbb571.tar.gz
kernel-qcow2-util-linux-4c856a471ecc75095b63861d37f2dd4daebbb571.tar.xz
kernel-qcow2-util-linux-4c856a471ecc75095b63861d37f2dd4daebbb571.zip
misc-tools/findmnt: add --pseudo, --real filters
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/findmnt.c21
-rw-r--r--misc-utils/findmnt.h2
2 files changed, 22 insertions, 1 deletions
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index c3365534c..09b98cc22 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -947,6 +947,12 @@ static int match_func(struct libmnt_fs *fs,
return rc;
}
+ if ((flags & FL_REAL) && mnt_fs_is_pseudofs(fs))
+ return rc;
+
+ if ((flags & FL_PSEUDO) && !mnt_fs_is_pseudofs(fs))
+ return rc;
+
return !rc;
}
@@ -1229,8 +1235,10 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -o, --output <list> the output columns to be shown\n"), out);
fputs(_(" --output-all output all available columns\n"), out);
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
+ fputs(_(" --pseudo print only pseudo-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(_(" --real print only real filesystems\n"), out);
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);
@@ -1274,7 +1282,9 @@ int main(int argc, char *argv[])
enum {
FINDMNT_OPT_VERBOSE = CHAR_MAX + 1,
FINDMNT_OPT_TREE,
- FINDMNT_OPT_OUTPUT_ALL
+ FINDMNT_OPT_OUTPUT_ALL,
+ FINDMNT_OPT_PSEUDO,
+ FINDMNT_OPT_REAL
};
static const struct option longopts[] = {
@@ -1316,6 +1326,8 @@ int main(int argc, char *argv[])
{ "version", no_argument, NULL, 'V' },
{ "verbose", no_argument, NULL, FINDMNT_OPT_VERBOSE },
{ "tree", no_argument, NULL, FINDMNT_OPT_TREE },
+ { "real", no_argument, NULL, FINDMNT_OPT_REAL },
+ { "pseudo", no_argument, NULL, FINDMNT_OPT_PSEUDO },
{ NULL, 0, NULL, 0 }
};
@@ -1328,6 +1340,7 @@ int main(int argc, char *argv[])
{ 'P','l','r','x' }, /* pairs,list,raw,verify */
{ 'p','x' }, /* poll,verify */
{ 'm','p','s' }, /* mtab,poll,fstab */
+ { FINDMNT_OPT_PSEUDO, FINDMNT_OPT_REAL },
{ 0 }
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
@@ -1489,6 +1502,12 @@ int main(int argc, char *argv[])
case FINDMNT_OPT_TREE:
force_tree = 1;
break;
+ case FINDMNT_OPT_PSEUDO:
+ flags |= FL_PSEUDO;
+ break;
+ case FINDMNT_OPT_REAL:
+ flags |= FL_REAL;
+ break;
default:
errtryhelp(EXIT_FAILURE);
}
diff --git a/misc-utils/findmnt.h b/misc-utils/findmnt.h
index fbaa38e82..6388837a0 100644
--- a/misc-utils/findmnt.h
+++ b/misc-utils/findmnt.h
@@ -18,6 +18,8 @@ enum {
FL_NOCACHE = (1 << 14),
FL_STRICTTARGET = (1 << 15),
FL_VERBOSE = (1 << 16),
+ FL_PSEUDO = (1 << 17),
+ FL_REAL = (1 << 18),
/* basic table settings */
FL_ASCII = (1 << 20),