diff options
author | Cy Schubert <cy@FreeBSD.org> | 2016-08-31 00:08:49 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2016-08-31 00:08:49 +0000 |
commit | ca57057f598bfc7119f79f71bf38ec88244ab396 (patch) | |
tree | 051f78ef258707b493cc7cb21569b6949915f6c7 /conf/nfs_prot | |
parent | e66b16bf080ead1c51f321eaf56710c771778706 (diff) | |
download | src-vendor/amd.tar.gz src-vendor/amd.zip |
Import am-utils 6.2,vendor/amd/6.2vendor/amd
Suggested by: pfg@
Obtained from: ftp://ftp.am-utils.org/pub/am-utils/
Notes
Notes:
svn path=/vendor/amd/dist/; revision=305100
svn path=/vendor/amd/6.2/; revision=305101; tag=vendor/amd/6.2
Diffstat (limited to 'conf/nfs_prot')
36 files changed, 10223 insertions, 173 deletions
diff --git a/conf/nfs_prot/nfs_prot_aix3.h b/conf/nfs_prot/nfs_prot_aix3.h new file mode 100644 index 000000000000..360f14a78037 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_aix3.h @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_aix3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ + +/* don't include this one */ +#ifdef HAVE_RPCSVC_MOUNT_H_not +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#ifndef MNTPATHLEN +# define MNTPATHLEN 1024 +#endif /* not MNTPATHLEN */ +#ifndef MNTNAMLEN +# define MNTNAMLEN 255 +#endif /* not MNTNAMLEN */ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *name; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; + +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* + * EXTERNALS: + */ +extern bool_t xdr_groups(XDR *xdrs, groups *objp); + +/* + * STRUCTURES: + */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_aix4.h b/conf/nfs_prot/nfs_prot_aix4.h new file mode 100644 index 000000000000..44f07eb4ecad --- /dev/null +++ b/conf/nfs_prot/nfs_prot_aix4.h @@ -0,0 +1,210 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_aix4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#ifndef MNTPATHLEN +# define MNTPATHLEN 1024 +#endif /* not MNTPATHLEN */ +#ifndef MNTNAMLEN +# define MNTNAMLEN 255 +#endif /* not MNTNAMLEN */ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *name; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; + +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* + * EXTERNALS: + */ +extern bool_t xdr_groups(XDR *xdrs, groups *objp); + +/* + * STRUCTURES: + */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_aix4_2.h b/conf/nfs_prot/nfs_prot_aix4_2.h new file mode 100644 index 000000000000..40acae9369e4 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_aix4_2.h @@ -0,0 +1,249 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_aix4_2.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + + +/* + * AIX 4.2 and newer support NFS V.3, hence the separate header. + */ + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#ifndef MNTPATHLEN +# define MNTPATHLEN 1024 +#endif /* not MNTPATHLEN */ +#ifndef MNTNAMLEN +# define MNTNAMLEN 255 +#endif /* not MNTNAMLEN */ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *name; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; + +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + + +/* + * STRUCTURES: + */ + +/* + * AIX 4.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef MNT_NFS3 + +struct aix4_nfs_args { + struct sockaddr_in addr; /* server address and port */ + caddr_t u0; /* ??? UNKNOWN ??? */ + unsigned long proto; /* IPPROTO_TCP/IPPROTO_UDP */ + char *hostname; /* pointer to hostname? */ + char *netname; /* pointer to netname? */ + caddr_t fh; /* pointer to NFS v3 fh? */ + unsigned long flags; /* flags */ + unsigned long wsize; /* wsize */ + unsigned long rsize; /* rsize */ + unsigned long timeo; /* timeo */ + unsigned long retrans; /* retrans */ + unsigned long acregmin; /* acregmin */ + unsigned long acregmax; /* acregmax */ + unsigned long acdirmin; /* acdirmin */ + unsigned long acdirmax; /* acdirmax */ + unsigned long u14; /* ??? UNKNOWN ??? */ + struct pathcnf *pathconf; /* pathconf */ +}; + +#endif /* MNT_NFS3 */ + +/* + * EXTERNALS: + */ +extern bool_t xdr_groups(XDR *xdrs, groups *objp); + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_aix4_3.h b/conf/nfs_prot/nfs_prot_aix4_3.h new file mode 100644 index 000000000000..442cd174e3e5 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_aix4_3.h @@ -0,0 +1,317 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_aix4_3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + + +/* + * AIX 4.3 and newer support NFS V.3, hence the separate header. + */ + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#ifndef MNTPATHLEN +# define MNTPATHLEN 1024 +#endif /* not MNTPATHLEN */ +#ifndef MNTNAMLEN +# define MNTNAMLEN 255 +#endif /* not MNTNAMLEN */ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *name; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; + +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + + +/* + * STRUCTURES: + */ + +/* + * AIX 4.3 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef MNT_NFS3 + +struct aix4_nfs_args { + struct sockaddr_in addr; /* file server address */ + struct sockaddr_in *syncaddr; /* secure NFS time sync addr */ + int proto; /* IPPROTO_TCP/IPPROTO_UDP ??? */ + char *hostname; /* server's hostname */ + char *netname; /* server's netname */ + caddr_t fh; /* File handle to be mounted */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int acregmin; /* attr cache file min secs */ + int acregmax; /* attr cache file max secs */ + int acdirmin; /* attr cache dir min secs */ + int acdirmax; /* attr cache dir max secs */ + struct ppathcnf *pathconf; /* static pathconf kludge */ + int biods; /* biods per mount */ + int numclust; /* numclust per mount */ +}; + +#if 0 +/* old structure we hand crafted. no longer needed */ +struct aix4_nfs_args { + struct sockaddr_in addr; /* server address and port */ + caddr_t u0; /* ??? UNKNOWN ??? */ + unsigned long proto; /* IPPROTO_TCP/IPPROTO_UDP */ + char *hostname; /* pointer to hostname? */ + char *netname; /* pointer to netname? */ + caddr_t fh; /* pointer to NFS v3 fh? */ + unsigned long flags; /* flags */ + unsigned long wsize; /* wsize */ + unsigned long rsize; /* rsize */ + unsigned long timeo; /* timeo */ + unsigned long retrans; /* retrans */ + unsigned long acregmin; /* acregmin */ + unsigned long acregmax; /* acregmax */ + unsigned long acdirmin; /* acdirmin */ + unsigned long acdirmax; /* acdirmax */ + unsigned long u14; /* ??? UNKNOWN ??? */ + struct pathcnf *pathconf; /* pathconf */ +}; +#endif /* 0 */ + +/* + * IBM is in dire need of taking a soft-eng class. + * They changed the API/ABI (namely the nfs3_args structure) + * in a service pack... + * + * All the following *_bis junk is here to try and deal with this idiocy. + */ +#define MOUNT_TYPE_NFS3_BIS 0x12344321 +struct aix4_nfs_args_bis { + struct sockaddr_in addr; /* server address and port */ + struct sockaddr_in *syncaddr; /* secure NFS time sync addr */ + int proto; /* IPPROTO_TCP/IPPROTO_UDP ??? */ + char *hostname; /* pointer to hostname? */ + char *netname; /* pointer to netname? */ + caddr_t fh; /* pointer to NFS v3 fh? */ + unsigned long flags; /* flags */ + unsigned long wsize; /* wsize */ + unsigned long rsize; /* rsize */ + unsigned long timeo; /* timeo */ + unsigned long retrans; /* retrans */ + unsigned long acregmin; /* acregmin */ + unsigned long acregmax; /* acregmax */ + unsigned long acdirmin; /* acdirmin */ + unsigned long acdirmax; /* acdirmax */ + unsigned long u14; /* ??? UNKNOWN ??? */ + struct ppathcnf *pathconf; /* static pathconf kludge */ + int biods; /* biods per mount */ + int numclust; /* numclust per mount */ +}; + +#endif /* MNT_NFS3 */ + +/* + ************************************************************************** + * AIX 4.3's autofs is not ported or tested yet... + * For now, undefine it or define dummy entries. + ************************************************************************** + */ +#ifdef MNT_AUTOFS +# undef MNT_AUTOFS +#endif /* MNT_AUTOFS */ +#ifdef HAVE_FS_AUTOFS +# undef HAVE_FS_AUTOFS +#endif /* HAVE_FS_AUTOFS */ + +/* + * EXTERNALS: + */ +extern bool_t xdr_groups(XDR *xdrs, groups *objp); +extern char *yperr_string (int incode); + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_aix5_1.h b/conf/nfs_prot/nfs_prot_aix5_1.h index e7fb47861c77..a4e67d0fc5f8 100644 --- a/conf/nfs_prot/nfs_prot_aix5_1.h +++ b/conf/nfs_prot/nfs_prot_aix5_1.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2003 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * @@ -36,9 +32,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: nfs_prot_aix5_1.h,v 1.1.2.3 2002/12/27 22:44:53 ezk Exp $ + * File: am-utils/conf/nfs_prot/nfs_prot_aix5_1.h * */ @@ -47,7 +42,7 @@ /* - * AIX 5.1 has a different aix51_nfs_args structure, hence the separate header. + * AIX 5.1 has a different aix5_nfs_args structure, hence the separate header. */ #ifdef HAVE_RPCSVC_NFS_PROT_H @@ -224,19 +219,7 @@ typedef writeargs nfswriteargs; */ #ifdef MNT_NFS3 -#define FHSIZE3 64 /* size in bytes of a file handle (v3) */ -#define NFS3_FHSIZE 64 -#define MOUNTVERS3 ((unsigned long)(3)) -#define NFS_V3 ((unsigned long)(3)) - -#if 0 -struct nfs_fh3 { - u_int len; - char val[64]; /* !!! */ -}; -#endif - -struct aix51_nfs_args { +struct aix5_nfs_args { struct sockaddr_in addr; /* server address and port */ caddr_t u0; /* ??? UNKNOWN ??? */ unsigned long proto; /* IPPROTO_TCP/IPPROTO_UDP */ @@ -257,54 +240,56 @@ struct aix51_nfs_args { struct pathcnf *pathconf; /* pathconf */ }; -typedef struct { - u_int fhandle3_len; - char *fhandle3_val; -} fhandle3; +#endif /* MNT_NFS3 */ + +#ifdef MNT_AUTOFS +#define A_MAXNAME 255 +#define A_MAXOPTS 255 +#define A_MAXPATH 1024 -enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006 +struct mntrequest { + char *name; + char *map; + char *opts; + char *path; }; -typedef enum mountstat3 mountstat3; +typedef struct mntrequest mntrequest; -struct mountres3_ok { - fhandle3 fhandle; - struct { - u_int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; +struct mntres { + int status; }; -typedef struct mountres3_ok mountres3_ok; +typedef struct mntres mntres; -struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; +struct umntrequest { + int isdirect; + u_int devid; + u_long rdevid; + struct umntrequest *next; }; -typedef struct mountres3 mountres3; +typedef struct umntrequest umntrequest; -struct nfs_fh3 { - u_int fh3_length; - union nfs_fh3_u { - struct nfs_fh3_i { - fhandle_t fh3_i; - } nfs_fh3_i; - char data[NFS3_FHSIZE]; - } fh3_u; +struct umntres { + int status; }; -typedef struct nfs_fh3 nfs_fh3; +typedef struct umntres umntres; -#endif /* MNT_NFS3 */ +#define AUTOFS_PROG ((unsigned long)(100099)) +#define AUTOFS_VERS ((unsigned long)(1)) + +#endif /* MNT_AUTOFS */ + +/* + ************************************************************************** + * AIX 5.1's autofs is not ported or tested yet... + * For now, undefine it or define dummy entries. + ************************************************************************** + */ +#ifdef MNT_AUTOFS +# undef MNT_AUTOFS +#endif /* MNT_AUTOFS */ +#ifdef HAVE_FS_AUTOFS +# undef HAVE_FS_AUTOFS +#endif /* HAVE_FS_AUTOFS */ /* * EXTERNALS: diff --git a/conf/nfs_prot/nfs_prot_aix5_2.h b/conf/nfs_prot/nfs_prot_aix5_2.h new file mode 100644 index 000000000000..887379055f1b --- /dev/null +++ b/conf/nfs_prot/nfs_prot_aix5_2.h @@ -0,0 +1,365 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_aix5_2.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + + +/* + * AIX 5.2 has a different aix5_nfs_args structure, hence the separate header. + */ + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +/* + * AIX 5.2 wants 'struct pathcnf', but I couldn't find its definition + * anywhere. Luckily, amd doesn't need the size of this structure in + * any other structure that it uses. So we sidestep it for now. + */ +struct pathcnf; +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ +#ifdef HAVE_SYS_VFS_H +/* AIX 5.3 (ppc) wants definition of kernel-specific structure */ +struct thread_credentials; +#endif /* HAVE_SYS_VFS_H */ + +/* + * MACROS + */ + +#ifndef MNTPATHLEN +# define MNTPATHLEN 1024 +#endif /* not MNTPATHLEN */ +#ifndef MNTNAMLEN +# define MNTNAMLEN 255 +#endif /* not MNTNAMLEN */ + +/* compatible macro name with other OSs */ +#ifdef UVMNT_FORCE +# define MS_FORCE UVMNT_FORCE +#endif /* UVMNT_FORCE */ + +/********************************************************************************/ +/* + * NFS mount option flags (out of mount.h) + * Maybe one day IBM will include them in system headers. + */ +#ifndef MNTOPT_ACDIRMAX +# define MNTOPT_ACDIRMAX "acdirmax" /* max ac timeout for dirs (sec) */ +# define MNTOPT_ACDIRMIN "acdirmin" /* min ac timeout for dirs (sec) */ +# define MNTOPT_ACREGMAX "acregmax" /* max ac timeout for reg files (sec) */ +# define MNTOPT_ACREGMIN "acregmin" /* min ac timeout for reg files (sec) */ +# define MNTOPT_ACTIMEO "actimeo" /* attr cache timeout (sec) */ +# define MNTOPT_BG "bg" /* mount op in background if 1st attempt fails */ +# define MNTOPT_FASTATTR "fastattr" /* no sync_vp in nfs3_getattr */ +# define MNTOPT_FG "fg" /* mount op in fg if 1st attempt fails, default */ +# define MNTOPT_GRPID "grpid" /* SysV-compatible group-id on create */ +# define MNTOPT_HARD "hard" /* hard mount (default) */ +# define MNTOPT_INTR "intr" /* allow interrupts on hard mount */ +# define MNTOPT_NOAC "noac" /* don't cache file attributes */ +# define MNTOPT_NOACL "noacl" /* don't read acl's from server - default */ +# define MNTOPT_ACL "acl" /* read acl's from server means we load ksec */ +# define MNTOPT_NOAUTO "noauto"/* hide entry from mount -a */ +# define MNTOPT_NOCTO "nocto" /* no "close to open" attr consistency */ +# define MNTOPT_NODEV "nodev" /*don't allow opening of devices accross mount*/ +# define MNTOPT_NOINTR "nointr" /* don't allow interrupts on hard mounts */ +# define MNTOPT_NOQUOTA "noquota" /* don't check quotas */ +# define MNTOPT_NOSUID "nosuid" /* no set uid allowed */ +# define MNTOPT_BSY "bsy" +# define MNTOPT_PORT "port" /* server IP port number */ +# define MNTOPT_POSIX "posix" /* ask for static pathconf values from mountd */ +# define MNTOPT_QUOTA "quota" /* quotas */ +# define MNTOPT_RETRANS "retrans" /* set number of request retries */ +# define MNTOPT_RETRYS "retry" /* # of times mount is attempted, def=10000*/ +# define MNTOPT_RMNT "remount" /* remount to rw if mode ro */ +# define MNTOPT_RO "ro" /* read only */ +# define MNTOPT_RSIZE "rsize" /* set read size (bytes) */ +# define MNTOPT_RW "rw" /* read/write */ +# define MNTOPT_SECURE "secure"/* use secure RPC for NFS */ +# define MNTOPT_SHORTDEV "shortdev" /* server dev */ +# define MNTOPT_SOFT "soft" /* soft mount */ +# define MNTOPT_TIMEO "timeo" /* set initial timeout (1/10 sec) */ +# define MNTOPT_WSIZE "wsize" /* set write size (bytes) */ +# define MNTOPT_VERS "vers" /* protocol version number indicator */ +# define MNTOPT_PROTO "proto" /* protocol network_id indicator */ +# define MNTOPT_LLOCK "llock" /* Local locking (no lock manager) */ +# define MNTOPT_BIODS "biods" /* max biods per mount */ +# define MNTOPT_EXTATTR "extraattr" /* extended attribute usage */ +# define MNTOPT_COMBEHND "combehind" /* extended attribute usage */ +# define MNTOPT_NUMCLUST "numclust" /* max numclust per mount */ +# define MNTOPT_NODIRCACHE "nodircache" /* No readdir cache */ + +# define NFSMNT_NOACL 0x0 /* turn off acl support (not supported) */ +# define NFSMNT_SHORTDEV 0x0 /* server does not support 32-bit device no. + (not supported) */ +# define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ +# define NFSMNT_WSIZE 0x002 /* set write size */ +# define NFSMNT_RSIZE 0x004 /* set read size */ +# define NFSMNT_TIMEO 0x008 /* set initial timeout */ +# define NFSMNT_RETRANS 0x010 /* set number of request retrys */ +# define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ +# define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ +# define NFSMNT_NOAC 0x080 /* don't cache attributes */ +# define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ +# define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ +# define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ +# define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ +# define NFSMNT_SECURE 0x1000 /* secure mount */ +# define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ +# define NFSMNT_KNCONF 0x4000 /* transport's knetconfig structure */ +# define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */ +# define NFSMNT_RPCTIMESYNC 0x10000 /* use RPC to do secure NFS time sync */ +# define NFSMNT_KERBEROS 0x20000 /* use kerberos credentials */ +# define NFSMNT_POSIX 0x40000 /* static pathconf kludge info */ +# define NFSMNT_LLOCK 0x80000 /* Local locking (no lock manager) */ +# define NFSMNT_ACL 0x100000 /* turn on acl support */ +# define NFSMNT_BIODS 0x200000 /* number of biods per mount */ +# define NFSMNT_EXTATTR 0x400000 /* extended attribute usage */ +# define NFSMNT_FASTATTR 0x800000 /* no sync_vp in nfs3_getattr */ +# define NFSMNT_COMBEHND 0x1000000 /* allow commit behind */ +# define NFSMNT_NUMCLUST 0x2000000 /* number of cluster per mount */ +# define NFSMNT_NODIRCACHE 0x4000000 /* No readdir cache */ +#endif /* not MNTOPT_ACDIRMAX */ +/********************************************************************************/ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *name; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; + +/* + * If these definitions fail to compile on your AIX 5.2 system, be + * sure you install all of the necessary header files. + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + + +/* + * STRUCTURES: + */ + +/* + * AIX 5.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef MNT_NFS3 + +struct aix5_nfs_args { + struct sockaddr_in addr; /* file server address */ + struct sockaddr_in *syncaddr; /* secure NFS time sync addr */ + int proto; + char *hostname; /* server's hostname */ + char *netname; /* server's netname */ + caddr_t fh; /* File handle to be mounted */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int acregmin; /* attr cache file min secs */ + int acregmax; /* attr cache file max secs */ + int acdirmin; /* attr cache dir min secs */ + int acdirmax; /* attr cache dir max secs */ + struct ppathcnf *pathconf; /* static pathconf kludge */ + int biods; /* biods per mount */ + int numclust; /* numclust per mount */ +}; + +#endif /* MNT_NFS3 */ + +/* + ************************************************************************** + * AIX 5.2's autofs is not ported or tested yet... + * For now, undefine it or define dummy entries. + ************************************************************************** + */ +#ifdef MNT_AUTOFS +# undef MNT_AUTOFS +#endif /* MNT_AUTOFS */ +#ifdef HAVE_FS_AUTOFS +# undef HAVE_FS_AUTOFS +#endif /* HAVE_FS_AUTOFS */ + +/* + * EXTERNALS: + */ +extern bool_t xdr_groups(XDR *xdrs, groups *objp); +extern char *yperr_string (int incode); + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_bsdi2.h b/conf/nfs_prot/nfs_prot_bsdi2.h new file mode 100644 index 000000000000..74866e062baf --- /dev/null +++ b/conf/nfs_prot/nfs_prot_bsdi2.h @@ -0,0 +1,496 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_bsdi2.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_UFS_UFS_UFSMOUNT_H +# ifndef MAXQUOTAS +# define MAXQUOTAS 2 +# endif /* not MAXQUOTAS */ +/* fake structure: too difficult to include other headers here */ +struct netexport { int this_is_SO_wrong; }; +# include <ufs/ufs/ufsmount.h> +#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ + +/* + * <msdosfs/msdosfsmount.h> is for kernel only on bsdi2, so do not + * include it. + */ +#ifndef ____MSDOSFS_MSDOSFSMOUNT_H__ +# define ____MSDOSFS_MSDOSFSMOUNT_H__ +#endif /* ____MSDOSFS_MSDOSFSMOUNT_H__ */ + +/* + * getifaddrs() on bsdi2 is broken. Don't use it. + */ +#ifdef HAVE_GETIFADDRS +# undef HAVE_GETIFADDRS +#endif /* HAVE_GETIFADDRS */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#ifndef NFS_MAXDATA +# define NFS_MAXDATA 8192 +#endif /* NFS_MAXDATA */ +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +/* + * BSD/OS 2.1 deprecated NFSPROC_ROOT and NFSPROC_WRITECACHE and set them + * to NFSPROC_NOOP. + * Since amd is its own NFS server, reinstate them. + */ +#if (NFSPROC_ROOT == NFSPROC_NOOP) +# undef NFSPROC_ROOT +# define NFSPROC_ROOT 3 +#endif /* (NFSPROC_ROOT == NFSPROC_NOOP) */ +#if (NFSPROC_WRITECACHE == NFSPROC_NOOP) +# undef NFSPROC_WRITECACHE +# define NFSPROC_WRITECACHE 7 +#endif /* (NFSPROC_WRITECACHE == NFSPROC_NOOP) */ + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt +#define fh_data fh_bytes + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef nfstype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern nfsattrstat *nfsproc_getattr_2_svc(nfsv2fh_t *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfsv2fh_t *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfsv2fh_t *, struct svc_req *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); + +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_mountlist(XDR *xdrs, mountlist *objp); +extern bool_t xdr_nfs_fh(XDR *, nfsv2fh_t*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); + + +/* + * ENUMS: + */ + +/* + * Use AMU_ prefixes so as to not conflict with #define's in <nfs/nfsv2.h>. + * It is vital! that the AMU_* match one-to-one with the NFS_OK and NFSERR_* + * codes listed in <nfs/nfsv2.h>. + */ +enum nfsstat { + AMU_NFS_OK = 0, + AMU_NFSERR_PERM = 1, + AMU_NFSERR_NOENT = 2, + AMU_NFSERR_IO = 5, + AMU_NFSERR_NXIO = 6, + AMU_NFSERR_ACCES = 13, + AMU_NFSERR_EXIST = 17, + AMU_NFSERR_NODEV = 19, + AMU_NFSERR_NOTDIR = 20, + AMU_NFSERR_ISDIR = 21, + AMU_NFSERR_FBIG = 27, + AMU_NFSERR_NOSPC = 28, + AMU_NFSERR_ROFS = 30, + AMU_NFSERR_NAMETOOLONG = 63, + AMU_NFSERR_NOTEMPTY = 66, + AMU_NFSERR_DQUOT = 69, + AMU_NFSERR_STALE = 70, + AMU_NFSERR_WFLUSH = 99 +}; + + +/* + * STRUCTURES: + */ + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfsv2fh_t sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfsv2fh_t da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfsv2fh_t drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfsv2fh_t ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfsv2fh_t wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfsv2fh_t la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfsv2fh_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + + +/****************************************************************************/ +/*** XDR ADDITIONS ***/ +/****************************************************************************/ + +struct exports { + dirpath ex_dir; + groups ex_groups; + exports ex_next; +}; + +typedef char fhandle[NFS_FHSIZE]; + +struct fhstatus { + u_int fhs_status; + union { + fhandle fhs_fhandle; + } fhstatus_u; +}; + +struct groups { + name gr_name; + groups gr_next; +}; + +struct mountlist { + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; +}; + + +/****************************************************************************/ +/*** NFS ADDITIONS ***/ +/****************************************************************************/ + +#ifndef MOUNTPROG +# define MOUNTPROG RPCPROG_MNT +#endif /* not MOUNTPROG */ + +#ifndef MOUNTVERS +# define MOUNTVERS RPCMNT_VER1 +#endif /* not MOUNTVERS */ + +#ifndef MOUNTPROC_MNT +# define MOUNTPROC_MNT RPCMNT_MOUNT +#endif /* not MOUNTPROC_MNT */ + +#ifndef MOUNTPROC_DUMP +# define MOUNTPROC_DUMP RPCMNT_DUMP +#endif /* not MOUNTPROC_DUMP */ + +#ifndef MOUNTPROC_UMNT +# define MOUNTPROC_UMNT RPCMNT_UMOUNT +#endif /* not MOUNTPROC_UMNT */ + +#ifndef MOUNTPROC_UMNTALL +# define MOUNTPROC_UMNTALL RPCMNT_UMNTALL +#endif /* not MOUNTPROC_UMNTALL */ + +#ifndef MOUNTPROC_EXPORT +# define MOUNTPROC_EXPORT RPCMNT_EXPORT +#endif /* not MOUNTPROC_EXPORT */ + + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_bsdi3.h b/conf/nfs_prot/nfs_prot_bsdi3.h new file mode 100644 index 000000000000..5e387acfcb7c --- /dev/null +++ b/conf/nfs_prot/nfs_prot_bsdi3.h @@ -0,0 +1,181 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_bsdi3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ + +#ifndef NFS_NPROCS +# define NFS_NPROCS 26 +#endif /* not NFS_NPROCS */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ +#ifdef HAVE_UFS_UFS_UFSMOUNT_H +# include <ufs/ufs/ufsmount.h> +#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ + +/****************************************************************************/ +/* + * NFS V3 support: + * BSD/OS 3.0 has it but no easy way to figure it out from the header files. + */ +#ifndef MNTTYPE_NFS3 +# define MNTTYPE_NFS3 "nfs" +#endif /* MNTTYPE_NFS3 */ + +/****************************************************************************/ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_size size +#define na_type type +#define na_gid gid +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_status status +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_from from +#define wra_fhandle file + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* missing definitions from bsdi4 */ +#if defined(HAVE_MAP_HESIOD) && !defined(HAVE_HESIOD_H) +extern int hesiod_init(void **context); +#endif /* defined(HAVE_MAP_HESIOD) && !defined(HAVE_HESIOD_H) */ + +/* + * On bsdi4, NFS V3/tcp mounts should not use the default resvport option. + * Defining this mnt option string will force compute_nfs_args() to not + * use reserved ports unless it was specified as a mount option. + */ +#ifndef MNTTAB_OPT_RESVPORT +# define MNTTAB_OPT_RESVPORT "resvport" +#endif /* not MNTTAB_OPT_RESVPORT */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_darwin.h b/conf/nfs_prot/nfs_prot_darwin.h index 9ef1e721e60d..a505254a4561 100644 --- a/conf/nfs_prot/nfs_prot_darwin.h +++ b/conf/nfs_prot/nfs_prot_darwin.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2003 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * @@ -36,9 +32,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: nfs_prot_darwin.h,v 1.1.2.4 2002/12/27 22:44:54 ezk Exp $ + * File: am-utils/conf/nfs_prot/nfs_prot_darwin.h * */ @@ -58,46 +53,6 @@ # include <ufs/ufs/ufsmount.h> #endif /* HAVE_UFS_UFS_UFSMOUNT_H */ -#define MOUNTVERS3 ((unsigned long)(3)) - -typedef struct { - u_int fhandle3_len; - char *fhandle3_val; -} fhandle3; - - -enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006 -}; -typedef enum mountstat3 mountstat3; - -struct mountres3_ok { - fhandle3 fhandle; - struct { - u_int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; -}; -typedef struct mountres3_ok mountres3_ok; - -struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; -}; -typedef struct mountres3 mountres3; - - /* * MACROS: */ @@ -215,45 +170,11 @@ typedef symlinkargs nfssymlinkargs; typedef writeargs nfswriteargs; -/* - * - * FreeBSD-3.0-RELEASE has NFS V3. Older versions had it only defined - * in the rpcgen source file. If you are on an older system, and you - * want NFSv3 support, you need to regenerate the rpcsvc header files as - * follows: - * cd /usr/include/rpcsvc - * rpcgen -h -C -DWANT_NFS3 mount.x - * rpcgen -h -C -DWANT_NFS3 nfs_prot.x - * If you don't want NFSv3, then you will have to turn off the NFSMNT_NFSV3 - * macro below. If the code doesn't compile, upgrade to the latest 3.0 - * version... - */ #ifdef NFSMNT_NFSV3 # define MOUNT_NFS3 "nfs" /* is this right? */ # define MNTOPT_NFS3 "nfs" -/* - * as of 3.0-RELEASE the nfs_fh3 that is defined in the system headers - * (or the one generated by rpcgen) lacks the proper full definition, - * listed below. A special macro (m4/macros/struct_nfs_fh3.m4) searches - * for this special name before other names. - */ - -#define NFS3_FHSIZE 64 -#define FHSIZE3 64 - -struct nfs_fh3_freebsd3 { - u_int fh3_length; - union nfs_fh3_u { - struct nfs_fh3_i { - fhandle_t fh3_i; - } nfs_fh3_i; - char data[NFS3_FHSIZE]; - } fh3_u; -}; -typedef struct nfs_fh3_freebsd3 nfs_fh3; - #endif /* NFSMNT_NFSV3 */ #endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_default.h b/conf/nfs_prot/nfs_prot_default.h new file mode 100644 index 000000000000..c5f047d99bf3 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_default.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_default.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_freebsd2.h b/conf/nfs_prot/nfs_prot_freebsd2.h index cf7ba33ee47b..73661c9da3d8 100644 --- a/conf/nfs_prot/nfs_prot_freebsd2.h +++ b/conf/nfs_prot/nfs_prot_freebsd2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * @@ -139,7 +135,7 @@ typedef writeargs nfswriteargs; */ #if 0 #define MOUNT_NFS3 MOUNT_NFS -#endif +#endif /* 0 */ #endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_freebsd3.h b/conf/nfs_prot/nfs_prot_freebsd3.h index edcc57540fee..51ac31d2aece 100644 --- a/conf/nfs_prot/nfs_prot_freebsd3.h +++ b/conf/nfs_prot/nfs_prot_freebsd3.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * diff --git a/conf/nfs_prot/nfs_prot_hpux.h b/conf/nfs_prot/nfs_prot_hpux.h new file mode 100644 index 000000000000..9d64360afb5e --- /dev/null +++ b/conf/nfs_prot/nfs_prot_hpux.h @@ -0,0 +1,398 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_hpux.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_NFS_EXPORT_H_not +/* don't include this b/c it'll get included twice */ +# include <nfs/export.h> +#endif /* HAVE_NFS_EXPORT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_NETDB_H +extern int h_errno; /* missing from older hpux10 systems */ +#endif /* HAVE_NETDB_H */ + + +/* + * Turn off NFS V.3 support to avoid confusing am-utils. + * 10.20 with some patches has incomplete support. + */ +#undef MNTTYPE_NFS3 +#undef MNTTAB_TYPE_NFS3 +#undef HAVE_FS_NFS3 + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +#ifndef HAVE_FHANDLE +typedef fhandle_t fhandle; +#endif /* not HAVE_FHANDLE */ +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(fhandle_t *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(fhandle_t *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(fhandle_t *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, fhandle_t*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + fhandle_t sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + fhandle_t da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + fhandle_t drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + fhandle_t ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + fhandle_t wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + fhandle_t la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + fhandle_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_hpux11.h b/conf/nfs_prot/nfs_prot_hpux11.h new file mode 100644 index 000000000000..0dd0286c6388 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_hpux11.h @@ -0,0 +1,595 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_hpux11.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * NOTE: HPUX 11 is missing many header definitions which had to be + * guessed and copied over from HPUX 10.20. + */ + +/* don't include this file as it isn't needed on hpux */ +#ifndef _TIUSER_H +# define _TIUSER_H +#endif /* TIUSER_H */ +#ifndef _TIUSER_INCLUDED +# define _TIUSER_INCLUDED +#endif /* TIUSER_INCLUDED */ +#ifndef _SYS_TIUSER_INCLUDED +# define _SYS_TIUSER_INCLUDED +#endif /* _SYS_TIUSER_INCLUDED */ +/* if T_NULL is defined, undefine it due to a conflict with <arpa/nameser.h> */ +#ifdef T_NULL +# undef T_NULL +#endif /* T_NULL */ + +#ifdef HAVE_NFS_EXPORT_H_not +/* don't include this b/c it'll get included twice */ +# include <nfs/export.h> +#endif /* HAVE_NFS_EXPORT_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 +#define HOSTNAMESZ 32 /* Max size of hostname in struct nfs_args */ + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* + * NFS mount option flags + */ +#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x002 /* set write size */ +#define NFSMNT_RSIZE 0x004 /* set read size */ +#define NFSMNT_TIMEO 0x008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x010 /* set number of request retries */ +#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ +#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ +#define NFSMNT_NOAC 0x080 /* don't cache attributes */ +#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ +#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ +#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ +#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ +#define NFSMNT_SECURE 0x1000 /* secure mount */ +#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ +#define NFSMNT_KNCONF 0x4000 /* transport's knetconfig structure */ +#define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */ +#define NFSMNT_RPCTIMESYNC 0x10000 /* use RPC to do secure NFS time sync */ +#define NFSMNT_KERBEROS 0x20000 /* use kerberos credentials */ +#define NFSMNT_POSIX 0x40000 /* static pathconf kludge info */ +#define NFSMNT_LLOCK 0x80000 /* Local locking (no lock manager) */ +#define NFSMNT_REMOUNT 0x100000 /* Remount from r/o to r/w */ + +#define NFSMNT_FSNAME 0x1000000 /* FS name e.g. "host:/path/" */ +#define NFSMNT_NODEVS 0x2000000 /* no devices access (default on) */ +#define NFSMNT_IGNORE 0x4000000 /* ignore in mnttab */ + +#define MS_FSS 0x00 /* fake flag to do nothing */ + +/* + * ENUMS: + */ + +/* + * Error status + * Should include all possible net errors. + * For now we just cast errno into an enum nfsstat. + */ +enum nfsstat { + NFS_OK = 0, /* no error */ + NFSERR_PERM = 1, /* Not owner */ + NFSERR_NOENT = 2, /* No such file or directory */ + NFSERR_IO = 5, /* I/O error */ + NFSERR_NXIO = 6, /* No such device or address */ + NFSERR_ACCES = 13, /* Permission denied */ + NFSERR_EXIST = 17, /* File exists */ + NFSERR_XDEV = 18, /* Cross-device link */ + NFSERR_NODEV = 19, /* No such device */ + NFSERR_NOTDIR = 20, /* Not a directory */ + NFSERR_ISDIR = 21, /* Is a directory */ + NFSERR_INVAL = 22, /* Invalid argument */ + NFSERR_FBIG = 27, /* File too large */ + NFSERR_NOSPC = 28, /* No space left on device */ + NFSERR_ROFS = 30, /* Read-only file system */ + NFSERR_OPNOTSUPP = 45, /* Operation not supported */ + NFSERR_NAMETOOLONG = 63, /* File name too long */ + NFSERR_NOTEMPTY = 66, /* Directory not empty */ + NFSERR_DQUOT = 69, /* Disc quota exceeded */ + NFSERR_STALE = 70, /* Stale NFS file handle */ + NFSERR_REMOTE = 71, /* Object is remote */ + NFSERR_WFLUSH /* write cache flushed */ +}; + +/* + * File types + */ +enum nfsftype { + NFNON, + NFREG, /* regular file */ + NFDIR, /* directory */ + NFBLK, /* block special */ + NFCHR, /* character special */ + NFLNK, /* symbolic link */ + NFSOC /* socket */ +}; + + +/* + * TYPEDEFS: + */ +typedef struct nfs_fh nfs_fh; +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + +/* + * NFSv3 handle (copied from am_xdr_func.h, because it is needed here) + * we use a different name but same storage size/alignment to avoid + * conflicts. Sigh, this is so hacky. -ezk + */ +#define HPUX11_FHSIZE3 64 /* size in bytes of a file handle (v3) */ +struct hpux11_nfs_fh3 { + u_int am_fh3_length; + char am_fh3_data[HPUX11_FHSIZE3]; +}; +typedef struct hpux11_nfs_fh3 hpux11_nfs_fh3; + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + +/* + * STRUCTURES: + */ + +/* This is similar to Solaris 2.5.1 */ +struct nfs_args { + struct netbuf *addr; /* file server address */ + struct netbuf *syncaddr; /* secure NFS time sync addr */ + struct knetconfig *knconf; /* transport netconfig struct */ + char *hostname; /* server's hostname */ + char *netname; /* server's netname */ + caddr_t fh; /* File handle to be mounted */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int acregmin; /* attr cache file min secs */ + int acregmax; /* attr cache file max secs */ + int acdirmin; /* attr cache dir min secs */ + int acdirmax; /* attr cache dir max secs */ + char *fsname; /* F/S name */ +#if 0 + struct pathcnf *pathconf; /* static pathconf kludge */ +#endif /* 0 */ +}; + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +/* + ************************************************************************** + * HP-UX 11 has Autofs support, but we don't support it yet. + * For now, undefine it or define dummy entries. + ************************************************************************** + */ +#ifdef MNTTYPE_AUTOFS +# undef MNTTYPE_AUTOFS +#endif /* MNTTYPE_AUTOFS */ +#ifdef MNTTAB_TYPE_AUTOFS +# undef MNTTAB_TYPE_AUTOFS +#endif /* MNTTAB_TYPE_AUTOFS */ +#ifdef HAVE_FS_AUTOFS +# undef HAVE_FS_AUTOFS +#endif /* HAVE_FS_AUTOFS */ + +#ifdef MNTTYPE_NFS3 + +#define NFSPROC3_LOOKUP ((u_long) 3) +enum nfsstat3 { + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008 +}; +typedef enum nfsstat3 nfsstat3; + +typedef char *filename3; + +struct diropargs3 { + hpux11_nfs_fh3 dir; + filename3 name; +}; +typedef struct diropargs3 diropargs3; + +struct LOOKUP3args { + diropargs3 what; +}; +typedef struct LOOKUP3args LOOKUP3args; + +struct LOOKUP3resok { + hpux11_nfs_fh3 object; +#if 0 + post_op_attr obj_attributes; + post_op_attr dir_attributes; +#endif /* 0 */ +}; +typedef struct LOOKUP3resok LOOKUP3resok; + +struct LOOKUP3resfail { + int dummy; +#if 0 + post_op_attr dir_attributes; +#endif /* 0 */ +}; +typedef struct LOOKUP3resfail LOOKUP3resfail; + +struct LOOKUP3res { + nfsstat3 status; + union { + LOOKUP3resok ok; + LOOKUP3resfail fail; + } res_u; +}; +typedef struct LOOKUP3res LOOKUP3res; + +# endif /* MNTTYPE_NFS3 */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_irix5.h b/conf/nfs_prot/nfs_prot_irix5.h new file mode 100644 index 000000000000..de4312a4d40c --- /dev/null +++ b/conf/nfs_prot/nfs_prot_irix5.h @@ -0,0 +1,450 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_irix5.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_SYS_UIO_H +# define _KMEMUSER +# include <sys/uio.h> +# undef _KMEMUSER +#endif /* HAVE_SYS_UIO_H */ +#ifdef HAVE_SYS_VNODE_H +# include <sys/vnode.h> +#endif /* HAVE_SYS_VNODE_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ +#ifdef HAVE_SYS_FSTYP_H +# include <sys/fstyp.h> +#endif /* HAVE_SYS_FSTYP_H */ + +/* XFS isn't really supported in 5.3, but the header files are confusing */ +#undef MNTTYPE_XFS +#undef MNTTAB_TYPE_XFS + +/****************************************************************************/ +/* + * NFS V3 SUPPORT: + * + * IRIX5.3 requires the fh_len field to be added to the struct nfs_args + * defined in <sys/fs/nfs_clnt.h> for NFS3 mounts (it doesn't hurt for + * NFS2 mounts). The mount syscall however always expects the argument + * structure size to be sizeof(struct nfs_args). + * So we need to use an extended struct nfs_args in amd/ops_nfs.c, + * while using the original struct nfs_arg in libamu/mountutil.c. + * -- stolcke 7/4/97 + */ + +/* + * NFS arguments to the mount system call. + */ +struct irix5_nfs_args { + struct sockaddr_in *addr; /* file server address */ + fhandle_t *fh; /* File handle to be mounted */ + int flags; /* flags */ + u_int wsize; /* write size in bytes */ + u_int rsize; /* read size in bytes */ + u_int timeo; /* initial timeout in .1 secs */ + u_int retrans; /* times to retry send */ + char *hostname; /* server's name */ + u_int acregmin; /* attr cache file min secs */ + u_int acregmax; /* attr cache file max secs */ + u_int acdirmin; /* attr cache dir min secs */ + u_int acdirmax; /* attr cache dir max secs */ + u_int symttl; /* symlink cache time-to-live */ + char base[FSTYPSZ]; /* base type for statvfs */ + u_int namemax; /* name length for statvfs */ + u_int fh_len; /* length for a v3 filehandle */ +}; + +#ifndef MNTOPT_PROTO +# define MNTOPT_PROTO "proto" +#endif /* not MNTOPT_PROTO */ +#ifndef MNTOPT_VERS +# define MNTOPT_VERS "vers" +#endif /* not MNTOPT_VERS */ + +/****************************************************************************/ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#ifndef FHSIZE +/* Irix 5.2 is missing the definition for FHSIZE */ +# define FHSIZE NFS_FHSIZE +#endif /* not FHSIZE */ +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_irix6.h b/conf/nfs_prot/nfs_prot_irix6.h new file mode 100644 index 000000000000..159dfe7ad6ff --- /dev/null +++ b/conf/nfs_prot/nfs_prot_irix6.h @@ -0,0 +1,496 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_irix6.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H_off +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +/* evil: don't include */ +#undef HAVE_RPCSVC_MOUNT_H + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 +#define FHSIZE 32 + +#define MOUNTPROG 100005 +#define MOUNTPROC_MNT 1 +#define MOUNTPROC_DUMP 2 +#define MOUNTPROC_UMNT 3 +#define MOUNTPROC_UMNTALL 4 +#define MOUNTPROC_EXPORT 5 +#define MOUNTPROC_EXPORTALL 6 +#define MOUNTVERS_ORIG 1 +#define MOUNTVERS 1 +#define MOUNTVERS3 3 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +/* + * Irix 6.2 does not define the proto/dev options, although they + * do support them for NFS V3. + */ +#ifdef MNTTYPE_NFS3 +# ifndef MNTOPT_PROTO +# define MNTOPT_PROTO "proto" +# endif /* not MNTOPT_PROTO */ +# ifndef MNTOPT_VERS +# define MNTOPT_VERS "vers" +# endif /* not MNTOPT_VERS */ +#endif /* MNTTYPE_NFS3 */ + +#define AUTOFS_CONFTYPE "udp" + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + + +/* + * Partial definitions from rpcsvc/mount.h (can't use that header + * because it includes other "bad" stuff wrt xdr_groups. + */ + +struct mountlist { + char *ml_name; + char *ml_path; + struct mountlist *ml_nxt; +}; + +struct fhstatus { + int fhs_status; + fhandle_t fhs_fh; +}; + +typedef char fhandle[FHSIZE]; + +typedef struct { + u_int fhandle3_len; + char *fhandle3_val; +} fhandle3; + +enum mountstat3 { + MNT_OK = 0, + MNT3ERR_PERM = 1, + MNT3ERR_NOENT = 2, + MNT3ERR_IO = 5, + MNT3ERR_ACCES = 13, + MNT3ERR_NOTDIR = 20, + MNT3ERR_INVAL = 22, + MNT3ERR_NAMETOOLONG = 63, + MNT3ERR_NOTSUPP = 10004, + MNT3ERR_SERVERFAULT = 10006 +}; +typedef enum mountstat3 mountstat3; + +struct mountres3_ok { + fhandle3 fhandle; + struct { + u_int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; +}; +typedef struct mountres3_ok mountres3_ok; + +struct mountres3 { + mountstat3 fhs_status; + union { + mountres3_ok mountinfo; + } mountres3_u; +}; +typedef struct mountres3 mountres3; + +/* + * List of exported directories + * An export entry with ex_groups + * NULL indicates an entry which is exported to the world. + */ +struct exports { + dev_t ex_dev; /* dev of directory */ + char *ex_name; /* name of directory */ + struct groups *ex_groups; /* groups allowed to mount this entry */ + struct exports *ex_next; + short ex_rootmap; /* id to map root requests to */ + short ex_flags; /* bits to mask off file mode */ +}; + +struct groups { + char *g_name; + struct groups *g_next; +}; + +extern bool_t xdr_groups(XDR *, groups *); +extern bool_t xdr_exports(XDR *, struct exports **); +extern bool_t xdr_mountres3_ok(XDR *, mountres3_ok *); +extern bool_t xdr_mountres3(XDR *, mountres3 *); +extern bool_t xdr_fhstatus(XDR *, struct fhstatus *); +extern bool_t xdr_mountlist(XDR *, struct mountlist **); + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_linux.h b/conf/nfs_prot/nfs_prot_linux.h new file mode 100644 index 000000000000..7ccf18f00202 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_linux.h @@ -0,0 +1,334 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_linux.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ + +/* + * Hard-code support for some file systems so the built amd + * binary can always run them. Also, this helps detection of iso9660 + * file system for which the module isn't named as the file system mount + * name. + */ +#include <linux/version.h> +#ifndef KERNEL_VERSION +# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif /* not KERNEL_VERSION */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +# ifndef MS_BIND +# define MS_BIND 4096 +# endif /* not MS_BIND */ + +# ifndef MNTTYPE_LOFS +# define MNTTYPE_LOFS "bind" +# endif /* not MNTTYPE_LOFS */ +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) */ + +#ifndef MNTTYPE_ISO9660 +# define MNTTYPE_ISO9660 "iso9660" +#endif /* not MNTTYPE_ISO9660 */ + +#ifndef FHSIZE +# define FHSIZE 32 +#endif /* not FHSIZE */ +#ifndef FHSIZE3 +# define FHSIZE3 64 +#endif /* not FHSIZE3 */ + +#ifdef HAVE_FS_NFS3 +#ifndef MNTTYPE_NFS3 +# define MNTTYPE_NFS3 "nfs" +#endif /* not MNTTYPE_NFS3 */ +#endif /* HAVE_FS_NFS3 */ + +/* + * These two force/lazy unmount flags are sometimes missing from some linux + * systems' headers. + */ +#ifdef HAVE_UMOUNT2 +# ifndef MNT_FORCE +# define MNT_FORCE 0x1 /* from <sys/mount.h> */ +# endif /* not MNT_FORCE */ +# ifndef MNT_DETACH +# define MNT_DETACH 0x2 /* from kernel <linux/fs.h> */ +# endif /* not MNT_DETACH */ +#endif /* HAVE_UMOUNT2 */ + +/* XXX: hack until we have a better way to detect /dev/loop devices */ +#ifdef HAVE_LINUX_LOOP_H +# define HAVE_LOOP_DEVICE +extern char *setup_loop_device(const char *file); +extern int delete_loop_device(const char *device); +#endif /* HAVE_LINUX_LOOP_H */ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define fhsize root.size +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropokres nfsdiropokres; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readokres nfsreadokres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattr nfssattr; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* Autofs trick */ +typedef int autofs_args_t; + +/* + * We use our own definitions here, because the definitions in the + * kernel change the API (though not the ABI) *way* too often. + */ +#undef nfs_args_t +struct nfs2_fh { + char data[FHSIZE]; +}; + +struct nfs3_fh { + u_short size; + u_char data[FHSIZE3]; +}; + +struct nfs_args { + int version; /* 1 */ + int fd; /* 1 */ + struct nfs2_fh old_root; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + struct sockaddr_in addr; /* 1 */ + char hostname[256]; /* 1 */ + int namlen; /* 2 */ + unsigned int bsize; /* 3 */ + struct nfs3_fh root; /* 4 */ + int pseudoflavor; /* 5 */ + char context[256 + 1];/* 6 */ +}; +typedef struct nfs_args nfs_args_t; + +#define NFS4_MOUNT_VERSION 1 + +struct nfs_string { + unsigned int len; + char *data; +}; + +struct nfs4_args { + int version; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + struct nfs_string client_addr; /* 1 */ + struct nfs_string mnt_path; /* 1 */ + struct nfs_string hostname; /* 1 */ + unsigned int host_addrlen; /* 1 */ + struct sockaddr *host_addr; /* 1 */ + int proto; /* 1 */ + int auth_flavourlen;/* 1 */ + int *auth_flavours; /* 1 */ +}; + +typedef struct nfs4_args nfs4_args_t; + +/* HACK: these are not defined on Linux but we still need them + * internally. We have to be able to differentiate between having a + * timeout value set to zero and not having the option at all. These + * flags are masked off before passing the nfs_args structure to + * mount2() */ + +#define MNT2_NFS_OPT_ACREGMIN 0x10000 +#define MNT2_NFS_OPT_ACREGMAX 0x20000 +#define MNT2_NFS_OPT_ACDIRMIN 0x40000 +#define MNT2_NFS_OPT_ACDIRMAX 0x80000 +#define MNT2_NFS_OPT_FLAGMASK 0xFFFF + +/* + * Missing definitions on redhat alpha linux + */ +#ifdef _SELECTBITS_H +# ifndef __FD_ZERO +/* This line MUST be split! Otherwise m4 will not change it. */ +# define __FD_ZERO(set) \ + ((void) memset ((__ptr_t) (set), 0, sizeof(fd_set))) +# endif /* not __FD_ZERO */ +# ifndef __FD_SET +# define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +# endif /* not __FD_SET */ +# ifndef __FD_CLR +# define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +# endif /* not __FD_CLR */ +# ifndef __FD_ISSET +# define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) +# endif /* not __FD_ISSET */ + +#endif /* _SELECTBITS_H */ + +/* turn off this (b/c of hlfsd) */ +#undef HAVE_RPC_AUTH_DES_H + +extern int linux_version_code(); +/* use a private mapper from errno's to NFS errors */ +extern int linux_nfs_error(int e); +#define nfs_error(e) linux_nfs_error(e) + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_ncr2.h b/conf/nfs_prot/nfs_prot_ncr2.h new file mode 100644 index 000000000000..7e64f5c692de --- /dev/null +++ b/conf/nfs_prot/nfs_prot_ncr2.h @@ -0,0 +1,476 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_ncr2.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because + * it will result in conflicts with <nfs/nfs.h>. The latter is a must + * for NFS V3 specs. + */ + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + + +/* + * MACROS + */ + +/* ncr2 does not define this one! Incredible */ +#ifndef MNTTYPE_NFS +# define MNTTYPE_NFS "nfs" +#endif /* MNTTYPE_NFS */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFSPROC_NULL ((unsigned long)(0)) +#define NFSPROC_GETATTR ((unsigned long)(1)) +#define NFSPROC_SETATTR ((unsigned long)(2)) +#define NFSPROC_ROOT ((unsigned long)(3)) +#define NFSPROC_LOOKUP ((unsigned long)(4)) +#define NFSPROC_READLINK ((unsigned long)(5)) +#define NFSPROC_READ ((unsigned long)(6)) +#define NFSPROC_WRITECACHE ((unsigned long)(7)) +#define NFSPROC_WRITE ((unsigned long)(8)) +#define NFSPROC_CREATE ((unsigned long)(9)) +#define NFSPROC_REMOVE ((unsigned long)(10)) +#define NFSPROC_RENAME ((unsigned long)(11)) +#define NFSPROC_LINK ((unsigned long)(12)) +#define NFSPROC_SYMLINK ((unsigned long)(13)) +#define NFSPROC_MKDIR ((unsigned long)(14)) +#define NFSPROC_RMDIR ((unsigned long)(15)) +#define NFSPROC_READDIR ((unsigned long)(16)) +#define NFSPROC_STATFS ((unsigned long)(17)) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + +typedef char *name; +typedef fhandle_t fhandle; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_fattr(XDR *, nfsfattr *); +extern bool_t xdr_sattr(XDR *, nfssattr *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_attrstat(XDR *, nfsattrstat *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_diropres(XDR *, nfsdiropres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readargs(XDR *, nfsreadargs *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_writeargs(XDR *, nfswriteargs *); +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_linkargs(XDR *, nfslinkargs *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); + +extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2(void *, CLIENT *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2(void *, CLIENT *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2(void *, CLIENT *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ +/* ncr2 (sysv4) forgets to include this in <sys/resource.h> */ +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; /* XXX: 0 */ + long ru_ixrss; /* XXX: 0 */ + long ru_idrss; /* XXX: sum of rm_asrss */ + long ru_isrss; /* XXX: 0 */ + long ru_minflt; /* any page faults not requiring I/O */ + long ru_majflt; /* any page faults requiring I/O */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ +}; + +/* + * ncr2 has ndbm functions, but no <ndbm.h> + * only a partial <rpcsvc/dbm.h> + */ +#define PBLKSIZ 1024 +#define DBLKSIZ 4096 +typedef struct { + int dbm_dirf; /* open directory file */ + int dbm_pagf; /* open page file */ + int dbm_flags; /* flags, see below */ + long dbm_maxbno; /* last ``bit'' in dir file */ + long dbm_bitno; /* current bit number */ + long dbm_hmask; /* hash mask */ + long dbm_blkptr; /* current block for dbm_nextkey */ + int dbm_keyptr; /* current key for dbm_nextkey */ + long dbm_blkno; /* current page to read/write */ + long dbm_pagbno; /* current page in pagbuf */ + char dbm_pagbuf[PBLKSIZ]; /* page file block buffer */ + long dbm_dirbno; /* current block in dirbuf */ + char dbm_dirbuf[DBLKSIZ]; /* directory file block buffer */ +} DBM; +#define _DBM_RDONLY 0x1 /* data base open read-only */ +#define _DBM_IOERR 0x2 /* data base I/O error */ +#define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY) +#define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR) + /* use this one at your own risk! */ +#define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR) +/* for fstat(2) */ +#define dbm_dirfno(db) ((db)->dbm_dirf) +#define dbm_pagfno(db) ((db)->dbm_pagf) +/* + * flags to dbm_store() + */ +#define DBM_INSERT 0 +#define DBM_REPLACE 1 +extern DBM *dbm_open(char *, int, int); +extern void dbm_close(DBM *); +#ifndef DATUM +typedef struct { + char *dptr; + int dsize; +} datum; +# define DATUM +#endif /* not DATUM */ +extern datum dbm_fetch(DBM *, datum); +extern datum dbm_firstkey(DBM *); +extern datum dbm_nextkey(DBM *); +extern int dbm_delete(DBM *, datum); +extern int dbm_store(DBM *, datum, datum, int); + + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_netbsd.h b/conf/nfs_prot/nfs_prot_netbsd.h new file mode 100644 index 000000000000..c134240a54d5 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_netbsd.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_netbsd.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ + +#ifndef NFS_NPROCS +# define NFS_NPROCS 26 +#endif /* not NFS_NPROCS */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +/* NON-NFS STUFF (doesn't really belong here) */ +#ifndef DEFINED_YPALL_CALLBACK_FXN_T +# define DEFINED_YPALL_CALLBACK_FXN_T +/* this is RIGHT for 1.2G and 1.2.1 */ +typedef int (*ypall_callback_fxn_t)(u_long, char *, int, char *, int, void *); +#if 0 +/* this is right for 1.3beta */ +typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *); +#endif /* 0 */ +#endif /* DEFINED_YPALL_CALLBACK_FXN_T */ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_size size +#define na_type type +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_status status +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_from from +#define wra_fhandle file + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +/* + * + * NetBSD 1.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef NFSMNT_NFSV3 + +# define MOUNT_NFS3 MOUNT_NFS +# define MNTOPT_NFS3 "nfs" + +#endif /* NFSMNT_NFSV3 */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_netbsd1_3.h b/conf/nfs_prot/nfs_prot_netbsd1_3.h new file mode 100644 index 000000000000..7fbd3a7a4fbd --- /dev/null +++ b/conf/nfs_prot/nfs_prot_netbsd1_3.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_netbsd1_3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ + +/* NON-NFS STUFF (doesn't really belong here) */ +#ifndef DEFINED_YPALL_CALLBACK_FXN_T +# define DEFINED_YPALL_CALLBACK_FXN_T +#if 0 +/* this is RIGHT for 1.2G and 1.2.1 */ +typedef int (*ypall_callback_fxn_t)(u_long, char *, int, char *, int, void *); +#endif /* 0 */ +/* this is right for 1.3beta and newer */ +typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *); +#endif /* DEFINED_YPALL_CALLBACK_FXN_T */ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_size size +#define na_type type +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_status status +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_from from +#define wra_fhandle file + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* + * + * NetBSD 1.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef NFSMNT_NFSV3 + +# define MOUNT_NFS3 MOUNT_NFS +# define MNTOPT_NFS3 "nfs" + +#endif /* NFSMNT_NFSV3 */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_netbsd1_4.h b/conf/nfs_prot/nfs_prot_netbsd1_4.h new file mode 100644 index 000000000000..c52c75e2cf9b --- /dev/null +++ b/conf/nfs_prot/nfs_prot_netbsd1_4.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_netbsd1_4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifndef NFS_NPROCS +# define NFS_NPROCS 26 +#endif /* not NFS_NPROCS */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_NFS_NFSMOUNT_H +# include <nfs/nfsmount.h> +#endif /* HAVE_NFS_NFSMOUNT_H */ + +#ifdef HAVE_UFS_UFS_UFSMOUNT_H +/* 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 */ + +/* NON-NFS STUFF (doesn't really belong here) */ +#ifndef DEFINED_YPALL_CALLBACK_FXN_T +# define DEFINED_YPALL_CALLBACK_FXN_T +#if 0 +/* this is RIGHT for 1.2G and 1.2.1 */ +typedef int (*ypall_callback_fxn_t)(u_long, char *, int, char *, int, void *); +#endif /* 0 */ +/* this is right for 1.3beta and newer */ +typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *); +#endif /* DEFINED_YPALL_CALLBACK_FXN_T */ + +#ifdef HAVE_STATVFS +# define statfs statvfs +#endif /* HAVE_STATVFS */ + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_uid uid +#define na_type type +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_status status +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_from from +#define wra_fhandle file + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + +/* + * + * NetBSD 1.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef NFSMNT_NFSV3 + +# define MOUNT_NFS3 MOUNT_NFS +# define MNTOPT_NFS3 "nfs" + +#endif /* NFSMNT_NFSV3 */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_nextstep.h b/conf/nfs_prot/nfs_prot_nextstep.h new file mode 100644 index 000000000000..fadc004cedf9 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_nextstep.h @@ -0,0 +1,595 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_nextstep.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_BSD_RPC_RPC_H +# include <bsd/rpc/rpc.h> +#endif /* HAVE_BSD_RPC_RPC_H */ +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif /* HAVE_SYS_STAT_H */ + +/* + * odd problems happen during configuration and nextstep's /bin/cc + * gets strange errors from /bin/sh. I suspect it may be a conflict + * over some memory, a bad /bin/cc, or even kernel bug. + * this is what I get, as a result of running cc inside configure: + * /bin/cc -o conftest -g -O2 -D_POSIX_SOURCE conftest.c -lrpcsvc + * configure:2294: illegal external declaration, found `#' + * configure:2388: illegal file name 'AMU_NFS_PROTOCOL_HEADER' + * configure:2416: illegal external declaration, found `{' + * I have no explanation for it... -Erez + * Solution: don't use /bin/cc, but gcc 2.7.2.1 or better! + */ + +#if 0 +/* cannot include this file b/c it refers to non-existing headers */ +# include <bsd/nfs/nfs_mount.h> +#endif /* 0 */ + + +/* + * MACROS: + */ + +/* ugly: fix up nextstep's nfs mount type */ +#ifdef MOUNT_TYPE_NFS___off_no_longer_needed +# undef MOUNT_TYPE_UFS +# define MOUNT_TYPE_UFS MOUNT_UFS +# undef MOUNT_TYPE_NFS +# define MOUNT_TYPE_NFS MOUNT_NFS +# undef MOUNT_TYPE_PCFS +# define MOUNT_TYPE_PCFS MOUNT_PC +# undef MOUNT_TYPE_LOFS +# define MOUNT_TYPE_LOFS MOUNT_LO +# undef MOUNT_TYPE_SPECFS +# define MOUNT_TYPE_SPECFS MOUNT_SPECFS +# undef MOUNT_TYPE_CFS +# define MOUNT_TYPE_CFS MOUNT_CFS +#endif /* MOUNT_TYPE_NFS */ + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + +/* + * NFS mount option flags + */ +#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x002 /* set write size */ +#define NFSMNT_RSIZE 0x004 /* set read size */ +#define NFSMNT_TIMEO 0x008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x010 /* set number of request retries */ +#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ +#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ +#define NFSMNT_NOAC 0x080 /* don't cache attributes */ +#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ +#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ +#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ +#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ +#define NFSMNT_SECURE 0x1000 /* secure mount */ +#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ + +#define NFS_PORT 2049 +#ifndef NFS_MAXDATA +# define NFS_MAXDATA 8192 +#endif /* NFS_MAXDATA */ +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* + * fix up or complete other some definitions... + */ +#define WNOHANG 01 +#define WUNTRACED 02 +#define WIFSTOPPED(status) ((status) & 0100) +#define WSTOPSIG(status) (int)(WIFSTOPPED(status) ? \ + (((status) >> 8) & 0177) : -1) +#define WIFSIGNALED(status) ( !WIFEXITED(status) && \ + !WIFSTOPPED(status) ) +#define WTERMSIG(status) (int)(WIFSIGNALED(status) ? \ + ((status) & 0177) : -1) +/* define missing macros */ +#ifndef S_ISDIR +# ifdef S_IFMT +# define S_ISDIR(mode) (((mode) & (S_IFMT)) == (S_IFDIR)) +# else /* not S_IFMT */ +# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) +# endif /* not S_IFMT */ +#endif /* not S_ISDIR */ + +/* + * ENUMS: + */ + +enum nfstype { + NFNON = 0, + NFREG = 1, + NFDIR = 2, + NFBLK = 3, + NFCHR = 4, + NFLNK = 5, + NFSOCK = 6, + NFBAD = 7, + NFFIFO = 8, +}; + +enum nfsstat { + NFS_OK = 0, /* no error */ + NFSERR_PERM=EPERM, /* Not owner */ + NFSERR_NOENT=ENOENT, /* No such file or directory */ + NFSERR_IO=EIO, /* I/O error */ + NFSERR_NXIO=ENXIO, /* No such device or address */ + NFSERR_ACCES=EACCES, /* Permission denied */ + NFSERR_EXIST=EEXIST, /* File exists */ + NFSERR_NODEV=ENODEV, /* No such device */ + NFSERR_NOTDIR=ENOTDIR, /* Not a directory */ + NFSERR_ISDIR=EISDIR, /* Is a directory */ + NFSERR_FBIG=EFBIG, /* File too large */ + NFSERR_NOSPC=ENOSPC, /* No space left on device */ + NFSERR_ROFS=EROFS, /* Read-only file system */ + NFSERR_NAMETOOLONG=ENAMETOOLONG,/* File name too long */ + NFSERR_NOTEMPTY=ENOTEMPTY, /* Directory not empty */ + NFSERR_DQUOT=EDQUOT, /* Disc quota exceeded */ + NFSERR_STALE=ESTALE, /* Stale NFS file handle */ + NFSERR_WFLUSH /* write cache flushed */ +}; + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char fhandle[NFS_FHSIZE]; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum ftype ftype; +typedef enum nfsstat nfsstat; +typedef enum nfstype nfsftype; +typedef fhandle fhandle_t; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); + +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_mountlist(XDR *xdrs, mountlist *objp); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); + + +/* + * STRUCTURES: + */ + +struct nfs_args { + struct sockaddr_in *addr; /* file server address */ + caddr_t fh; /* File handle to be mounted */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + char *hostname; /* server's hostname */ + int acregmin; /* attr cache file min secs */ + int acregmax; /* attr cache file max secs */ + int acdirmin; /* attr cache dir min secs */ + int acdirmax; /* attr cache dir max secs */ + char *netname; /* server's netname */ +}; + +struct nfs_fh { + char data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_openbsd.h b/conf/nfs_prot/nfs_prot_openbsd.h new file mode 100644 index 000000000000..e46978451538 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_openbsd.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_openbsd.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ + +#ifndef NFS_NPROCS +# define NFS_NPROCS 26 +#endif /* not NFS_NPROCS */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_UFS_UFS_UFSMOUNT_H +# ifdef HAVE_UFS_UFS_EXTATTR_H +/* + * Need to define _KERNEL to include protected definition of struct + * ufs_extattr_per_mount, which is used in struct ufsmount in + * <ufs/ufs/ufsmount.h>, but is NOT protected by _KERNEL there. + */ +# define _KERNEL +# include <ufs/ufs/extattr.h> +# undef _KERNEL +# endif /* HAVE_UFS_UFS_EXTATTR_H */ +# ifndef MAXQUOTAS +# define MAXQUOTAS 2 +# endif /* not MAXQUOTAS */ +/* + * XXX: fake struct nextexport: trying to include proper headers here is too + * difficult: those headers drag many other headers, etc. + */ +struct netexport { int this_is_SO_wrong; }; +# include <ufs/ufs/ufsmount.h> +#endif /* HAVE_UFS_UFS_UFSMOUNT_H */ + + +/* + * MACROS: + */ +#define dr_drok_u diropres +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_size size +#define na_type type +#define na_uid uid +#define na_gid gid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_status status +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_from from +#define wra_fhandle file + + +/* + * TYPEDEFS: + */ +typedef attrstat nfsattrstat; +typedef createargs nfscreateargs; +typedef dirlist nfsdirlist; +typedef diropargs nfsdiropargs; +typedef diropres nfsdiropres; +typedef entry nfsentry; +typedef fattr nfsfattr; +typedef ftype nfsftype; +typedef linkargs nfslinkargs; +typedef readargs nfsreadargs; +typedef readdirargs nfsreaddirargs; +typedef readdirres nfsreaddirres; +typedef readlinkres nfsreadlinkres; +typedef readres nfsreadres; +typedef renameargs nfsrenameargs; +typedef sattrargs nfssattrargs; +typedef statfsokres nfsstatfsokres; +typedef statfsres nfsstatfsres; +typedef symlinkargs nfssymlinkargs; +typedef writeargs nfswriteargs; + + +/* + * OpenBSD 2.2 has NFS V3, but it is undefined in the header files. + * so I define everything that's needed for NFS V3 here. + */ +#ifdef NFSMNT_NFSV3 + +/* + * turn of this function so it cannot be used! OpenBSD seems to + * require that NFS sockets be connected. + * See m4/macros/check_nfs_socket_connection.m4. + */ + +# define MOUNT_NFS3 MOUNT_NFS +# define MNTOPT_NFS3 "nfs" + +#endif /* NFSMNT_NFSV3 */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_osf2.h b/conf/nfs_prot/nfs_prot_osf2.h new file mode 100644 index 000000000000..82f8f38f0e81 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_osf2.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_osf2.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_SYS_ERRNO_H +# include <sys/errno.h> +#endif /* HAVE_SYS_ERRNO_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + +/* avoid conflicts with Irix's EFS */ +#undef MOUNT_EFS /* DCE Episode FS */ +/* <sys/fs_types.h> includes a global symbol in every module! */ +#define _SYS_FS_TYPES_H_ + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define fh_data fh_bytes + +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +#define drok_attributes drok_attr +#define na_fileid na_nodeid +#define la_fhandle la_from +#define nt_seconds tv_sec +#define nt_useconds tv_usec +#define ra_totalcount ra_totcount +#define sla_to sla_tnm +#define sla_attributes sla_sa +#define sag_fhandle saa_fh +#define sag_attributes saa_sa +#define sfrok_tsize fsok_tsize +#define sfrok_bsize fsok_bsize +#define sfrok_blocks fsok_blocks +#define sfrok_bfree fsok_bfree +#define sfrok_bavail fsok_bavail +#define sfr_status fs_status +#define sfr_u fs_u +#define sfr_reply_u fs_fsok_u +#define wra_fhandle wa_fhandle +#define wra_beginoffset wa_begoff +#define wra_offset wa_offset +#define wra_totalcount wa_totcount +#define wra_u wa_mbuf->m_hdr +#define wra_val_u mh_data +#define wra_len_u mh_len + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct nfssvcfh fhandle; +typedef struct nfsattrstat nfsattrstat; +typedef struct nfscreateargs nfscreateargs; +typedef struct nfsdirlist nfsdirlist; +typedef struct nfsdiropargs nfsdiropargs; +typedef struct nfsdrok nfsdiropokres; +typedef struct nfsdiropres nfsdiropres; +typedef struct nfsentry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct nfsfattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct nfslinkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct _nfs_fh _nfs_fh; +typedef struct timeval nfstime; +typedef struct nfsreadargs nfsreadargs; +typedef struct nfsreaddirargs nfsreaddirargs; +typedef struct nfsreaddirres nfsreaddirres; +typedef struct nfsreadlinkres nfsreadlinkres; +typedef struct nfsreadokres nfsreadokres; +typedef struct nfsreadres nfsreadres; +typedef struct nfsrenameargs nfsrenameargs; +typedef struct nfssattr nfssattr; +typedef struct nfssaargs nfssattrargs; +typedef struct nfsstatfsok nfsstatfsokres; +typedef struct nfsstatfs nfsstatfsres; +typedef struct nfsslargs nfssymlinkargs; +typedef struct nfswriteargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct _nfs_fh { + char data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct nfsreadlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct nfsreadokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct nfsreadres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct nfscreateargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct nfsrenameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct nfsreaddirargs { + nfsv2fh_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct nfsentry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct nfsdirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct nfsreaddirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_osf4.h b/conf/nfs_prot/nfs_prot_osf4.h new file mode 100644 index 000000000000..db74b4aa009d --- /dev/null +++ b/conf/nfs_prot/nfs_prot_osf4.h @@ -0,0 +1,417 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_osf4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNTV3_H +# include <rpcsvc/mountv3.h> +#endif /* HAVE_RPCSVC_MOUNTV3_H */ +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + +/* avoid conflicts with Irix's EFS */ +#undef MOUNT_EFS /* DCE Episode FS */ + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +#define drok_attributes drok_attr +#define na_fileid na_nodeid +#define la_fhandle la_from +#define nt_seconds tv_sec +#define nt_useconds tv_usec +#define ra_totalcount ra_totcount +#define sla_to sla_tnm +#define sla_attributes sla_sa +#define sag_fhandle saa_fh +#define sag_attributes saa_sa +#define sfrok_tsize fsok_tsize +#define sfrok_bsize fsok_bsize +#define sfrok_blocks fsok_blocks +#define sfrok_bfree fsok_bfree +#define sfrok_bavail fsok_bavail +#define sfr_status fs_status +#define sfr_u fs_u +#define sfr_reply_u fs_fsok_u +#define wra_fhandle wa_fhandle +#define wra_beginoffset wa_begoff +#define wra_offset wa_offset +#define wra_totalcount wa_totcount +#define wra_u wa_mbuf->m_hdr +#define wra_val_u mh_data +#define wra_len_u mh_len + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct nfssvcfh fhandle; +typedef struct nfsattrstat nfsattrstat; +typedef struct nfscreateargs nfscreateargs; +typedef struct nfsdirlist nfsdirlist; +typedef struct nfsdiropargs nfsdiropargs; +typedef struct nfsdrok nfsdiropokres; +typedef struct nfsdiropres nfsdiropres; +typedef struct nfsentry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct nfsfattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct nfslinkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct _nfs_fh _nfs_fh; +typedef struct timeval nfstime; +typedef struct nfsreadargs nfsreadargs; +typedef struct nfsreaddirargs nfsreaddirargs; +typedef struct nfsreaddirres nfsreaddirres; +typedef struct nfsreadlinkres nfsreadlinkres; +typedef struct nfsreadokres nfsreadokres; +typedef struct nfsreadres nfsreadres; +typedef struct nfsrenameargs nfsrenameargs; +typedef struct nfssattr nfssattr; +typedef struct nfssaargs nfssattrargs; +typedef struct nfsstatfsok nfsstatfsokres; +typedef struct nfsstatfs nfsstatfsres; +typedef struct nfsslargs nfssymlinkargs; +typedef struct nfswriteargs nfswriteargs; + + +/* + * EXTERNALS: (some are missing from system headers) + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(struct nfssvcfh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(struct nfssvcfh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(struct nfssvcfh *, struct svc_req *); +extern int plock(int op); +extern const char *hstrerror(int err); +extern int getmntinfo(struct statfs **mntbufp, int flags); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, struct nfssvcfh*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); +extern bool_t xdr_exportnode (XDR *, exportnode*); +extern bool_t xdr_groups (XDR *, groups*); + + + +/* + * STRUCTURES: + */ + +struct _nfs_fh { + char data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct _fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct _sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct _attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct _sattrargs { + struct nfssvcfh sag_fhandle; + nfssattr sag_attributes; +}; + +struct _diropargs { + struct nfssvcfh da_fhandle; /* was dir */ + filename da_name; +}; + +struct _diropokres { + struct nfssvcfh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct _diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct nfsreadlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct _readargs { + struct nfssvcfh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct nfsreadokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct nfsreadres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +#if 0 +struct _writeargs { + struct nfssvcfh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; +#endif /* 0 */ + +struct nfscreateargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct nfsrenameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct _linkargs { + struct nfssvcfh la_fhandle; + nfsdiropargs la_to; +}; + +struct _symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct nfsreaddirargs { + struct nfssvcfh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct nfsentry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct nfsdirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct nfsreaddirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct _statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct _statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_osf5.h b/conf/nfs_prot/nfs_prot_osf5.h index 655e98d03902..f091a7a2d61c 100644 --- a/conf/nfs_prot/nfs_prot_osf5.h +++ b/conf/nfs_prot/nfs_prot_osf5.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2003 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * @@ -36,9 +32,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: nfs_prot_osf5.h,v 1.1.2.4 2002/12/27 22:44:57 ezk Exp $ + * File: am-utils/conf/nfs_prot/nfs_prot_osf5.h * */ @@ -365,7 +360,7 @@ struct _writeargs { char *wra_val_u; } wra_u; }; -#endif +#endif /* 0 */ struct nfscreateargs { nfsdiropargs ca_where; @@ -428,4 +423,20 @@ struct _statfsres { } sfr_u; }; +/* + ************************************************************************** + * Tru64 5.1's autofs is not ported or tested yet... + * For now, undefine it or define dummy entries. + ************************************************************************** + */ +#ifdef MNTTYPE_AUTOFS +# undef MNTTYPE_AUTOFS +#endif /* MNTTYPE_AUTOFS */ +#ifdef MNTTAB_TYPE_AUTOFS +# undef MNTTAB_TYPE_AUTOFS +#endif /* MNTTAB_TYPE_AUTOFS */ +#ifdef HAVE_FS_AUTOFS +# undef HAVE_FS_AUTOFS +#endif /* HAVE_FS_AUTOFS */ + #endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos3.h b/conf/nfs_prot/nfs_prot_sunos3.h new file mode 100644 index 000000000000..557a2ccbbd75 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos3.h @@ -0,0 +1,401 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_SYS_ERRNO_H +#include <sys/errno.h> +#endif /* HAVE_SYS_ERRNO_H */ +#ifdef HAVE_RPC_RPC_H +#include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +# ifdef HAVE_NFS_NFS_CLNT_H +# include <nfs/nfs_clnt.h> +# endif /* HAVE_NFS_NFS_CLNT_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +/* complete missing definition that is actually used in SunOS 3.x */ +#ifndef MNTOPT_DEV +# define MNTOPT_DEV "dev" +#endif /* not MNTOPT_DEV */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name +#define na_fileid na_nodeid +#define la_fhandle la_from +#define ra_totalcount ra_totcount + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef char fhandle[NFS_FHSIZE]; +typedef struct attrstat nfsattrstat; +typedef struct nfscreateargs nfscreateargs; +typedef struct nfsdirlist nfsdirlist; +typedef struct nfsdiropargs nfsdiropargs; +typedef struct nfsdiropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct nfsentry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct nfsfhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct nfslinkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfstime nfstime; +typedef struct nfsreadargs nfsreadargs; +typedef struct nfsreaddirargs nfsreaddirargs; +typedef struct nfsreaddirres nfsreaddirres; +typedef struct nfsreadlinkres nfsreadlinkres; +typedef struct nfsreadokres nfsreadokres; +typedef struct nfsreadres nfsreadres; +typedef struct nfsrenameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct nfssattrargs nfssattrargs; +typedef struct nfsstatfsokres nfsstatfsokres; +typedef struct nfsstatfsres nfsstatfsres; +typedef struct nfssymlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(fhandle_t *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(fhandle_t *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(fhandle_t *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, fhandle_t*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct nfssattrargs { + fhandle_t sag_fhandle; + nfssattr sag_attributes; +}; + +struct _nfsdiropargs { + fhandle_t da_fhandle; /* was dir */ + filename da_name; +}; + +struct nfsdiropokres { + fhandle_t drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct nfsreadlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct _nfsreadargs { + fhandle_t ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct nfsreadokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct nfsreadres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + fhandle_t wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct nfscreateargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct nfsrenameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct _nfslinkargs { + fhandle_t la_fhandle; + nfsdiropargs la_to; +}; + +struct nfssymlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct nfsreaddirargs { + fhandle_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct nfsentry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct nfsdirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct nfsreaddirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct nfsstatfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct nfsstatfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +struct nfsfhstatus { + int fhs_status; + fhandle fhs_fh; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos4.h b/conf/nfs_prot/nfs_prot_sunos4.h new file mode 100644 index 000000000000..c32edd3632b8 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos4.h @@ -0,0 +1,401 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_SYS_ERRNO_H +#include <sys/errno.h> +#endif /* HAVE_SYS_ERRNO_H */ +#ifdef HAVE_RPC_RPC_H +#include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ +#ifdef HAVE_NFS_NFSV2_H +# include <nfs/nfsv2.h> +#endif /* HAVE_NFS_NFSV2_H */ +#ifdef HAVE_NFS_RPCV2_H +# include <nfs/rpcv2.h> +#endif /* HAVE_NFS_RPCV2_H */ +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ +# ifdef HAVE_NFS_NFS_CLNT_H +# include <nfs/nfs_clnt.h> +# endif /* HAVE_NFS_NFS_CLNT_H */ +#ifdef HAVE_SYS_FS_NFS_H +# include <sys/fs/nfs.h> +#endif /* HAVE_SYS_FS_NFS_H */ +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ + +/* complete missing definition that is actually used in SunOS 4.x */ +#ifndef MNTOPT_DEV +# define MNTOPT_DEV "dev" +#endif /* not MNTOPT_DEV */ + +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name +#define na_fileid na_nodeid +#define la_fhandle la_from +#define ra_totalcount ra_totcount + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef char fhandle[NFS_FHSIZE]; +typedef struct attrstat nfsattrstat; +typedef struct nfscreateargs nfscreateargs; +typedef struct nfsdirlist nfsdirlist; +typedef struct nfsdiropargs nfsdiropargs; +typedef struct nfsdiropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct nfsentry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct nfsfhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct nfslinkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct nfstime nfstime; +typedef struct nfsreadargs nfsreadargs; +typedef struct nfsreaddirargs nfsreaddirargs; +typedef struct nfsreaddirres nfsreaddirres; +typedef struct nfsreadlinkres nfsreadlinkres; +typedef struct nfsreadokres nfsreadokres; +typedef struct nfsreadres nfsreadres; +typedef struct nfsrenameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct nfssattrargs nfssattrargs; +typedef struct nfsstatfsokres nfsstatfsokres; +typedef struct nfsstatfsres nfsstatfsres; +typedef struct nfssymlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(fhandle_t *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(fhandle_t *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(fhandle_t *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, fhandle_t*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct nfssattrargs { + fhandle_t sag_fhandle; + nfssattr sag_attributes; +}; + +struct _nfsdiropargs { + fhandle_t da_fhandle; /* was dir */ + filename da_name; +}; + +struct nfsdiropokres { + fhandle_t drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct nfsreadlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct _nfsreadargs { + fhandle_t ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct nfsreadokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct nfsreadres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + fhandle_t wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct nfscreateargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct nfsrenameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct _nfslinkargs { + fhandle_t la_fhandle; + nfsdiropargs la_to; +}; + +struct nfssymlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct nfsreaddirargs { + fhandle_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct nfsentry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct nfsdirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct nfsreaddirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct nfsstatfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct nfsstatfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +struct nfsfhstatus { + int fhs_status; + fhandle fhs_fh; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_3.h b/conf/nfs_prot/nfs_prot_sunos5_3.h new file mode 100644 index 000000000000..da760dfe0f46 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos5_3.h @@ -0,0 +1,264 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos5_3.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do not include <nfs/nfs.h> because Solaris 2.3 really does not have NFS + * V.3 support, despite what their header files claim. + */ + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ + +#ifndef fhandle_t +# define fhandle_t nfs_fh +#endif /* not fhandle_t */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ +#ifdef HAVE_RPC_RPC_H +#include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + +/* missing mntent definition for cachefs */ +#ifndef MNTTYPE_CACHEFS +# define MNTTYPE_CACHEFS "cachefs" /* Cache File System */ +#endif /* not MNTTYPE_CACHEFS */ + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + + +/* + * TYPEDEFS: + */ + +typedef char *dirpath; +typedef char *name; +typedef char fhandle[FHSIZE]; +typedef enum ftype nfsftype; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct nfsfhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +struct nfsfhstatus { + int fhs_status; + fhandle fhs_fh; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_4.h b/conf/nfs_prot/nfs_prot_sunos5_4.h new file mode 100644 index 000000000000..25dc58b896dc --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos5_4.h @@ -0,0 +1,266 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos5_4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do not include <nfs/nfs.h> because Solaris 2.4 really does not have NFS + * V.3 support, despite what their header files claim. + */ + +#ifdef HAVE_RPCSVC_NFS_PROT_H +# include <rpcsvc/nfs_prot.h> +#endif /* HAVE_RPCSVC_NFS_PROT_H */ + +#define FHSIZE 32 +typedef char fhandle[FHSIZE]; +#define fhandle_t fhandle + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ +#ifdef HAVE_RPC_RPC_H +#include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + +/* missing mntent definition for cachefs */ +#ifndef MNTTYPE_CACHEFS +# define MNTTYPE_CACHEFS "cachefs" /* Cache File System */ +#endif /* not MNTTYPE_CACHEFS */ + +/* + * Solaris 2.4 has header definitions for NFS V.3, but does not really + * have NFS V.3 support in the kernel. So I must undefine these. + */ +#ifdef MNTTYPE_NFS3 +# undef MNTTYPE_NFS3 +#endif /* MNTTYPE_NFS3 */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define dr_drok_u diropres +#define ca_attributes attributes +#define ca_where where +#define da_fhandle dir +#define da_name name +#define dl_entries entries +#define dl_eof eof +#define dr_status status +#define dr_u diropres_u +#define drok_attributes attributes +#define drok_fhandle file +#define fh_data data +#define la_fhandle from +#define la_to to +#define na_atime atime +#define na_blocks blocks +#define na_blocksize blocksize +#define na_ctime ctime +#define na_fileid fileid +#define na_fsid fsid +#define na_gid gid +#define na_mode mode +#define na_mtime mtime +#define na_nlink nlink +#define na_rdev rdev +#define na_size size +#define na_type type +#define na_uid uid +#define ne_cookie cookie +#define ne_fileid fileid +#define ne_name name +#define ne_nextentry nextentry +#define ns_attr_u attributes +#define ns_status status +#define ns_u attrstat_u +#define nt_seconds seconds +#define nt_useconds useconds +#define ra_count count +#define ra_fhandle file +#define ra_offset offset +#define ra_totalcount totalcount +#define raok_attributes attributes +#define raok_len_u data_len +#define raok_u data +#define raok_val_u data_val +#define rda_cookie cookie +#define rda_count count +#define rda_fhandle dir +#define rdr_reply_u reply +#define rdr_status status +#define rdr_u readdirres_u +#define rlr_data_u data +#define rlr_status status +#define rlr_u readlinkres_u +#define rna_from from +#define rna_to to +#define rr_reply_u reply +#define rr_status status +#define rr_u readres_u +#define sa_atime atime +#define sa_gid gid +#define sa_mode mode +#define sa_mtime mtime +#define sa_size size +#define sa_uid uid +#define sag_attributes attributes +#define sag_fhandle file +#define sfr_reply_u reply +#define sfr_status status +#define sfr_u statfsres_u +#define sfrok_bavail bavail +#define sfrok_bfree bfree +#define sfrok_blocks blocks +#define sfrok_bsize bsize +#define sfrok_tsize tsize +#define sla_attributes attributes +#define sla_from from +#define sla_to to +#define wra_beginoffset beginoffset +#define wra_fhandle file +#define wra_len_u data_len +#define wra_offset offset +#define wra_totalcount totalcount +#define wra_u data +#define wra_val_u data_val + +/* map field names */ +#define ex_dir ex_name +#define gr_name g_name +#define gr_next g_next +#define ml_directory ml_path +#define ml_hostname ml_name +#define ml_next ml_nxt + + +/* + * TYPEDEFS: + */ + +typedef char *dirpath; +typedef char *name; +typedef enum ftype nfsftype; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct linkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_5.h b/conf/nfs_prot/nfs_prot_sunos5_5.h new file mode 100644 index 000000000000..6e31ddc242d9 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos5_5.h @@ -0,0 +1,381 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos5_5.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because + * it will result in conflicts with <nfs/nfs.h>. The latter is a must + * for NFS V3 specs. + */ + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFSPROC_NULL ((unsigned long)(0)) +#define NFSPROC_GETATTR ((unsigned long)(1)) +#define NFSPROC_SETATTR ((unsigned long)(2)) +#define NFSPROC_ROOT ((unsigned long)(3)) +#define NFSPROC_LOOKUP ((unsigned long)(4)) +#define NFSPROC_READLINK ((unsigned long)(5)) +#define NFSPROC_READ ((unsigned long)(6)) +#define NFSPROC_WRITECACHE ((unsigned long)(7)) +#define NFSPROC_WRITE ((unsigned long)(8)) +#define NFSPROC_CREATE ((unsigned long)(9)) +#define NFSPROC_REMOVE ((unsigned long)(10)) +#define NFSPROC_RENAME ((unsigned long)(11)) +#define NFSPROC_LINK ((unsigned long)(12)) +#define NFSPROC_SYMLINK ((unsigned long)(13)) +#define NFSPROC_MKDIR ((unsigned long)(14)) +#define NFSPROC_RMDIR ((unsigned long)(15)) +#define NFSPROC_READDIR ((unsigned long)(16)) +#define NFSPROC_STATFS ((unsigned long)(17)) + +#define AUTOFS_CONFTYPE "ticlts" + + +/* + * TYPEDEFS: + */ + +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_fattr(XDR *, nfsfattr *); +extern bool_t xdr_sattr(XDR *, nfssattr *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_attrstat(XDR *, nfsattrstat *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_diropres(XDR *, nfsdiropres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readargs(XDR *, nfsreadargs *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_writeargs(XDR *, nfswriteargs *); +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_linkargs(XDR *, nfslinkargs *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); + +extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2(void *, CLIENT *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2(void *, CLIENT *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2(void *, CLIENT *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_6.h b/conf/nfs_prot/nfs_prot_sunos5_6.h new file mode 100644 index 000000000000..36f613f3f7a3 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos5_6.h @@ -0,0 +1,385 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos5_6.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because + * it will result in conflicts with <nfs/nfs.h>. The latter is a must + * for NFS V3 specs. + */ + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFSPROC_NULL ((unsigned long)(0)) +#define NFSPROC_GETATTR ((unsigned long)(1)) +#define NFSPROC_SETATTR ((unsigned long)(2)) +#define NFSPROC_ROOT ((unsigned long)(3)) +#define NFSPROC_LOOKUP ((unsigned long)(4)) +#define NFSPROC_READLINK ((unsigned long)(5)) +#define NFSPROC_READ ((unsigned long)(6)) +#define NFSPROC_WRITECACHE ((unsigned long)(7)) +#define NFSPROC_WRITE ((unsigned long)(8)) +#define NFSPROC_CREATE ((unsigned long)(9)) +#define NFSPROC_REMOVE ((unsigned long)(10)) +#define NFSPROC_RENAME ((unsigned long)(11)) +#define NFSPROC_LINK ((unsigned long)(12)) +#define NFSPROC_SYMLINK ((unsigned long)(13)) +#define NFSPROC_MKDIR ((unsigned long)(14)) +#define NFSPROC_RMDIR ((unsigned long)(15)) +#define NFSPROC_READDIR ((unsigned long)(16)) +#define NFSPROC_STATFS ((unsigned long)(17)) + +#define AUTOFS_CONFTYPE "ticotsord" + + +/* + * TYPEDEFS: + */ + +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_fattr(XDR *, nfsfattr *); +extern bool_t xdr_sattr(XDR *, nfssattr *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_attrstat(XDR *, nfsattrstat *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_diropres(XDR *, nfsdiropres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readargs(XDR *, nfsreadargs *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_writeargs(XDR *, nfswriteargs *); +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_linkargs(XDR *, nfslinkargs *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); + +extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2(void *, CLIENT *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2(void *, CLIENT *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2(void *, CLIENT *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_7.h b/conf/nfs_prot/nfs_prot_sunos5_7.h new file mode 100644 index 000000000000..3d0d30f823a1 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_sunos5_7.h @@ -0,0 +1,396 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_sunos5_7.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because + * it will result in conflicts with <nfs/nfs.h>. The latter is a must + * for NFS V3 specs. + */ + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFSPROC_NULL ((unsigned long)(0)) +#define NFSPROC_GETATTR ((unsigned long)(1)) +#define NFSPROC_SETATTR ((unsigned long)(2)) +#define NFSPROC_ROOT ((unsigned long)(3)) +#define NFSPROC_LOOKUP ((unsigned long)(4)) +#define NFSPROC_READLINK ((unsigned long)(5)) +#define NFSPROC_READ ((unsigned long)(6)) +#define NFSPROC_WRITECACHE ((unsigned long)(7)) +#define NFSPROC_WRITE ((unsigned long)(8)) +#define NFSPROC_CREATE ((unsigned long)(9)) +#define NFSPROC_REMOVE ((unsigned long)(10)) +#define NFSPROC_RENAME ((unsigned long)(11)) +#define NFSPROC_LINK ((unsigned long)(12)) +#define NFSPROC_SYMLINK ((unsigned long)(13)) +#define NFSPROC_MKDIR ((unsigned long)(14)) +#define NFSPROC_RMDIR ((unsigned long)(15)) +#define NFSPROC_READDIR ((unsigned long)(16)) +#define NFSPROC_STATFS ((unsigned long)(17)) + +#define AUTOFS_CONFTYPE "ticotsord" + +/* Sun has incomplete ldap headers, but libraries are ok */ +#ifndef LDAP_VERSION_MAX +#define LDAP_VERSION_MAX LDAP_VERSION3 +#endif /* LDAP_VERSION_MAX */ + + +/* + * TYPEDEFS: + */ + +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_fattr(XDR *, nfsfattr *); +extern bool_t xdr_sattr(XDR *, nfssattr *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_attrstat(XDR *, nfsattrstat *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_diropres(XDR *, nfsdiropres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readargs(XDR *, nfsreadargs *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_writeargs(XDR *, nfswriteargs *); +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_linkargs(XDR *, nfslinkargs *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); + +extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2(void *, CLIENT *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2(void *, CLIENT *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2(void *, CLIENT *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); + +/* Sun has incomplete ldap headers, but libraries are ok */ +#ifdef HAVE_LDAP_H +extern int ldap_set_option(LDAP *, int, const void *); +#endif /* HAVE_LDAP_H */ + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_sunos5_8.h b/conf/nfs_prot/nfs_prot_sunos5_8.h index 639262229608..2108a71f6fcf 100644 --- a/conf/nfs_prot/nfs_prot_sunos5_8.h +++ b/conf/nfs_prot/nfs_prot_sunos5_8.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2003 Erez Zadok + * Copyright (c) 1997-2014 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. @@ -16,11 +16,7 @@ * 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 + * 3. 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. * @@ -36,9 +32,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: nfs_prot_sunos5_8.h,v 1.2.2.4 2002/12/27 22:44:59 ezk Exp $ + * File: am-utils/conf/nfs_prot/nfs_prot_sunos5_8.h * */ @@ -103,6 +98,7 @@ #define NFSPROC_READDIR ((unsigned long)(16)) #define NFSPROC_STATFS ((unsigned long)(17)) +#define AUTOFS_CONFTYPE "ticotsord" /* * TYPEDEFS: diff --git a/conf/nfs_prot/nfs_prot_svr4.h b/conf/nfs_prot/nfs_prot_svr4.h new file mode 100644 index 000000000000..09a478745493 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_svr4.h @@ -0,0 +1,401 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_svr4.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +/* + * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because + * it will result in conflicts with <nfs/nfs.h>. The latter is a must + * for NFS V3 specs. + */ + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +#ifdef HAVE_RPCSVC_MOUNT_H +# include <rpcsvc/mount.h> +#endif /* HAVE_RPCSVC_MOUNT_H */ + +#ifdef HAVE_RPC_RPC_H +# include <rpc/rpc.h> +#endif /* HAVE_RPC_RPC_H */ + + +/* + * MACROS + */ + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFSPROC_NULL ((unsigned long)(0)) +#define NFSPROC_GETATTR ((unsigned long)(1)) +#define NFSPROC_SETATTR ((unsigned long)(2)) +#define NFSPROC_ROOT ((unsigned long)(3)) +#define NFSPROC_LOOKUP ((unsigned long)(4)) +#define NFSPROC_READLINK ((unsigned long)(5)) +#define NFSPROC_READ ((unsigned long)(6)) +#define NFSPROC_WRITECACHE ((unsigned long)(7)) +#define NFSPROC_WRITE ((unsigned long)(8)) +#define NFSPROC_CREATE ((unsigned long)(9)) +#define NFSPROC_REMOVE ((unsigned long)(10)) +#define NFSPROC_RENAME ((unsigned long)(11)) +#define NFSPROC_LINK ((unsigned long)(12)) +#define NFSPROC_SYMLINK ((unsigned long)(13)) +#define NFSPROC_MKDIR ((unsigned long)(14)) +#define NFSPROC_RMDIR ((unsigned long)(15)) +#define NFSPROC_READDIR ((unsigned long)(16)) +#define NFSPROC_STATFS ((unsigned long)(17)) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef struct attrstat nfsattrstat; +typedef struct createargs nfscreateargs; +typedef struct dirlist nfsdirlist; +typedef struct diropargs nfsdiropargs; +typedef struct diropokres nfsdiropokres; +typedef struct diropres nfsdiropres; +typedef struct entry nfsentry; +typedef struct fattr nfsfattr; +typedef struct linkargs nfslinkargs; +typedef struct nfs_fh nfs_fh; +typedef struct nfstime nfstime; +typedef struct readargs nfsreadargs; +typedef struct readdirargs nfsreaddirargs; +typedef struct readdirres nfsreaddirres; +typedef struct readlinkres nfsreadlinkres; +typedef struct readokres nfsreadokres; +typedef struct readres nfsreadres; +typedef struct renameargs nfsrenameargs; +typedef struct sattr nfssattr; +typedef struct sattrargs nfssattrargs; +typedef struct statfsokres nfsstatfsokres; +typedef struct statfsres nfsstatfsres; +typedef struct symlinkargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + +typedef char *name; +typedef fhandle_t fhandle; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; + + +/* + * EXTERNALS: + */ + +extern bool_t xdr_nfsstat(XDR *, nfsstat *); +extern bool_t xdr_ftype(XDR *, nfsftype *); +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +extern bool_t xdr_nfstime(XDR *, nfstime *); +extern bool_t xdr_fattr(XDR *, nfsfattr *); +extern bool_t xdr_sattr(XDR *, nfssattr *); +extern bool_t xdr_filename(XDR *, filename *); +extern bool_t xdr_nfspath(XDR *, nfspath *); +extern bool_t xdr_attrstat(XDR *, nfsattrstat *); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs *); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs *); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres *); +extern bool_t xdr_diropres(XDR *, nfsdiropres *); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres *); +extern bool_t xdr_readargs(XDR *, nfsreadargs *); +extern bool_t xdr_readokres(XDR *, nfsreadokres *); +extern bool_t xdr_readres(XDR *, nfsreadres *); +extern bool_t xdr_writeargs(XDR *, nfswriteargs *); +extern bool_t xdr_createargs(XDR *, nfscreateargs *); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs *); +extern bool_t xdr_linkargs(XDR *, nfslinkargs *); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs *); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs *); +extern bool_t xdr_entry(XDR *, nfsentry *); +extern bool_t xdr_dirlist(XDR *, nfsdirlist *); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres *); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres *); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres *); + +extern nfsattrstat *nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern nfsattrstat *nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2(nfssattrargs *, CLIENT *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2(nfswriteargs *, CLIENT *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2(nfsdiropargs *, CLIENT *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2(nfscreateargs *, CLIENT *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2(nfslinkargs *, CLIENT *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2(nfsrenameargs *, CLIENT *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2(nfsdiropargs *, CLIENT *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2(nfssymlinkargs *, CLIENT *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2(nfsreaddirargs *, CLIENT *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2(nfsreadargs *, CLIENT *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern nfsstatfsres *nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); +extern void *nfsproc_null_2(void *, CLIENT *); +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern void *nfsproc_root_2(void *, CLIENT *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern void *nfsproc_writecache_2(void *, CLIENT *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); + + +/* + * ENUMS: + */ + + +/* + * STRUCTURES: + */ + +struct nfs_fh { + char fh_data[NFS_FHSIZE]; +}; + +struct nfstime { + u_int nt_seconds; + u_int nt_useconds; +}; + +struct fattr { + nfsftype na_type; + u_int na_mode; + u_int na_nlink; + u_int na_uid; + u_int na_gid; + u_int na_size; + u_int na_blocksize; + u_int na_rdev; + u_int na_blocks; + u_int na_fsid; + u_int na_fileid; + nfstime na_atime; + nfstime na_mtime; + nfstime na_ctime; +}; + +struct sattr { + u_int sa_mode; + u_int sa_uid; + u_int sa_gid; + u_int sa_size; + nfstime sa_atime; + nfstime sa_mtime; +}; + +struct attrstat { + nfsstat ns_status; + union { + nfsfattr ns_attr_u; + } ns_u; +}; + +struct sattrargs { + nfs_fh sag_fhandle; + nfssattr sag_attributes; +}; + +struct diropargs { + nfs_fh da_fhandle; /* was dir */ + filename da_name; +}; + +struct diropokres { + nfs_fh drok_fhandle; + nfsfattr drok_attributes; +}; + +struct diropres { + nfsstat dr_status; /* was status */ + union { + nfsdiropokres dr_drok_u; /* was diropres */ + } dr_u; /* was diropres_u */ +}; + +struct readlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct readargs { + nfs_fh ra_fhandle; + u_int ra_offset; + u_int ra_count; + u_int ra_totalcount; +}; + +struct readokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct readres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + nfs_fh wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct createargs { + nfsdiropargs ca_where; + nfssattr ca_attributes; +}; + +struct renameargs { + nfsdiropargs rna_from; + nfsdiropargs rna_to; +}; + +struct linkargs { + nfs_fh la_fhandle; + nfsdiropargs la_to; +}; + +struct symlinkargs { + nfsdiropargs sla_from; + nfspath sla_to; + nfssattr sla_attributes; +}; + +struct readdirargs { + nfs_fh rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct entry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct dirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct readdirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct statfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct statfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; + +#endif /* not _AMU_NFS_PROT_H */ diff --git a/conf/nfs_prot/nfs_prot_ultrix.h b/conf/nfs_prot/nfs_prot_ultrix.h new file mode 100644 index 000000000000..216216beb755 --- /dev/null +++ b/conf/nfs_prot/nfs_prot_ultrix.h @@ -0,0 +1,304 @@ +/* + * Copyright (c) 1997-2014 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. 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/conf/nfs_prot/nfs_prot_ultrix.h + * + */ + +#ifndef _AMU_NFS_PROT_H +#define _AMU_NFS_PROT_H + +#ifdef HAVE_NFS_NFS_H +# include <nfs/nfs.h> +#endif /* HAVE_NFS_NFS_H */ + +/* + * MACROS + */ + +#if 0 +/* <nfs/nfs.h> */ +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#endif /* 0 */ +/* sizeof(u_long) */ +#define NFS_COOKIESIZE 4 +#if 0 +/* defaults: libamu/amu.h */ +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 +#endif /* 0 */ + +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#if 0 +/* <nfs/nfs.h> */ +#ifndef NFS_PROGRAM +# define NFS_PROGRAM ((u_long)100003) +#endif /* not NFS_PROGRAM */ +#ifndef NFS_VERSION +# define NFS_VERSION ((u_long)2) +#endif /* not NFS_VERSION */ +#endif /* 0 */ + +/* could use (u_long)RFS_* with RFS_* from <nfs/nfs.h> */ +#define NFSPROC_NULL ((u_long)0) +#define NFSPROC_GETATTR ((u_long)1) +#define NFSPROC_SETATTR ((u_long)2) +#define NFSPROC_ROOT ((u_long)3) +#define NFSPROC_LOOKUP ((u_long)4) +#define NFSPROC_READLINK ((u_long)5) +#define NFSPROC_READ ((u_long)6) +#define NFSPROC_WRITECACHE ((u_long)7) +#define NFSPROC_WRITE ((u_long)8) +#define NFSPROC_CREATE ((u_long)9) +#define NFSPROC_REMOVE ((u_long)10) +#define NFSPROC_RENAME ((u_long)11) +#define NFSPROC_LINK ((u_long)12) +#define NFSPROC_SYMLINK ((u_long)13) +#define NFSPROC_MKDIR ((u_long)14) +#define NFSPROC_RMDIR ((u_long)15) +#define NFSPROC_READDIR ((u_long)16) +#define NFSPROC_STATFS ((u_long)17) + +/* map field names */ +#define ml_hostname ml_name +#define ml_directory ml_path +#define ml_next ml_nxt +#define gr_next g_next +#define gr_name g_name +#define ex_dir ex_name + +#define ca_where ca_da +#define ca_attributes ca_sa +#define drok_attributes drok_attr +#define fh_data fh_pad +#define na_fileid na_nodeid +#define la_fhandle la_from +#define nt_seconds tv_sec +#define nt_useconds tv_usec +#define ra_totalcount ra_totcount +#define rlr_status rl_status +#define rlr_u rl_u +#define sla_to sla_tnm +#define sla_attributes sla_sa +#define sag_fhandle saa_fh +#define sag_attributes saa_sa + + +/* + * TYPEDEFS: + */ +typedef char *dirpath; +typedef char *filename; +typedef char *name; +typedef char *nfspath; +typedef char nfscookie[NFS_COOKIESIZE]; +typedef enum nfsftype nfsftype; +typedef enum nfsstat nfsstat; +typedef fhandle_t fhandle; +typedef struct nfsattrstat nfsattrstat; +typedef struct nfscreatargs nfscreateargs; +typedef struct nfsdirlist nfsdirlist; +typedef struct nfsdiropargs nfsdiropargs; +typedef struct nfsdrok nfsdiropokres; +typedef struct nfsdiropres nfsdiropres; +typedef struct nfsentry nfsentry; +typedef struct exports *exports; +typedef struct exports exportnode; +typedef struct nfsfattr nfsfattr; +typedef struct fhstatus fhstatus; +typedef struct groups *groups; +typedef struct groups groupnode; +typedef struct nfslinkargs nfslinkargs; +typedef struct mountlist *mountlist; +typedef struct mountlist mountbody; +typedef struct timeval nfstime; +typedef struct nfsreadargs nfsreadargs; +typedef struct nfsreaddirargs nfsreaddirargs; +typedef struct nfsreaddirres nfsreaddirres; +typedef struct nfsreadlinkres nfsreadlinkres; +typedef struct nfsreadokres nfsreadokres; +typedef struct nfsreadres nfsreadres; +typedef struct nfsrnmargs nfsrenameargs; +typedef struct nfssattr nfssattr; +typedef struct nfssaargs nfssattrargs; +typedef struct nfsstatfsokres nfsstatfsokres; +typedef struct nfsstatfsres nfsstatfsres; +typedef struct nfsslargs nfssymlinkargs; +typedef struct writeargs nfswriteargs; + + +/* + * EXTERNALS: + */ + +extern void *nfsproc_null_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(fhandle_t *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern void *nfsproc_root_2_svc(void *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(fhandle_t *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(fhandle_t *, struct svc_req *); + +extern bool_t xdr_nfsstat(XDR *, nfsstat*); +extern bool_t xdr_ftype(XDR *, nfsftype*); +extern bool_t xdr_nfs_fh(XDR *, fhandle_t*); +extern bool_t xdr_nfstime(XDR *, nfstime*); +extern bool_t xdr_fattr(XDR *, nfsfattr*); +extern bool_t xdr_sattr(XDR *, nfssattr*); +extern bool_t xdr_filename(XDR *, filename*); +extern bool_t xdr_nfspath(XDR *, nfspath*); +extern bool_t xdr_attrstat(XDR *, nfsattrstat*); +extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); +extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); +extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); +extern bool_t xdr_diropres(XDR *, nfsdiropres*); +extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); +extern bool_t xdr_readargs(XDR *, nfsreadargs*); +extern bool_t xdr_readokres(XDR *, nfsreadokres*); +extern bool_t xdr_readres(XDR *, nfsreadres*); +extern bool_t xdr_writeargs(XDR *, nfswriteargs*); +extern bool_t xdr_createargs(XDR *, nfscreateargs*); +extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); +extern bool_t xdr_linkargs(XDR *, nfslinkargs*); +extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); +extern bool_t xdr_nfscookie(XDR *, nfscookie); +extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); +extern bool_t xdr_entry(XDR *, nfsentry*); +extern bool_t xdr_dirlist(XDR *, nfsdirlist*); +extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); +extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); +extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); + + +/* + * STRUCTURES: + */ + +struct nfsreadlinkres { + nfsstat rlr_status; + union { + nfspath rlr_data_u; + } rlr_u; +}; + +struct nfsreadokres { + nfsfattr raok_attributes; + struct { + u_int raok_len_u; + char *raok_val_u; + } raok_u; +}; + +struct nfsreadres { + nfsstat rr_status; + union { + nfsreadokres rr_reply_u; + } rr_u; +}; + +struct writeargs { + fhandle_t wra_fhandle; + u_int wra_beginoffset; + u_int wra_offset; + u_int wra_totalcount; + struct { + u_int wra_len_u; + char *wra_val_u; + } wra_u; +}; + +struct nfsreaddirargs { + fhandle_t rda_fhandle; + nfscookie rda_cookie; + u_int rda_count; +}; + +struct nfsentry { + u_int ne_fileid; + filename ne_name; + nfscookie ne_cookie; + nfsentry *ne_nextentry; +}; + +struct nfsdirlist { + nfsentry *dl_entries; + bool_t dl_eof; +}; + +struct nfsreaddirres { + nfsstat rdr_status; + union { + nfsdirlist rdr_reply_u; + } rdr_u; +}; + +struct nfsstatfsokres { + u_int sfrok_tsize; + u_int sfrok_bsize; + u_int sfrok_blocks; + u_int sfrok_bfree; + u_int sfrok_bavail; +}; + +struct nfsstatfsres { + nfsstat sfr_status; + union { + nfsstatfsokres sfr_reply_u; + } sfr_u; +}; +#endif /* not _AMU_NFS_PROT_H */ |