From: Karel Zak Date: Tue, 21 Jun 2011 09:46:36 +0000 (+0200) Subject: mountpoint: add new command X-Git-Tag: v2.20-rc1~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0164c24595bd4209ab7b668fec34f5cdcdd1d5eb;p=thirdparty%2Futil-linux.git mountpoint: add new command This is libmount based re-implementation of the mountpoint(1) command. The original implementation is maintained in sysvinit suite. The mountpoint(1) in util-linux is not enabled by default (for now) -- use --enable-mountpoint to enable the util. Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 52eade9e11..a02b5e31f6 100644 --- a/configure.ac +++ b/configure.ac @@ -483,6 +483,17 @@ esac AM_CONDITIONAL(BUILD_LIBMOUNT_MOUNT, test "x$enable_libmount_mount" = xyes) +AC_ARG_ENABLE([mountpoint], + AS_HELP_STRING([--enable-mountpoint], [build mountpoint]), + [], enable_mountpoint=no +) +case "$enable_libmount:$enable_mountpoint" in +no:yes) + AC_MSG_ERROR([cannot enable mountpoint when libmount is disabled]) ;; +esac +AM_CONDITIONAL(BUILD_MOUNTPOINT, test "x$enable_mountpoint" = xyes) + + UTIL_CHECK_LIB(util, openpty) UTIL_CHECK_LIB(termcap, tgetnum) diff --git a/libmount/samples/.gitignore b/libmount/samples/.gitignore index 6008ee3212..fde6477393 100644 --- a/libmount/samples/.gitignore +++ b/libmount/samples/.gitignore @@ -1,2 +1 @@ mount -mountpoint diff --git a/libmount/samples/Makefile.am b/libmount/samples/Makefile.am index ee13d8b777..b0c655f1ac 100644 --- a/libmount/samples/Makefile.am +++ b/libmount/samples/Makefile.am @@ -3,5 +3,5 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -I$(ul_libmount_incdir) AM_LDFLAGS += $(ul_libmount_la) -noinst_PROGRAMS = mount mountpoint +noinst_PROGRAMS = mount diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore index b8af98f1aa..3ae7e4a7bf 100644 --- a/sys-utils/.gitignore +++ b/sys-utils/.gitignore @@ -18,6 +18,7 @@ lscpu mips32.8 mips64.8 mips.8 +mountpoint parisc32.8 parisc64.8 parisc.8 diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index d916d3d04f..53cdc3718c 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -31,6 +31,13 @@ fstrim_SOURCES = fstrim.c $(top_srcdir)/lib/strutils.c rtcwake_SOURCES = rtcwake.c $(top_srcdir)/lib/strutils.c dmesg_SOURCES = dmesg.c $(top_srcdir)/lib/strutils.c +if BUILD_MOUNTPOINT +bin_PROGRAMS += mountpoint +mountpoint_LDADD = $(ul_libmount_la) +mountpoint_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) +dist_man_MANS += mountpoint.1 +endif + if BUILD_FALLOCATE usrbin_exec_PROGRAMS += fallocate fallocate_SOURCES = fallocate.c $(top_srcdir)/lib/strutils.c diff --git a/sys-utils/mountpoint.1 b/sys-utils/mountpoint.1 new file mode 100644 index 0000000000..be17c42ddf --- /dev/null +++ b/sys-utils/mountpoint.1 @@ -0,0 +1,43 @@ +.\" -*- nroff -*- +.TH MOUNTPOINT 1 "June 2011" +.SH NAME +mountpoint \- see if a directory is a mountpoint +.SH SYNOPSIS +.B mountpoint +.RB [ \-q ] +.RB [ \-d ] +.I directory + +.B mountpoint +.RB \-x +.I device + +.SH DESCRIPTION +.B mountpoint +checks if the directory is mentioned in the /proc/self/mountinfo file. +.SH OPTIONS +.IP "\fB\-h, \-\-help\fP" +Print help and exit. +.IP "\fB\-q, \-\-quiet\fP" +Be quiet - don't print anything. +.IP "\fB\-d, \-\-fs\-devno\fP" +Print major/minor device number of the filesystem on stdout. +.IP "\fB\-x, \-\-devno\fP" +Print major/minor device number of the blockdevice on stdout. +.SH EXIT STATUS +Zero if the directory is a mountpoint, non-zero if not. +.SH AUTHOR +.PP +Karel Zak +.SH NOTES +.PP +The util-linux +.B mountpoint +implementation was written from scratch for libmount. The original version +for sysvinit suite was written by Miquel van Smoorenburg. +.SH SEE ALSO +.BR mount (8) +.SH AVAILABILITY +The mountpoint command is part of the util-linux package and is available from +ftp://ftp.kernel.org/pub/linux/utils/util-linux/. + diff --git a/libmount/samples/mountpoint.c b/sys-utils/mountpoint.c similarity index 100% rename from libmount/samples/mountpoint.c rename to sys-utils/mountpoint.c