Index: contrib/smbfs/mount_smbfs/mount_smbfs.c =================================================================== --- contrib/smbfs/mount_smbfs/mount_smbfs.c (revision 247149) +++ contrib/smbfs/mount_smbfs/mount_smbfs.c (working copy) @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -56,8 +57,6 @@ #include -#include "mntopts.h" - static char mount_point[MAXPATHLEN + 1]; static void usage(void); Index: include/Makefile =================================================================== --- include/Makefile (revision 247149) +++ include/Makefile (working copy) @@ -13,8 +13,8 @@ fts.h ftw.h getopt.h glob.h grp.h gssapi.h \ ieeefp.h ifaddrs.h \ inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ - locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ - ndbm.h netconfig.h \ + locale.h malloc.h malloc_np.h memory.h mntopts.h \ + monetary.h mpool.h mqueue.h ndbm.h netconfig.h \ netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \ printf.h proc_service.h pthread.h \ pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ Index: lib/libutil/Makefile =================================================================== --- lib/libutil/Makefile (revision 247149) +++ lib/libutil/Makefile (working copy) @@ -8,7 +8,8 @@ LIB= util SHLIB_MAJOR= 9 -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ + getmntopts.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c kinfo_getfile.c \ kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c kld.c \ login_auth.c login_cap.c \ @@ -25,7 +26,7 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/ -MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ +MAN+= expand_number.3 flopen.3 fparseln.3 getmntopts.3 hexdump.3 \ humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ Index: sbin/fsck_ffs/Makefile =================================================================== --- sbin/fsck_ffs/Makefile (revision 247256) +++ sbin/fsck_ffs/Makefile (working copy) @@ -7,12 +7,12 @@ MAN= fsck_ffs.8 MLINKS= fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8 SRCS= dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \ - pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c -DPADD= ${LIBUFS} -LDADD= -lufs + pass4.c pass5.c setup.c suj.c utilities.c gjournal.c +DPADD= ${LIBUFS} ${LIBUTIL} +LDADD= -lufs -lutil WARNS?= 2 -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mount +CFLAGS+= -I${.CURDIR} -.PATH: ${.CURDIR}/../../sys/ufs/ffs ${.CURDIR}/../mount +.PATH: ${.CURDIR}/../../sys/ufs/ffs .include Index: sbin/growfs/Makefile =================================================================== --- sbin/growfs/Makefile (revision 247149) +++ sbin/growfs/Makefile (working copy) @@ -6,12 +6,9 @@ #GFSDBG= -.PATH: ${.CURDIR}/../mount - PROG= growfs -SRCS= growfs.c getmntopts.c +SRCS= growfs.c MAN= growfs.8 -CFLAGS+=-I${.CURDIR}/../mount .if defined(GFSDBG) SRCS+= debug.c Index: sbin/mksnap_ffs/Makefile =================================================================== --- sbin/mksnap_ffs/Makefile (revision 247149) +++ sbin/mksnap_ffs/Makefile (working copy) @@ -3,12 +3,13 @@ .PATH: ${.CURDIR}/../mount PROG= mksnap_ffs -SRCS= mksnap_ffs.c getmntopts.c MAN= mksnap_ffs.8 WARNS?= 2 -CFLAGS+=-I${.CURDIR}/../mount +DPADD= ${LIBUTIL} +LDADD= -lutil + .if defined(NOSUID) BINMODE=550 .else Index: sbin/mount/Makefile =================================================================== --- sbin/mount/Makefile (revision 247149) +++ sbin/mount/Makefile (working copy) @@ -2,9 +2,8 @@ # $FreeBSD$ PROG= mount -SRCS= mount.c mount_fs.c getmntopts.c vfslist.c +SRCS= mount.c mount_fs.c vfslist.c MAN= mount.8 -# We do NOT install the getmntopts.3 man page. DPADD= ${LIBUTIL} LDADD= -lutil Index: sbin/mount/getmntopts.3 =================================================================== --- sbin/mount/getmntopts.3 (revision 247149) +++ sbin/mount/getmntopts.3 (working copy) @@ -1,181 +0,0 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, 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. -.\" -.\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95 -.\" $FreeBSD$ -.\" -.Dd February 17, 2008 -.Dt GETMNTOPTS 3 -.Os -.Sh NAME -.Nm getmntopts -.Nd scan mount options -.Sh SYNOPSIS -.Fd #include \&"mntopts.h" -.Ft void -.Fo getmntopts -.Fa "const char *options" "const struct mntopt *mopts" -.Fa "int *flagp" "int *altflagp" -.Fc -.Sh DESCRIPTION -The -.Fn getmntopts -function takes a comma separated option list and a list -of valid option names, and computes the bitmask -corresponding to the requested set of options. -.Pp -The string -.Fa options -is broken down into a sequence of comma separated tokens. -Each token is looked up in the table described by -.Fa mopts -and the bits in -the word referenced by either -.Fa flagp -or -.Fa altflagp -(depending on the -.Va m_altloc -field of the option's table entry) -are updated. -The flag words are not initialized by -.Fn getmntopts . -The table, -.Fa mopts , -has the following format: -.Bd -literal -struct mntopt { - char *m_option; /* option name */ - int m_inverse; /* is this a negative option, e.g., "dev" */ - int m_flag; /* bit to set, e.g., MNT_RDONLY */ - int m_altloc; /* non-zero to use altflagp rather than flagp */ -}; -.Ed -.Pp -The members of this structure are: -.Bl -tag -width m_inverse -.It Va m_option -the option name, -for example -.Dq Li suid . -.It Va m_inverse -tells -.Fn getmntopts -that the name has the inverse meaning of the -bit. -For example, -.Dq Li suid -is the string, whereas the -mount flag is -.Dv MNT_NOSUID . -In this case, the sense of the string and the flag -are inverted, so the -.Va m_inverse -flag should be set. -.It Va m_flag -the value of the bit to be set or cleared in -the flag word when the option is recognized. -The bit is set when the option is discovered, -but cleared if the option name was preceded -by the letters -.Dq Li no . -The -.Va m_inverse -flag causes these two operations to be reversed. -.It Va m_altloc -the bit should be set or cleared in -.Fa altflagp -rather than -.Fa flagp . -.El -.Pp -Each of the user visible -.Dv MNT_ -flags has a corresponding -.Dv MOPT_ -macro which defines an appropriate -.Vt "struct mntopt" -entry. -To simplify the program interface and ensure consistency across all -programs, a general purpose macro, -.Dv MOPT_STDOPTS , -is defined which -contains an entry for all the generic VFS options. -In addition, the macros -.Dv MOPT_FORCE -and -.Dv MOPT_UPDATE -exist to enable the -.Dv MNT_FORCE -and -.Dv MNT_UPDATE -flags to be set. -Finally, the table must be terminated by an entry with a -.Dv NULL -first element. -.Sh EXAMPLES -Most commands will use the standard option set. -Local file systems which support the -.Dv MNT_UPDATE -flag, would also have an -.Dv MOPT_UPDATE -entry. -This can be declared and used as follows: -.Bd -literal -#include "mntopts.h" - -struct mntopt mopts[] = { - MOPT_STDOPTS, - MOPT_UPDATE, - { NULL } -}; - - ... - mntflags = mntaltflags = 0; - ... - getmntopts(options, mopts, &mntflags, &mntaltflags); - ... -.Ed -.Sh DIAGNOSTICS -If the external integer variable -.Va getmnt_silent -is zero, then the -.Fn getmntopts -function displays an error message and exits if an -unrecognized option is encountered. -Otherwise unrecognized options are silently ignored. -By default -.Va getmnt_silent -is zero. -.Sh SEE ALSO -.Xr err 3 , -.Xr mount 8 -.Sh HISTORY -The -.Fn getmntopts -function appeared in -.Bx 4.4 . Index: sbin/mount/getmntopts.c =================================================================== --- sbin/mount/getmntopts.c (revision 247149) +++ sbin/mount/getmntopts.c (working copy) @@ -1,183 +0,0 @@ -/*- - * Copyright (c) 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, 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. - */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; -#endif /* not lint */ -#endif -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "mntopts.h" - -int getmnt_silent = 0; - -void -getmntopts(const char *options, const struct mntopt *m0, int *flagp, - int *altflagp) -{ - const struct mntopt *m; - int negative, len; - char *opt, *optbuf, *p; - int *thisflagp; - - /* Copy option string, since it is about to be torn asunder... */ - if ((optbuf = strdup(options)) == NULL) - err(1, NULL); - - for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { - /* Check for "no" prefix. */ - if (opt[0] == 'n' && opt[1] == 'o') { - negative = 1; - opt += 2; - } else - negative = 0; - - /* - * for options with assignments in them (ie. quotas) - * ignore the assignment as it's handled elsewhere - */ - p = strchr(opt, '='); - if (p != NULL) - *++p = '\0'; - - /* Scan option table. */ - for (m = m0; m->m_option != NULL; ++m) { - len = strlen(m->m_option); - if (strncasecmp(opt, m->m_option, len) == 0) - if (opt[len] == '\0' || opt[len] == '=') - break; - } - - /* Save flag, or fail if option is not recognized. */ - if (m->m_option) { - thisflagp = m->m_altloc ? altflagp : flagp; - if (negative == m->m_inverse) - *thisflagp |= m->m_flag; - else - *thisflagp &= ~m->m_flag; - } else if (!getmnt_silent) { - errx(1, "-o %s: option not supported", opt); - } - } - - free(optbuf); -} - -void -rmslashes(char *rrpin, char *rrpout) -{ - char *rrpoutstart; - - *rrpout = *rrpin; - for (rrpoutstart = rrpout; *rrpin != '\0'; *rrpout++ = *rrpin++) { - - /* skip all double slashes */ - while (*rrpin == '/' && *(rrpin + 1) == '/') - rrpin++; - } - - /* remove trailing slash if necessary */ - if (rrpout - rrpoutstart > 1 && *(rrpout - 1) == '/') - *(rrpout - 1) = '\0'; - else - *rrpout = '\0'; -} - -int -checkpath(const char *path, char *resolved) -{ - struct stat sb; - - if (realpath(path, resolved) == NULL || stat(resolved, &sb) != 0) - return (1); - if (!S_ISDIR(sb.st_mode)) { - errno = ENOTDIR; - return (1); - } - return (0); -} - -void -build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, - size_t len) -{ - int i; - - if (*iovlen < 0) - return; - i = *iovlen; - *iov = realloc(*iov, sizeof **iov * (i + 2)); - if (*iov == NULL) { - *iovlen = -1; - return; - } - (*iov)[i].iov_base = strdup(name); - (*iov)[i].iov_len = strlen(name) + 1; - i++; - (*iov)[i].iov_base = val; - if (len == (size_t)-1) { - if (val != NULL) - len = strlen(val) + 1; - else - len = 0; - } - (*iov)[i].iov_len = (int)len; - *iovlen = ++i; -} - -/* - * This function is needed for compatibility with parameters - * which used to use the mount_argf() command for the old mount() syscall. - */ -void -build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, - const char *fmt, ...) -{ - va_list ap; - char val[255] = { 0 }; - - va_start(ap, fmt); - vsnprintf(val, sizeof(val), fmt, ap); - va_end(ap); - build_iovec(iov, iovlen, name, strdup(val), (size_t)-1); -} Index: sbin/mount/mntopts.h =================================================================== --- sbin/mount/mntopts.h (revision 247149) +++ sbin/mount/mntopts.h (working copy) @@ -1,99 +0,0 @@ -/*- - * Copyright (c) 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, 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. - * - * @(#)mntopts.h 8.7 (Berkeley) 3/29/95 - * $FreeBSD$ - */ - -struct mntopt { - const char *m_option; /* option name */ - int m_inverse; /* if a negative option, e.g. "atime" */ - int m_flag; /* bit to set, e.g. MNT_RDONLY */ - int m_altloc; /* 1 => set bit in altflags */ -}; - -/* User-visible MNT_ flags. */ -#define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 } -#define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 } -#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_RDONLY { "rdonly", 0, MNT_RDONLY, 0 } -#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 } -#define MOPT_UNION { "union", 0, MNT_UNION, 0 } -#define MOPT_USERQUOTA { "userquota", 0, 0, 0 } -#define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 } -#define MOPT_NOCLUSTERR { "clusterr", 1, MNT_NOCLUSTERR, 0 } -#define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 } -#define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 } -#define MOPT_SNAPSHOT { "snapshot", 0, MNT_SNAPSHOT, 0 } -#define MOPT_MULTILABEL { "multilabel", 0, MNT_MULTILABEL, 0 } -#define MOPT_ACLS { "acls", 0, MNT_ACLS, 0 } -#define MOPT_NFS4ACLS { "nfsv4acls", 0, MNT_NFS4ACLS, 0 } - -/* Control flags. */ -#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } -#define MOPT_UPDATE { "update", 0, MNT_UPDATE, 0 } -#define MOPT_RO { "ro", 0, MNT_RDONLY, 0 } -#define MOPT_RW { "rw", 1, MNT_RDONLY, 0 } - -/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */ -#define MOPT_AUTO { "auto", 0, 0, 0 } - -/* A handy macro as terminator of MNT_ array. */ -#define MOPT_END { NULL, 0, 0, 0 } - -#define MOPT_FSTAB_COMPAT \ - MOPT_RO, \ - MOPT_RW, \ - MOPT_AUTO - -/* Standard options which all mounts can understand. */ -#define MOPT_STDOPTS \ - MOPT_USERQUOTA, \ - MOPT_GROUPQUOTA, \ - MOPT_FSTAB_COMPAT, \ - MOPT_NOATIME, \ - MOPT_NOEXEC, \ - MOPT_SUIDDIR, /* must be before MOPT_NOSUID */ \ - MOPT_NOSUID, \ - MOPT_NOSYMFOLLOW, \ - MOPT_RDONLY, \ - MOPT_UNION, \ - MOPT_NOCLUSTERR, \ - MOPT_NOCLUSTERW, \ - MOPT_MULTILABEL, \ - MOPT_ACLS, \ - MOPT_NFS4ACLS - -void getmntopts(const char *, const struct mntopt *, int *, int *); -void rmslashes(char *, char *); -int checkpath(const char *, char resolved_path[]); -extern int getmnt_silent; -void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); -void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); Index: sbin/mount/mount.c =================================================================== --- sbin/mount/mount.c (revision 247149) +++ sbin/mount/mount.c (working copy) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,6 @@ #include #include "extern.h" -#include "mntopts.h" #include "pathnames.h" /* `meta' options */ Index: sbin/mount/mount_fs.c =================================================================== --- sbin/mount/mount_fs.c (revision 247149) +++ sbin/mount/mount_fs.c (working copy) @@ -50,13 +50,13 @@ #include #include #include +#include #include #include #include #include #include "extern.h" -#include "mntopts.h" static struct mntopt mopts[] = { MOPT_STDOPTS, Index: sbin/mount_cd9660/Makefile =================================================================== --- sbin/mount_cd9660/Makefile (revision 247149) +++ sbin/mount_cd9660/Makefile (working copy) @@ -2,18 +2,12 @@ # $FreeBSD$ PROG= mount_cd9660 -SRCS= mount_cd9660.c getmntopts.c MAN= mount_cd9660.8 -DPADD= ${LIBKICONV} -LDADD= -lkiconv +DPADD= ${LIBKICONV} ${LIBUTIL} +LDADD= -lkiconv -lutil -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} - # Needs to be dynamically linked for optional dlopen() access to # userland libiconv NO_SHARED?= NO -.PATH: ${MOUNT} - .include Index: sbin/mount_cd9660/mount_cd9660.c =================================================================== --- sbin/mount_cd9660/mount_cd9660.c (revision 247149) +++ sbin/mount_cd9660/mount_cd9660.c (working copy) @@ -60,14 +60,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" - static struct mntopt mopts[] = { MOPT_STDOPTS, MOPT_UPDATE, Index: sbin/mount_ext2fs/Makefile =================================================================== --- sbin/mount_ext2fs/Makefile (revision 247149) +++ sbin/mount_ext2fs/Makefile (working copy) @@ -2,13 +2,11 @@ # $FreeBSD$ PROG= mount_ext2fs -SRCS= mount_ext2fs.c getmntopts.c MAN= mount_ext2fs.8 WARNS?= 2 -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} -.PATH: ${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil .include Index: sbin/mount_ext2fs/mount_ext2fs.c =================================================================== --- sbin/mount_ext2fs/mount_ext2fs.c (revision 247149) +++ sbin/mount_ext2fs/mount_ext2fs.c (working copy) @@ -46,14 +46,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" - static void usage(void); int Index: sbin/mount_fusefs/Makefile =================================================================== --- sbin/mount_fusefs/Makefile (revision 247149) +++ sbin/mount_fusefs/Makefile (working copy) @@ -21,13 +21,10 @@ .endif PROG= mount_fusefs -SRCS= mount_fusefs.c getmntopts.c MAN8= mount_fusefs.8 NO_MANCOMPRESS?= yes -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil -.PATH: ${MOUNT} - .include Index: sbin/mount_fusefs/mount_fusefs.c =================================================================== --- sbin/mount_fusefs/mount_fusefs.c (revision 247149) +++ sbin/mount_fusefs/mount_fusefs.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -48,8 +49,6 @@ #include #include -#include "mntopts.h" - #ifndef FUSE4BSD_VERSION #define FUSE4BSD_VERSION "0.3.9-pre1" #endif Index: sbin/mount_hpfs/Makefile =================================================================== --- sbin/mount_hpfs/Makefile (revision 247149) +++ sbin/mount_hpfs/Makefile (working copy) @@ -3,12 +3,11 @@ # PROG= mount_hpfs -SRCS= mount_hpfs.c getmntopts.c MAN= mount_hpfs.8 -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} -DHPFS +CFLAGS+= -DHPFS -.PATH: ${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil .include Index: sbin/mount_hpfs/mount_hpfs.c =================================================================== --- sbin/mount_hpfs/mount_hpfs.c (revision 247149) +++ sbin/mount_hpfs/mount_hpfs.c (working copy) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -46,8 +47,6 @@ #include #include -#include "mntopts.h" - static struct mntopt mopts[] = { MOPT_STDOPTS, MOPT_END Index: sbin/mount_msdosfs/Makefile =================================================================== --- sbin/mount_msdosfs/Makefile (revision 247149) +++ sbin/mount_msdosfs/Makefile (working copy) @@ -3,18 +3,12 @@ # PROG= mount_msdosfs -SRCS= mount_msdosfs.c getmntopts.c MAN= mount_msdosfs.8 -DPADD= ${LIBKICONV} -LDADD= -lkiconv +DPADD= ${LIBKICONV} ${LIBUTIL} +LDADD= -lkiconv -lutil -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} - # Needs to be dynamically linked for optional dlopen() access to # userland libiconv NO_SHARED?= NO -.PATH: ${MOUNT} - .include Index: sbin/mount_msdosfs/mount_msdosfs.c =================================================================== --- sbin/mount_msdosfs/mount_msdosfs.c (revision 247149) +++ sbin/mount_msdosfs/mount_msdosfs.c (working copy) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include /* must be after stdio to declare fparseln */ @@ -55,8 +56,6 @@ #include #include -#include "mntopts.h" - static gid_t a_gid(char *); static uid_t a_uid(char *); static mode_t a_mask(char *); Index: sbin/mount_nfs/Makefile =================================================================== --- sbin/mount_nfs/Makefile (revision 247149) +++ sbin/mount_nfs/Makefile (working copy) @@ -3,17 +3,19 @@ # $FreeBSD$ PROG= mount_nfs -SRCS= mount_nfs.c getmntopts.c mounttab.c +SRCS= mount_nfs.c mounttab.c MAN= mount_nfs.8 MLINKS= mount_nfs.8 mount_oldnfs.8 -MOUNT= ${.CURDIR}/../mount UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall -CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL} +CFLAGS+= -DNFS -I${UMNTALL} WARNS?= 3 +DPADD= ${LIBUTIL} +LDADD= -lutil + LINKS= ${BINDIR}/mount_nfs ${BINDIR}/mount_oldnfs -.PATH: ${MOUNT} ${UMNTALL} +.PATH: ${UMNTALL} .include Index: sbin/mount_nfs/mount_nfs.c =================================================================== --- sbin/mount_nfs/mount_nfs.c (revision 247149) +++ sbin/mount_nfs/mount_nfs.c (working copy) @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -75,7 +76,6 @@ #include #include -#include "mntopts.h" #include "mounttab.h" /* Table for af,sotype -> netid conversions. */ Index: sbin/mount_ntfs/Makefile =================================================================== --- sbin/mount_ntfs/Makefile (revision 247149) +++ sbin/mount_ntfs/Makefile (working copy) @@ -3,18 +3,12 @@ # PROG= mount_ntfs -SRCS= mount_ntfs.c getmntopts.c MAN= mount_ntfs.8 -DPADD= ${LIBKICONV} -LDADD= -lkiconv +DPADD= ${LIBKICONV} ${LIBUTIL} +LDADD= -lkiconv -lutil -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} - # Needs to be dynamically linked for optional dlopen() access to # userland libiconv NO_SHARED?= NO -.PATH: ${MOUNT} - .include Index: sbin/mount_ntfs/mount_ntfs.c =================================================================== --- sbin/mount_ntfs/mount_ntfs.c (revision 247149) +++ sbin/mount_ntfs/mount_ntfs.c (working copy) @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -52,8 +53,6 @@ #include #include -#include "mntopts.h" - #define TRANSITION_PERIOD_HACK static struct mntopt mopts[] = { Index: sbin/mount_nullfs/Makefile =================================================================== --- sbin/mount_nullfs/Makefile (revision 247149) +++ sbin/mount_nullfs/Makefile (working copy) @@ -2,12 +2,9 @@ # $FreeBSD$ PROG= mount_nullfs -SRCS= mount_nullfs.c getmntopts.c MAN= mount_nullfs.8 -MOUNT= ${.CURDIR}/../mount -CFLAGS+=-I${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil -.PATH: ${MOUNT} - .include Index: sbin/mount_nullfs/mount_nullfs.c =================================================================== --- sbin/mount_nullfs/mount_nullfs.c (revision 247149) +++ sbin/mount_nullfs/mount_nullfs.c (working copy) @@ -49,14 +49,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" - int subdir(const char *, const char *); static void usage(void) __dead2; Index: sbin/mount_reiserfs/Makefile =================================================================== --- sbin/mount_reiserfs/Makefile (revision 247149) +++ sbin/mount_reiserfs/Makefile (working copy) @@ -1,13 +1,9 @@ # $FreeBSD$ PROG = mount_reiserfs -SRCS = mount_reiserfs.c getmntopts.c MAN = mount_reiserfs.8 -# mount_reiserfs needs mntopts.h and getmntopts.c from src/sbin/mount/ -MOUNT ?= ${.CURDIR}/../mount -CFLAGS += -I${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil -.PATH: ${MOUNT} - .include Index: sbin/mount_reiserfs/mount_reiserfs.c =================================================================== --- sbin/mount_reiserfs/mount_reiserfs.c (revision 247149) +++ sbin/mount_reiserfs/mount_reiserfs.c (working copy) @@ -31,14 +31,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" - struct mntopt mopts[] = { MOPT_STDOPTS, MOPT_END Index: sbin/mount_std/Makefile =================================================================== --- sbin/mount_std/Makefile (revision 247149) +++ sbin/mount_std/Makefile (working copy) @@ -2,18 +2,16 @@ # $FreeBSD$ PROG= mount_std -SRCS= mount_std.c getmntopts.c MAN= mount_std.8 MLINKS= mount_std.8 mount_devfs.8 \ mount_std.8 mount_fdescfs.8 \ mount_std.8 mount_linprocfs.8 \ mount_std.8 mount_procfs.8 -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} WARNS?= 3 -.PATH: ${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil LINKS= ${BINDIR}/mount_std ${BINDIR}/mount_devfs \ ${BINDIR}/mount_std ${BINDIR}/mount_fdescfs \ Index: sbin/mount_std/mount_std.c =================================================================== --- sbin/mount_std/mount_std.c (revision 247149) +++ sbin/mount_std/mount_std.c (working copy) @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -53,8 +54,6 @@ #include #include -#include "mntopts.h" - static struct mntopt mopts[] = { MOPT_STDOPTS, MOPT_END Index: sbin/mount_udf/Makefile =================================================================== --- sbin/mount_udf/Makefile (revision 247149) +++ sbin/mount_udf/Makefile (working copy) @@ -1,14 +1,11 @@ # $FreeBSD$ PROG= mount_udf -SRCS= mount_udf.c getmntopts.c MAN= mount_udf.8 -DPADD= ${LIBKICONV} -LDADD= -lkiconv +DPADD= ${LIBKICONV} ${LIBUTIL} +LDADD= -lkiconv -lutil -MOUNT= ${.CURDIR}/../mount -CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys -.PATH: ${MOUNT} +CFLAGS+= -I${.CURDIR}/../../sys WARNS?= 1 # Needs to be dynamically linked for optional dlopen() access to Index: sbin/mount_udf/mount_udf.c =================================================================== --- sbin/mount_udf/mount_udf.c (revision 247149) +++ sbin/mount_udf/mount_udf.c (working copy) @@ -53,14 +53,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" - static struct mntopt mopts[] = { MOPT_STDOPTS, MOPT_UPDATE, Index: sbin/mount_unionfs/Makefile =================================================================== --- sbin/mount_unionfs/Makefile (revision 247149) +++ sbin/mount_unionfs/Makefile (working copy) @@ -2,12 +2,9 @@ # $FreeBSD$ PROG= mount_unionfs -SRCS= mount_unionfs.c getmntopts.c MAN= mount_unionfs.8 -MOUNT= ${.CURDIR}/../mount -CFLAGS+=-I${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil -.PATH: ${MOUNT} - .include Index: sbin/mount_unionfs/mount_unionfs.c =================================================================== --- sbin/mount_unionfs/mount_unionfs.c (revision 247149) +++ sbin/mount_unionfs/mount_unionfs.c (working copy) @@ -54,6 +54,7 @@ #include #include +#include #include #include #include @@ -62,8 +63,6 @@ #include #include -#include "mntopts.h" - static int subdir(const char *p, const char *dir) { Index: usr.sbin/mount_nwfs/Makefile =================================================================== --- usr.sbin/mount_nwfs/Makefile (revision 247149) +++ usr.sbin/mount_nwfs/Makefile (working copy) @@ -1,15 +1,11 @@ # $FreeBSD$ PROG= mount_nwfs -SRCS= mount_nwfs.c getmntopts.c MAN= mount_nwfs.8 -MOUNT= ${.CURDIR}/../../sbin/mount -CFLAGS+= -DNWFS -I${MOUNT} +CFLAGS+= -DNWFS -.PATH: ${MOUNT} +DPADD= ${LIBNCP} ${LIBIPX} ${LIBUTIL} +LDADD= -lncp -lipx -lutil -DPADD= ${LIBNCP} ${LIBIPX} -LDADD= -lncp -lipx - .include Index: usr.sbin/mount_nwfs/mount_nwfs.c =================================================================== --- usr.sbin/mount_nwfs/mount_nwfs.c (revision 247149) +++ usr.sbin/mount_nwfs/mount_nwfs.c (working copy) @@ -48,11 +48,11 @@ #include #include #include +#include #include #include #include -#include "mntopts.h" #define NWFS_VFSNAME "nwfs" Index: usr.sbin/mount_portalfs/Makefile =================================================================== --- usr.sbin/mount_portalfs/Makefile (revision 247149) +++ usr.sbin/mount_portalfs/Makefile (working copy) @@ -2,14 +2,13 @@ # $FreeBSD$ PROG= mount_portalfs -SRCS= mount_portalfs.c activate.c conf.c cred.c getmntopts.c pt_conf.c \ +SRCS= mount_portalfs.c activate.c conf.c cred.c pt_conf.c \ pt_exec.c pt_file.c pt_pipe.c pt_tcp.c pt_tcplisten.c MAN= mount_portalfs.8 -MOUNT= ${.CURDIR}/../../sbin/mount -CFLAGS+=-I${MOUNT} WARNS?= 3 -.PATH: ${MOUNT} +DPADD= ${LIBUTIL} +LDADD= -lutil .include Index: usr.sbin/mount_portalfs/mount_portalfs.c =================================================================== --- usr.sbin/mount_portalfs/mount_portalfs.c (revision 247149) +++ usr.sbin/mount_portalfs/mount_portalfs.c (working copy) @@ -53,13 +53,13 @@ #include #include +#include #include #include #include #include #include -#include "mntopts.h" #include "pathnames.h" #include "portald.h" Index: usr.sbin/mount_smbfs/Makefile =================================================================== --- usr.sbin/mount_smbfs/Makefile (revision 247149) +++ usr.sbin/mount_smbfs/Makefile (working copy) @@ -1,15 +1,13 @@ # $FreeBSD$ PROG= mount_smbfs -SRCS= mount_smbfs.c getmntopts.c MAN= mount_smbfs.8 -MOUNTDIR= ${.CURDIR}/../../sbin/mount CONTRIBDIR= ${.CURDIR}/../../contrib/smbfs -CFLAGS+= -DSMBFS -I${MOUNTDIR} -I${CONTRIBDIR}/include +CFLAGS+= -DSMBFS -I${CONTRIBDIR}/include -LDADD= -lsmb -lkiconv -DPADD= ${LIBSMB} ${LIBKICONV} +LDADD= -lsmb -lkiconv -lutil +DPADD= ${LIBSMB} ${LIBKICONV} ${LIBUTIL} # Needs to be dynamically linked for optional dlopen() access to # userland libiconv (see the -E option). @@ -17,6 +15,5 @@ NO_SHARED?= NO .PATH: ${CONTRIBDIR}/mount_smbfs -.PATH: ${MOUNTDIR} .include Index: usr.sbin/mountd/Makefile =================================================================== --- usr.sbin/mountd/Makefile (revision 247149) +++ usr.sbin/mountd/Makefile (working copy) @@ -2,15 +2,10 @@ # $FreeBSD$ PROG= mountd -SRCS= mountd.c getmntopts.c MAN= exports.5 netgroup.5 mountd.8 -MOUNT= ${.CURDIR}/../../sbin/mount -CFLAGS+= -I${MOUNT} WARNS?= 2 -.PATH: ${MOUNT} - DPADD= ${LIBUTIL} LDADD= -lutil Index: usr.sbin/mountd/mountd.c =================================================================== --- usr.sbin/mountd/mountd.c (revision 247149) +++ usr.sbin/mountd/mountd.c (working copy) @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,6 @@ #include #include #include "pathnames.h" -#include "mntopts.h" #ifdef DEBUG #include