1 /* $NetBSD: nfs_prot_osf5.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */ 2 3 /* 4 * Copyright (c) 1997-2014 Erez Zadok 5 * Copyright (c) 1990 Jan-Simon Pendry 6 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 7 * Copyright (c) 1990 The Regents of the University of California. 8 * All rights reserved. 9 * 10 * This code is derived from software contributed to Berkeley by 11 * Jan-Simon Pendry at Imperial College, London. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * 38 * File: am-utils/conf/nfs_prot/nfs_prot_osf5.h 39 * 40 */ 41 42 #ifndef _AMU_NFS_PROT_H 43 #define _AMU_NFS_PROT_H 44 45 #ifdef HAVE_RPCSVC_NFS_PROT_H 46 # include <rpcsvc/nfs_prot.h> 47 #endif /* HAVE_RPCSVC_NFS_PROT_H */ 48 #ifdef HAVE_NFS_NFS_H 49 # include <nfs/nfs.h> 50 #endif /* HAVE_NFS_NFS_H */ 51 #ifdef HAVE_RPCSVC_MOUNTV3_H 52 # include <rpcsvc/mountv3.h> 53 #endif /* HAVE_RPCSVC_MOUNTV3_H */ 54 #ifdef HAVE_RPC_RPC_H 55 # include <rpc/rpc.h> 56 #endif /* HAVE_RPC_RPC_H */ 57 58 /* avoid conflicts with Irix's EFS */ 59 #undef MOUNT_EFS /* DCE Episode FS */ 60 61 /* 62 * The NFSMNT_AUTO flag in Tru64 UNIX V5 has two effects: it causes df and 63 * mount not to display this mount point without the -e switch, as it did in 64 * previous releases. Unfortunately it also ignores the timeo mount option, 65 * disables the usual timeout backof and enforces a timeout of NFS_MAXTIMO 66 * (20 seconds) instead. This breaks amd which can sometimes take longer to 67 * respond to an NFS request, causing `nfs server not responding still trying' 68 * messages. 69 * 70 * To avoid this, we need to completely disable this flag on automount points, 71 * with the unfortunate side effect that they are no longer hidden in df and 72 * mount output. 73 */ 74 #undef MNT2_NFS_OPT_AUTO 75 76 /* 77 * MACROS 78 */ 79 80 #define NFS_PORT 2049 81 #define NFS_MAXDATA 8192 82 #define NFS_MAXPATHLEN 1024 83 #define NFS_MAXNAMLEN 255 84 #define NFS_FHSIZE 32 85 #define NFS_COOKIESIZE 4 86 #define MNTPATHLEN 1024 87 #define MNTNAMLEN 255 88 89 #define NFSMODE_FMT 0170000 90 #define NFSMODE_DIR 0040000 91 #define NFSMODE_CHR 0020000 92 #define NFSMODE_BLK 0060000 93 #define NFSMODE_REG 0100000 94 #define NFSMODE_LNK 0120000 95 #define NFSMODE_SOCK 0140000 96 #define NFSMODE_FIFO 0010000 97 98 #ifndef NFS_PROGRAM 99 # define NFS_PROGRAM ((u_long)100003) 100 #endif /* not NFS_PROGRAM */ 101 #ifndef NFS_VERSION 102 # define NFS_VERSION ((u_long)2) 103 #endif /* not NFS_VERSION */ 104 105 #define NFSPROC_NULL ((u_long)0) 106 #define NFSPROC_GETATTR ((u_long)1) 107 #define NFSPROC_SETATTR ((u_long)2) 108 #define NFSPROC_ROOT ((u_long)3) 109 #define NFSPROC_LOOKUP ((u_long)4) 110 #define NFSPROC_READLINK ((u_long)5) 111 #define NFSPROC_READ ((u_long)6) 112 #define NFSPROC_WRITECACHE ((u_long)7) 113 #define NFSPROC_WRITE ((u_long)8) 114 #define NFSPROC_CREATE ((u_long)9) 115 #define NFSPROC_REMOVE ((u_long)10) 116 #define NFSPROC_RENAME ((u_long)11) 117 #define NFSPROC_LINK ((u_long)12) 118 #define NFSPROC_SYMLINK ((u_long)13) 119 #define NFSPROC_MKDIR ((u_long)14) 120 #define NFSPROC_RMDIR ((u_long)15) 121 #define NFSPROC_READDIR ((u_long)16) 122 #define NFSPROC_STATFS ((u_long)17) 123 124 /* map field names */ 125 #define ml_hostname ml_name 126 #define ml_directory ml_path 127 #define ml_next ml_nxt 128 #define gr_next g_next 129 #define gr_name g_name 130 #define ex_dir ex_name 131 132 #define drok_attributes drok_attr 133 #define na_fileid na_nodeid 134 #define la_fhandle la_from 135 #define nt_seconds tv_sec 136 #define nt_useconds tv_usec 137 #define ra_totalcount ra_totcount 138 #define sla_to sla_tnm 139 #define sla_attributes sla_sa 140 #define sag_fhandle saa_fh 141 #define sag_attributes saa_sa 142 #define sfrok_tsize fsok_tsize 143 #define sfrok_bsize fsok_bsize 144 #define sfrok_blocks fsok_blocks 145 #define sfrok_bfree fsok_bfree 146 #define sfrok_bavail fsok_bavail 147 #define sfr_status fs_status 148 #define sfr_u fs_u 149 #define sfr_reply_u fs_fsok_u 150 #define wra_fhandle wa_fhandle 151 #define wra_beginoffset wa_begoff 152 #define wra_offset wa_offset 153 #define wra_totalcount wa_totcount 154 #define wra_u wa_mbuf->m_hdr 155 #define wra_val_u mh_data 156 #define wra_len_u mh_len 157 158 159 /* 160 * TYPEDEFS: 161 */ 162 typedef char *dirpath; 163 typedef char *filename; 164 typedef char *name; 165 typedef char *nfspath; 166 typedef char nfscookie[NFS_COOKIESIZE]; 167 typedef enum nfsftype nfsftype; 168 typedef enum nfsstat nfsstat; 169 typedef struct nfssvcfh fhandle; 170 typedef struct nfsattrstat nfsattrstat; 171 typedef struct nfscreateargs nfscreateargs; 172 typedef struct nfsdirlist nfsdirlist; 173 typedef struct nfsdiropargs nfsdiropargs; 174 typedef struct nfsdrok nfsdiropokres; 175 typedef struct nfsdiropres nfsdiropres; 176 typedef struct nfsentry nfsentry; 177 typedef struct exports *exports; 178 typedef struct exports exportnode; 179 typedef struct nfsfattr nfsfattr; 180 typedef struct fhstatus fhstatus; 181 typedef struct groups *groups; 182 typedef struct groups groupnode; 183 typedef struct nfslinkargs nfslinkargs; 184 typedef struct mountlist *mountlist; 185 typedef struct mountlist mountbody; 186 typedef struct _nfs_fh _nfs_fh; 187 typedef struct timeval nfstime; 188 typedef struct nfsreadargs nfsreadargs; 189 typedef struct nfsreaddirargs nfsreaddirargs; 190 typedef struct nfsreaddirres nfsreaddirres; 191 typedef struct nfsreadlinkres nfsreadlinkres; 192 typedef struct nfsreadokres nfsreadokres; 193 typedef struct nfsreadres nfsreadres; 194 typedef struct nfsrenameargs nfsrenameargs; 195 typedef struct nfssattr nfssattr; 196 typedef struct nfssaargs nfssattrargs; 197 typedef struct nfsstatfsok nfsstatfsokres; 198 typedef struct nfsstatfs nfsstatfsres; 199 typedef struct nfsslargs nfssymlinkargs; 200 typedef struct nfswriteargs nfswriteargs; 201 202 203 /* 204 * EXTERNALS: 205 */ 206 207 extern void *nfsproc_null_2_svc(void *, struct svc_req *); 208 extern nfsattrstat *nfsproc_getattr_2_svc(struct nfssvcfh *, struct svc_req *); 209 extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); 210 extern void *nfsproc_root_2_svc(void *, struct svc_req *); 211 extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); 212 extern nfsreadlinkres *nfsproc_readlink_2_svc(struct nfssvcfh *, struct svc_req *); 213 extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); 214 extern void *nfsproc_writecache_2_svc(void *, struct svc_req *); 215 extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); 216 extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); 217 extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); 218 extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); 219 extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); 220 extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); 221 extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); 222 extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); 223 extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); 224 extern nfsstatfsres *nfsproc_statfs_2_svc(struct nfssvcfh *, struct svc_req *); 225 226 extern bool_t xdr_nfsstat(XDR *, nfsstat*); 227 extern bool_t xdr_ftype(XDR *, nfsftype*); 228 extern bool_t xdr_nfs_fh(XDR *, struct nfssvcfh*); 229 extern bool_t xdr_nfstime(XDR *, nfstime*); 230 extern bool_t xdr_fattr(XDR *, nfsfattr*); 231 extern bool_t xdr_sattr(XDR *, nfssattr*); 232 extern bool_t xdr_filename(XDR *, filename*); 233 extern bool_t xdr_nfspath(XDR *, nfspath*); 234 extern bool_t xdr_attrstat(XDR *, nfsattrstat*); 235 extern bool_t xdr_sattrargs(XDR *, nfssattrargs*); 236 extern bool_t xdr_diropargs(XDR *, nfsdiropargs*); 237 extern bool_t xdr_diropokres(XDR *, nfsdiropokres*); 238 extern bool_t xdr_diropres(XDR *, nfsdiropres*); 239 extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*); 240 extern bool_t xdr_readargs(XDR *, nfsreadargs*); 241 extern bool_t xdr_readokres(XDR *, nfsreadokres*); 242 extern bool_t xdr_readres(XDR *, nfsreadres*); 243 extern bool_t xdr_writeargs(XDR *, nfswriteargs*); 244 extern bool_t xdr_createargs(XDR *, nfscreateargs*); 245 extern bool_t xdr_renameargs(XDR *, nfsrenameargs*); 246 extern bool_t xdr_linkargs(XDR *, nfslinkargs*); 247 extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*); 248 extern bool_t xdr_nfscookie(XDR *, nfscookie); 249 extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*); 250 extern bool_t xdr_entry(XDR *, nfsentry*); 251 extern bool_t xdr_dirlist(XDR *, nfsdirlist*); 252 extern bool_t xdr_readdirres(XDR *, nfsreaddirres*); 253 extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*); 254 extern bool_t xdr_statfsres(XDR *, nfsstatfsres*); 255 256 257 /* 258 * STRUCTURES: 259 */ 260 261 struct _nfs_fh { 262 char data[NFS_FHSIZE]; 263 }; 264 265 struct nfstime { 266 u_int nt_seconds; 267 u_int nt_useconds; 268 }; 269 270 struct _fattr { 271 nfsftype na_type; 272 u_int na_mode; 273 u_int na_nlink; 274 u_int na_uid; 275 u_int na_gid; 276 u_int na_size; 277 u_int na_blocksize; 278 u_int na_rdev; 279 u_int na_blocks; 280 u_int na_fsid; 281 u_int na_fileid; 282 nfstime na_atime; 283 nfstime na_mtime; 284 nfstime na_ctime; 285 }; 286 287 struct _sattr { 288 u_int sa_mode; 289 u_int sa_uid; 290 u_int sa_gid; 291 u_int sa_size; 292 nfstime sa_atime; 293 nfstime sa_mtime; 294 }; 295 296 struct _attrstat { 297 nfsstat ns_status; 298 union { 299 nfsfattr ns_attr_u; 300 } ns_u; 301 }; 302 303 struct _sattrargs { 304 struct nfssvcfh sag_fhandle; 305 nfssattr sag_attributes; 306 }; 307 308 struct _diropargs { 309 struct nfssvcfh da_fhandle; /* was dir */ 310 filename da_name; 311 }; 312 313 struct _diropokres { 314 struct nfssvcfh drok_fhandle; 315 nfsfattr drok_attributes; 316 }; 317 318 struct _diropres { 319 nfsstat dr_status; /* was status */ 320 union { 321 nfsdiropokres dr_drok_u; /* was diropres */ 322 } dr_u; /* was diropres_u */ 323 }; 324 325 struct nfsreadlinkres { 326 nfsstat rlr_status; 327 union { 328 nfspath rlr_data_u; 329 } rlr_u; 330 }; 331 332 struct _readargs { 333 struct nfssvcfh ra_fhandle; 334 u_int ra_offset; 335 u_int ra_count; 336 u_int ra_totalcount; 337 }; 338 339 struct nfsreadokres { 340 nfsfattr raok_attributes; 341 struct { 342 u_int raok_len_u; 343 char *raok_val_u; 344 } raok_u; 345 }; 346 347 struct nfsreadres { 348 nfsstat rr_status; 349 union { 350 nfsreadokres rr_reply_u; 351 } rr_u; 352 }; 353 354 #if 0 355 struct _writeargs { 356 struct nfssvcfh wra_fhandle; 357 u_int wra_beginoffset; 358 u_int wra_offset; 359 u_int wra_totalcount; 360 struct { 361 u_int wra_len_u; 362 char *wra_val_u; 363 } wra_u; 364 }; 365 #endif /* 0 */ 366 367 struct nfscreateargs { 368 nfsdiropargs ca_where; 369 nfssattr ca_attributes; 370 }; 371 372 struct nfsrenameargs { 373 nfsdiropargs rna_from; 374 nfsdiropargs rna_to; 375 }; 376 377 struct _linkargs { 378 struct nfssvcfh la_fhandle; 379 nfsdiropargs la_to; 380 }; 381 382 struct _symlinkargs { 383 nfsdiropargs sla_from; 384 nfspath sla_to; 385 nfssattr sla_attributes; 386 }; 387 388 struct nfsreaddirargs { 389 struct nfssvcfh rda_fhandle; 390 nfscookie rda_cookie; 391 u_int rda_count; 392 }; 393 394 struct nfsentry { 395 u_int ne_fileid; 396 filename ne_name; 397 nfscookie ne_cookie; 398 nfsentry *ne_nextentry; 399 }; 400 401 struct nfsdirlist { 402 nfsentry *dl_entries; 403 bool_t dl_eof; 404 }; 405 406 struct nfsreaddirres { 407 nfsstat rdr_status; 408 union { 409 nfsdirlist rdr_reply_u; 410 } rdr_u; 411 }; 412 413 struct _statfsokres { 414 u_int sfrok_tsize; 415 u_int sfrok_bsize; 416 u_int sfrok_blocks; 417 u_int sfrok_bfree; 418 u_int sfrok_bavail; 419 }; 420 421 struct _statfsres { 422 nfsstat sfr_status; 423 union { 424 nfsstatfsokres sfr_reply_u; 425 } sfr_u; 426 }; 427 428 /* 429 ************************************************************************** 430 * Tru64 5.1's autofs is not ported or tested yet... 431 * For now, undefine it or define dummy entries. 432 ************************************************************************** 433 */ 434 #ifdef MNTTYPE_AUTOFS 435 # undef MNTTYPE_AUTOFS 436 #endif /* MNTTYPE_AUTOFS */ 437 #ifdef MNTTAB_TYPE_AUTOFS 438 # undef MNTTAB_TYPE_AUTOFS 439 #endif /* MNTTAB_TYPE_AUTOFS */ 440 #ifdef HAVE_FS_AUTOFS 441 # undef HAVE_FS_AUTOFS 442 #endif /* HAVE_FS_AUTOFS */ 443 444 #endif /* not _AMU_NFS_PROT_H */ 445