Permalink
Browse files

Put getmntopts() into libutil and install mntopts.h to /usr/include.

Previously, they were private to sbin/mount and the other mount_*
commands would take them from there via their Makefiles.

However, puffs related stuff outside base (in pkgsrc for example)
couldn't reach them this way. So for now, arrange it like NetBSD
has it.
  • Loading branch information...
1 parent 397ffc5 commit 2dc55a028ad7f68522a47f44ae874279b9d181ab Sascha Wildner committed Jun 8, 2012
Showing with 100 additions and 176 deletions.
  1. +1 −1 include/Makefile
  2. +12 −6 {sbin/mount → include}/mntopts.h
  3. +3 −2 lib/libutil/Makefile
  4. +5 −4 {sbin/mount → lib/libutil}/getmntopts.3
  5. +2 −4 {sbin/mount → lib/libutil}/getmntopts.c
  6. +4 −3 sbin/mount/Makefile
  7. +1 −2 sbin/mount/mount.c
  8. +0 −5 sbin/mount_cd9660/Makefile
  9. +1 −3 sbin/mount_cd9660/mount_cd9660.c
  10. +2 −4 sbin/mount_devfs/Makefile
  11. +2 −2 sbin/mount_devfs/mount_devfs.c
  12. +2 −5 sbin/mount_ext2fs/Makefile
  13. +1 −3 sbin/mount_ext2fs/mount_ext2fs.c
  14. +2 −7 sbin/mount_hammer/Makefile
  15. +1 −4 sbin/mount_hammer/mount_hammer.c
  16. +4 −5 sbin/mount_hpfs/Makefile
  17. +1 −3 sbin/mount_hpfs/mount_hpfs.c
  18. +0 −5 sbin/mount_msdos/Makefile
  19. +1 −3 sbin/mount_msdos/mount_msdos.c
  20. +6 −5 sbin/mount_nfs/Makefile
  21. +1 −2 sbin/mount_nfs/mount_nfs.c
  22. +0 −5 sbin/mount_ntfs/Makefile
  23. +1 −3 sbin/mount_ntfs/mount_ntfs.c
  24. +4 −5 sbin/mount_null/Makefile
  25. +1 −3 sbin/mount_null/mount_null.c
  26. +3 −7 sbin/mount_nwfs/Makefile
  27. +1 −2 sbin/mount_nwfs/mount_nwfs.c
  28. +5 −5 sbin/mount_portal/Makefile
  29. +1 −2 sbin/mount_portal/mount_portal.c
  30. +1 −3 sbin/mount_smbfs/Makefile
  31. +2 −5 sbin/mount_std/Makefile
  32. +1 −3 sbin/mount_std/mount_std.c
  33. +2 −6 sbin/mount_tmpfs/Makefile
  34. +1 −1 sbin/mount_tmpfs/mount_tmpfs.c
  35. +2 −6 sbin/mount_udf/Makefile
  36. +1 −3 sbin/mount_udf/mount_udf.c
  37. +5 −3 sbin/mount_ufs/Makefile
  38. +1 −2 sbin/mount_ufs/mount_ufs.c
  39. +4 −5 sbin/mount_union/Makefile
  40. +1 −3 sbin/mount_union/mount_union.c
  41. +5 −4 sbin/newfs/Makefile
  42. +1 −1 sbin/newfs/newfs.c
  43. +1 −8 share/examples/puffs/pnullfs/Makefile
  44. +1 −10 usr.sbin/puffs/Makefile.inc
  45. +3 −3 usr.sbin/puffs/mount_psshfs/Makefile
