1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
|
/*
* $Id: linux.map.h,v 1.5 2005/02/25 09:52:03 c4chris Exp $
*/
/* DIRECT include of SunOS 4.1 <nfs/nfs.h> as the IRIX <sys/fs/nfs.h>
* is in such a state as to be confusing/painful to use
*/
/* @(#)nfs.h 2.40 89/12/13 SMI */
#ifndef _nfs_nfs_h
#define _nfs_nfs_h
/* Maximum size of data portion of a remote request */
#define NFS_MAXDATA 8192
#define NFS_MAXNAMLEN 255
#define NFS_MAXPATHLEN 1024
/*
* Rpc retransmission parameters
*/
#define NFS_TIMEO 11 /* initial timeout in tenths of a sec. */
#define NFS_RETRIES 5 /* times to retry request */
/*
* maximum transfer size for different interfaces
*/
#define ECTSIZE 2048
#define IETSIZE 8192
/*
* 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=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 */
};
#define puterrno(error) ((enum nfsstat)error)
#define geterrno(status) ((int)status)
/*
* File types
*/
enum nfsftype {
NFNON,
NFREG, /* regular file */
NFDIR, /* directory */
NFBLK, /* block special */
NFCHR, /* character special */
NFLNK /* symbolic link */
};
/*
* Special kludge for fifos (named pipes) [to adhere to NFS Protocol Spec]
*
* VFIFO is not in the protocol spec (VNON will be replaced by VFIFO)
* so the over-the-wire representation is VCHR with a '-1' device number.
*
* NOTE: This kludge becomes unnecessary with the Protocol Revision,
* but it may be necessary to support it (backwards compatibility).
*/
#define NFS_FIFO_TYPE NFCHR
#define NFS_FIFO_MODE S_IFCHR
#define NFS_FIFO_DEV (~0)
/* identify fifo in nfs attributes */
#define NA_ISFIFO(NA) (((NA)->na_type == NFS_FIFO_TYPE) && \
((NA)->na_rdev == NFS_FIFO_DEV))
/* set fifo in nfs attributes */
#define NA_SETFIFO(NA) { \
(NA)->na_type = NFS_FIFO_TYPE; \
(NA)->na_rdev = NFS_FIFO_DEV; \
(NA)->na_mode = ((NA)->na_mode&~S_IFMT)|NFS_FIFO_MODE; \
}
/*
* Size of an fhandle in bytes
*/
#define NFS_FHSIZE 32
/*
* File access handle
* This structure is the Sun server representation of a file.
* It is handed out by a server for the client to use in further
* file transactions.
*/
#ifdef NFSSERVER
/*
* This struct is only used to find the size of the data field in the
* fhandle structure below.
*/
struct fhsize {
fsid_t f1;
u_short f2;
char f3[4];
u_short f4;
char f5[4];
};
#define NFS_FHMAXDATA ((NFS_FHSIZE - sizeof (struct fhsize) + 8) / 2)
struct svcfh {
fsid_t fh_fsid; /* filesystem id */
u_short fh_len; /* file number length */
char fh_data[NFS_FHMAXDATA]; /* and data */
u_short fh_xlen; /* export file number length */
char fh_xdata[NFS_FHMAXDATA]; /* and data */
};
typedef struct svcfh fhandle_t;
#else
/*
* This is the client view of an fhandle
*/
typedef struct {
char fh_data[NFS_FHSIZE]; /* opaque data */
} fhandle_t;
#endif
/*
* Arguments to remote write and writecache
*/
struct nfswriteargs {
fhandle_t wa_fhandle; /* handle for file */
u_int wa_begoff; /* beginning byte offset in file */
u_int wa_offset; /* current byte offset in file */
u_int wa_totcount; /* total write cnt (to this offset) */
u_int wa_count; /* size of this write */
char *wa_data; /* data to write (up to NFS_MAXDATA) */
struct mbuf *wa_mbuf; /* mbuf containing data */
};
struct nfs2_timeval {
uint32_t tv_sec;
uint32_t tv_usec;
};
/*
* File attributes
*/
struct nfsfattr {
enum nfsftype na_type; /* file type */
u_int na_mode; /* protection mode bits */
u_int na_nlink; /* # hard links */
u_int na_uid; /* owner user id */
u_int na_gid; /* owner group id */
u_int na_size; /* file size in bytes */
u_int na_blocksize; /* prefered block size */
u_int na_rdev; /* special device # */
u_int na_blocks; /* Kb of disk used by file */
u_int na_fsid; /* device # */
u_int na_nodeid; /* inode # */
struct nfs2_timeval na_atime; /* time of last access */
struct nfs2_timeval na_mtime; /* time of last modification */
struct nfs2_timeval na_ctime; /* time of last change */
};
#define n2v_type(x) (NA_ISFIFO(x) ? VFIFO : (enum vtype)((x)->na_type))
#define n2v_rdev(x) (NA_ISFIFO(x) ? 0 : (x)->na_rdev)
/*
* Arguments to remote read
*/
struct nfsreadargs {
fhandle_t ra_fhandle; /* handle for file */
u_int ra_offset; /* byte offset in file */
u_int ra_count; /* immediate read count */
u_int ra_totcount; /* total read cnt (from this offset) */
};
/*
* Status OK portion of remote read reply
*/
struct nfsrrok {
struct nfsfattr rrok_attr; /* attributes, need for pagin */
u_int rrok_count; /* bytes of data */
char *rrok_data; /* data (up to NFS_MAXDATA bytes) */
char *rrok_map; /* pointer to mapped data */
struct vnode *rrok_vp; /* vnode assoc. with mapping */
};
/*
* Reply from remote read
*/
struct nfsrdresult {
enum nfsstat rr_status; /* status of read */
union {
struct nfsrrok rr_ok_u; /* attributes, need for pagin */
} rr_u;
};
#define rr_ok rr_u.rr_ok_u
#define rr_attr rr_u.rr_ok_u.rrok_attr
#define rr_count rr_u.rr_ok_u.rrok_count
#define rr_data rr_u.rr_ok_u.rrok_data
#define rr_map rr_u.rr_ok_u.rrok_map
#define rr_vp rr_u.rr_ok_u.rrok_vp
/*
* File attributes which can be set
*/
struct nfssattr {
u_int sa_mode; /* protection mode bits */
u_int sa_uid; /* owner user id */
u_int sa_gid; /* owner group id */
u_int sa_size; /* file size in bytes */
struct nfs2_timeval sa_atime; /* time of last access */
struct nfs2_timeval sa_mtime; /* time of last modification */
};
/*
* Reply status with file attributes
*/
struct nfsattrstat {
enum nfsstat ns_status; /* reply status */
union {
struct nfsfattr ns_attr_u; /* NFS_OK: file attributes */
} ns_u;
};
#define ns_attr ns_u.ns_attr_u
/*
* NFS_OK part of read sym link reply union
*/
struct nfssrok {
u_int srok_count; /* size of string */
char *srok_data; /* string (up to NFS_MAXPATHLEN bytes) */
};
/*
* Result of reading symbolic link
*/
struct nfsrdlnres {
enum nfsstat rl_status; /* status of symlink read */
union {
struct nfssrok rl_srok_u; /* name of linked to */
} rl_u;
};
#define rl_srok rl_u.rl_srok_u
#define rl_count rl_u.rl_srok_u.srok_count
#define rl_data rl_u.rl_srok_u.srok_data
/*
* Arguments to readdir
*/
struct nfsrddirargs {
fhandle_t rda_fh; /* directory handle */
u_int rda_offset; /* offset in directory (opaque) */
u_int rda_count; /* number of directory bytes to read */
};
/*
* NFS_OK part of readdir result
*/
struct nfsrdok {
u_int rdok_offset; /* next offset (opaque) */
u_int rdok_size; /* size in bytes of entries */
bool_t rdok_eof; /* true if last entry is in result */
struct dirent *rdok_entries; /* variable number of entries */
};
/*
* Readdir result
*/
struct nfsrddirres {
u_int rd_bufsize; /* client request size (not xdr'ed) */
u_int rd_origreqsize; /* client request size */
enum nfsstat rd_status;
union {
struct nfsrdok rd_rdok_u;
} rd_u;
};
#define rd_rdok rd_u.rd_rdok_u
#define rd_offset rd_u.rd_rdok_u.rdok_offset
#define rd_size rd_u.rd_rdok_u.rdok_size
#define rd_eof rd_u.rd_rdok_u.rdok_eof
#define rd_entries rd_u.rd_rdok_u.rdok_entries
/*
* Arguments for directory operations
*/
struct nfsdiropargs {
fhandle_t da_fhandle; /* directory file handle */
char *da_name; /* name (up to NFS_MAXNAMLEN bytes) */
};
/*
* NFS_OK part of directory operation result
*/
struct nfsdrok {
fhandle_t drok_fhandle; /* result file handle */
struct nfsfattr drok_attr; /* result file attributes */
};
/*
* Results from directory operation
*/
struct nfsdiropres {
enum nfsstat dr_status; /* result status */
union {
struct nfsdrok dr_drok_u; /* NFS_OK result */
} dr_u;
};
#define dr_drok dr_u.dr_drok_u
#define dr_fhandle dr_u.dr_drok_u.drok_fhandle
#define dr_attr dr_u.dr_drok_u.drok_attr
/*
* arguments to setattr
*/
struct nfssaargs {
fhandle_t saa_fh; /* fhandle of file to be set */
struct nfssattr saa_sa; /* new attributes */
};
/*
* arguments to create and mkdir
*/
struct nfscreatargs {
struct nfsdiropargs ca_da; /* file name to create and parent dir */
struct nfssattr ca_sa; /* initial attributes */
};
/*
* arguments to link
*/
struct nfslinkargs {
fhandle_t la_from; /* old file */
struct nfsdiropargs la_to; /* new file and parent dir */
};
/*
* arguments to rename
*/
struct nfsrnmargs {
struct nfsdiropargs rna_from; /* old file and parent dir */
struct nfsdiropargs rna_to; /* new file and parent dir */
};
/*
* arguments to symlink
*/
struct nfsslargs {
struct nfsdiropargs sla_from; /* old file and parent dir */
char *sla_tnm; /* new name */
struct nfssattr sla_sa; /* attributes */
};
/*
* NFS_OK part of statfs operation
*/
struct nfsstatfsok {
u_int fsok_tsize; /* preferred transfer size in bytes */
u_int fsok_bsize; /* fundamental file system block size */
u_int fsok_blocks; /* total blocks in file system */
u_int fsok_bfree; /* free blocks in fs */
u_int fsok_bavail; /* free blocks avail to non-superuser */
};
/*
* Results of statfs operation
*/
struct nfsstatfs {
enum nfsstat fs_status; /* result status */
union {
struct nfsstatfsok fs_fsok_u; /* NFS_OK result */
} fs_u;
};
#define fs_fsok fs_u.fs_fsok_u
#define fs_tsize fs_u.fs_fsok_u.fsok_tsize
#define fs_bsize fs_u.fs_fsok_u.fsok_bsize
#define fs_blocks fs_u.fs_fsok_u.fsok_blocks
#define fs_bfree fs_u.fs_fsok_u.fsok_bfree
#define fs_bavail fs_u.fs_fsok_u.fsok_bavail
/*
* Remote file service routines
*/
#define RFS_NULL 0
#define RFS_GETATTR 1
#define RFS_SETATTR 2
#define RFS_ROOT 3
#define RFS_LOOKUP 4
#define RFS_READLINK 5
#define RFS_READ 6
#define RFS_WRITECACHE 7
#define RFS_WRITE 8
#define RFS_CREATE 9
#define RFS_REMOVE 10
#define RFS_RENAME 11
#define RFS_LINK 12
#define RFS_SYMLINK 13
#define RFS_MKDIR 14
#define RFS_RMDIR 15
#define RFS_READDIR 16
#define RFS_STATFS 17
/*
* remote file service numbers
*/
#define NFS_PROGRAM ((u_long)100003)
#define NFS_VERSION ((u_long)2)
#define NFS_PORT 2049
/*
* NFS3 stuff
*/
#define NFS3_FHSIZE 64
typedef unsigned int uint_t;
typedef char *filename3;
struct nfs_fh3 {
uint_t fh3_length;
union nfs_fh3_u {
struct nfs_fh3_i {
fhandle_t fh3_i;
} nfs_fh3_i;
unsigned char data[NFS3_FHSIZE];
} fh3_u;
};
typedef struct nfs_fh3 nfs_fh3;
struct diropargs3 {
nfs_fh3 *dirp;
nfs_fh3 dir;
filename3 name;
int flags;
};
typedef struct diropargs3 diropargs3;
struct RENAME3args {
diropargs3 from;
diropargs3 to;
};
typedef struct RENAME3args RENAME3args;
struct LINK3args {
nfs_fh3 file;
diropargs3 link;
};
typedef struct LINK3args LINK3args;
#define NFSPROC3_NULL 0
#define NFSPROC3_GETATTR 1
#define NFSPROC3_SETATTR 2
#define NFSPROC3_LOOKUP 3
#define NFSPROC3_ACCESS 4
#define NFSPROC3_READLINK 5
#define NFSPROC3_READ 6
#define NFSPROC3_WRITE 7
#define NFSPROC3_CREATE 8
#define NFSPROC3_MKDIR 9
#define NFSPROC3_SYMLINK 10
#define NFSPROC3_MKNOD 11
#define NFSPROC3_REMOVE 12
#define NFSPROC3_RMDIR 13
#define NFSPROC3_RENAME 14
#define NFSPROC3_LINK 15
#define NFSPROC3_READDIR 16
#define NFSPROC3_READDIRPLUS 17
#define NFSPROC3_FSSTAT 18
#define NFSPROC3_FSINFO 19
#define NFSPROC3_PATHCONF 20
#define NFSPROC3_COMMIT 21
#endif /*!_nfs_nfs_h*/
|