* [PATCH 0/2] Add user-defined fstab location for findmnt
@ 2011-12-11 18:58 Dave Reisner
2011-12-11 18:58 ` [PATCH 1/2] findmnt: use warnx for libmnt error callback Dave Reisner
2011-12-11 18:58 ` [PATCH 2/2] findmnt: support alternative location of fstab Dave Reisner
0 siblings, 2 replies; 5+ messages in thread
From: Dave Reisner @ 2011-12-11 18:58 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
This adds an optional argument to the --fstab parameter of findmnt to allow for
a custom location of /etc/fstab. The first patch is a minor fixup for a bug I
discovered while testing.
Dave Reisner (2):
findmnt: use warnx for libmnt error callback
findmnt: support alternative location of fstab
misc-utils/findmnt.8 | 6 ++++--
misc-utils/findmnt.c | 8 ++++----
2 files changed, 8 insertions(+), 6 deletions(-)
--
1.7.8
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] findmnt: use warnx for libmnt error callback
2011-12-11 18:58 [PATCH 0/2] Add user-defined fstab location for findmnt Dave Reisner
@ 2011-12-11 18:58 ` Dave Reisner
2011-12-16 10:43 ` Karel Zak
2011-12-11 18:58 ` [PATCH 2/2] findmnt: support alternative location of fstab Dave Reisner
1 sibling, 1 reply; 5+ messages in thread
From: Dave Reisner @ 2011-12-11 18:58 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
libmount doesn't set errno appropriately here:
$ findmnt -s
findmnt: /etc/fstab: parse error at line 20: Success
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
misc-utils/findmnt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 9c2b9fc..4577dc6 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -484,7 +484,7 @@ leave:
static int parser_errcb(struct libmnt_table *tb __attribute__ ((__unused__)),
const char *filename, int line)
{
- warn(_("%s: parse error at line %d"), filename, line);
+ warnx(_("%s: parse error at line %d"), filename, line);
return 0;
}
--
1.7.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] findmnt: support alternative location of fstab
2011-12-11 18:58 [PATCH 0/2] Add user-defined fstab location for findmnt Dave Reisner
2011-12-11 18:58 ` [PATCH 1/2] findmnt: use warnx for libmnt error callback Dave Reisner
@ 2011-12-11 18:58 ` Dave Reisner
2011-12-16 10:48 ` Karel Zak
1 sibling, 1 reply; 5+ messages in thread
From: Dave Reisner @ 2011-12-11 18:58 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
misc-utils/findmnt.8 | 6 ++++--
misc-utils/findmnt.c | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/misc-utils/findmnt.8 b/misc-utils/findmnt.8
index 24e3a52..7f3dc6c 100644
--- a/misc-utils/findmnt.8
+++ b/misc-utils/findmnt.8
@@ -36,12 +36,14 @@ The command prints all mounted filesystems in the tree-like format by default.
.SH OPTIONS
.IP "\fB\-h, \-\-help\fP"
Print help and exit.
-.IP "\fB\-s, \-\-fstab\fP"
+.IP "\fB\-s, \-\-fstab\fR[\fI=fstab\fR]\fP"
Search in
.IR /etc/fstab
and
.IR /etc/fstab.d .
-The output is in the list format (see --list).
+The output is in the list format (see --list). Optionally, search the file
+specified by
+.IR fstab .
.IP "\fB\-m, \-\-mtab\fP"
Search in
.IR /etc/mtab .
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 4577dc6..a23a432 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -770,7 +770,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fprintf(out, _(
"\nOptions:\n"
- " -s, --fstab search in static table of filesystems\n"
+ " -s, --fstab[=<fstab>] search in static table of filesystems\n"
" -m, --mtab search in table of mounted filesystems\n"
" -k, --kernel search in kernel table of mounted\n"
" filesystems (default)\n\n"));
@@ -839,7 +839,7 @@ int main(int argc, char *argv[])
{ "direction", 1, 0, 'd' },
{ "evaluate", 0, 0, 'e' },
{ "first-only", 0, 0, 'f' },
- { "fstab", 0, 0, 's' },
+ { "fstab", 2, 0, 's' },
{ "help", 0, 0, 'h' },
{ "invert", 0, 0, 'i' },
{ "kernel", 0, 0, 'k' },
@@ -938,7 +938,7 @@ int main(int argc, char *argv[])
case 's': /* fstab */
if (tabfile)
errx_mutually_exclusive("--{fstab,mtab,kernel}");
- tabfile = _PATH_MNTTAB;
+ tabfile = optarg ? optarg : _PATH_MNTTAB;
tt_flags &= ~TT_FL_TREE;
break;
case 'k': /* kernel (mountinfo) */
--
1.7.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] findmnt: use warnx for libmnt error callback
2011-12-11 18:58 ` [PATCH 1/2] findmnt: use warnx for libmnt error callback Dave Reisner
@ 2011-12-16 10:43 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2011-12-16 10:43 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Sun, Dec 11, 2011 at 01:58:04PM -0500, Dave Reisner wrote:
> misc-utils/findmnt.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
> index 9c2b9fc..4577dc6 100644
> --- a/misc-utils/findmnt.c
> +++ b/misc-utils/findmnt.c
> @@ -484,7 +484,7 @@ leave:
> static int parser_errcb(struct libmnt_table *tb __attribute__ ((__unused__)),
> const char *filename, int line)
> {
> - warn(_("%s: parse error at line %d"), filename, line);
> + warnx(_("%s: parse error at line %d"), filename, line);
Oh.. yes, errno does not make sense here. Applied, thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] findmnt: support alternative location of fstab
2011-12-11 18:58 ` [PATCH 2/2] findmnt: support alternative location of fstab Dave Reisner
@ 2011-12-16 10:48 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2011-12-16 10:48 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Sun, Dec 11, 2011 at 01:58:05PM -0500, Dave Reisner wrote:
> misc-utils/findmnt.8 | 6 ++++--
> misc-utils/findmnt.c | 6 +++---
> 2 files changed, 7 insertions(+), 5 deletions(-)
Applied, thanks. My plan is to support this feature in new
mount(8) (libmount/src/sample/mount.c) too.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-16 10:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-11 18:58 [PATCH 0/2] Add user-defined fstab location for findmnt Dave Reisner
2011-12-11 18:58 ` [PATCH 1/2] findmnt: use warnx for libmnt error callback Dave Reisner
2011-12-16 10:43 ` Karel Zak
2011-12-11 18:58 ` [PATCH 2/2] findmnt: support alternative location of fstab Dave Reisner
2011-12-16 10:48 ` Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.