View
@@ -14,7 +14,7 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
fts.h ftw.h getopt.h glob.h grp.h histedit.h \
iconv.h ieeefp.h ifaddrs.h iso646.h inttypes.h \
langinfo.h libgen.h limits.h link.h locale.h malloc.h math.h memory.h \
- mpool.h mqueue.h monetary.h ndbm.h netconfig.h \
+ mntopts.h mpool.h mqueue.h monetary.h ndbm.h netconfig.h \
netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h \
paths.h printf.h pthread.h pthread_np.h pwd.h \
ranlib.h readpassphrase.h regex.h regexp.h \
@@ -32,11 +32,12 @@
*
* @(#)mntopts.h 8.7 (Berkeley) 3/29/95
* $FreeBSD: src/sbin/mount/mntopts.h,v 1.16 1999/10/09 11:54:07 phk Exp $
- * $DragonFly: src/sbin/mount/mntopts.h,v 1.4 2005/01/06 03:21:00 cpressey Exp $
*/
-#ifndef _MOUNT_MNTOPTS_H_
-#define _MOUNT_MNTOPTS_H_
+#ifndef _MNTOPTS_H_
+#define _MNTOPTS_H_
+
+#include <sys/cdefs.h>
struct mntopt {
const char *m_option; /* option name */
@@ -52,7 +53,7 @@ struct mntopt {
#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 }
#define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 }
#define MOPT_NOSYMFOLLOW { "symfollow", 1, MNT_NOSYMFOLLOW, 0 }
-#define MOPT_TRIM { "trim", 0, MNT_TRIM, 0 }
+#define MOPT_TRIM { "trim", 0, MNT_TRIM, 0 }
#define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 }
#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 }
#define MOPT_UNION { "union", 0, MNT_UNION, 0 }
@@ -97,9 +98,14 @@ struct mntopt {
MOPT_NOCLUSTERW, \
MOPT_IGNORE
+extern int getmnt_silent;
+
+__BEGIN_DECLS
+#if __BSD_VISIBLE
void getmntopts(const char *, const struct mntopt *, int *, int *);
void rmslashes(char *, char *);
void checkpath(const char *, char resolved_path[]);
-extern int getmnt_silent;
+#endif /* __BSD_VISIBLE */
+__END_DECLS
-#endif
+#endif /* !_MNTOPTS_H_ */
View
@@ -11,7 +11,8 @@ SRCS= flopen.c login.c login_tty.c logout.c logwtmp.c logwtmpx.c pty.c \
property.c auth.c \
realhostname.c fparseln.c stub.c pidfile.c trimdomain.c \
dehumanize_number.c humanize_number.c humanize_unsigned.c pw_util.c \
- efun.c
+ efun.c getmntopts.c
+
INCS= libutil.h login_cap.h
INCSLINKS=libutil.h ${INCLUDEDIR}/util.h
WARNS?= 3
@@ -24,7 +25,7 @@ MAN+= flopen.3 login.3 loginx.3 login_auth.3 login_tty.3 logout.3 logwtmp.3 \
_secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \
realhostname_sa.3 trimdomain.3 fparseln.3 pidfile.3 \
humanize_number.3 humanize_unsigned.3 \
- efun.3
+ efun.3 getmntopts.3
MAN+= login.conf.5 auth.conf.5
MLINKS+=auth.3 auth_getval.3
@@ -31,16 +31,17 @@
.\"
.\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95
.\" $FreeBSD: src/sbin/mount/getmntopts.3,v 1.6.2.4 2003/02/23 20:17:15 trhodes Exp $
-.\" $DragonFly: src/sbin/mount/getmntopts.3,v 1.2 2003/06/17 04:27:33 dillon Exp $
.\"
-.Dd March 30, 1995
+.Dd June 8, 2012
.Dt GETMNTOPTS 3
.Os
.Sh NAME
.Nm getmntopts
.Nd scan mount options
+.Sh LIBRARY
+.Lb libutil
.Sh SYNOPSIS
-.Fd #include \&"mntopts.h"
+.In mntopts.h
.Ft void
.Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp" "int *altflagp"
.Sh DESCRIPTION
@@ -148,7 +149,7 @@ flag, would also have an
entry.
This can be declared and used as follows:
.Bd -literal
-#include "mntopts.h"
+#include <mntopts.h>
struct mntopt mopts[] = {
MOPT_STDOPTS,
@@ -32,20 +32,18 @@
*
* @(#)getmntopts.c 8.3 (Berkeley) 3/29/95
* $FreeBSD: src/sbin/mount/getmntopts.c,v 1.9 1999/10/09 11:54:06 phk Exp $
- * $DragonFly: src/sbin/mount/getmntopts.c,v 1.4 2004/09/06 01:19:07 dillon Exp $
*/
#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
+#include <mntopts.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
-#include "mntopts.h"
-
int getmnt_silent = 0;
void
@@ -124,7 +122,7 @@ checkpath(const char *path, char *resolved)
struct stat sb;
if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) {
- if (!S_ISDIR(sb.st_mode))
+ if (!S_ISDIR(sb.st_mode))
errx(EX_USAGE, "%s: not a directory", resolved);
} else
errx(EX_USAGE, "%s: %s", resolved, strerror(errno));
View
@@ -1,10 +1,11 @@
# @(#)Makefile 8.6 (Berkeley) 5/8/95
# $FreeBSD: src/sbin/mount/Makefile,v 1.9.2.1 2001/04/25 10:58:33 ru Exp $
-# $DragonFly: src/sbin/mount/Makefile,v 1.5 2006/10/28 20:42:54 pavalos Exp $
PROG= mount
-SRCS= mount.c getmntopts.c vfslist.c
+SRCS= mount.c vfslist.c
MAN= mount.8
-# We do NOT install the getmntopts.3 man page.
+
+LDADD= -lutil
+DPADD= ${LIBUTIL}
.include <bsd.prog.mk>
View
@@ -33,7 +33,6 @@
* @(#) Copyright (c) 1980, 1989, 1993, 1994 The Regents of the University of California. All rights reserved.
* @(#)mount.c 8.25 (Berkeley) 5/8/95
* $FreeBSD: src/sbin/mount/mount.c,v 1.39.2.3 2001/08/01 08:26:23 obrien Exp $
- * $DragonFly: src/sbin/mount/mount.c,v 1.10 2005/04/03 17:13:08 joerg Exp $
*/
#include <sys/param.h>
@@ -49,6 +48,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fstab.h>
+#include <mntopts.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -57,7 +57,6 @@
#include <unistd.h>
#include "extern.h"
-#include "mntopts.h"
#include "pathnames.h"
/* `meta' options */
@@ -2,13 +2,8 @@
# $FreeBSD: src/sbin/mount_cd9660/Makefile,v 1.4.6.1 2001/04/25 10:58:34 ru Exp $
PROG= mount_cd9660
-SRCS= mount_cd9660.c getmntopts.c
MAN= mount_cd9660.8
LDADD= -lutil -lkiconv
DPADD= ${LIBUTIL} ${LIBKICONV}
-MOUNT= ${.CURDIR}/../mount
-CFLAGS+= -I${MOUNT}
-.PATH: ${MOUNT}
-
.include <bsd.prog.mk>
@@ -40,7 +40,6 @@
* @(#) Copyright (c) 1992, 1993, 1994 The Regents of the University of California. All rights reserved.
* @(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95
* $FreeBSD: src/sbin/mount_cd9660/mount_cd9660.c,v 1.15.2.3 2001/03/14 12:05:01 bp Exp $
- * $DragonFly: src/sbin/mount_cd9660/mount_cd9660.c,v 1.5 2005/04/02 21:43:15 dillon Exp $
*/
#include <sys/cdio.h>
@@ -54,15 +53,14 @@
#include <err.h>
#include <errno.h>
+#include <mntopts.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <sysexits.h>
#include <unistd.h>
-#include "mntopts.h"
-
struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_UPDATE,
@@ -1,9 +1,7 @@
PROG= mount_devfs
-SRCS= mount_devfs.c getmntopts.c
MAN= mount_devfs.8
-MOUNT= ${.CURDIR}/../mount
-CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
-.PATH: ${MOUNT}
+LDADD= -lutil
+DPADD= ${LIBUTIL}
.include <bsd.prog.mk>
@@ -31,19 +31,19 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/devfs.h>
#include <err.h>
+#include <mntopts.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
-#include "mntopts.h"
-
#if 0
#define MOPT_UPDATE { "update", 0, MNT_UPDATE, 0 }
#endif
@@ -1,13 +1,10 @@
# @(#)Makefile 8.3 (Berkeley) 3/27/94
# $FreeBSD: src/sbin/mount_ext2fs/Makefile,v 1.3.6.1 2001/04/25 10:58:34 ru Exp $
-# $DragonFly: src/sbin/mount_ext2fs/Makefile,v 1.4 2006/10/17 00:55:42 pavalos Exp $
PROG= mount_ext2fs
-SRCS= mount_ext2fs.c getmntopts.c
MAN= mount_ext2fs.8
-MOUNT= ${.CURDIR}/../mount
-CFLAGS+= -I${MOUNT}
-.PATH: ${MOUNT}
+LDADD= -lutil
+DPADD= ${LIBUTIL}
.include <bsd.prog.mk>
@@ -33,13 +33,13 @@
* @(#) Copyright (c) 1993, 1994 The Regents of the University of California. All rights reserved.
* @(#)mount_lfs.c 8.3 (Berkeley) 3/27/94
* $FreeBSD: src/sbin/mount_ext2fs/mount_ext2fs.c,v 1.11 1999/10/09 11:54:09 phk Exp $
- * $DragonFly: src/sbin/mount_ext2fs/mount_ext2fs.c,v 1.7 2005/04/03 15:46:43 joerg Exp $
*/
#include <sys/param.h>
#include <sys/mount.h>
#include <err.h>
+#include <mntopts.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -48,8 +48,6 @@
#include <vfs/ufs/ufsmount.h>
-#include "mntopts.h"
-
struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_FORCE,
@@ -1,12 +1,7 @@
-#
-# $DragonFly: src/sbin/mount_hammer/Makefile,v 1.1 2007/10/10 19:35:19 dillon Exp $
-
PROG= mount_hammer
-SRCS= mount_hammer.c getmntopts.c
MAN= mount_hammer.8
-MOUNT= ${.CURDIR}/../mount
-CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
-.PATH: ${MOUNT}
+LDADD= -lutil
+DPADD= ${LIBUTIL}
.include <bsd.prog.mk>
@@ -30,8 +30,6 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $DragonFly: src/sbin/mount_hammer/mount_hammer.c,v 1.9 2008/07/19 18:48:15 dillon Exp $
*/
#include <sys/types.h>
@@ -55,8 +53,7 @@
#include <err.h>
#include <assert.h>
#include <ctype.h>
-
-#include "mntopts.h"
+#include <mntopts.h>
typedef const char **ary_ptr_t;
View
@@ -1,14 +1,13 @@
#
# $FreeBSD: src/sbin/mount_hpfs/Makefile,v 1.1.2.1 2001/04/25 10:58:35 ru Exp $
-# $DragonFly: src/sbin/mount_hpfs/Makefile,v 1.4 2006/10/17 00:55:42 pavalos Exp $
#
PROG= mount_hpfs
-SRCS= mount_hpfs.c getmntopts.c
MAN= mount_hpfs.8
-MOUNT= ${.CURDIR}/../mount
-CFLAGS+=-I${.CURDIR}/../../sys -I${MOUNT}
-.PATH: ${MOUNT}
+LDADD= -lutil
+DPADD= ${LIBUTIL}
+
+CFLAGS+=-I${.CURDIR}/../../sys
.include <bsd.prog.mk>
@@ -29,7 +29,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sbin/mount_hpfs/mount_hpfs.c,v 1.1 1999/12/09 19:09:15 semenu Exp $
- * $DragonFly: src/sbin/mount_hpfs/mount_hpfs.c,v 1.8 2005/04/03 18:59:24 joerg Exp $
*/
#include <sys/cdefs.h>
@@ -40,15 +39,14 @@
#include <ctype.h>
#include <err.h>
#include <grp.h>
+#include <mntopts.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
-#include "mntopts.h"
-
static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_NULL
@@ -3,13 +3,8 @@
#
PROG= mount_msdos
-SRCS= mount_msdos.c getmntopts.c
MAN= mount_msdos.8
DPADD= ${LIBUTIL} ${LIBKICONV}
LDADD= -lutil -lkiconv
-MOUNT= ${.CURDIR}/../mount
-CFLAGS= -I${MOUNT}
-.PATH: ${MOUNT}
-
.include <bsd.prog.mk>
@@ -30,7 +30,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sbin/mount_msdos/mount_msdos.c,v 1.19.2.1 2000/07/20 10:35:13 kris Exp $
- * $DragonFly: src/sbin/mount_msdos/mount_msdos.c,v 1.8 2008/11/02 21:52:46 swildner Exp $
*/
#include <sys/param.h>
@@ -45,6 +44,7 @@
#include <err.h>
#include <grp.h>
#include <locale.h>
+#include <mntopts.h>
#include <pwd.h>
#include <stdio.h>
/* must be after stdio to declare fparseln */
@@ -54,8 +54,6 @@
#include <sysexits.h>
#include <unistd.h>
-#include "mntopts.h"
-
/*
* XXX - no way to specify "foo=<bar>"-type options; that's what we'd
* want for "-u", "-g", "-m", "-L", and "-D".
Oops, something went wrong.

0 comments on commit 2dc55a0

Please sign in to comment.