aboutsummaryrefslogtreecommitdiff
path: root/contrib/amd/include
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/amd/include')
-rw-r--r--contrib/amd/include/am_compat.h15
-rw-r--r--contrib/amd/include/am_defs.h74
-rw-r--r--contrib/amd/include/am_utils.h101
-rw-r--r--contrib/amd/include/am_xdr_func.h6
-rw-r--r--contrib/amd/include/amq_defs.h4
-rw-r--r--contrib/amd/include/mount_headers1.h167
-rw-r--r--contrib/amd/include/mount_headers2.h29
7 files changed, 319 insertions, 77 deletions
diff --git a/contrib/amd/include/am_compat.h b/contrib/amd/include/am_compat.h
index 876f2ea4f532..639e9a168944 100644
--- a/contrib/amd/include/am_compat.h
+++ b/contrib/amd/include/am_compat.h
@@ -86,6 +86,14 @@
# define MNTTAB_OPT_MAXGROUPS "maxgroups"
#endif /* defined(MNT2_NFS_OPT_MAXGRPS) && !defined(MNTTAB_OPT_MAXGROUPS) */
+#if defined(MNT2_NFS_OPT_PROPLIST) && !defined(MNTTAB_OPT_PROPLIST)
+# define MNTTAB_OPT_PROPLIST "proplist"
+#endif /* defined(MNT2_NFS_OPT_PROPLIST) && !defined(MNTTAB_OPT_PROPLIST) */
+
+#if defined(MNT2_NFS_OPT_NONLM) && !defined(MNTTAB_OPT_NOLOCK)
+# define MNTTAB_OPT_NOLOCK "nolock"
+#endif /* defined(MNT2_NFS_OPT_NONLM) && !defined(MNTTAB_OPT_NOLOCK) */
+
/*
* Complete MNTTAB_OPT_* options based on MNT2_CDFS_OPT_* mount options.
*/
@@ -250,6 +258,13 @@ struct hsfs_args {
# define ufs_args_t u_int
#endif /* defined(HAVE_FS_UFS) && !defined(ufs_args_t) */
+/*
+ * if does not define struct efs_args, assume integer bit-field (linux)
+ */
+#if defined(HAVE_FS_EFS) && !defined(efs_args_t)
+# define efs_args_t u_int
+#endif /* defined(HAVE_FS_EFS) && !defined(efs_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) */
diff --git a/contrib/amd/include/am_defs.h b/contrib/amd/include/am_defs.h
index dbf266b9325f..136abe1a0737 100644
--- a/contrib/amd/include/am_defs.h
+++ b/contrib/amd/include/am_defs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-1999 Erez Zadok
+ * Copyright (c) 1997-2001 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.
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: am_defs.h,v 1.11 1999/09/18 08:38:05 ezk Exp $
+ * $Id: am_defs.h,v 1.15.2.9 2001/04/07 00:47:44 ib42 Exp $
*
*/
@@ -331,14 +331,15 @@ extern int errno;
/* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
# define DATUM
# endif /* not DATUM */
-#endif /* HAVE_NDBM_H */
-#ifdef HAVE_DB1_NDBM_H
-# include <db1/ndbm.h>
-# ifndef DATUM
+#else /* not HAVE_NDBM_H */
+# ifdef HAVE_DB1_NDBM_H
+# include <db1/ndbm.h>
+# ifndef DATUM
/* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
-# define DATUM
-# endif /* not DATUM */
-#endif /* HAVE_DB1_NDBM_H */
+# define DATUM
+# endif /* not DATUM */
+# endif /* HAVE_DB1_NDBM_H */
+#endif /* HAVE_NDBM_H */
/*
* Actions to take if <net/errno.h> exists.
@@ -457,32 +458,29 @@ struct ypall_callback;
* NFS and other definitions included.
*/
# ifndef NFSCLIENT
-# define NFSCLIENT
+# define NFSCLIENT 1
# endif /* not NFSCLIENT */
# ifndef NFS
-# define NFS
+# define NFS 1
# endif /* not NFS */
# ifndef PCFS
-# define PCFS
+# define PCFS 1
# endif /* not PCFS */
# ifndef LOFS
-# define LOFS
+# define LOFS 1
# endif /* not LOFS */
# ifndef RFS
-# define RFS
+# define RFS 1
# endif /* not RFS */
# ifndef MSDOSFS
-# define MSDOSFS
+# define MSDOSFS 1
# endif /* not MSDOSFS */
# ifndef MFS
-# define MFS
+# define MFS 1
# endif /* not MFS */
# ifndef CD9660
-# define CD9660
+# define CD9660 1
# endif /* not CD9660 */
-# ifndef NFS
-# define NFS
-# endif /* not NFS */
# include <sys/mount.h>
#endif /* HAVE_SYS_MOUNT_H */
@@ -492,8 +490,10 @@ struct ypall_callback;
/*
* Actions to take if <linux/fs.h> exists.
+ * There is no point in including this on a glibc2 system,
+ * we're only asking for trouble
*/
-#ifdef HAVE_LINUX_FS_H
+#if defined HAVE_LINUX_FS_H && (!defined __GLIBC__ || __GLIBC__ < 2)
/*
* There are various conflicts in definitions between RedHat Linux, newer
* 2.2 kernels, and <netinet/in.h> and <linux/fs.h>.
@@ -559,8 +559,21 @@ struct ypall_callback;
/* conflicts with <statfsbuf.h> */
# define _SYS_STATFS_H
# endif /* _SYS_MOUNT_H */
+# ifndef _LINUX_STRING_H_
+# define _LINUX_STRING_H_
+# endif /* not _LINUX_STRING_H_ */
+# ifdef HAVE_LINUX_KDEV_T_H
+# define __KERNEL__
+# include <linux/kdev_t.h>
+# undef __KERNEL__
+# endif /* HAVE_LINUX_KDEV_T_H */
+# ifdef HAVE_LINUX_LIST_H
+# define __KERNEL__
+# include <linux/list.h>
+# undef __KERNEL__
+# endif /* HAVE_LINUX_LIST_H */
# include <linux/fs.h>
-#endif /* HAVE_LINUX_FS_H */
+#endif /* HAVE_LINUX_FS_H && (!__GLIBC__ || __GLIBC__ < 2) */
#ifdef HAVE_CDFS_CDFS_MOUNT_H
# include <cdfs/cdfs_mount.h>
@@ -572,7 +585,11 @@ struct ypall_callback;
/*
* Actions to take if <linux/auto_fs.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 */
@@ -586,7 +603,11 @@ struct ypall_callback;
/*
* Actions to take if <sys/fs/autofs_prot.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_SYS_FS_AUTOFS_PROT_H
# include <sys/fs/autofs_prot.h>
#endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
@@ -632,7 +653,7 @@ struct ypall_callback;
# include <nfs/mount.h>
#endif /* HAVE_NFS_MOUNT_H */
#ifdef HAVE_NFS_NFS_MOUNT_H_off
-/* broken on nexttep3 (includes non-existing headers) */
+/* broken on nextstep3 (includes non-existing headers) */
# include <nfs/nfs_mount.h>
#endif /* HAVE_NFS_NFS_MOUNT_H */
#ifdef HAVE_NFS_PATHCONF_H
@@ -648,6 +669,11 @@ struct ypall_callback;
# include <sys/fs/nfs_clnt.h>
#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
# include <linux/nfs_mount.h>
#endif /* HAVE_LINUX_NFS_MOUNT_H */
@@ -1275,7 +1301,7 @@ typedef struct _am_mntent {
*/
#ifndef HAVE_EXTERN_SYS_ERRLIST
-extern const char * const sys_errlist[];
+extern const char *const sys_errlist[];
#endif /* not HAVE_EXTERN_SYS_ERRLIST */
#ifndef HAVE_EXTERN_OPTARG
diff --git a/contrib/amd/include/am_utils.h b/contrib/amd/include/am_utils.h
index 4098cd42f241..f43eed2b7fff 100644
--- a/contrib/amd/include/am_utils.h
+++ b/contrib/amd/include/am_utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-1999 Erez Zadok
+ * Copyright (c) 1997-2001 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.
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: am_utils.h,v 1.6 1999/08/22 05:12:55 ezk Exp $
+ * $Id: am_utils.h,v 1.11.2.6 2001/02/23 01:03:40 ezk Exp $
*
*/
@@ -76,11 +76,19 @@
# ifdef HOSTNAMESZ
# define MAXHOSTNAMELEN HOSTNAMESZ
# else /* not HOSTNAMESZ */
-# define MAXHOSTNAMELEN 64
+# define MAXHOSTNAMELEN 256
# endif /* not HOSTNAMESZ */
#endif /* not MAXHOSTNAMELEN */
/*
+ * for hlfsd, and amd for detecting uid/gid
+ */
+#ifndef INVALIDID
+/* this is also defined in include/am_utils.h */
+# define INVALIDID (((unsigned short) ~0) - 3)
+#endif /* not INVALIDID */
+
+/*
* String comparison macros
*/
#define STREQ(s1, s2) (strcmp((s1), (s2)) == 0)
@@ -178,9 +186,9 @@ extern int umount_fs(char *fs_name, const char *mnttabname);
#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_AM_FS_NFSL
+#ifdef HAVE_AMU_FS_NFSL
# define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */
-#endif /* HAVE_AM_FS_NFSL */
+#endif /* HAVE_AMU_FS_NFSL */
/*
* macros for struct am_node (map of auto-mount points).
@@ -295,7 +303,6 @@ struct am_opts {
char *opt_opts;
char *opt_remopts;
char *opt_pref;
- char *opt_autopref;
char *opt_cache;
char *opt_rfs;
char *opt_rhost;
@@ -499,6 +506,7 @@ 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 */
@@ -506,21 +514,13 @@ extern char *PrimNetNum; /* Name of primary connected network */
extern char *SubsNetName; /* Name of subsidiary connected network */
extern char *SubsNetNum; /* Name of subsidiary connected network */
-#if 0
-extern char *progname; /* "amd" */
-#endif
-extern void am_set_progname(char *pn); /* "amd" */
-extern const char * am_get_progname(void); /* "amd" */
+extern void am_set_progname(char *pn); /* "amd" */
+extern const char *am_get_progname(void); /* "amd" */
extern void am_set_hostname(char *hn);
-extern const char * am_get_hostname(void);
+extern const char *am_get_hostname(void);
extern pid_t am_set_mypid(void);
extern pid_t am_mypid;
-#if 0
-extern char hostname[]; /* "kiska" */
-extern pid_t mypid; /* Current process id */
-#endif
-
extern int first_free_map; /* First free node */
extern int foreground; /* Foreground process */
extern int immediate_abort; /* Should close-down unmounts be retried */
@@ -542,7 +542,6 @@ 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 SVCXPRT *nfsxprt;
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 *);
@@ -574,7 +573,10 @@ 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 char *hasmnteq(mntent_t *, char *);
+extern char *haseq(char *);
extern int is_network_member(const char *net);
extern int islocalnet(u_long);
extern int make_nfs_auth(void);
@@ -606,7 +608,7 @@ extern struct sockaddr_in *amu_svc_getcaller(SVCXPRT *xprt);
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 amq_program_1(struct svc_req *rqstp, SVCXPRT *transp);
extern void amu_get_myaddress(struct in_addr *iap);
extern void amu_release_controlling_tty(void);
extern void compute_automounter_nfs_args(nfs_args_t *nap, mntent_t *mntp);
@@ -643,7 +645,7 @@ 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, char *,...)
+extern void plog(int, const char *,...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void rem_que(qelem *);
extern void reschedule_timeout_mp(void);
@@ -782,7 +784,7 @@ extern am_ops ufs_ops; /* Un*x file system */
/*
* Automount File System
*/
-#ifdef HAVE_AM_FS_AUTO
+#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 */
@@ -795,94 +797,94 @@ extern int amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfse
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_AM_FS_AUTO */
+#endif /* HAVE_AMU_FS_AUTO */
/*
* Toplvl Automount File System
*/
-#ifdef HAVE_AM_FS_TOPLVL
+#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_AM_FS_TOPLVL */
+#endif /* HAVE_AMU_FS_TOPLVL */
/*
* Direct Automount File System
*/
-#ifdef HAVE_AM_FS_DIRECT
+#ifdef HAVE_AMU_FS_DIRECT
extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */
-#endif /* HAVE_AM_FS_DIRECT */
+#endif /* HAVE_AMU_FS_DIRECT */
/*
* Error File System
*/
-#ifdef HAVE_AM_FS_ERROR
+#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_AM_FS_ERROR */
+#endif /* HAVE_AMU_FS_ERROR */
/*
* Inheritance File System
*/
-#ifdef HAVE_AM_FS_INHERIT
+#ifdef HAVE_AMU_FS_INHERIT
extern am_ops amfs_inherit_ops; /* Inheritance file system */
-#endif /* HAVE_AM_FS_INHERIT */
+#endif /* HAVE_AMU_FS_INHERIT */
/*
* NFS mounts with local existence check.
*/
-#ifdef HAVE_AM_FS_NFSL
+#ifdef HAVE_AMU_FS_NFSL
extern am_ops amfs_nfsl_ops; /* NFSL */
-#endif /* HAVE_AM_FS_NFSL */
+#endif /* HAVE_AMU_FS_NFSL */
/*
* Multi-nfs mounts.
*/
-#ifdef HAVE_AM_FS_NFSX
+#ifdef HAVE_AMU_FS_NFSX
extern am_ops amfs_nfsx_ops; /* NFSX */
-#endif /* HAVE_AM_FS_NFSX */
+#endif /* HAVE_AMU_FS_NFSX */
/*
* NFS host - a whole tree.
*/
-#ifdef HAVE_AM_FS_HOST
+#ifdef HAVE_AMU_FS_HOST
extern am_ops amfs_host_ops; /* NFS host */
-#endif /* HAVE_AM_FS_HOST */
+#endif /* HAVE_AMU_FS_HOST */
/*
* Program File System
* This is useful for things like RVD.
*/
-#ifdef HAVE_AM_FS_PROGRAM
+#ifdef HAVE_AMU_FS_PROGRAM
extern am_ops amfs_program_ops; /* Program File System */
-#endif /* HAVE_AM_FS_PROGRAM */
+#endif /* HAVE_AMU_FS_PROGRAM */
/*
* Symbolic-link file system.
* A "filesystem" which is just a symbol link.
*/
-#ifdef HAVE_AM_FS_LINK
+#ifdef HAVE_AMU_FS_LINK
extern am_ops amfs_link_ops; /* Symlink FS */
extern int amfs_link_fmount(mntfs *mf);
-#endif /* HAVE_AM_FS_LINK */
+#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_AM_FS_LINKX
+#ifdef HAVE_AMU_FS_LINKX
extern am_ops amfs_linkx_ops; /* Symlink FS with existence check */
-#endif /* HAVE_AM_FS_LINKX */
+#endif /* HAVE_AMU_FS_LINKX */
/*
* Union file system
*/
-#ifdef HAVE_AM_FS_UNION
+#ifdef HAVE_AMU_FS_UNION
extern am_ops amfs_union_ops; /* Union FS */
-#endif /* HAVE_AM_FS_UNION */
+#endif /* HAVE_AMU_FS_UNION */
/*
* Autofs file system
@@ -914,14 +916,17 @@ extern am_ops autofs_ops; /* (Sun) Autofs FS */
# define D_FORK 0x0080 /* 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 */
/*
- * Normally, don't enter daemon mode, and don't register amq
+ * Normally, don't enter daemon mode, don't register amq, and don't trace xdr
*/
# ifdef DEBUG_MEM
-# define D_TEST (~(D_DAEMON|D_MEM|D_STR))
+# define D_TEST (~(D_DAEMON|D_MEM|D_STR|D_XDRTRACE))
# else /* not DEBUG_MEM */
-# define D_TEST (~(D_DAEMON|D_STR))
+# define D_TEST (~(D_DAEMON|D_STR|D_XDRTRACE))
# endif /* not DEBUG_MEM */
# define amuDebug(x) if (debug_flags & (x))
@@ -965,7 +970,7 @@ extern void print_nfs_args(const nfs_args_t *nap, u_long nfs_version);
extern int debug_flags; /* Debug options */
extern int debug_option (char *opt);
extern struct opt_tab dbg_opt[];
-extern void dplog(char *fmt, ...)
+extern void dplog(const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
/**************************************************************************/
diff --git a/contrib/amd/include/am_xdr_func.h b/contrib/amd/include/am_xdr_func.h
index b50e0086556e..c974f1ccdeb0 100644
--- a/contrib/amd/include/am_xdr_func.h
+++ b/contrib/amd/include/am_xdr_func.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-1999 Erez Zadok
+ * Copyright (c) 1997-2001 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.
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: am_xdr_func.h,v 1.2 1999/01/10 21:54:35 ezk Exp $
+ * $Id: am_xdr_func.h,v 1.3.2.2 2001/01/10 03:23:38 ezk Exp $
*
*/
@@ -99,7 +99,7 @@ bool_t xdr_ftype(XDR *xdrs, nfsftype *objp);
bool_t xdr_groupnode(XDR *xdrs, groupnode *objp);
#endif /* not HAVE_XDR_GROUPNODE */
#ifndef HAVE_XDR_GROUPS
-bool_t xdr_groups(XDR *xdrs, groups objp);
+bool_t xdr_groups(XDR *xdrs, groups *objp);
#endif /* not HAVE_XDR_GROUPS */
#ifndef HAVE_XDR_LINKARGS
bool_t xdr_linkargs(XDR *xdrs, nfslinkargs *objp);
diff --git a/contrib/amd/include/amq_defs.h b/contrib/amd/include/amq_defs.h
index 6564e24ba4af..2f4a6ed620f2 100644
--- a/contrib/amd/include/amq_defs.h
+++ b/contrib/amd/include/amq_defs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-1999 Erez Zadok
+ * Copyright (c) 1997-2001 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.
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: amq_defs.h,v 1.3 1999/09/08 23:36:52 ezk Exp $
+ * $Id: amq_defs.h,v 1.4.2.1 2001/01/10 03:23:38 ezk Exp $
*
*/
diff --git a/contrib/amd/include/mount_headers1.h b/contrib/amd/include/mount_headers1.h
new file mode 100644
index 000000000000..87455a9d1a4e
--- /dev/null
+++ b/contrib/amd/include/mount_headers1.h
@@ -0,0 +1,167 @@
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+#ifdef HAVE_SYS_ERRNO_H
+# include <sys/errno.h>
+#endif /* HAVE_SYS_ERRNO_H */
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif /* HAVE_SYS_PARAM_H */
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_SYS_UCRED_H
+# include <sys/ucred.h>
+#endif /* HAVE_SYS_UCRED_H */
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif /* HAVE_NETINET_IN_H */
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif /* HAVE_NET_IF_H */
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
+#endif /* HAVE_STDIO_H */
+
+#ifndef KERNEL
+# define KERNEL_off_for_now_breaks_FreeBSD
+#endif /* not KERNEL */
+
+#ifdef HAVE_SYS_MNTENT_H
+# include <sys/mntent.h>
+#endif /* HAVE_SYS_MNTENT_H */
+#ifdef HAVE_MNTENT_H
+# include <mntent.h>
+#endif /* HAVE_MNTENT_H */
+#ifdef HAVE_SYS_MNTTAB_H
+# include <sys/mnttab.h>
+#endif /* HAVE_SYS_MNTTAB_H */
+#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
+/*
+ * Do not include it if MNTTAB is already defined because it probably
+ * came from <sys/mnttab.h> and we do not want conflicting definitions.
+ */
+# include <mnttab.h>
+#endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
+
+#ifdef HAVE_SYS_MOUNT_H
+# ifndef NFSCLIENT
+# define NFSCLIENT
+# endif /* not NFSCLIENT */
+# ifndef PCFS
+# define PCFS
+# endif /* not PCFS */
+# ifndef LOFS
+# define LOFS
+# endif /* not LOFS */
+# ifndef RFS
+# define RFS
+# endif /* not RFS */
+# ifndef MSDOSFS
+# define MSDOSFS
+# endif /* not MSDOSFS */
+# ifndef MFS
+# define MFS
+# endif /* not MFS */
+# ifndef CD9660
+# define CD9660
+# endif /* not CD9660 */
+# ifndef NFS
+# define NFS
+# endif /* not NFS */
+# include <sys/mount.h>
+#endif /* HAVE_SYS_MOUNT_H */
+
+#ifdef HAVE_SYS_VMOUNT_H
+# include <sys/vmount.h>
+#endif /* HAVE_SYS_VMOUNT_H */
+
+/*
+ * There is no point in including this on a glibc2 system
+ * we're only asking for trouble
+ */
+#if defined HAVE_LINUX_FS_H && (!defined __GLIBC__ || __GLIBC__ < 2)
+/*
+ * There's a conflict of definitions on redhat alpha linux between
+ * <netinet/in.h> and <linux/fs.h>.
+ * Also a conflict in definitions of ntohl/htonl in RH-5.1 sparc64
+ * between <netinet/in.h> and <linux/byteorder/generic.h> (2.1 kernels).
+ */
+# ifdef HAVE_SOCKETBITS_H
+# define _LINUX_SOCKET_H
+# undef BLKFLSBUF
+# undef BLKGETSIZE
+# undef BLKRAGET
+# undef BLKRASET
+# undef BLKROGET
+# undef BLKROSET
+# undef BLKRRPART
+# undef MS_MGC_VAL
+# undef MS_RMT_MASK
+# endif /* HAVE_SOCKETBITS_H */
+# ifdef HAVE_LINUX_POSIX_TYPES_H
+# include <linux/posix_types.h>
+# endif /* HAVE_LINUX_POSIX_TYPES_H */
+# ifndef _LINUX_BYTEORDER_GENERIC_H
+# define _LINUX_BYTEORDER_GENERIC_H
+# endif /* _LINUX_BYTEORDER_GENERIC_H */
+# ifndef _LINUX_STRING_H_
+# define _LINUX_STRING_H_
+# endif /* not _LINUX_STRING_H_ */
+# ifdef HAVE_LINUX_KDEV_T_H
+# define __KERNEL__
+# include <linux/kdev_t.h>
+# undef __KERNEL__
+# endif /* HAVE_LINUX_KDEV_T_H */
+# ifdef HAVE_LINUX_LIST_H
+# define __KERNEL__
+# include <linux/list.h>
+# undef __KERNEL__
+# endif /* HAVE_LINUX_LIST_H */
+# include <linux/fs.h>
+#endif /* HAVE_LINUX_FS_H && (!__GLIBC__ || __GLIBC__ < 2) */
+
+#ifdef HAVE_SYS_FS_TYPES_H
+# include <sys/fs_types.h>
+#endif /* HAVE_SYS_FS_TYPES_H */
+
+#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_CDFS_CDFS_MOUNT_H
+# include <cdfs/cdfs_mount.h>
+#endif /* HAVE_CDFS_CDFS_MOUNT_H */
+#ifdef HAVE_CDFS_CDFSMOUNT_H
+# include <cdfs/cdfsmount.h>
+#endif /* HAVE_CDFS_CDFSMOUNT_H */
+#ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
+# include <isofs/cd9660/cd9660_mount.h>
+#endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
+
+#ifdef HAVE_RPC_RPC_H
+# include <rpc/rpc.h>
+#endif /* HAVE_RPC_RPC_H */
+#ifdef HAVE_RPC_TYPES_H
+# include <rpc/types.h>
+#endif /* HAVE_RPC_TYPES_H */
+/* Prevent multiple inclusion on Ultrix 4 */
+#if defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__)
+# include <rpc/xdr.h>
+#endif /* defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__) */
+
+/* ALWAYS INCLUDE AM-UTILS' SPECIFIC NFS PROTOCOL HEADER NEXT! */
diff --git a/contrib/amd/include/mount_headers2.h b/contrib/amd/include/mount_headers2.h
new file mode 100644
index 000000000000..bd9f567420b1
--- /dev/null
+++ b/contrib/amd/include/mount_headers2.h
@@ -0,0 +1,29 @@
+
+#ifdef HAVE_RPCSVC_MOUNT_H
+# include <rpcsvc/mount.h>
+#endif /* HAVE_RPCSVC_MOUNT_H */
+
+#ifdef HAVE_MOUNT_H
+# include <mount.h>
+#endif /* HAVE_MOUNT_H */
+
+#ifdef HAVE_NFS_NFS_GFS_H
+# include <nfs/nfs_gfs.h>
+#endif /* HAVE_NFS_NFS_GFS_H */
+
+#ifdef HAVE_NFS_MOUNT_H
+# include <nfs/mount.h>
+#endif /* HAVE_NFS_MOUNT_H */
+
+#ifdef HAVE_SYS_FS_NFS_CLNT_H
+# include <sys/fs/nfs_clnt.h>
+#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
+# include <linux/nfs_mount.h>
+#endif /* HAVE_LINUX_NFS_MOUNT_H */