From 3d3be141551bb4622da1cb610e4f6f798dd1715e Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Mon, 28 Jun 1999 08:55:07 +0000 Subject: First import --- include/OSdefs.h | 13 ++ include/config.h | 30 ++++ include/config.h.in | 29 ++++ include/defs.h | 33 +++++ include/defs.h.in | 33 +++++ include/fparam.h | 21 +++ include/misc-aix3.h | 99 +++++++++++++ include/mp.h | 200 +++++++++++++++++++++++++ include/nfs_prot.h | 406 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/os-aix3.h | 182 +++++++++++++++++++++++ include/sun_stdlib.h | 268 ++++++++++++++++++++++++++++++++++ 11 files changed, 1314 insertions(+) create mode 100644 include/OSdefs.h create mode 100644 include/config.h create mode 100644 include/config.h.in create mode 100644 include/defs.h create mode 100644 include/defs.h.in create mode 100644 include/fparam.h create mode 100644 include/misc-aix3.h create mode 100644 include/mp.h create mode 100644 include/nfs_prot.h create mode 100644 include/os-aix3.h create mode 100644 include/sun_stdlib.h (limited to 'include') diff --git a/include/OSdefs.h b/include/OSdefs.h new file mode 100644 index 0000000..261f45a --- /dev/null +++ b/include/OSdefs.h @@ -0,0 +1,13 @@ +#ifdef __FreeBSD__ +# include +# include +# include +# include +#endif + +#if defined(__NeXT__) +# include +# include +# include +# define strdup NXCopyStringBuffer +#endif diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..a2ced96 --- /dev/null +++ b/include/config.h @@ -0,0 +1,30 @@ +/* include/config.h. Generated automatically by configure. */ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ + +#define VERSION "0.1" + +#define PACKAGE "plpnfsd" + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_ERRNO_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TTOLD_H */ + +/* Define if you have the bsd library (-lbsd). */ +/* #undef HAVE_LIBBSD */ + +/* Define if you have the nsl library (-lnsl). */ +#define HAVE_LIBNSL 1 + +/* Define if you have the rpcsoc library (-lrpcsoc). */ +/* #undef HAVE_LIBRPCSOC */ + +/* Define if you have the socket library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ diff --git a/include/config.h.in b/include/config.h.in new file mode 100644 index 0000000..5fc2ffd --- /dev/null +++ b/include/config.h.in @@ -0,0 +1,29 @@ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ + +#undef VERSION + +#undef PACKAGE + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_ERRNO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TTOLD_H + +/* Define if you have the bsd library (-lbsd). */ +#undef HAVE_LIBBSD + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the rpcsoc library (-lrpcsoc). */ +#undef HAVE_LIBRPCSOC + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET diff --git a/include/defs.h b/include/defs.h new file mode 100644 index 0000000..8733d37 --- /dev/null +++ b/include/defs.h @@ -0,0 +1,33 @@ +#ifndef _defs_h_ +#define _defs_h_ + +#define MTAB_PATH "/etc/mtab" +#ifdef linux +# define MTAB_TMP "/etc/mtab~" +#else +# define MTAB_TMP "/etc/mtab.p3nfsd" +#endif + +#define DDEV "/dev/ttyS0" + +#ifdef _IBMR2 +# define DONT_UPDATE_MTAB /* The mount table is obtained from the kernel (!?) */ +#endif + +#define DUSER "root" + +#ifndef DDIR +# define DDIR "/psion.stand/mnt" +#endif + +#ifndef PSIONHOSTNAME +# define PSIONHOSTNAME "localhost" +#endif + +/* See CHANGES for comment */ +#ifdef linux +#define NO_WRITE_SELECT +#endif + +#include "config.h" +#endif diff --git a/include/defs.h.in b/include/defs.h.in new file mode 100644 index 0000000..9ee654e --- /dev/null +++ b/include/defs.h.in @@ -0,0 +1,33 @@ +#ifndef _defs_h_ +#define _defs_h_ + +#define MTAB_PATH "@MTAB@" +#ifdef linux +# define MTAB_TMP "@MTAB@~" +#else +# define MTAB_TMP "@MTAB@.p3nfsd" +#endif + +#define DDEV "@DDEV@" + +#ifdef _IBMR2 +# define DONT_UPDATE_MTAB /* The mount table is obtained from the kernel (!?) */ +#endif + +#define DUSER "root" + +#ifndef DDIR +# define DDIR "/psion.stand/mnt" +#endif + +#ifndef PSIONHOSTNAME +# define PSIONHOSTNAME "localhost" +#endif + +/* See CHANGES for comment */ +#ifdef linux +#define NO_WRITE_SELECT +#endif + +#include "config.h" +#endif diff --git a/include/fparam.h b/include/fparam.h new file mode 100644 index 0000000..cb881c2 --- /dev/null +++ b/include/fparam.h @@ -0,0 +1,21 @@ +/* $Id$ + * + */ + +#ifndef _fparam_h_ +#define _fparam_h_ + +#if defined(sun) && defined(__STDC__) && !defined(__SVR4) +# include "sun_stdlib.h" +# define __P(a) a +#endif + +#ifndef __P +# if defined(__STDC__) +# define __P(a) a +# else +# define __P(a) () +# endif +#endif + +#endif diff --git a/include/misc-aix3.h b/include/misc-aix3.h new file mode 100644 index 0000000..36ce41f --- /dev/null +++ b/include/misc-aix3.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * %W% (Berkeley) %G% + * + * $Id$ + * + */ + +#include +#include + +struct ufs_args { + char *fspec; /* Block device */ +}; + +struct nfs_args { + struct sockaddr_in addr; /* file server address */ + fhandle_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 */ + int biods; /* number of BIODS */ +}; + +/* + * NFS mount option flags + */ +#define MNTOPT_RO "ro" /* read only */ +#define MNTOPT_RW "rw" /* read/write */ +#define MNTOPT_SOFT "soft" /* soft mount */ +#define MNTOPT_HARD "hard" /* hard mount */ +#define MNTOPT_NOSUID "nosuid"/* no set uid allowed */ +#define MNTOPT_NOAUTO "noauto"/* hide entry from mount -a */ +#define MNTOPT_INTR "intr" /* allow interrupts on hard mount */ +#define MNTOPT_SECURE "secure"/* use secure RPC for NFS */ +#define MNTOPT_GRPID "grpid" /* SysV-compatible group-id on create */ +#define MNTOPT_NOSUB "nosub" /* disallow mounts beneath this one */ +#define MNTOPT_MULTI "multi" /* Do multi-component lookup */ +#define MNTOPT_NOAC "noac" /* don't cache attributes */ + +#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_BIODS 0x10000 /* Number of biods for the file system */ + +#define DEF_BIODS 6 diff --git a/include/mp.h b/include/mp.h new file mode 100644 index 0000000..dd456d5 --- /dev/null +++ b/include/mp.h @@ -0,0 +1,200 @@ +/* $Id$ + * + */ + +#ifndef _mp_h_ +#define _mp_h_ + +#include "fparam.h" +#include "nfs_prot.h" + +#define PFS_OP_CREATE 0x01 +#define PFS_OP_GETATTR 0x02 +#define PFS_OP_MKDIR 0x03 +#define PFS_OP_READ 0x04 +#define PFS_OP_READDIR 0x05 +#define PFS_OP_REMOVE 0x06 +#define PFS_OP_RENAME 0x07 +#define PFS_OP_RMDIR 0x08 +#define PFS_OP_SETATTR 0x09 +#define PFS_OP_WRITE 0x0a +#define PFS_OP_GETDEVS 0x0b +/* The same as getattr without the stat (for linkcount purposes */ +#define PFS_OP_STATDEV 0x0c + +/* Only for the new nfsc */ +#define PFS_OP_TTYDATA 0x0d +#define PFS_OP_EXEC 0x0e +#define PFS_OP_ECHO 0x0f +#define PREFIX 0x80 + +typedef struct p_inode +{ + int inode; + char *name; + struct p_inode *nextnam, *nextnum; +} p_inode; + +/* + * Description of a Psion-Device + */ +typedef struct p_device +{ + char *name; /* Volume-Name */ + char letter; /* Drive-Number (zero-based, i.e. 0 = A, 1 = B, 2 = C ...) */ + long attrib; /* Device-Attribs */ + long total; /* Total capacity in bytes */ + long free; /* Free space in bytes */ + struct p_device *next; +} device; + +/* + * Description of a Psion-File/Dir + */ +typedef struct p_dentry +{ + char *name; + long time; + long attr; + long size; + long links; + struct p_dentry *next; +} dentry; + +/* data cache */ +struct dcache +{ + struct dcache *next; + unsigned char *data; + unsigned int offset, len; + int towrite; +}; + +/* attribute cache */ +struct cache +{ + struct cache *next; + unsigned int inode; + int actual_size; + struct dcache *dcache; + fattr attr; +}; + +struct entrycache +{ + int inode; + entry *head; + struct entrycache *next; +}; + +extern int debug, gmtoffset, exiting, psion_alive, dowakeup, + query_cache, series5; +extern fattr root_fattr; +extern struct cache *datacache, *attrcache; + +#ifdef __SVR4 +#define bzero(a,b) memset(a,0,b) +#define bcopy(a,b,c) memcpy(b,a,c) +#define bcmp(a,b,n) memcmp(a,b,n) +#define index strchr +#define rindex strrchr +#endif + +#if !defined(__STDC__) +extern char *index(), *rindex(), *strdup(); +#endif + + +#define THE_END (struct entry *)-1 +#define PBUFSIZE 8192 + +#define TIMEOUT -54 +#define BLOCKSIZE 1024 +#define FID 7 /* File system id */ + +#if defined(sun) && defined(__SVR4) +/* + * at least /opt/SUNWspro/bin/cc on Solaris 2.4 likes these: + */ +# define SIGARG (int arg) +#else +# define SIGARG () +#endif + +/* mp_main.c */ +#if defined(hpux) || defined(__SVR4) + /* HPUX 10.20 declares int usleep( useconds_t useconds); */ +# ifndef HPUX10 + extern void usleep __P((int usec)); +# endif +#endif + +/* mp_serial.c */ +int init_serial __P((char *dev, int speed)); +int fd_is_still_alive __P((int fd, int wake)); +void reset_serial __P((int fd)); + +/* crc.c */ +int docrc16 __P((unsigned char *, int)); + +/* mp_mount.c */ +void mount_and_run __P((char *dir, void (*proc)(), nfs_fh *root_fh)); + +/* mp_inode.c */ +extern p_inode *get_num __P((int)); +extern p_inode *get_nam __P((char *)); +extern p_inode *re_nam __P((char *, char *)); +extern void inode2fh __P((int, char *)); + +extern char *dirname __P((char *)); +extern char *filname __P((char *)); +extern char *build_path __P((char *, char *)); + +extern int fh2inode __P((char *)); +extern int getpinode __P((p_inode *inode)); +extern char *iso2cp __P((char *)); +extern char *cp2iso __P((char *)); + +extern struct cache *add_cache __P((struct cache **, unsigned int, fattr *)); +extern void rem_cache __P((struct cache **, unsigned int)); +extern void clean_cache __P((struct cache **)); +extern struct cache *search_cache __P((struct cache *, unsigned int)); + +extern struct dcache *add_dcache __P((struct cache *, unsigned int, unsigned int, unsigned char *)); +extern void clean_dcache __P((struct cache *)); +extern struct dcache *search_dcache __P((struct cache *, unsigned int, unsigned int)); + +/* mp_xmit.c */ +int sendop __P((int cmd, char *fname, char *rest, int restlen)); +int getstr __P((char *str)); +int getanswer __P((void)); +int sendcmd __P((int cmd, char *fname, char *rest, int restlen)); +int getcount __P((unsigned char *str, int num)); +int senddata __P((char *p, int len)); +void long2pstr __P((unsigned int l, unsigned char *s)); +void short2pstr __P((unsigned int l, unsigned char *s)); +unsigned int pstr2long __P((unsigned char *s)); + +/* mp_pfs_ops.c */ +extern void *nfsproc_null_2 __P((void)); +extern void *nfsproc_root_2 __P((void)); +extern void *nfsproc_writecache_2 __P((void)); +extern nfsstat *nfsproc_link_2 __P((struct linkargs *la)); +extern nfsstat *nfsproc_rmdir_2 __P((struct diropargs *da)); +extern nfsstat *nfsproc_remove_2 __P((struct diropargs *da)); +extern nfsstat *nfsproc_rename_2 __P((struct renameargs *ra)); +extern nfsstat *nfsproc_symlink_2 __P((struct symlinkargs *sa)); +extern struct readres *nfsproc_read_2 __P((struct readargs *ra)); +extern struct attrstat *nfsproc_write_2 __P((struct writeargs *wa)); +extern struct diropres *nfsproc_mkdir_2 __P((struct createargs *ca)); +extern struct diropres *nfsproc_create_2 __P((struct createargs *ca)); +extern struct diropres *nfsproc_lookup_2 __P((struct diropargs *da)); +extern struct attrstat *nfsproc_getattr_2 __P((struct nfs_fh *fh)); +extern struct attrstat *nfsproc_setattr_2 __P((struct sattrargs *sa)); +extern struct statfsres *nfsproc_statfs_2 __P((struct nfs_fh *fh)); +extern struct readdirres *nfsproc_readdir_2 __P((struct readdirargs *ra)); +extern struct readlinkres *nfsproc_readlink_2 __P((struct nfs_fh *fh)); + +extern int mp_main(int argc, char **argv); + +#endif diff --git a/include/nfs_prot.h b/include/nfs_prot.h new file mode 100644 index 0000000..16cc31f --- /dev/null +++ b/include/nfs_prot.h @@ -0,0 +1,406 @@ +#ifndef _nfs_prot_h_ +#define _nfs_prot_h_ + +#include "fparam.h" + +#ifdef hpux +#include +#include +#endif +#ifdef linux +# include +# include +#endif +#ifdef __sgi +# include +# include +# include +#endif + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#ifndef NFS_FIFO_DEV +#define NFS_FIFO_DEV -1 +#endif +#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 !defined(hpux) && !defined(linux) && !defined(__sgi) +enum nfsstat { + NFS_OK = 0, + NFSERR_PERM = 1, + NFSERR_NOENT = 2, + NFSERR_IO = 5, + NFSERR_NXIO = 6, + NFSERR_ACCES = 13, + NFSERR_EXIST = 17, + NFSERR_NODEV = 19, + NFSERR_NOTDIR = 20, + NFSERR_ISDIR = 21, + NFSERR_FBIG = 27, + NFSERR_NOSPC = 28, + NFSERR_ROFS = 30, + NFSERR_NAMETOOLONG = 63, + NFSERR_NOTEMPTY = 66, + NFSERR_DQUOT = 69, + NFSERR_STALE = 70, + NFSERR_WFLUSH = 99 +}; +#endif /* !hpux, linux */ + +#ifdef linux +typedef enum nfs_stat nfsstat; +#else +typedef enum nfsstat nfsstat; +#endif +bool_t xdr_nfsstat(); + +#if !defined(hpux) && !defined(linux) && !defined(__sgi) +enum ftype { + NFNON = 0, + NFREG = 1, + NFDIR = 2, + NFBLK = 3, + NFCHR = 4, + NFLNK = 5, + NFSOCK = 6, + NFBAD = 7, + NFFIFO = 8 +}; +typedef enum ftype ftype; +#endif /* !linux, hpux */ + +#ifdef __sgi +typedef enum nfsftype ftype; +#endif + +#ifdef hpux +typedef enum nfsftype ftype; +#endif +#ifdef linux +typedef enum nfs_ftype ftype; +#endif + +bool_t xdr_ftype(); + +#ifndef linux +struct nfs_fh { + char data[NFS_FHSIZE]; +}; +#endif +typedef struct nfs_fh nfs_fh; +bool_t xdr_nfs_fh(); + +struct nfstime { + u_int seconds; + u_int useconds; +}; +typedef struct nfstime nfstime; +bool_t xdr_nfstime(); + +struct fattr { + ftype type; + u_int mode; + u_int nlink; + u_int uid; + u_int gid; + u_int size; + u_int blocksize; + u_int rdev; + u_int blocks; + u_int fsid; + u_int fileid; + nfstime atime; + nfstime mtime; + nfstime ctime; +}; +typedef struct fattr fattr; +bool_t xdr_fattr(); + +struct sattr { + u_int mode; + u_int uid; + u_int gid; + u_int size; + nfstime atime; + nfstime mtime; +}; +typedef struct sattr sattr; +bool_t xdr_sattr(); + +typedef char *filename; +bool_t xdr_filename(); + +typedef char *nfspath; +bool_t xdr_nfspath(); + +struct attrstat { + nfsstat status; + union { + fattr attributes; + } attrstat_u; +}; +typedef struct attrstat attrstat; +bool_t xdr_attrstat(); + +struct sattrargs { + nfs_fh file; + sattr attributes; +}; +typedef struct sattrargs sattrargs; +bool_t xdr_sattrargs(); + +struct diropargs { + nfs_fh dir; + filename name; +}; +typedef struct diropargs diropargs; +bool_t xdr_diropargs(); + +struct diropokres { + nfs_fh file; + fattr attributes; +}; +typedef struct diropokres diropokres; +bool_t xdr_diropokres(); + +struct diropres { + nfsstat status; + union { + diropokres diropres; + } diropres_u; +}; +typedef struct diropres diropres; +bool_t xdr_diropres(); + +struct readlinkres { + nfsstat status; + union { + nfspath data; + } readlinkres_u; +}; +typedef struct readlinkres readlinkres; +bool_t xdr_readlinkres(); + +struct readargs { + nfs_fh file; + u_int offset; + u_int count; + u_int totalcount; +}; +typedef struct readargs readargs; +bool_t xdr_readargs(); + +struct readokres { + fattr attributes; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct readokres readokres; +bool_t xdr_readokres(); + +struct readres { + nfsstat status; + union { + readokres reply; + } readres_u; +}; +typedef struct readres readres; +bool_t xdr_readres(); + +struct writeargs { + nfs_fh file; + u_int beginoffset; + u_int offset; + u_int totalcount; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct writeargs writeargs; +bool_t xdr_writeargs(); + +struct createargs { + diropargs where; + sattr attributes; +}; +typedef struct createargs createargs; +bool_t xdr_createargs(); + +struct renameargs { + diropargs from; + diropargs to; +}; +typedef struct renameargs renameargs; +bool_t xdr_renameargs(); + +struct linkargs { + nfs_fh from; + diropargs to; +}; +typedef struct linkargs linkargs; +bool_t xdr_linkargs(); + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; +typedef struct symlinkargs symlinkargs; +bool_t xdr_symlinkargs(); + +typedef char nfscookie[NFS_COOKIESIZE]; +bool_t xdr_nfscookie(); + +struct readdirargs { + nfs_fh dir; + nfscookie cookie; + u_int count; +}; +typedef struct readdirargs readdirargs; +bool_t xdr_readdirargs(); + +struct entry { + u_int fileid; + filename name; + nfscookie cookie; + struct entry *nextentry; +}; +typedef struct entry entry; +bool_t xdr_entry(); + +struct dirlist { + entry *entries; + bool_t eof; +}; +typedef struct dirlist dirlist; +bool_t xdr_dirlist(); + +struct readdirres { + nfsstat status; + union { + dirlist reply; + } readdirres_u; +}; +typedef struct readdirres readdirres; +bool_t xdr_readdirres(); + +struct statfsokres { + u_int tsize; + u_int bsize; + u_int blocks; + u_int bfree; + u_int bavail; +}; +typedef struct statfsokres statfsokres; +bool_t xdr_statfsokres(); + +struct statfsres { + nfsstat status; + union { + statfsokres reply; + } statfsres_u; +}; +typedef struct statfsres statfsres; +bool_t xdr_statfsres(); + +#ifndef NFS_PROGRAM +#define NFS_PROGRAM ((u_long)100003) +#endif +#ifndef NFS_VERSION +#define NFS_VERSION ((u_long)2) +#endif +#ifndef NFSPROC_NULL +#define NFSPROC_NULL ((u_long)0) +#endif +extern void *nfsproc_null_2 __P((void)); +#ifndef NFSPROC_GETATTR +#define NFSPROC_GETATTR ((u_long)1) +#endif +extern attrstat *nfsproc_getattr_2 __P((struct nfs_fh *fh)); +#ifndef NFSPROC_SETATTR +#define NFSPROC_SETATTR ((u_long)2) +#endif +extern attrstat *nfsproc_setattr_2 __P((struct sattrargs *sa)); +#ifndef NFSPROC_ROOT +#define NFSPROC_ROOT ((u_long)3) +#endif +extern void *nfsproc_root_2 __P((void)); +#ifndef NFSPROC_LOOKUP +#define NFSPROC_LOOKUP ((u_long)4) +#endif +extern diropres *nfsproc_lookup_2 __P((struct diropargs *da)); +#ifndef NFSPROC_READLINK +#define NFSPROC_READLINK ((u_long)5) +#endif +extern readlinkres *nfsproc_readlink_2 __P((struct nfs_fh *fh)); +#ifndef NFSPROC_READ +#define NFSPROC_READ ((u_long)6) +#endif +extern readres *nfsproc_read_2 __P((struct readargs *ra)); +#ifndef NFSPROC_WRITECACHE +#define NFSPROC_WRITECACHE ((u_long)7) +#endif +extern void *nfsproc_writecache_2 __P((void)); +#ifndef NFSPROC_WRITE +#define NFSPROC_WRITE ((u_long)8) +#endif +extern attrstat *nfsproc_write_2 __P((struct writeargs *wa)); +#ifndef NFSPROC_CREATE +#define NFSPROC_CREATE ((u_long)9) +#endif +extern diropres *nfsproc_create_2 __P((struct createargs *ca)); +#ifndef NFSPROC_REMOVE +#define NFSPROC_REMOVE ((u_long)10) +#endif +extern nfsstat *nfsproc_remove_2 __P((struct diropargs *da)); +#ifndef NFSPROC_RENAME +#define NFSPROC_RENAME ((u_long)11) +#endif +extern nfsstat *nfsproc_rename_2 __P((struct renameargs *ra)); +#ifndef NFSPROC_LINK +#define NFSPROC_LINK ((u_long)12) +#endif +extern nfsstat *nfsproc_link_2 __P((struct linkargs *la)); +#ifndef NFSPROC_SYMLINK +#define NFSPROC_SYMLINK ((u_long)13) +#endif +extern nfsstat *nfsproc_symlink_2 __P((struct symlinkargs *sa)); +#ifndef NFSPROC_MKDIR +#define NFSPROC_MKDIR ((u_long)14) +#endif +extern diropres *nfsproc_mkdir_2 __P((struct createargs *ca)); +#ifndef NFSPROC_RMDIR +#define NFSPROC_RMDIR ((u_long)15) +#endif +extern nfsstat *nfsproc_rmdir_2 __P((struct diropargs *da)); +#ifndef NFSPROC_READDIR +#define NFSPROC_READDIR ((u_long)16) +#endif +extern readdirres *nfsproc_readdir_2 __P((struct readdirargs *ra)); +#ifndef NFSPROC_STATFS +#define NFSPROC_STATFS ((u_long)17) +#endif +extern statfsres *nfsproc_statfs_2 __P((struct nfs_fh *fh)); + +#endif diff --git a/include/os-aix3.h b/include/os-aix3.h new file mode 100644 index 0000000..f95e083 --- /dev/null +++ b/include/os-aix3.h @@ -0,0 +1,182 @@ +/* + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * %W% (Berkeley) %G% + * + * $Id$ + * + * AIX 3.1 definitions for Amd (automounter) + */ + +/* + * Does the compiler grok void * + */ +#define VOIDP + +/* + * Which version of the Sun RPC library we are using + * This is the implementation release number, not + * the protocol revision number. + */ +#define RPC_4 + +/* + * Which version of the NFS interface are we using. + * This is the implementation release number, not + * the protocol revision number. + */ +#define NFS_AIX3 + +/* + * Does this OS have NDBM support? + */ +#define OS_HAS_NDBM + +/* + * The mount table is obtained from the kernel + */ +#undef UPDATE_MTAB + +/* + * Pick up BSD bits from include files + * Try for 4.4 compatibility if available (AIX 3.2 and later) + */ +#define _BSD 44 + +/* + * No mntent info on AIX 3 + */ +#undef MNTENT_HDR +#define MNTENT_HDR + +/* + * Name of filesystem types + */ +#define MOUNT_TYPE_NFS MNT_NFS +#define MOUNT_TYPE_UFS MNT_JFS +#undef MTAB_TYPE_UFS +#define MTAB_TYPE_UFS "jfs" + +/* + * How to unmount filesystems + */ +#undef MOUNT_TRAP +#define MOUNT_TRAP(type, mnt, flag, mnt_data) \ + aix3_mount(mnt->mnt_fsname, mnt->mnt_dir, flag, type, mnt_data, mnt->mnt_opts) +#undef UNMOUNT_TRAP +#define UNMOUNT_TRAP(mnt) uvmount(mnt->mnt_passno, 0) + + +/* + * Byte ordering + */ +#ifndef BYTE_ORDER +#include +#endif /* BYTE_ORDER */ + +#undef ARCH_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN +#define ARCH_ENDIAN "little" +#else +#if BYTE_ORDER == BIG_ENDIAN +#define ARCH_ENDIAN "big" +#else +XXX - Probably no hope of running Amd on this machine! +#endif /* BIG */ +#endif /* LITTLE */ + +/* + * Miscellaneous AIX 3 bits + */ +#define NEED_MNTOPT_PARSER +#define SHORT_MOUNT_NAME + +#define MNTMAXSTR 128 + +#define MNTTYPE_UFS "jfs" /* Un*x file system */ +#define MNTTYPE_NFS "nfs" /* network file system */ +#define MNTTYPE_IGNORE "ignore" /* No type specified, ignore this entry */ + +struct mntent { + char *mnt_fsname; /* name of mounted file system */ + char *mnt_dir; /* file system path prefix */ + char *mnt_type; /* MNTTYPE_* */ + char *mnt_opts; /* MNTOPT* */ + int mnt_freq; /* dump frequency, in days */ + int mnt_passno; /* pass number on parallel fsck */ +}; + +#define NFS_HDR "misc-aix3.h" +#define UFS_HDR "misc-aix3.h" +#undef NFS_FH_DREF +#define NFS_FH_DREF(dst, src) { (dst) = *(src); } +#undef NFS_SA_DREF +#define NFS_SA_DREF(dst, src) { (dst).addr = *(src); } +#define M_RDONLY MNT_READONLY + +/* + * How to get a mount list + */ +#undef READ_MTAB_FROM_FILE +#define READ_MTAB_AIX3_STYLE + +/* + * The data for the mount syscall needs the path in addition to the + * host name since that is the only source of information about the + * mounted filesystem. +#define NFS_ARGS_NEEDS_PATH + */ + +#define NFS_LOMAP 34 +#define NFS_HIMAP 99 +#define NFS_ERROR_MAPPING \ +static nfs_errormap[] = { 0,75,77,99,99,99, \ + 99,99,99,99,99,78,99,99,99,79, \ + 99,99,70,99,35,36,37,38,39,40, \ + 41,42,43,44,45,46,47,48,49,50, \ + 51,52,53,54,55,56,57,58,60,61, \ + 64,65,99,67,68,62,63,66,69,68, \ + 99,99,99,71,99,99,99,99,99,99 \ + }; + +#define MOUNT_HELPER_SOURCE "mount_aix.c" + +/* + * Need this too + */ +#include +#include diff --git a/include/sun_stdlib.h b/include/sun_stdlib.h new file mode 100644 index 0000000..ac6757a --- /dev/null +++ b/include/sun_stdlib.h @@ -0,0 +1,268 @@ +/* + * sun_stdlib.h 95/06/07 + * + * Copyright 1994, BBW + * + */ +/* + * Copyright 1992-1994 Rudolf Koenig. + * sun_stdlib.h + * + * This header file is redundant/wrong for architectures that have sane + * header files. Grrr. + */ +#ifndef __sun_stdlib_h +#define __sun_stdlib_h +#if defined(FILE) + +#if !defined(STDIO_WRITE_NOW) + +extern int fputs(char *, FILE *); +extern int fseek(FILE *, int, int); +extern int fclose(FILE *); +extern int fread(char *, int, int, FILE *); +extern int fwrite(char *, int, int, FILE *); +extern int fflush(FILE *); +extern int fprintf(FILE *, const char *, ... ); +extern void rewind(FILE *); +extern void setvbuf(FILE *stream, char *buf, int type, int size); +extern void setbuffer(FILE *stream, char *buf, int size); + +extern int _filbuf( FILE * ); +extern int _flsbuf(unsigned char, FILE*); +#else +extern int _fill_buffer_( FILE * ); +extern int _flush_buffer_(int, FILE*); +#endif + +#endif + +extern int puts(char *); + +#if !defined(STDIO_WRITE_NOW) +extern int printf( const char *, ... ); +#endif + + +extern int getpid(void); +extern int getppid(void); +extern int pipe(int *); + +#if 1 +extern char *sprintf( char *, const char *, ... ); +extern char *vsprintf( char *, const char *, ... ); +#endif +extern int vfork(void); +extern int fork(void); +extern int close(int); +extern int dup(int); + +#ifndef __sys_unistd_h /* GNUCC has another imagination about this */ +extern int execl(char *, ... ); +extern int execv(char *, char *[]); +extern int execle(char *, ... ); +extern int execlp(char *, ... ); +extern int execvp(char *, char *[]); +extern int setuid(int); +#endif + +extern int seteuid(int); + +extern int getpgrp(int); +extern int setpgrp(int, int); + +extern int gethostname (char *, int); +extern int sethostname (char *, int); + +#ifdef _sys_socket_h +extern int getpeername(int, struct sockaddr *, int *); +extern int send(int, char *, int, int); +extern int sendto(int, char *, int, int, struct sockaddr *, int); +extern int recv(int, char *, int, int); +extern int recvfrom(int, char *, int, int, struct sockaddr *, int *); +#endif + +#ifdef _sys_vfs_h +extern int statfs(const char *, struct statfs *); +#endif + +#ifdef __sys_types_h /* def of caddr_t */ +extern time_t time(time_t *); +extern int ioctl(int, int, caddr_t); +extern int truncate(char *, off_t); +extern int ftruncate(int, off_t); +caddr_t mmap(caddr_t, size_t, int, int, int, off_t); +int munmap(caddr_t, int); +#endif +extern void perror(char *); + +extern int openlog(char *, int, int); + +extern int syslog(int, char *, ... ); +extern int closelog(void); +extern int setlogmask(int); + +extern unsigned int alarm(unsigned int); + +extern char *crypt(char *, char *); +extern char *_crypt(char *, char *); +extern int setkey(char *); +extern int encrypt(char *, int); + +extern char *getenv(char *name); +extern int putenv(char *); +extern void bcopy(char *, char *, int); +extern void bzero(char *, int); +extern int bcmp(char *, char *, int); +extern int tolower(int); +extern int toupper(int); + +#if !defined(__memory_h__) +extern void memset(char *, int, int); +#if !defined(__GNUC__) +extern char *memcpy(char *, char *, int); +extern int memcmp(char *, char *, int); +#endif +#endif + +extern int ffs(int); + +extern int sigblock(int); +extern int sigsetmask(int); +extern int sigpause(int); + +extern int unmount(char *name); +extern int umount(char *name); +int mount(char *type, char *dir, int flags, char *data); + + +#ifdef __sys_stat_h +extern int fchmod(int fd, mode_t mode); +#endif + +#ifdef _mntent_h +extern FILE *setmntent(char *filep, char *type); +extern struct mntent *getmntent(FILE *filep); +extern int addmntent(FILE *filep, struct mntent *mnt); +extern char *hasmntopt(struct mntent *mnt, char *opt); +extern int endmntent(FILE *filep); +#endif + +#ifdef __pwd_h +extern struct passwd *getpwent(void); +extern void endpwent(void); +#endif + + +extern int usleep(unsigned); +#if 0 +extern int lseek(int, int, int); +#endif + +#ifndef __sys_unistd_h /* GNUCC has another imagination about this */ +extern int read(int, char *, int); +extern int write(int, char *, int); +extern int sleep(unsigned int); +extern int getuid(void); +extern int geteuid(void); +#endif +extern int fsync(int); + +extern int rename(const char *, const char *); +extern int unlink(const char *); +#if defined(__sys_dirent_h) +extern int scandir(char *, struct dirent ***, int (*)(), int (*)()); +#else +#if defined(_sys_dir_h) +extern int scandir(char *, struct direct ***, int (*)(), int (*)()); +#endif +#endif + +#ifndef __stdlib_h +extern int atoi(char *); +extern int qsort(char *, int, int, int (*)()); +#endif + +extern char *rindex(const char *, const char); +extern char *index(const char *, const char); + +#ifndef __string_h /* GNUCC string.h */ +extern int strcmp(const char *, const char *); +extern int strncmp(const char *, const char *, int); +extern char *strcat(char *, const char *); +extern char *strdup(const char *); + +extern int strcpy(char *, const char *); +extern int strncpy(char *, const char *, int); + +extern int strtok(char *, char *); +#endif + +extern int strtol(char *, char **, int); + +extern int system(char *); +#ifdef RLIMIT_NOFILE +extern int getrlimit(int, struct rlimit *); +extern int setrlimit(int, struct rlimit *); +#endif + +extern int chdir(const char *); +#if defined(_sys_time_h) && defined(__sys_types_h) +extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int gettimeofday(struct timeval *tp, struct timezone *tzp); +extern int getitimer(int, struct itimerval *); +extern int setitimer(int, struct itimerval *, struct itimerval *); +#endif +extern char *getpass(char *); +#if !defined(__malloc_h) && !defined(__stdlib_h) /* GNU malloc defs */ +extern void *realloc(void *, unsigned); +extern void *calloc(unsigned, unsigned); +extern void *malloc(unsigned); +extern void free(const char *); +#endif + +#ifdef SOCK_STREAM +extern int socket(int, int, int); +extern int connect(int, struct sockaddr *, int); +extern int bind(int, struct sockaddr *, int); +extern int getsockname(int, struct sockaddr *, int *); +extern int accept(int, struct sockaddr *, int *); +extern int listen(int, int); +extern int shutdown(int, int); +extern int inet_addr(char *); +extern int getsockopt(int, int, int, char *, int *); +extern int setsockopt(int, int, int, char *, int); + +#endif + +#ifdef _nettli_tiuser_h +extern int t_open(char *, int, struct t_info *); +extern void t_error(char *); +extern int t_bind(int, struct t_bind *, struct t_bind *); +extern int t_listen(int, struct t_call *); +extern int t_accept(int, int, struct t_call *); +extern int t_rcv(int, char *, unsigned int, int *); +extern int t_snd(int, char *, unsigned int, int); +extern int t_close(int); +extern int t_connect(int, struct t_call *, struct t_call *); +#endif +#ifdef _sys_poll_h +extern int poll(struct pollfd *, unsigned long, int); +#endif + +#ifdef _sys_resource_h +int wait3(int *, int, struct rusage *); +#else +int wait3(int *, int, int); +#endif + +#ifdef _sys_asynch_h +extern aio_result_t *aiowait(struct timeval *); +extern int aioread(int, char *, int, int, int, aio_result_t *); +extern int aiowrite(int, char *, int, int, int, aio_result_t *); +extern int aiocancel(aio_result_t *); +#endif + +extern int on_exit(void (*procp)(), void *arg); + +#endif -- cgit v1.2.3