File indexing completed on 2025-01-18 10:12:36
0001
0002
0003
0004
0005
0006 #ifndef _NFS_PROT_H_RPCGEN
0007 #define _NFS_PROT_H_RPCGEN
0008
0009 #include <rpc/rpc.h>
0010
0011
0012 #ifdef __cplusplus
0013 extern "C" {
0014 #endif
0015
0016 #define NFS_PORT 2049
0017 #define NFS_MAXDATA 8192
0018 #define NFS_MAXPATHLEN 1024
0019 #define NFS_MAXNAMLEN 255
0020 #define NFS_FHSIZE 32
0021 #define NFS_COOKIESIZE 4
0022 #define NFS_FIFO_DEV -1
0023 #define NFSMODE_FMT 0170000
0024 #define NFSMODE_DIR 0040000
0025 #define NFSMODE_CHR 0020000
0026 #define NFSMODE_BLK 0060000
0027 #define NFSMODE_REG 0100000
0028 #define NFSMODE_LNK 0120000
0029 #define NFSMODE_SOCK 0140000
0030 #define NFSMODE_FIFO 0010000
0031
0032 enum nfsstat {
0033 NFS_OK = 0,
0034 NFSERR_PERM = 1,
0035 NFSERR_NOENT = 2,
0036 NFSERR_IO = 5,
0037 NFSERR_NXIO = 6,
0038 NFSERR_ACCES = 13,
0039 NFSERR_EXIST = 17,
0040 NFSERR_NODEV = 19,
0041 NFSERR_NOTDIR = 20,
0042 NFSERR_ISDIR = 21,
0043 NFSERR_FBIG = 27,
0044 NFSERR_NOSPC = 28,
0045 NFSERR_ROFS = 30,
0046 NFSERR_NAMETOOLONG = 63,
0047 NFSERR_NOTEMPTY = 66,
0048 NFSERR_DQUOT = 69,
0049 NFSERR_STALE = 70,
0050 NFSERR_WFLUSH = 99,
0051 };
0052 typedef enum nfsstat nfsstat;
0053
0054 enum ftype {
0055 NFNON = 0,
0056 NFREG = 1,
0057 NFDIR = 2,
0058 NFBLK = 3,
0059 NFCHR = 4,
0060 NFLNK = 5,
0061 NFSOCK = 6,
0062 NFBAD = 7,
0063 NFFIFO = 8,
0064 };
0065 typedef enum ftype ftype;
0066
0067 struct nfs_fh {
0068 char data[NFS_FHSIZE];
0069 };
0070 typedef struct nfs_fh nfs_fh;
0071
0072 struct nfstime {
0073 u_int seconds;
0074 u_int useconds;
0075 };
0076 typedef struct nfstime nfstime;
0077
0078 struct fattr {
0079 ftype type;
0080 u_int mode;
0081 u_int nlink;
0082 u_int uid;
0083 u_int gid;
0084 u_int size;
0085 u_int blocksize;
0086 u_int rdev;
0087 u_int blocks;
0088 u_int fsid;
0089 u_int fileid;
0090 nfstime atime;
0091 nfstime mtime;
0092 nfstime ctime;
0093 };
0094 typedef struct fattr fattr;
0095
0096 struct sattr {
0097 u_int mode;
0098 u_int uid;
0099 u_int gid;
0100 u_int size;
0101 nfstime atime;
0102 nfstime mtime;
0103 };
0104 typedef struct sattr sattr;
0105
0106 typedef char *filename;
0107
0108 typedef char *nfspath;
0109
0110 struct attrstat {
0111 nfsstat status;
0112 union {
0113 fattr attributes;
0114 } attrstat_u;
0115 };
0116 typedef struct attrstat attrstat;
0117
0118 struct sattrargs {
0119 nfs_fh file;
0120 sattr attributes;
0121 };
0122 typedef struct sattrargs sattrargs;
0123
0124 struct diropargs {
0125 nfs_fh dir;
0126 filename name;
0127 };
0128 typedef struct diropargs diropargs;
0129
0130 struct diropokres {
0131 nfs_fh file;
0132 fattr attributes;
0133 };
0134 typedef struct diropokres diropokres;
0135
0136 struct diropres {
0137 nfsstat status;
0138 union {
0139 diropokres diropres;
0140 } diropres_u;
0141 };
0142 typedef struct diropres diropres;
0143
0144 struct readlinkres {
0145 nfsstat status;
0146 union {
0147 nfspath data;
0148 } readlinkres_u;
0149 };
0150 typedef struct readlinkres readlinkres;
0151
0152 struct readargs {
0153 nfs_fh file;
0154 u_int offset;
0155 u_int count;
0156 u_int totalcount;
0157 };
0158 typedef struct readargs readargs;
0159
0160 struct readokres {
0161 fattr attributes;
0162 struct {
0163 u_int data_len;
0164 char *data_val;
0165 } data;
0166 };
0167 typedef struct readokres readokres;
0168
0169 struct readres {
0170 nfsstat status;
0171 union {
0172 readokres reply;
0173 } readres_u;
0174 };
0175 typedef struct readres readres;
0176
0177 struct writeargs {
0178 nfs_fh file;
0179 u_int beginoffset;
0180 u_int offset;
0181 u_int totalcount;
0182 struct {
0183 u_int data_len;
0184 char *data_val;
0185 } data;
0186 };
0187 typedef struct writeargs writeargs;
0188
0189 struct createargs {
0190 diropargs where;
0191 sattr attributes;
0192 };
0193 typedef struct createargs createargs;
0194
0195 struct renameargs {
0196 diropargs from;
0197 diropargs to;
0198 };
0199 typedef struct renameargs renameargs;
0200
0201 struct linkargs {
0202 nfs_fh from;
0203 diropargs to;
0204 };
0205 typedef struct linkargs linkargs;
0206
0207 struct symlinkargs {
0208 diropargs from;
0209 nfspath to;
0210 sattr attributes;
0211 };
0212 typedef struct symlinkargs symlinkargs;
0213
0214 typedef char nfscookie[NFS_COOKIESIZE];
0215
0216 struct readdirargs {
0217 nfs_fh dir;
0218 nfscookie cookie;
0219 u_int count;
0220 };
0221 typedef struct readdirargs readdirargs;
0222
0223 struct entry {
0224 u_int fileid;
0225 filename name;
0226 nfscookie cookie;
0227 struct entry *nextentry;
0228 };
0229 typedef struct entry entry;
0230
0231 struct dirlist {
0232 entry *entries;
0233 bool_t eof;
0234 };
0235 typedef struct dirlist dirlist;
0236
0237 struct readdirres {
0238 nfsstat status;
0239 union {
0240 dirlist reply;
0241 } readdirres_u;
0242 };
0243 typedef struct readdirres readdirres;
0244
0245 struct statfsokres {
0246 u_int tsize;
0247 u_int bsize;
0248 u_int blocks;
0249 u_int bfree;
0250 u_int bavail;
0251 };
0252 typedef struct statfsokres statfsokres;
0253
0254 struct statfsres {
0255 nfsstat status;
0256 union {
0257 statfsokres reply;
0258 } statfsres_u;
0259 };
0260 typedef struct statfsres statfsres;
0261
0262 #define NFS_PROGRAM 100003
0263 #define NFS_VERSION 2
0264
0265 #if defined(__STDC__) || defined(__cplusplus)
0266 #define NFSPROC_NULL 0
0267 extern void * nfsproc_null_2(void *, CLIENT *);
0268 extern void * nfsproc_null_2_svc(void *, struct svc_req *);
0269 #define NFSPROC_GETATTR 1
0270 extern attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *);
0271 extern attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *);
0272 #define NFSPROC_SETATTR 2
0273 extern attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *);
0274 extern attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *);
0275 #define NFSPROC_ROOT 3
0276 extern void * nfsproc_root_2(void *, CLIENT *);
0277 extern void * nfsproc_root_2_svc(void *, struct svc_req *);
0278 #define NFSPROC_LOOKUP 4
0279 extern diropres * nfsproc_lookup_2(diropargs *, CLIENT *);
0280 extern diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *);
0281 #define NFSPROC_READLINK 5
0282 extern readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *);
0283 extern readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *);
0284 #define NFSPROC_READ 6
0285 extern readres * nfsproc_read_2(readargs *, CLIENT *);
0286 extern readres * nfsproc_read_2_svc(readargs *, struct svc_req *);
0287 #define NFSPROC_WRITECACHE 7
0288 extern void * nfsproc_writecache_2(void *, CLIENT *);
0289 extern void * nfsproc_writecache_2_svc(void *, struct svc_req *);
0290 #define NFSPROC_WRITE 8
0291 extern attrstat * nfsproc_write_2(writeargs *, CLIENT *);
0292 extern attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *);
0293 #define NFSPROC_CREATE 9
0294 extern diropres * nfsproc_create_2(createargs *, CLIENT *);
0295 extern diropres * nfsproc_create_2_svc(createargs *, struct svc_req *);
0296 #define NFSPROC_REMOVE 10
0297 extern nfsstat * nfsproc_remove_2(diropargs *, CLIENT *);
0298 extern nfsstat * nfsproc_remove_2_svc(diropargs *, struct svc_req *);
0299 #define NFSPROC_RENAME 11
0300 extern nfsstat * nfsproc_rename_2(renameargs *, CLIENT *);
0301 extern nfsstat * nfsproc_rename_2_svc(renameargs *, struct svc_req *);
0302 #define NFSPROC_LINK 12
0303 extern nfsstat * nfsproc_link_2(linkargs *, CLIENT *);
0304 extern nfsstat * nfsproc_link_2_svc(linkargs *, struct svc_req *);
0305 #define NFSPROC_SYMLINK 13
0306 extern nfsstat * nfsproc_symlink_2(symlinkargs *, CLIENT *);
0307 extern nfsstat * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *);
0308 #define NFSPROC_MKDIR 14
0309 extern diropres * nfsproc_mkdir_2(createargs *, CLIENT *);
0310 extern diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *);
0311 #define NFSPROC_RMDIR 15
0312 extern nfsstat * nfsproc_rmdir_2(diropargs *, CLIENT *);
0313 extern nfsstat * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *);
0314 #define NFSPROC_READDIR 16
0315 extern readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *);
0316 extern readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *);
0317 #define NFSPROC_STATFS 17
0318 extern statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *);
0319 extern statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *);
0320 extern int nfs_program_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
0321
0322 #else
0323 #define NFSPROC_NULL 0
0324 extern void * nfsproc_null_2();
0325 extern void * nfsproc_null_2_svc();
0326 #define NFSPROC_GETATTR 1
0327 extern attrstat * nfsproc_getattr_2();
0328 extern attrstat * nfsproc_getattr_2_svc();
0329 #define NFSPROC_SETATTR 2
0330 extern attrstat * nfsproc_setattr_2();
0331 extern attrstat * nfsproc_setattr_2_svc();
0332 #define NFSPROC_ROOT 3
0333 extern void * nfsproc_root_2();
0334 extern void * nfsproc_root_2_svc();
0335 #define NFSPROC_LOOKUP 4
0336 extern diropres * nfsproc_lookup_2();
0337 extern diropres * nfsproc_lookup_2_svc();
0338 #define NFSPROC_READLINK 5
0339 extern readlinkres * nfsproc_readlink_2();
0340 extern readlinkres * nfsproc_readlink_2_svc();
0341 #define NFSPROC_READ 6
0342 extern readres * nfsproc_read_2();
0343 extern readres * nfsproc_read_2_svc();
0344 #define NFSPROC_WRITECACHE 7
0345 extern void * nfsproc_writecache_2();
0346 extern void * nfsproc_writecache_2_svc();
0347 #define NFSPROC_WRITE 8
0348 extern attrstat * nfsproc_write_2();
0349 extern attrstat * nfsproc_write_2_svc();
0350 #define NFSPROC_CREATE 9
0351 extern diropres * nfsproc_create_2();
0352 extern diropres * nfsproc_create_2_svc();
0353 #define NFSPROC_REMOVE 10
0354 extern nfsstat * nfsproc_remove_2();
0355 extern nfsstat * nfsproc_remove_2_svc();
0356 #define NFSPROC_RENAME 11
0357 extern nfsstat * nfsproc_rename_2();
0358 extern nfsstat * nfsproc_rename_2_svc();
0359 #define NFSPROC_LINK 12
0360 extern nfsstat * nfsproc_link_2();
0361 extern nfsstat * nfsproc_link_2_svc();
0362 #define NFSPROC_SYMLINK 13
0363 extern nfsstat * nfsproc_symlink_2();
0364 extern nfsstat * nfsproc_symlink_2_svc();
0365 #define NFSPROC_MKDIR 14
0366 extern diropres * nfsproc_mkdir_2();
0367 extern diropres * nfsproc_mkdir_2_svc();
0368 #define NFSPROC_RMDIR 15
0369 extern nfsstat * nfsproc_rmdir_2();
0370 extern nfsstat * nfsproc_rmdir_2_svc();
0371 #define NFSPROC_READDIR 16
0372 extern readdirres * nfsproc_readdir_2();
0373 extern readdirres * nfsproc_readdir_2_svc();
0374 #define NFSPROC_STATFS 17
0375 extern statfsres * nfsproc_statfs_2();
0376 extern statfsres * nfsproc_statfs_2_svc();
0377 extern int nfs_program_2_freeresult ();
0378 #endif
0379
0380
0381
0382 #if defined(__STDC__) || defined(__cplusplus)
0383 extern bool_t xdr_nfsstat (XDR *, nfsstat*);
0384 extern bool_t xdr_ftype (XDR *, ftype*);
0385 extern bool_t xdr_nfs_fh (XDR *, nfs_fh*);
0386 extern bool_t xdr_nfstime (XDR *, nfstime*);
0387 extern bool_t xdr_fattr (XDR *, fattr*);
0388 extern bool_t xdr_sattr (XDR *, sattr*);
0389 extern bool_t xdr_filename (XDR *, filename*);
0390 extern bool_t xdr_nfspath (XDR *, nfspath*);
0391 extern bool_t xdr_attrstat (XDR *, attrstat*);
0392 extern bool_t xdr_sattrargs (XDR *, sattrargs*);
0393 extern bool_t xdr_diropargs (XDR *, diropargs*);
0394 extern bool_t xdr_diropokres (XDR *, diropokres*);
0395 extern bool_t xdr_diropres (XDR *, diropres*);
0396 extern bool_t xdr_readlinkres (XDR *, readlinkres*);
0397 extern bool_t xdr_readargs (XDR *, readargs*);
0398 extern bool_t xdr_readokres (XDR *, readokres*);
0399 extern bool_t xdr_readres (XDR *, readres*);
0400 extern bool_t xdr_writeargs (XDR *, writeargs*);
0401 extern bool_t xdr_createargs (XDR *, createargs*);
0402 extern bool_t xdr_renameargs (XDR *, renameargs*);
0403 extern bool_t xdr_linkargs (XDR *, linkargs*);
0404 extern bool_t xdr_symlinkargs (XDR *, symlinkargs*);
0405 extern bool_t xdr_nfscookie (XDR *, nfscookie);
0406 extern bool_t xdr_readdirargs (XDR *, readdirargs*);
0407 extern bool_t xdr_entry (XDR *, entry*);
0408 extern bool_t xdr_dirlist (XDR *, dirlist*);
0409 extern bool_t xdr_readdirres (XDR *, readdirres*);
0410 extern bool_t xdr_statfsokres (XDR *, statfsokres*);
0411 extern bool_t xdr_statfsres (XDR *, statfsres*);
0412
0413 #else
0414 extern bool_t xdr_nfsstat ();
0415 extern bool_t xdr_ftype ();
0416 extern bool_t xdr_nfs_fh ();
0417 extern bool_t xdr_nfstime ();
0418 extern bool_t xdr_fattr ();
0419 extern bool_t xdr_sattr ();
0420 extern bool_t xdr_filename ();
0421 extern bool_t xdr_nfspath ();
0422 extern bool_t xdr_attrstat ();
0423 extern bool_t xdr_sattrargs ();
0424 extern bool_t xdr_diropargs ();
0425 extern bool_t xdr_diropokres ();
0426 extern bool_t xdr_diropres ();
0427 extern bool_t xdr_readlinkres ();
0428 extern bool_t xdr_readargs ();
0429 extern bool_t xdr_readokres ();
0430 extern bool_t xdr_readres ();
0431 extern bool_t xdr_writeargs ();
0432 extern bool_t xdr_createargs ();
0433 extern bool_t xdr_renameargs ();
0434 extern bool_t xdr_linkargs ();
0435 extern bool_t xdr_symlinkargs ();
0436 extern bool_t xdr_nfscookie ();
0437 extern bool_t xdr_readdirargs ();
0438 extern bool_t xdr_entry ();
0439 extern bool_t xdr_dirlist ();
0440 extern bool_t xdr_readdirres ();
0441 extern bool_t xdr_statfsokres ();
0442 extern bool_t xdr_statfsres ();
0443
0444 #endif
0445
0446 #ifdef __cplusplus
0447 }
0448 #endif
0449
0450 #endif