diff options
Diffstat (limited to 'contrib/amd/include')
-rw-r--r-- | contrib/amd/include/am_compat.h | 111 | ||||
-rw-r--r-- | contrib/amd/include/am_defs.h | 276 | ||||
-rw-r--r-- | contrib/amd/include/am_utils.h | 680 | ||||
-rw-r--r-- | contrib/amd/include/am_xdr_func.h | 170 | ||||
-rw-r--r-- | contrib/amd/include/amq_defs.h | 8 | ||||
-rw-r--r-- | contrib/amd/include/mount_headers1.h | 71 | ||||
-rw-r--r-- | contrib/amd/include/mount_headers2.h | 68 |
7 files changed, 705 insertions, 679 deletions
diff --git a/contrib/amd/include/am_compat.h b/contrib/amd/include/am_compat.h index c5bc3214e1f0..dc3b71d74468 100644 --- a/contrib/amd/include/am_compat.h +++ b/contrib/amd/include/am_compat.h @@ -1,5 +1,47 @@ /* - * am_compat.h: + * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * + * File: am-utils/include/am_compat.h + * + */ + +/* * * This file contains compatibility functions and macros, all of which * should be auto-discovered, but for one reason or another (mostly @@ -59,6 +101,10 @@ # define MNTTAB_OPT_PGTHRESH "pgthresh" #endif /* defined(MNT2_NFS_OPT_PGTHRESH) && !defined(MNTTAB_OPT_PGTHRESH) */ +#if defined(MNT2_NFS_OPT_PRIVATE) && !defined(MNTTAB_OPT_PRIVATE) +# define MNTTAB_OPT_PRIVATE "private" +#endif /* defined(MNT2_NFS_OPT_PRIVATE) && !defined(MNTTAB_OPT_PRIVATE) */ + #if defined(MNT2_NFS_OPT_RETRANS) && !defined(MNTTAB_OPT_RETRANS) # define MNTTAB_OPT_RETRANS "retrans" #endif /* defined(MNT2_NFS_OPT_RETRANS) && !defined(MNTTAB_OPT_RETRANS) */ @@ -94,6 +140,10 @@ # define MNTTAB_OPT_NOLOCK "nolock" #endif /* defined(MNT2_NFS_OPT_NONLM) && !defined(MNTTAB_OPT_NOLOCK) */ +#if defined(MNT2_NFS_OPT_XLATECOOKIE) && !defined(MNTTAB_OPT_XLATECOOKIE) +# define MNTTAB_OPT_XLATECOOKIE "xlatecookie" +#endif /* defined(MNT2_NFS_OPT_XLATECOOKIE) && !defined(MNTTAB_OPT_XLATECOOKIE) */ + /* * Complete MNTTAB_OPT_* options based on MNT2_CDFS_OPT_* mount options. */ @@ -131,6 +181,19 @@ #endif /* defined(MNT2_CDFS_OPT_EXTATT) && !defined(MNTTAB_OPT_EXTATT) */ /* + * Complete MNTTAB_OPT_* options based on MNT2_PCFS_OPT_* mount options. + */ +#if defined(MNT2_PCFS_OPT_LONGNAME) && !defined(MNTTAB_OPT_LONGNAME) +# define MNTTAB_OPT_LONGNAME "longnames" +#endif /* defined(MNT2_PCFS_OPT_LONGNAME) && !defined(MNTTAB_OPT_LONGNAME) */ +#if defined(MNT2_PCFS_OPT_NOWIN95) && !defined(MNTTAB_OPT_NOWIN95) +# define MNTTAB_OPT_NOWIN95 "nowin95" +#endif /* defined(MNT2_PCFS_OPT_NOWIN95) && !defined(MNTTAB_OPT_NOWIN95) */ +#if defined(MNT2_PCFS_OPT_SHORTNAME) && !defined(MNTTAB_OPT_SHORTNAME) +# define MNTTAB_OPT_SHORTNAME "shortnames" +#endif /* defined(MNT2_PCFS_OPT_SHORTNAME) && !defined(MNTTAB_OPT_SHORTNAME) */ + +/* * Complete MNTTAB_OPT_* options based on MNT2_GEN_OPT_* mount options. */ #if defined(MNT2_GEN_OPT_GRPID) && !defined(MNTTAB_OPT_GRPID) @@ -189,6 +252,10 @@ # define MNTTAB_OPT_PORT "port" #endif /* not MNTTAB_OPT_PORT */ +#ifndef MNTTAB_OPT_PUBLIC +# define MNTTAB_OPT_PUBLIC "public" +#endif /* not MNTTAB_OPT_PUBLIC */ + #ifndef MNTTAB_OPT_RETRANS # define MNTTAB_OPT_RETRANS "retrans" #endif /* not MNTTAB_OPT_RETRANS */ @@ -217,6 +284,19 @@ # define MNTTAB_OPT_WSIZE "wsize" #endif /* not MNTTAB_OPT_WSIZE */ +/* next four are useful for pcfs mounts */ +#ifndef MNTTAB_OPT_USER +# define MNTTAB_OPT_USER "user" +#endif /* not MNTTAB_OPT_USER */ +#ifndef MNTTAB_OPT_GROUP +# define MNTTAB_OPT_GROUP "group" +#endif /* not MNTTAB_OPT_GROUP */ +#ifndef MNTTAB_OPT_MASK +# define MNTTAB_OPT_MASK "mask" +#endif /* not MNTTAB_OPT_MASK */ +#ifndef MNTTAB_OPT_DIRMASK +# define MNTTAB_OPT_DIRMASK "dirmask" +#endif /* not MNTTAB_OPT_DIRMASK */ /* * Incomplete filesystem definitions (sunos4, irix6, solaris2) @@ -268,6 +348,10 @@ struct hsfs_args { # define xfs_args_t u_int #endif /* defined(HAVE_FS_XFS) && !defined(xfs_args_t) */ +#if defined(HAVE_FS_AUTOFS) && defined(MOUNT_TYPE_AUTOFS) && !defined(MNTTYPE_AUTOFS) +# define MNTTYPE_AUTOFS "autofs" +#endif /* defined(HAVE_FS_AUTOFS) && defined(MOUNT_TYPE_AUTOFS) && !defined(MNTTYPE_AUTOFS) */ + /* * If NFS3, then make sure that "proto" and "vers" mnttab options * are available. @@ -281,4 +365,29 @@ struct hsfs_args { # endif /* not MNTTAB_OPT_PROTO */ #endif /* not HAVE_FS_NFS3 */ +/* + * If loop device (header file) exists, define mount table option + */ +#if defined(HAVE_LOOP_DEVICE) && !defined(MNTTAB_OPT_LOOP) +# define MNTTAB_OPT_LOOP "loop" +#endif /* defined(HAVE_LOOP_DEVICE) && !defined(MNTTAB_OPT_LOOP) */ + +/* + * Define a dummy struct netconfig for non-TLI systems + */ +#if !defined(HAVE_NETCONFIG_H) && !defined(HAVE_SYS_NETCONFIG_H) +struct netconfig { + int dummy; +}; +#endif /* not HAVE_NETCONFIG_H and not HAVE_SYS_NETCONFIG_H */ + +/* some OSs don't define INADDR_NONE and assume it's unsigned -1 */ +#ifndef INADDR_NONE +# define INADDR_NONE 0xffffffffU +#endif /* INADDR_NONE */ +/* some OSs don't define INADDR_LOOPBACK */ +#ifndef INADDR_LOOPBACK +# define INADDR_LOOPBACK 0x7f000001 +#endif /* not INADDR_LOOPBACK */ + #endif /* not _AM_COMPAT_H */ diff --git a/contrib/amd/include/am_defs.h b/contrib/amd/include/am_defs.h index 35a9d0334b14..c2185dbfd3e6 100644 --- a/contrib/amd/include/am_defs.h +++ b/contrib/amd/include/am_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2004 Erez Zadok + * Copyright (c) 1997-2006 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -36,9 +36,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: am_defs.h,v 1.15.2.16 2004/05/12 15:54:31 ezk Exp $ + * File: am-utils/include/am_defs.h * */ @@ -69,26 +68,6 @@ char *strchr(), *strrchr(), *strdup(); #endif /* not STDC_HEADERS */ -/* AIX requires this to be the first thing in the file. */ -#ifndef __GNUC__ -# if HAVE_ALLOCA_H -# include <alloca.h> -# else /* not HAVE_ALLOCA_H */ -# ifdef _AIX -/* - * This pragma directive is indented so that pre-ANSI C compilers will - * ignore it, rather than choke on it. - */ - #pragma alloca -# else /* not _AIX */ -# ifndef alloca -/* predefined by HP cc +Olibcalls */ -voidp alloca(); -# endif /* not alloca */ -# endif /* not _AIX */ -# endif /* not HAVE_ALLOCA_H */ -#endif /* not __GNUC__ */ - /* * Handle gcc __attribute__ if available. */ @@ -125,6 +104,15 @@ voidp alloca(); */ #if TIME_WITH_SYS_TIME # include <sys/time.h> +# ifdef _ALL_SOURCE +/* + * AIX 5.2 needs struct sigevent from signal.h to be defined, but I + * don't want to move the inclusion of signal.h this early into this + * file. Luckily, amd doesn't need the size of this structure in any + * other structure that it uses. So we sidestep it for now. + */ +struct sigevent; +# endif /* _ALL_SOURCE */ # include <time.h> #else /* not TIME_WITH_SYS_TIME */ # if HAVE_SYS_TIME_H @@ -158,6 +146,13 @@ voidp alloca(); #endif /* HAVE_SYS_TYPES_H */ /* + * Actions to take if HAVE_LIMITS_H is defined. + */ +#if HAVE_LIMITS_H_H +# include <limits.h> +#endif /* HAVE_LIMITS_H */ + +/* * Actions to take if HAVE_UNISTD_H is defined. */ #if HAVE_UNISTD_H @@ -212,6 +207,12 @@ voidp alloca(); * Actions to take if HAVE_FCNTL_H is defined. */ #if HAVE_FCNTL_H +# ifdef HAVE_LINUX_LOOP_H +/* so I can mount large files as loop devices */ +/* XXX: need to move these two LARGEFILE defines to a better place */ +# define _LARGEFILE64_SOURCE +# define __USE_LARGEFILE64 +# endif /* HAVE_LINUX_LOOP_H */ # include <fcntl.h> #endif /* HAVE_FCNTL_H */ @@ -364,6 +365,13 @@ extern int errno; #endif /* HAVE_NET_ERRNO_H */ /* + * Actions to take if <net/if.h> exists. + */ +#ifdef HAVE_NET_IF_H +# include <net/if.h> +#endif /* HAVE_NET_IF_H */ + +/* * Actions to take if <net/route.h> exists. */ #ifdef HAVE_NET_ROUTE_H @@ -397,11 +405,11 @@ extern int errno; #endif /* HAVE_SYS_MBUF_H */ /* - * Actions to take if <net/if.h> exists. + * Actions to take if <sys/mman.h> exists. */ -#ifdef HAVE_NET_IF_H -# include <net/if.h> -#endif /* HAVE_NET_IF_H */ +#ifdef HAVE_SYS_MMAN_H +# include <sys/mman.h> +#endif /* HAVE_SYS_MMAN_H */ /* * Actions to take if <netdb.h> exists. @@ -599,15 +607,77 @@ struct ypall_callback; #endif /* HAVE_CDFS_CDFSMOUNT_H */ /* - * Actions to take if <linux/auto_fs.h> exists. + * Actions to take if <linux/loop.h> exists. + */ +#ifdef HAVE_LINUX_LOOP_H +# ifdef HAVE_LINUX_POSIX_TYPES_H +# include <linux/posix_types.h> +# endif /* HAVE_LINUX_POSIX_TYPES_H */ +/* next dev_t lines needed due to changes in kernel code */ +# undef dev_t +# define dev_t unsigned short /* compatible with Red Hat and SuSE */ +# include <linux/loop.h> +#endif /* HAVE_LINUX_LOOP_H */ + +/* + * AUTOFS PROTOCOL HEADER FILES: + */ + +/* + * Actions to take if <linux/auto_fs[4].h> exists. * We really don't want <linux/fs.h> pulled in here */ #ifndef _LINUX_FS_H #define _LINUX_FS_H #endif /* _LINUX_FS_H */ -#ifdef HAVE_LINUX_AUTO_FS_H -# include <linux/auto_fs.h> -#endif /* HAVE_LINUX_AUTO_FS_H */ +#ifdef HAVE_LINUX_AUTO_FS4_H +# include <linux/auto_fs4.h> +#else /* not HAVE_LINUX_AUTO_FS4_H */ +# ifdef HAVE_LINUX_AUTO_FS_H +# include <linux/auto_fs.h> +# endif /* HAVE_LINUX_AUTO_FS_H */ +#endif /* not HAVE_LINUX_AUTO_FS4_H */ + +/* + * Actions to take if <sys/fs/autofs.h> exists. + */ +#ifdef HAVE_SYS_FS_AUTOFS_H +# include <sys/fs/autofs.h> +#endif /* HAVE_SYS_FS_AUTOFS_H */ + +/* + * Actions to take if <rpcsvc/autofs_prot.h> or <sys/fs/autofs_prot.h> exist. + */ +#ifdef HAVE_RPCSVC_AUTOFS_PROT_H +# include <rpcsvc/autofs_prot.h> +#else /* not HAVE_RPCSVC_AUTOFS_PROT_H */ +# ifdef HAVE_SYS_FS_AUTOFS_PROT_H +# include <sys/fs/autofs_prot.h> +# endif /* HAVE_SYS_FS_AUTOFS_PROT_H */ +#endif /* not HAVE_RPCSVC_AUTOFS_PROT_H */ + +/* + * Actions to take if <lber.h> exists. + * This header file is required before <ldap.h> can be included. + */ +#ifdef HAVE_LBER_H +# include <lber.h> +#endif /* HAVE_LBER_H */ + +/* + * Actions to take if <ldap.h> exists. + */ +#ifdef HAVE_LDAP_H +# include <ldap.h> +#endif /* HAVE_LDAP_H */ + +/**************************************************************************** + ** IMPORTANT!!! ** + ** We always include am-utils' amu_autofs_prot.h. ** + ** That is actually defined in "conf/autofs/autofs_${autofs_style}.h" ** + ****************************************************************************/ +#include <amu_autofs_prot.h> + /* * NFS PROTOCOL HEADER FILES: @@ -622,7 +692,7 @@ struct ypall_callback; /**************************************************************************** ** IMPORTANT!!! ** - ** We always include am-util's amu_nfs_prot.h. ** + ** We always include am-utils' amu_nfs_prot.h. ** ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" ** ****************************************************************************/ #include <amu_nfs_prot.h> @@ -665,13 +735,29 @@ struct ypall_callback; #ifdef HAVE_SYS_FS_NFS_CLNT_H # include <sys/fs/nfs_clnt.h> #endif /* HAVE_SYS_FS_NFS_CLNT_H */ + +/* complex rules for linux/nfs_mount.h: broken on so many systems */ #ifdef HAVE_LINUX_NFS_MOUNT_H -# define _LINUX_NFS_H -# define _LINUX_NFS2_H -# define _LINUX_NFS3_H -# define _LINUX_NFS_FS_H -# define _LINUX_IN_H +# ifndef _LINUX_NFS_H +# define _LINUX_NFS_H +# endif /* not _LINUX_NFS_H */ +# ifndef _LINUX_NFS2_H +# define _LINUX_NFS2_H +# endif /* not _LINUX_NFS2_H */ +# ifndef _LINUX_NFS3_H +# define _LINUX_NFS3_H +# endif /* not _LINUX_NFS3_H */ +# ifndef _LINUX_NFS_FS_H +# define _LINUX_NFS_FS_H +# endif /* not _LINUX_NFS_FS_H */ +# ifndef _LINUX_IN_H +# define _LINUX_IN_H +# endif /* not _LINUX_IN_H */ +# ifndef __KERNEL__ +# define __KERNEL__ +# endif /* __KERNEL__ */ # include <linux/nfs_mount.h> +# undef __KERNEL__ #endif /* HAVE_LINUX_NFS_MOUNT_H */ /* @@ -689,21 +775,6 @@ struct ypall_callback; #endif /* HAVE_HESIOD_H */ /* - * Actions to take if <lber.h> exists. - * This header file is required before <ldap.h> can be included. - */ -#ifdef HAVE_LBER_H -# include <lber.h> -#endif /* HAVE_LBER_H */ - -/* - * Actions to take if <ldap.h> exists. - */ -#ifdef HAVE_LDAP_H -# include <ldap.h> -#endif /* HAVE_LDAP_H */ - -/* * Actions to take if <arpa/nameser.h> exists. * Should be included before <resolv.h>. */ @@ -736,6 +807,14 @@ struct sockaddr_dl; * Actions to take if <resolv.h> exists. */ #ifdef HAVE_RESOLV_H +/* + * On AIX 5.2, both <resolv.h> and <arpa/nameser_compat.h> define MAXDNAME, + * if compiling with gcc -D_USE_IRS (so that we get extern definitions for + * hstrerror() and others). + */ +# if defined(_AIX) && defined(MAXDNAME) && defined(_USE_IRS) +# undef MAXDNAME +# endif /* defined(_AIX) && defined(MAXDNAME) && defined(_USE_IRS) */ # include <resolv.h> #endif /* HAVE_RESOLV_H */ @@ -768,6 +847,13 @@ struct sockaddr_dl; #endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */ /* + * Actions to take if <fs/msdosfs/msdosfsmount.h> exists. + */ +#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H +# include <fs/msdosfs/msdosfsmount.h> +#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */ + +/* * Actions to take if <sys/fs/tmp.h> exists. */ #ifdef HAVE_SYS_FS_TMP_H @@ -785,7 +871,7 @@ struct sockaddr_dl; # error causes errors with other header files. Instead, add it to the # error specific conf/nfs_prot_*.h file. # include <ufs/ufs/ufsmount.h> -#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ +#endif /* HAVE_UFS_UFS_UFSMOUNT_H_off */ /* * Actions to take if <sys/fs/efs_clnt.h> exists. @@ -915,6 +1001,22 @@ struct sockaddr_dl; * Actions to take if <rpcsvc/nis.h> exists. */ #ifdef HAVE_RPCSVC_NIS_H +/* + * Solaris 10 (build 72) defines GROUP_OBJ in <sys/acl.h>, which is included + * in many other header files. <rpcsvc/nis.h> uses GROUP_OBJ inside enum + * zotypes. So if you're unlucky enough to include both headers, you get a + * compile error because the two symbols conflict. + * A similar conflict arises with Sun cc and the definition of "GROUP". + * + * Temp hack: undefine acl.h's GROUP_OBJ and GROUP because they're not needed + * for am-utils. + */ +# ifdef GROUP_OBJ +# undef GROUP_OBJ +# endif /* GROUP_OBJ */ +# ifdef GROUP +# undef GROUP +# endif /* GROUP */ # include <rpcsvc/nis.h> #endif /* HAVE_RPCSVC_NIS_H */ @@ -1119,6 +1221,13 @@ extern char *nc_sperror(void); #endif /* HAVE_SYS_STATFS_H */ /* + * Actions to take if <sys/statvfs.h> exists. + */ +#ifdef HAVE_SYS_STATVFS_H +# include <sys/statvfs.h> +#endif /* HAVE_SYS_STATVFS_H */ + +/* * Actions to take if <sys/vfs.h> exists. */ #ifdef HAVE_SYS_VFS_H @@ -1211,6 +1320,13 @@ extern char *nc_sperror(void); # include <regex.h> #endif /* HAVE_REGEX_H */ +/* + * Actions to take if <tcpd.h> exists. + */ +#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) +# include <tcpd.h> +#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */ + /****************************************************************************/ /* @@ -1292,6 +1408,16 @@ typedef struct _am_mntent { # endif /* not HAVE_STRUCT_MNTTAB */ #endif /* not HAVE_STRUCT_MNTENT */ +/* + * Provide FD_* macros for systems that lack them. + */ +#ifndef FD_SET +# define FD_SET(fd, set) (*(set) |= (1 << (fd))) +# define FD_ISSET(fd, set) (*(set) & (1 << (fd))) +# define FD_CLR(fd, set) (*(set) &= ~(1 << (fd))) +# define FD_ZERO(set) (*(set) = 0) +#endif /* not FD_SET */ + /* * Complete external definitions missing from some systems. @@ -1348,6 +1474,10 @@ extern int getpagesize(void); extern char *getwd(char *s); #endif /* not HAVE_EXTERN_GETWD */ +#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) && !defined(HAVE_EXTERN_HOSTS_CTL) +extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, char *client_user); +#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) && !defined(HAVE_EXTERN_HOSTS_CTL) */ + #ifndef HAVE_EXTERN_INNETGR extern int innetgr(char *, char *, char *, char *); #endif /* not HAVE_EXTERN_INNETGR */ @@ -1368,6 +1498,10 @@ extern int seteuid(uid_t euid); extern int setitimer(int, struct itimerval *, struct itimerval *); #endif /* defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER) */ +#ifndef HAVE_EXTERN_SLEEP +extern unsigned int sleep(unsigned int seconds); +#endif /* not HAVE_EXTERN_SETITIMER */ + #ifndef HAVE_EXTERN_STRCASECMP /* * define this extern even if function does not exist, for it will @@ -1384,6 +1518,22 @@ extern int strcasecmp(const char *s1, const char *s2); extern char *strdup(const char *s); #endif /* not HAVE_EXTERN_STRDUP */ +#ifndef HAVE_EXTERN_STRLCAT +/* + * define this extern even if function does not exist, for it will + * be filled in by libamu/strlcat.c + */ +extern size_t strlcat(char *dst, const char *src, size_t siz); +#endif /* not HAVE_EXTERN_STRLCAT */ + +#ifndef HAVE_EXTERN_STRLCPY +/* + * define this extern even if function does not exist, for it will + * be filled in by libamu/strlcpy.c + */ +extern size_t strlcpy(char *dst, const char *src, size_t siz); +#endif /* not HAVE_EXTERN_STRLCPY */ + #if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) extern char *strstr(const char *s1, const char *s2); #endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */ @@ -1419,11 +1569,11 @@ extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth); #ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE # include <amu_nfs_prot.h> #endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */ +#include <am_compat.h> +#include <am_xdr_func.h> #include <am_utils.h> #include <amq_defs.h> #include <aux_conf.h> -/* compatibility with old amd, while autoconfiscating it */ -#include <am_compat.h> /****************************************************************************/ @@ -1432,14 +1582,14 @@ extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth); * and those are probably declared in any of the above headers. */ -#ifndef HAVE_HASMNTOPT -extern char *hasmntopt(mntent_t *mnt, char *opt); +#ifdef HAVE_HASMNTOPT +# ifdef HAVE_BAD_HASMNTOPT +extern char *amu_hasmntopt(mntent_t *mnt, char *opt); +# else /* not HAVE_BAD_HASMNTOPT */ +# define amu_hasmntopt hasmntopt +# endif /* not HAVE_BAD_HASMNTOPT */ +#else /* not HAVE_HASMNTOPT */ +extern char *amu_hasmntopt(mntent_t *mnt, char *opt); #endif /* not HAVE_HASMNTOPT */ -/* - * include definitions of all possible xdr functions that are otherwise - * not defined elsewhere. - */ -#include <am_xdr_func.h> - #endif /* not _AM_DEFS_H */ diff --git a/contrib/amd/include/am_utils.h b/contrib/amd/include/am_utils.h index 0549186a7185..b7e55ce33e2c 100644 --- a/contrib/amd/include/am_utils.h +++ b/contrib/amd/include/am_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2004 Erez Zadok + * Copyright (c) 1997-2006 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -36,9 +36,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: am_utils.h,v 1.11.2.13 2004/01/06 03:15:24 ezk Exp $ + * File: am-utils/include/am_utils.h * */ @@ -50,6 +49,8 @@ #define _AM_UTILS_H +#include "aux_conf.h" + /**************************************************************************/ /*** MACROS ***/ /**************************************************************************/ @@ -111,16 +112,9 @@ #define XLOG_DEFSTR "all,nomap,nostats" /* Default log options */ #define XLOG_ALL (XLOG_FATAL|XLOG_ERROR|XLOG_USER|XLOG_WARNING|XLOG_INFO|XLOG_MAP|XLOG_STATS) -#define clocktime() (clock_valid ? clock_valid : time(&clock_valid)) - -#ifndef ROOT_MAP -# define ROOT_MAP "\"root\"" -#endif /* not ROOT_MAP */ - -#define NO_SUBNET "notknown" /* default subnet name for no subnet */ -#define NEXP_AP (1022) /* gdmr: was 254 */ -#define NEXP_AP_MARGIN (128) -#define MAX_READDIR_ENTRIES 16 +#define NO_SUBNET "notknown" /* default subnet name for no subnet */ +#define NEXP_AP (1022) /* gdmr: was 254 */ +#define NEXP_AP_MARGIN (128) /* ???? not used */ /* * Linked list macros @@ -135,82 +129,30 @@ /* allocate anything of type ty */ #define ALLOC(ty) ((ty *) xmalloc(sizeof(ty))) -#define CALLOC(ty) ((ty *) xcalloc(1, sizeof(ty))) +#define CALLOC(ty) ((ty *) xzalloc(sizeof(ty))) /* simply allocate b bytes */ #define SALLOC(b) xmalloc((b)) -/* converting am-filehandles to mount-points */ -#define fh_to_mp2(fhp, rp) fh_to_mp3(fhp, rp, VLOOK_CREATE) - /* * Systems which have the mount table in a file need to read it before * they can perform an unmount() system call. */ -#define UMOUNT_FS(dir, mtb_name) umount_fs(dir, mtb_name) -/* imported via $srcdir/conf/umount/umount_*.c */ -extern int umount_fs(char *fs_name, const char *mnttabname); - -/* - * macros for automounter vfs/vnode operations. - */ -#define VLOOK_CREATE 0x1 -#define VLOOK_DELETE 0x2 -#define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */ -#define FS_MBACKGROUND 0x0002 /* Should background this mount */ -#define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */ -#define FS_MKMNT 0x0008 /* Need to make the mount point */ -#define FS_UBACKGROUND 0x0010 /* Unmount in background */ -#define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND) -#define FS_DISCARD 0x0020 /* Discard immediately on last reference */ -#define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */ +#define UMOUNT_FS(dir, mtb_name, unmount_flags) umount_fs(dir, mtb_name, unmount_flags) +/* next two are imported via $srcdir/conf/umount/umount_*.c */ +extern int umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags); +#ifdef MNT2_GEN_OPT_FORCE +extern int umount2_fs(const char *mntdir, u_int unmount_flags); +#endif /* MNT2_GEN_OPT_FORCE */ -/* - * macros for struct fserver. - */ -#define FSF_VALID 0x0001 /* Valid information available */ -#define FSF_DOWN 0x0002 /* This fileserver is thought to be down */ -#define FSF_ERROR 0x0004 /* Permanent error has occurred */ -#define FSF_WANT 0x0008 /* Want a wakeup call */ -#define FSF_PINGING 0x0010 /* Already doing pings */ -#define FSRV_ISDOWN(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_DOWN|FSF_VALID)) -#define FSRV_ISUP(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_VALID)) - -/* - * macros for struct mntfs (list of mounted filesystems) - */ -#define MFF_MOUNTED 0x0001 /* Node is mounted */ -#define MFF_MOUNTING 0x0002 /* Mount is in progress */ -#define MFF_UNMOUNTING 0x0004 /* Unmount is in progress */ -#define MFF_RESTART 0x0008 /* Restarted node */ -#define MFF_MKMNT 0x0010 /* Delete this node's am_mount */ -#define MFF_ERROR 0x0020 /* This node failed to mount */ -#define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */ -#define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */ -#define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy */ -#ifdef HAVE_AMU_FS_NFSL -# define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */ -#endif /* HAVE_AMU_FS_NFSL */ - -/* - * macros for struct am_node (map of auto-mount points). - */ -#define AMF_NOTIMEOUT 0x0001 /* This node never times out */ -#define AMF_ROOT 0x0002 /* This is a root node */ -#define AMF_AUTOFS 0x0004 /* This node is of type autofs -- not yet supported */ +/* unmount-related flags (special handling of autofs, forced/lazy, etc.) */ +#define AMU_UMOUNT_FORCE 0x1 +#define AMU_UMOUNT_DETACH 0x2 +#define AMU_UMOUNT_AUTOFS 0x4 /* * The following values can be tuned... */ #define ALLOWED_MOUNT_TIME 40 /* 40s for a mount */ -#define AM_TTL (5 * 60) /* Default cache period */ -#define AM_TTL_W (2 * 60) /* Default unmount interval */ -#define AM_PINGER 30 /* NFS ping interval for live systems */ -#define AMFS_AUTO_TIMEO 8 /* Default amfs_auto timeout - .8s */ - -/* - * default amfs_auto retrans - 1/10th seconds - */ -#define AMFS_AUTO_RETRANS ((ALLOWED_MOUNT_TIME*10+5*gopt.amfs_auto_timeo)/gopt.amfs_auto_timeo * 2) /* * RPC-related macros. @@ -218,6 +160,7 @@ extern int umount_fs(char *fs_name, const char *mnttabname); #define RPC_XID_PORTMAP 0 #define RPC_XID_MOUNTD 1 #define RPC_XID_NFSPING 2 +#define RPC_XID_WEBNFS 3 #define RPC_XID_MASK (0x0f) /* 16 id's for now */ #define MK_RPC_XID(type_id, uniq) ((type_id) | ((uniq) << 4)) @@ -228,20 +171,6 @@ extern int umount_fs(char *fs_name, const char *mnttabname); */ #define AMD_COMPAT 5000000 /* 5.0 */ -/* - * Error to return if remote host is not available. - * Try, in order, "host down", "host unreachable", "invalid argument". - */ -#ifdef EHOSTDOWN -# define AM_ERRNO_HOST_DOWN EHOSTDOWN -# else /* not EHOSTDOWN */ -# ifdef EHOSTUNREACH -# define AM_ERRNO_HOST_DOWN EHOSTUNREACH -# else /* not EHOSTUNREACH */ -# define AM_ERRNO_HOST_DOWN EINVAL -# endif /* not EHOSTUNREACH */ -#endif /* not EHOSTDOWN */ - /**************************************************************************/ /*** STRUCTURES AND TYPEDEFS ***/ @@ -249,13 +178,8 @@ extern int umount_fs(char *fs_name, const char *mnttabname); /* some typedefs must come first */ typedef char *amq_string; -typedef struct mntfs mntfs; -typedef struct am_opts am_opts; -typedef struct am_ops am_ops; -typedef struct am_node am_node; typedef struct _qelem qelem; typedef struct mntlist mntlist; -typedef struct fserver fserver; /* * Linked list @@ -285,120 +209,6 @@ typedef enum { Done } serv_state; -/* - * Options - */ -struct am_opts { - char *fs_glob; /* Smashed copy of global options */ - char *fs_local; /* Expanded copy of local options */ - char *fs_mtab; /* Mount table entry */ - /* Other options ... */ - char *opt_dev; - char *opt_delay; - char *opt_dir; - char *opt_fs; - char *opt_group; - char *opt_mount; - char *opt_opts; - char *opt_remopts; - char *opt_pref; - char *opt_cache; - char *opt_rfs; - char *opt_rhost; - char *opt_sublink; - char *opt_type; - char *opt_unmount; - char *opt_user; - char *opt_maptype; /* map type: file, nis, hesiod, etc. */ - char *opt_cachedir; /* cache directory */ - char *opt_addopts; /* options to add to opt_opts */ -}; - -/* - * List of mounted filesystems - */ -struct mntfs { - qelem mf_q; /* List of mounted filesystems */ - am_ops *mf_ops; /* Operations on this mountpoint */ - am_opts *mf_fo; /* File opts */ - char *mf_mount; /* "/a/kiska/home/kiska" */ - char *mf_info; /* Mount info */ - char *mf_auto; /* Automount opts */ - char *mf_mopts; /* FS mount opts */ - char *mf_remopts; /* Remote FS mount opts */ - fserver *mf_server; /* File server */ - int mf_flags; /* Flags MFF_* */ - int mf_error; /* Error code from background mount */ - int mf_refc; /* Number of references to this node */ - int mf_cid; /* Callout id */ - void (*mf_prfree) (voidp); /* Free private space */ - voidp mf_private; /* Private - per-fs data */ -}; - -/* - * File Handle - * - * This is interpreted by indexing the exported array - * by fhh_id. - * - * The whole structure is mapped onto a standard fhandle_t - * when transmitted. - */ -struct am_fh { - int fhh_pid; /* process id */ - int fhh_id; /* map id */ - int fhh_gen; /* generation number */ -}; - -/* - * Multi-protocol NFS file handle - */ -union am_nfs_handle { - /* placeholder for V4 file handle */ -#ifdef HAVE_FS_NFS3 - struct mountres3 v3; /* NFS version 3 handle */ -#endif /* HAVE_FS_NFS3 */ - struct fhstatus v2; /* NFS version 2 handle */ -}; -typedef union am_nfs_handle am_nfs_handle_t; - -/* - * automounter vfs/vnode operations. - */ -typedef char *(*vfs_match) (am_opts *); -typedef int (*vfs_init) (mntfs *); -typedef int (*vmount_fs) (am_node *); -typedef int (*vfmount_fs) (mntfs *); -typedef int (*vumount_fs) (am_node *); -typedef int (*vfumount_fs) (mntfs *); -typedef am_node *(*vlookuppn) (am_node *, char *, int *, int); -typedef int (*vreaddir) (am_node *, nfscookie, nfsdirlist *, nfsentry *, int); -typedef am_node *(*vreadlink) (am_node *, int *); -typedef void (*vmounted) (mntfs *); -typedef void (*vumounted) (am_node *); -typedef fserver *(*vffserver) (mntfs *); - -struct am_ops { - char *fs_type; /* type of filesystems "nfsx" */ - vfs_match fs_match; /* fxn: match */ - vfs_init fs_init; /* fxn: initialization */ - vmount_fs mount_fs; /* fxn: mount vnode */ - vfmount_fs fmount_fs; /* fxn: mount VFS */ - vumount_fs umount_fs; /* fxn: unmount vnode */ - vfumount_fs fumount_fs; /* fxn: unmount VFS */ - vlookuppn lookuppn; /* fxn: lookup path-name */ - vreaddir readdir; /* fxn: read directory */ - vreadlink readlink; /* fxn: read link */ - vmounted mounted; /* fxn: after-mount extra actions */ - vumounted umounted; /* fxn: after-umount extra actions */ - vffserver ffserver; /* fxn: find a file server */ - int fs_flags; /* filesystem flags FS_* */ -}; - -typedef int (*task_fun) (voidp); -typedef void (*cb_fun) (int, int, voidp); -typedef void (*fwd_fun) P((voidp, int, struct sockaddr_in *, - struct sockaddr_in *, voidp, int)); /* * List of mount table entries @@ -413,76 +223,6 @@ struct mntlist { */ typedef struct mnt_map mnt_map; -/* - * Per-mountpoint statistics - */ -struct am_stats { - time_t s_mtime; /* Mount time */ - u_short s_uid; /* Uid of mounter */ - int s_getattr; /* Count of getattrs */ - int s_lookup; /* Count of lookups */ - int s_readdir; /* Count of readdirs */ - int s_readlink; /* Count of readlinks */ - int s_statfs; /* Count of statfs */ -}; -typedef struct am_stats am_stats; - -/* - * System statistics - */ -struct amd_stats { - int d_drops; /* Dropped requests */ - int d_stale; /* Stale NFS handles */ - int d_mok; /* Successful mounts */ - int d_merr; /* Failed mounts */ - int d_uerr; /* Failed unmounts */ -}; -extern struct amd_stats amd_stats; - -/* - * List of fileservers - */ -struct fserver { - qelem fs_q; /* List of fileservers */ - int fs_refc; /* Number of references to this node */ - char *fs_host; /* Normalized hostname of server */ - struct sockaddr_in *fs_ip; /* Network address of server */ - int fs_cid; /* Callout id */ - int fs_pinger; /* Ping (keepalive) interval */ - int fs_flags; /* Flags */ - char *fs_type; /* File server type */ - u_long fs_version; /* NFS version of server (2, 3, etc.)*/ - char *fs_proto; /* NFS protocol of server (tcp, udp, etc.) */ - voidp fs_private; /* Private data */ - void (*fs_prfree) (voidp); /* Free private data */ -}; - -/* - * Map of auto-mount points. - */ -struct am_node { - int am_mapno; /* Map number */ - mntfs *am_mnt; /* Mounted filesystem */ - char *am_name; /* "kiska": name of this node */ - char *am_path; /* "/home/kiska": path of this node's mount point */ - char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */ - am_node *am_parent; /* Parent of this node */ - am_node *am_ysib; /* Younger sibling of this node */ - am_node *am_osib; /* Older sibling of this node */ - am_node *am_child; /* First child of this node */ - nfsattrstat am_attr; /* File attributes */ -#define am_fattr am_attr.ns_u.ns_attr_u - int am_flags; /* Boolean flags AMF_* */ - int am_error; /* Specific mount error */ - time_t am_ttl; /* Time to live */ - int am_timeo_w; /* Wait interval */ - int am_timeo; /* Timeout interval */ - u_int am_gen; /* Generation number */ - char *am_pref; /* Mount info prefix */ - am_stats am_stats; /* Statistics gathering */ - SVCXPRT *am_transp; /* Info for quick reply */ -}; - /**************************************************************************/ /*** EXTERNALS ***/ @@ -496,8 +236,6 @@ extern char *cpu; /* "CPU type" */ extern char *endian; /* "big" */ extern char *hostdomain; /* "southseas.nz" */ extern char copyright[]; /* Copyright info */ -extern char hostd[]; /* "kiska.southseas.nz" */ -extern char pid_fsname[]; /* kiska.southseas.nz:(pid%d) */ extern char version[]; /* Version info */ /* @@ -506,8 +244,6 @@ extern char version[]; /* Version info */ extern AUTH *nfs_auth; /* Dummy authorization for remote servers */ extern FILE *logfp; /* Log file */ extern SVCXPRT *nfsxprt; -extern am_node **exported_ap; /* List of nodes */ -extern am_node *root_node; /* Node for "root" */ extern char *PrimNetName; /* Name of primary connected network */ extern char *PrimNetNum; /* Name of primary connected network */ extern char *SubsNetName; /* Name of subsidiary connected network */ @@ -520,20 +256,13 @@ extern const char *am_get_hostname(void); extern pid_t am_set_mypid(void); extern pid_t am_mypid; -extern int first_free_map; /* First free node */ extern int foreground; /* Foreground process */ -extern int immediate_abort; /* Should close-down unmounts be retried */ -extern int last_used_map; /* Last map being used for mounts */ extern int orig_umask; /* umask() on startup */ -extern int task_notify_todo; /* Task notifier needs running */ extern int xlog_level; /* Logging level */ extern int xlog_level_init; extern serv_state amd_state; /* Should we go now */ extern struct in_addr myipaddr; /* (An) IP address of this host */ extern struct opt_tab xlog_opt[]; -extern time_t clock_valid; /* Clock needs recalculating */ -extern time_t do_mapc_reload; /* Flush & reload mount map cache */ -extern time_t next_softclock; /* Time to call softclock() */ extern u_short nfs_port; /* Our NFS service port */ /* @@ -541,134 +270,92 @@ extern u_short nfs_port; /* Our NFS service port */ */ extern CLIENT *get_mount_client(char *unused_host, struct sockaddr_in *sin, struct timeval *tv, int *sock, u_long mnt_version); extern RETSIGTYPE sigchld(int); -extern am_node *efs_lookuppn(am_node *, char *, int *, int); -extern am_node *exported_ap_alloc(void); -extern am_node *fh_to_mp(am_nfs_fh *); -extern am_node *fh_to_mp3(am_nfs_fh *, int *, int); -extern am_node *find_mf(mntfs *); -extern am_node *next_map(int *); -extern am_node *root_ap(char *, int); -extern am_ops *ops_match(am_opts *, char *, char *, char *, char *, char *); extern bool_t xdr_amq_string(XDR *xdrs, amq_string *objp); extern bool_t xdr_dirpath(XDR *xdrs, dirpath *objp); extern char **strsplit(char *, int, int); -extern char *expand_key(char *); +extern char *expand_selectors(char *); extern char *get_version_string(void); -extern char *inet_dquad(char *, u_long); +extern char *inet_dquad(char *, size_t, u_long); extern char *print_wires(void); extern char *str3cat(char *, char *, char *, char *); extern char *strealloc(char *, char *); extern char *strip_selectors(char *, char *); extern char *strnsave(const char *, int); -extern fserver *dup_srvr(fserver *); extern int amu_close(int fd); -extern int background(void); extern int bind_resv_port(int, u_short *); extern int cmdoption(char *, struct opt_tab *, int *); extern int compute_automounter_mount_flags(mntent_t *); extern int compute_mount_flags(mntent_t *); -extern int efs_readdir(am_node *, nfscookie, nfsdirlist *, nfsentry *, int); -extern int eval_fs_opts(am_opts *, char *, char *, char *, char *, char *); -extern int fwd_init(void); -extern int fwd_packet(int, voidp, int, struct sockaddr_in *, struct sockaddr_in *, voidp, fwd_fun); extern int get_amd_program_number(void); extern int getcreds(struct svc_req *, uid_t *, gid_t *, SVCXPRT *); extern int hasmntval(mntent_t *, char *); +extern unsigned int hasmntvalerr(mntent_t *, char *, int *); +extern char *hasmntstr(mntent_t *, char *); extern char *hasmnteq(mntent_t *, char *); extern char *haseq(char *); extern int is_network_member(const char *net); +extern int is_interface_local(u_long); extern int islocalnet(u_long); -extern int make_nfs_auth(void); extern int make_rpc_packet(char *, int, u_long, struct rpc_msg *, voidp, XDRPROC_T_TYPE, AUTH *); -extern int mapc_keyiter(mnt_map *, void(*)(char *, voidp), voidp); -extern int mapc_search(mnt_map *, char *, char **); -extern int mapc_type_exists(const char *type); extern int mkdirs(char *, int); -extern int mount_auto_node(char *, voidp); -extern int mount_automounter(int); -extern int mount_exported(void); -extern int mount_fs(mntent_t *, int, caddr_t, int, MTYPE_TYPE, u_long, const char *, const char *); -extern int mount_node(am_node *); -extern int nfs_srvr_port(fserver *, u_short *, voidp); +extern int mount_fs(mntent_t *, int, caddr_t, int, MTYPE_TYPE, u_long, const char *, const char *, int); +extern void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp); extern int pickup_rpc_reply(voidp, int, voidp, XDRPROC_T_TYPE); -extern int root_keyiter(void(*)(char *, voidp), voidp); -extern int softclock(void); extern int switch_option(char *); -extern int switch_to_logfile(char *logfile, int orig_umask); -extern int timeout(u_int, void (*fn)(voidp), voidp); -extern int valid_key(char *); -extern mnt_map *mapc_find(char *, char *, const char *); -extern mntfs *dup_mntfs(mntfs *); -extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *); -extern mntfs *new_mntfs(void); -extern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *); +extern int switch_to_logfile(char *logfile, int orig_umask, int truncate_log); extern mntlist *read_mtab(char *, const char *); +#ifndef HAVE_TRANSPORT_TYPE_TLI extern struct sockaddr_in *amu_svc_getcaller(SVCXPRT *xprt); +#endif /* not HAVE_TRANSPORT_TYPE_TLI */ extern time_t time(time_t *); -extern void am_mounted(am_node *); -extern void am_unmounted(am_node *); -extern void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp); -extern void amu_get_myaddress(struct in_addr *iap); +extern void amu_get_myaddress(struct in_addr *iap, const char *preferred_localhost); extern void amu_release_controlling_tty(void); extern void compute_automounter_nfs_args(nfs_args_t *nap, mntent_t *mntp); -extern void deslashify(char *); extern void discard_mntlist(mntlist *mp); -extern void do_task_notify(void); -extern void flush_mntfs(void); -extern void flush_nfs_fhandle_cache(fserver *); -extern void forcibly_timeout_mp(am_node *); -extern void free_map(am_node *); -extern void free_mntfs(voidp); extern void free_mntlist(mntlist *); -extern void free_opts(am_opts *); -extern void free_srvr(fserver *); -extern void fwd_reply(void); -extern void get_args(int argc, char *argv[]); extern void getwire(char **name1, char **number1); extern void going_down(int); -extern void host_normalize(char **); -extern void init_map(am_node *, char *); -extern void ins_que(qelem *, qelem *); -extern void insert_am(am_node *, am_node *); -extern void make_root_node(void); -extern void map_flush_srvr(fserver *); -extern void mapc_add_kv(mnt_map *, char *, char *); -extern void mapc_free(voidp); -extern void mapc_reload(void); -extern void mapc_showtypes(char *buf); -extern void mk_fattr(am_node *, nfsftype); extern void mnt_free(mntent_t *); -extern void mp_to_fh(am_node *, am_nfs_fh *); -extern void new_ttl(am_node *); -extern void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp); -extern void normalize_slash(char *); -extern void ops_showamfstypes(char *buf); -extern void ops_showfstypes(char *outbuf); extern void plog(int, const char *,...) __attribute__ ((__format__ (__printf__, 2, 3))); -extern void rem_que(qelem *); -extern void reschedule_timeout_mp(void); -extern void restart(void); extern void rmdirs(char *); extern void rpc_msg_init(struct rpc_msg *, u_long, u_long, u_long); -extern void run_task(task_fun, voidp, cb_fun, voidp); -extern void sched_task(cb_fun, voidp, voidp); extern void set_amd_program_number(int program); extern void show_opts(int ch, struct opt_tab *); -extern void show_rcs_info(const char *, char *); -extern void srvrlog(fserver *, char *); -extern void timeout_mp(voidp); -extern void umount_exported(void); extern void unregister_amq(void); -extern void untimeout(int); -extern void wakeup(voidp); -extern void wakeup_srvr(fserver *); -extern void wakeup_task(int, int, voidp); extern voidp xmalloc(int); extern voidp xrealloc(voidp, int); extern voidp xzalloc(int); +extern int check_pmap_up(char *host, struct sockaddr_in* sin); extern u_long get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const char *proto); +extern long get_server_pid(void); +extern void setup_sighandler(int signum, void (*handler)(int)); +extern time_t clocktime(nfstime *nt); + +#if defined(DEBUG) && (defined(HAVE_C99_VARARGS_MACROS) || defined(HAVE_GCC_VARARGS_MACROS)) +# ifdef HAVE_C99_VARARGS_MACROS +#define xsnprintf(str,size,fmt,...) _xsnprintf(__FILE__,__LINE__,(str),(size),(fmt),__VA_ARGS__) +# endif /* HAVE_C99_VARARGS_MACROS */ +# ifdef HAVE_GCC_VARARGS_MACROS +#define xsnprintf(str,size,fmt,args...) _xsnprintf(__FILE__,__LINE__,(str),(size),(fmt),args) +# endif /* HAVE_GCC_VARARGS_MACROS */ +extern int _xsnprintf(const char *filename, int lineno, char *str, size_t size, const char *format, ...); +#define xvsnprintf(str,size,fmt,ap) _xvsnprintf(__FILE__,__LINE__,(str),(size),(fmt),(ap)) +extern int _xvsnprintf(const char *filename, int lineno, char *str, size_t size, const char *format, va_list ap); +#else /* not DEBUG or no C99/GCC-style vararg cpp macros supported */ +extern int xsnprintf(char *str, size_t size, const char *format, ...); +extern int xvsnprintf(char *str, size_t size, const char *format, va_list ap); +#endif /* not DEBUG or no C99/GCC-style vararg cpp macros supported */ +#ifdef DEBUG +extern void _xstrlcat(const char *filename, int lineno, char *dst, const char *src, size_t len); +# define xstrlcat(d,s,l) _xstrlcat(__FILE__,__LINE__,(d),(s),(l)) +extern void _xstrlcpy(const char *filename, int lineno, char *dst, const char *src, size_t len); +# define xstrlcpy(d,s,l) _xstrlcpy(__FILE__,__LINE__,(d),(s),(l)) +#else /* not DEBUG */ +extern void xstrlcat(char *dst, const char *src, size_t len); +extern void xstrlcpy(char *dst, const char *src, size_t len); +#endif /* not DEBUG */ #ifdef MOUNT_TABLE_ON_FILE extern void rewrite_mtab(mntlist *, const char *); @@ -680,83 +367,30 @@ extern void write_mntent(mntent_t *, const char *); extern int syslogging; #endif /* defined(HAVE_SYSLOG_H) || defined(HAVE_SYS_SYSLOG_H) */ -#ifdef HAVE_TRANSPORT_TYPE_TLI - extern void compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name); -extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **udp_amqncpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **tcp_amqncpp); +extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **udp_amqncpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **tcp_amqncpp, u_short preferred_amq_port); extern int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)); +extern int amu_svc_register(SVCXPRT *, u_long, u_long, void (*)(struct svc_req *, SVCXPRT *), u_long, struct netconfig *); + +#ifdef HAVE_TRANSPORT_TYPE_TLI + extern int get_knetconfig(struct knetconfig **kncpp, struct netconfig *in_ncp, char *nc_protoname); extern struct netconfig *nfsncp; extern void free_knetconfig(struct knetconfig *kncp); -#else /* not HAVE_TRANSPORT_TYPE_TLI */ +#endif /* HAVE_TRANSPORT_TYPE_TLI */ -extern void compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name); -extern enum clnt_stat pmap_ping(struct sockaddr_in *address); -extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp); -extern int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)); +#ifdef HAVE_FS_AUTOFS +extern int register_autofs_service(char *autofs_conftype, void (*autofs_dispatch)(struct svc_req *rqstp, SVCXPRT *xprt)); +extern int unregister_autofs_service(char *autofs_conftype); +#endif /* HAVE_FS_AUTOFS */ -#endif /* not HAVE_TRANSPORT_TYPE_TLI */ #ifndef HAVE_STRUCT_FHSTATUS_FHS_FH # define fhs_fh fhstatus_u.fhs_fhandle #endif /* not HAVE_STRUCT_FHSTATUS_FHS_FH */ -/**************************************************************************/ -/*** Generic file-system types, implemented as part of the native O/S. ***/ -/**************************************************************************/ - -/* - * Loopback File System - * Many systems can't support this, and in any case most of the - * functionality is available with Symlink FS. - */ -#ifdef HAVE_FS_LOFS -extern am_ops lofs_ops; -#endif /* HAVE_FS_LOFS */ - -/* - * CD-ROM File System (CD-ROM) - * (HSFS: High Sierra F/S on some machines) - * Many systems can't support this, and in any case most of the - * functionality is available with program FS. - */ -#ifdef HAVE_FS_CDFS -extern am_ops cdfs_ops; -#endif /* HAVE_FS_CDFS */ - -/* - * PC File System (MS-DOS) - * Many systems can't support this, and in any case most of the - * functionality is available with program FS. - */ -#ifdef HAVE_FS_PCFS -extern am_ops pcfs_ops; -#endif /* HAVE_FS_PCFS */ - -/* - * Caching File System (Solaris) - */ -#ifdef HAVE_FS_CACHEFS -extern am_ops cachefs_ops; -#endif /* HAVE_FS_CACHEFS */ - -/* - * Network File System - * Good, slow, NFS V.2. - */ -#ifdef HAVE_FS_NFS -extern am_ops nfs_ops; /* NFS */ -extern fserver *find_nfs_srvr (mntfs *); -extern int nfs_fmount(mntfs *mf); -extern int nfs_fumount(mntfs *mf); -extern int nfs_init(mntfs *mf); -extern qelem nfs_srvr_list; -extern void nfs_umounted(am_node *mp); -#endif /* HAVE_FS_NFS */ - - /* * Network File System: the new generation * NFS V.3 @@ -767,124 +401,6 @@ extern void nfs_umounted(am_node *mp); # endif /* not NFS_VERSION3 */ #endif /* HAVE_FS_NFS3 */ -/* - * Un*x File System - * Normal local disk file system. - */ -#ifdef HAVE_FS_UFS -extern am_ops ufs_ops; /* Un*x file system */ -#endif /* HAVE_FS_UFS */ - - -/**************************************************************************/ -/*** Automounter file-system types, implemented by amd. ***/ -/**************************************************************************/ - -/* - * Automount File System - */ -#ifdef HAVE_AMU_FS_AUTO -extern am_ops amfs_auto_ops; /* Automount file system (this!) */ -extern am_ops amfs_toplvl_ops; /* Top-level automount file system */ -extern am_ops amfs_root_ops; /* Root file system */ -extern qelem amfs_auto_srvr_list; -extern am_node *amfs_auto_lookuppn(am_node *mp, char *fname, int *error_return, int op); -extern am_node *next_nonerror_node(am_node *xp); -extern char *amfs_auto_match(am_opts *fo); -extern fserver *find_amfs_auto_srvr(mntfs *); -extern int amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, int count); -extern int amfs_auto_umount(am_node *mp); -extern int amfs_auto_fmount(am_node *mp); -extern int amfs_auto_fumount(am_node *mp); -#endif /* HAVE_AMU_FS_AUTO */ - -/* - * Toplvl Automount File System - */ -#ifdef HAVE_AMU_FS_TOPLVL -extern am_ops amfs_toplvl_ops; /* Toplvl Automount file system */ -extern int amfs_toplvl_mount(am_node *mp); -extern int amfs_toplvl_umount(am_node *mp); -extern void amfs_toplvl_mounted(mntfs *mf); -#endif /* HAVE_AMU_FS_TOPLVL */ - -/* - * Direct Automount File System - */ -#ifdef HAVE_AMU_FS_DIRECT -extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */ -#endif /* HAVE_AMU_FS_DIRECT */ - -/* - * Error File System - */ -#ifdef HAVE_AMU_FS_ERROR -extern am_ops amfs_error_ops; /* Error file system */ -extern am_node *amfs_error_lookuppn(am_node *mp, char *fname, int *error_return, int op); -extern int amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, int count); -#endif /* HAVE_AMU_FS_ERROR */ - -/* - * Inheritance File System - */ -#ifdef HAVE_AMU_FS_INHERIT -extern am_ops amfs_inherit_ops; /* Inheritance file system */ -#endif /* HAVE_AMU_FS_INHERIT */ - -/* - * NFS mounts with local existence check. - */ -#ifdef HAVE_AMU_FS_NFSL -extern am_ops amfs_nfsl_ops; /* NFSL */ -#endif /* HAVE_AMU_FS_NFSL */ - -/* - * Multi-nfs mounts. - */ -#ifdef HAVE_AMU_FS_NFSX -extern am_ops amfs_nfsx_ops; /* NFSX */ -#endif /* HAVE_AMU_FS_NFSX */ - -/* - * NFS host - a whole tree. - */ -#ifdef HAVE_AMU_FS_HOST -extern am_ops amfs_host_ops; /* NFS host */ -#endif /* HAVE_AMU_FS_HOST */ - -/* - * Program File System - * This is useful for things like RVD. - */ -#ifdef HAVE_AMU_FS_PROGRAM -extern am_ops amfs_program_ops; /* Program File System */ -#endif /* HAVE_AMU_FS_PROGRAM */ - -/* - * Symbolic-link file system. - * A "filesystem" which is just a symbol link. - */ -#ifdef HAVE_AMU_FS_LINK -extern am_ops amfs_link_ops; /* Symlink FS */ -extern int amfs_link_fmount(mntfs *mf); -#endif /* HAVE_AMU_FS_LINK */ - -/* - * Symbolic-link file system, which also checks that the target of - * the symlink exists. - * A "filesystem" which is just a symbol link. - */ -#ifdef HAVE_AMU_FS_LINKX -extern am_ops amfs_linkx_ops; /* Symlink FS with existence check */ -#endif /* HAVE_AMU_FS_LINKX */ - -/* - * Union file system - */ -#ifdef HAVE_AMU_FS_UNION -extern am_ops amfs_union_ops; /* Union FS */ -#endif /* HAVE_AMU_FS_UNION */ - /**************************************************************************/ /*** DEBUGGING ***/ @@ -893,42 +409,39 @@ extern am_ops amfs_union_ops; /* Union FS */ /* * DEBUGGING: */ + #ifdef DEBUG -# define D_ALL (~0) -# define D_DAEMON 0x0001 /* Enter daemon mode */ +# define D_ALL (~(D_MTAB|D_HRTIME|D_XDRTRACE|D_DAEMON|D_FORK|D_AMQ)) +# define D_DAEMON 0x0001 /* Don't enter daemon mode */ # define D_TRACE 0x0002 /* Do protocol trace */ # define D_FULL 0x0004 /* Do full trace */ # define D_MTAB 0x0008 /* Use local mtab */ -# define D_AMQ 0x0010 /* Register amq program */ +# define D_AMQ 0x0010 /* Don't register amq program */ # define D_STR 0x0020 /* Debug string munging */ -# ifdef DEBUG_MEM -# define D_MEM 0x0040 /* Trace memory allocations */ -# endif /* DEBUG_MEM */ -# define D_FORK 0x0080 /* Fork server */ +# ifdef DEBUG_MEM +# define D_MEM 0x0040 /* Trace memory allocations */ +# else /* not DEBUG_MEM */ +# define D_MEM 0x0000 /* Dummy */ +# endif /* not DEBUG_MEM */ +# define D_FORK 0x0080 /* Don't fork server */ /* info service specific debugging (hesiod, nis, etc) */ # define D_INFO 0x0100 # define D_HRTIME 0x0200 /* Print high resolution time stamps */ # define D_XDRTRACE 0x0400 /* Trace xdr routines */ -# define D_READDIR 0x0800 /* show browsable_dir progress */ +# define D_READDIR 0x0800 /* Show browsable_dir progress */ /* - * Normally, don't enter daemon mode, don't register amq, and don't trace xdr + * Test mode is test mode: don't daemonize, don't register amq, don't fork, + * don't touch system mtab, etc. */ -# ifdef DEBUG_MEM -# define D_TEST (~(D_DAEMON|D_MEM|D_STR|D_XDRTRACE)) -# else /* not DEBUG_MEM */ -# define D_TEST (~(D_DAEMON|D_STR|D_XDRTRACE)) -# endif /* not DEBUG_MEM */ +# define D_TEST (~(D_MEM|D_STR|D_XDRTRACE)) -# define amuDebug(x) if (debug_flags & (x)) -# define dlog amuDebug(D_FULL) dplog -# define amuDebugNo(x) if (!(debug_flags & (x))) +# define amuDebug(x) (debug_flags & (x)) +# define dlog if (amuDebug(D_FULL)) dplog -/* debugging mount-table file to use */ -# ifndef DEBUG_MNTTAB -# define DEBUG_MNTTAB "./mnttab" -# endif /* not DEBUG_MNTTAB */ +/* my favorite debugging tool -Erez */ +#define EZKDBG plog(XLOG_INFO,"EZK:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__) # ifdef DEBUG_MEM /* @@ -949,18 +462,25 @@ extern void malloc_verify(void); /* functions that depend solely on debugging */ extern void print_nfs_args(const nfs_args_t *nap, u_long nfs_version); extern int debug_option (char *opt); +extern void dplog(const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); #else /* not DEBUG */ /* - * if not debugging, then simple perform free, and don't bother - * resetting the pointer. + * If not debugging, then also reset the pointer. + * It's safer -- and besides, free() should do that anyway. */ -# define XFREE(x) free(x) +# define XFREE(x) do { free((voidp)x); x = NULL;} while (0) + +#define amuDebug(x) (0) -#define amuDebug(x) if (0) -#define dlog if (0) dplog -#define amuDebugNo(x) if (0) +#ifdef __GNUC__ +#define dlog(fmt...) +#else /* not __GNUC__ */ +/* this define means that we CCP leaves code behind the (list,of,args) */ +#define dlog +#endif /* not __GNUC__ */ #define print_nfs_args(nap, nfs_version) #define debug_option(x) (1) @@ -969,8 +489,6 @@ extern int debug_option (char *opt); extern int debug_flags; /* Debug options */ extern struct opt_tab dbg_opt[]; -extern void dplog(const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); /**************************************************************************/ /*** MISC (stuff left to autoconfiscate) ***/ diff --git a/contrib/amd/include/am_xdr_func.h b/contrib/amd/include/am_xdr_func.h index 6e3cdcea26a4..c4159188c799 100644 --- a/contrib/amd/include/am_xdr_func.h +++ b/contrib/amd/include/am_xdr_func.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2004 Erez Zadok + * Copyright (c) 1997-2006 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -36,12 +36,147 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: am_xdr_func.h,v 1.3.2.6 2004/01/06 03:15:24 ezk Exp $ + * File: am-utils/include/am_xdr_func.h * */ +#ifdef HAVE_FS_NFS3 + +#define AM_FHSIZE3 64 /* size in bytes of a file handle (v3) */ +#define AM_MOUNTVERS3 ((unsigned long)(3)) + +/* NFSv3 handle */ +struct am_nfs_fh3 { + u_int am_fh3_length; + char am_fh3_data[AM_FHSIZE3]; +}; +typedef struct am_nfs_fh3 am_nfs_fh3; + +#define AM_NFSPROC3_LOOKUP ((u_long) 3) +enum am_nfsstat3 { + AM_NFS3_OK = 0, + AM_NFS3ERR_PERM = 1, + AM_NFS3ERR_NOENT = 2, + AM_NFS3ERR_IO = 5, + AM_NFS3ERR_NXIO = 6, + AM_NFS3ERR_ACCES = 13, + AM_NFS3ERR_EXIST = 17, + AM_NFS3ERR_XDEV = 18, + AM_NFS3ERR_NODEV = 19, + AM_NFS3ERR_NOTDIR = 20, + AM_NFS3ERR_ISDIR = 21, + AM_NFS3ERR_INVAL = 22, + AM_NFS3ERR_FBIG = 27, + AM_NFS3ERR_NOSPC = 28, + AM_NFS3ERR_ROFS = 30, + AM_NFS3ERR_MLINK = 31, + AM_NFS3ERR_NAMETOOLONG = 63, + AM_NFS3ERR_NOTEMPTY = 66, + AM_NFS3ERR_DQUOT = 69, + AM_NFS3ERR_STALE = 70, + AM_NFS3ERR_REMOTE = 71, + AM_NFS3ERR_BADHANDLE = 10001, + AM_NFS3ERR_NOT_SYNC = 10002, + AM_NFS3ERR_BAD_COOKIE = 10003, + AM_NFS3ERR_NOTSUPP = 10004, + AM_NFS3ERR_TOOSMALL = 10005, + AM_NFS3ERR_SERVERFAULT = 10006, + AM_NFS3ERR_BADTYPE = 10007, + AM_NFS3ERR_JUKEBOX = 10008 +}; +typedef enum am_nfsstat3 am_nfsstat3; + +typedef struct { + u_int fhandle3_len; + char *fhandle3_val; +} am_fhandle3; + +enum am_mountstat3 { + AM_MNT3_OK = 0, + AM_MNT3ERR_PERM = 1, + AM_MNT3ERR_NOENT = 2, + AM_MNT3ERR_IO = 5, + AM_MNT3ERR_ACCES = 13, + AM_MNT3ERR_NOTDIR = 20, + AM_MNT3ERR_INVAL = 22, + AM_MNT3ERR_NAMETOOLONG = 63, + AM_MNT3ERR_NOTSUPP = 10004, + AM_MNT3ERR_SERVERFAULT = 10006 +}; +typedef enum am_mountstat3 am_mountstat3; + +struct am_mountres3_ok { + am_fhandle3 fhandle; + struct { + u_int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; +}; +typedef struct am_mountres3_ok am_mountres3_ok; + +struct am_mountres3 { + am_mountstat3 fhs_status; + union { + am_mountres3_ok mountinfo; + } mountres3_u; +}; +typedef struct am_mountres3 am_mountres3; + +typedef char *am_filename3; + +struct am_diropargs3 { + am_nfs_fh3 dir; + am_filename3 name; +}; +typedef struct am_diropargs3 am_diropargs3; + +struct am_LOOKUP3args { + am_diropargs3 what; +}; +typedef struct am_LOOKUP3args am_LOOKUP3args; + +struct am_LOOKUP3resok { + am_nfs_fh3 object; +#if 0 + post_op_attr obj_attributes; + post_op_attr dir_attributes; +#endif +}; +typedef struct am_LOOKUP3resok am_LOOKUP3resok; + +struct am_LOOKUP3resfail { +#if 0 + post_op_attr dir_attributes; +#else + char dummy; /* cannot have an empty declaration */ +#endif +}; +typedef struct am_LOOKUP3resfail am_LOOKUP3resfail; + +struct am_LOOKUP3res { + am_nfsstat3 status; + union { + am_LOOKUP3resok ok; + am_LOOKUP3resfail fail; + } res_u; +}; +typedef struct am_LOOKUP3res am_LOOKUP3res; +#endif /* HAVE_FS_NFS3 */ + +/* + * Multi-protocol NFS file handle + */ +union am_nfs_handle { + /* placeholder for V4 file handle */ +#ifdef HAVE_FS_NFS3 + am_nfs_fh3 v3; /* NFS version 3 handle */ +#endif /* HAVE_FS_NFS3 */ + am_nfs_fh v2; /* NFS version 2 handle */ +}; +typedef union am_nfs_handle am_nfs_handle_t; + + /* * Definitions of all possible xdr functions that are otherwise * not defined elsewhere. @@ -110,17 +245,6 @@ bool_t xdr_mountbody(XDR *xdrs, mountbody *objp); #ifndef HAVE_XDR_MOUNTLIST bool_t xdr_mountlist(XDR *xdrs, mountlist *objp); #endif /* not HAVE_XDR_MOUNTLIST */ - -/* - * NFS3 XDR FUNCTIONS: - */ -#if defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) -bool_t xdr_fhandle3(XDR *xdrs, fhandle3 *objp); -bool_t xdr_mountstat3(XDR *xdrs, mountstat3 *objp); -bool_t xdr_mountres3_ok(XDR *xdrs, mountres3_ok *objp); -bool_t xdr_mountres3(XDR *xdrs, mountres3 *objp); -#endif /* defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) */ - #ifndef HAVE_XDR_NAME bool_t xdr_name(XDR *xdrs, name *objp); #endif /* not HAVE_XDR_NAME */ @@ -182,4 +306,22 @@ bool_t xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp); bool_t xdr_writeargs(XDR *xdrs, nfswriteargs *objp); #endif /* not HAVE_XDR_WRITEARGS */ +/* + * NFS3 XDR FUNCTIONS: + */ +#ifdef HAVE_FS_NFS3 +bool_t xdr_am_fhandle3(XDR *xdrs, am_fhandle3 *objp); +bool_t xdr_am_mountstat3(XDR *xdrs, am_mountstat3 *objp); +bool_t xdr_am_mountres3_ok(XDR *xdrs, am_mountres3_ok *objp); +bool_t xdr_am_mountres3(XDR *xdrs, am_mountres3 *objp); +bool_t xdr_am_diropargs3(XDR *xdrs, am_diropargs3 *objp); +bool_t xdr_am_filename3(XDR *xdrs, am_filename3 *objp); +bool_t xdr_am_LOOKUP3args(XDR *xdrs, am_LOOKUP3args *objp); +bool_t xdr_am_LOOKUP3res(XDR *xdrs, am_LOOKUP3res *objp); +bool_t xdr_am_LOOKUP3resfail(XDR *xdrs, am_LOOKUP3resfail *objp); +bool_t xdr_am_LOOKUP3resok(XDR *xdrs, am_LOOKUP3resok *objp); +bool_t xdr_am_nfsstat3(XDR *xdrs, am_nfsstat3 *objp); +bool_t xdr_am_nfs_fh3(XDR *xdrs, am_nfs_fh3 *objp); +#endif /* HAVE_FS_NFS3 */ + #endif /* not _AM_XDR_FUNC_H */ diff --git a/contrib/amd/include/amq_defs.h b/contrib/amd/include/amq_defs.h index 118233026d99..75c465171033 100644 --- a/contrib/amd/include/amq_defs.h +++ b/contrib/amd/include/amq_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2004 Erez Zadok + * Copyright (c) 1997-2006 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -36,9 +36,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: amq_defs.h,v 1.4.2.4 2004/01/06 03:15:24 ezk Exp $ + * File: am-utils/include/amq_defs.h * */ @@ -51,7 +50,7 @@ #ifndef AMQ_SIZE # define AMQ_SIZE 16384 #endif /* not AMQ_SIZE */ -#define AMQ_STRLEN 2048 +#define AMQ_STRLEN 16384 #define AMQ_PROGRAM ((u_long)300019) #define AMQ_VERSION ((u_long)1) #define AMQPROC_NULL ((u_long)0) @@ -64,6 +63,7 @@ #define AMQPROC_MOUNT ((u_long)7) #define AMQPROC_GETVERS ((u_long)8) #define AMQPROC_GETPID ((u_long)9) +#define AMQPROC_PAWD ((u_long)10) /* * TYPEDEFS diff --git a/contrib/amd/include/mount_headers1.h b/contrib/amd/include/mount_headers1.h index 0015528453e5..41f26e59f99d 100644 --- a/contrib/amd/include/mount_headers1.h +++ b/contrib/amd/include/mount_headers1.h @@ -1,3 +1,47 @@ +/* + * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * + * File: am-utils/include/mount_headers1.h + * + */ + + #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif /* HAVE_SYS_TYPES_H */ @@ -131,17 +175,12 @@ #ifdef HAVE_UFS_UFS_MOUNT_H # include <ufs/ufs_mount.h> #endif /* HAVE_UFS_UFS_MOUNT_H */ -#ifdef HAVE_UFS_UFS_UFSMOUNT_H -# ifndef MAXQUOTAS -# define MAXQUOTAS 2 -# endif /* not MAXQUOTAS */ -struct netexport { int this_is_SO_wrong; }; /* for bsdi-2.1 */ -/* netbsd-1.4 does't protect <ufs/ufs/ufsmount.h> */ -# ifndef _UFS_UFS_UFSMOUNT_H -# include <ufs/ufs/ufsmount.h> -# define _UFS_UFS_UFSMOUNT_H -# endif /* not _UFS_UFS_UFSMOUNT_H */ -#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ +#ifdef HAVE_UFS_UFS_UFSMOUNT_H_off +# error do not include this file here because on *bsd it +# error causes errors with other header files. Instead, add it to the +# error specific conf/nfs_prot_*.h file. +# include <ufs/ufs/ufsmount.h> +#endif /* HAVE_UFS_UFS_UFSMOUNT_H_off */ #ifdef HAVE_CDFS_CDFS_MOUNT_H # include <cdfs/cdfs_mount.h> @@ -153,6 +192,16 @@ struct netexport { int this_is_SO_wrong; }; /* for bsdi-2.1 */ # include <isofs/cd9660/cd9660_mount.h> #endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */ +#ifdef HAVE_SYS_FS_PC_FS_H +# include <sys/fs/pc_fs.h> +#endif /* HAVE_SYS_FS_PC_FS_H */ +#ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H +# include <msdosfs/msdosfsmount.h> +#endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */ +#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H +# include <fs/msdosfs/msdosfsmount.h> +#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */ + #ifdef HAVE_RPC_RPC_H # include <rpc/rpc.h> #endif /* HAVE_RPC_RPC_H */ diff --git a/contrib/amd/include/mount_headers2.h b/contrib/amd/include/mount_headers2.h index bd9f567420b1..273e89cae10c 100644 --- a/contrib/amd/include/mount_headers2.h +++ b/contrib/amd/include/mount_headers2.h @@ -1,3 +1,47 @@ +/* + * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * + * File: am-utils/include/mount_headers2.h + * + */ + + #ifdef HAVE_RPCSVC_MOUNT_H # include <rpcsvc/mount.h> @@ -20,10 +64,24 @@ #endif /* HAVE_SYS_FS_NFS_CLNT_H */ #ifdef HAVE_LINUX_NFS_MOUNT_H -# define _LINUX_NFS_H -# define _LINUX_NFS2_H -# define _LINUX_NFS3_H -# define _LINUX_NFS_FS_H -# define _LINUX_IN_H +# ifndef _LINUX_NFS_H +# define _LINUX_NFS_H +# endif /* not _LINUX_NFS_H */ +# ifndef _LINUX_NFS2_H +# define _LINUX_NFS2_H +# endif /* not _LINUX_NFS2_H */ +# ifndef _LINUX_NFS3_H +# define _LINUX_NFS3_H +# endif /* not _LINUX_NFS3_H */ +# ifndef _LINUX_NFS_FS_H +# define _LINUX_NFS_FS_H +# endif /* not _LINUX_NFS_FS_H */ +# ifndef _LINUX_IN_H +# define _LINUX_IN_H +# endif /* not _LINUX_IN_H */ +# ifndef __KERNEL__ +# define __KERNEL__ +# endif /* __KERNEL__ */ # include <linux/nfs_mount.h> +# undef __KERNEL__ #endif /* HAVE_LINUX_NFS_MOUNT_H */ |