1 /* $OpenBSD: am.h,v 1.3 1997/01/31 14:42:18 graichen Exp $ */ 2 3 /* 4 * Copyright (c) 1990 Jan-Simon Pendry 5 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 6 * Copyright (c) 1990, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * Jan-Simon Pendry at Imperial College, London. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the University of 23 * California, Berkeley and its contributors. 24 * 4. Neither the name of the University nor the names of its contributors 25 * may be used to endorse or promote products derived from this software 26 * without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * SUCH DAMAGE. 39 * 40 * from: @(#)am.h 5.6 (Berkeley) 6/6/93 41 */ 42 43 #include "config.h" 44 45 /* 46 * Global declarations 47 */ 48 #include <sys/param.h> 49 #include <sys/socket.h> 50 #include <rpc/rpc.h> 51 #include <sys/mount.h> 52 #include <string.h> 53 #include <stdlib.h> 54 #ifdef MNTENT_HDR 55 #include MNTENT_HDR 56 #endif /* MNTENT_HDR */ 57 #ifndef NFS_PROTOCOL_VERSION 58 #if NFS_ARGSVERSION >= 3 59 #define NFS_PROTOCOL_VERSION 3 60 #endif /* NFS_ARGSVERSION >= 3 */ 61 #endif /* NFS_PROTOCOL_VERSION */ 62 #include "nfs_prot.h" 63 #include <assert.h> 64 65 #ifdef DEBUG_MEM 66 #include <malloc.h> 67 #endif /* DEBUG_MEM */ 68 69 #ifndef MAXHOSTNAMELEN 70 #define MAXHOSTNAMELEN 64 71 #endif /* MAXHOSTNAMELEN */ 72 73 #ifndef MNTTYPE_AUTO 74 #define MNTTYPE_AUTO "auto" 75 #endif /* MNTTYPE_AUTO */ 76 77 #ifndef FALSE 78 #define FALSE 0 79 #define TRUE 1 80 #endif /* FALSE */ 81 82 #ifndef ROOT_MAP 83 #define ROOT_MAP "\"root\"" 84 #endif /* ROOT_MAP */ 85 86 /* 87 * Flags from command line 88 */ 89 extern int print_pid; /* Print pid to stdout */ 90 extern int normalize_hosts; /* Normalize host names before use */ 91 extern int restart_existing_mounts; 92 #ifdef HAS_NIS_MAPS 93 extern char *domain; /* NIS domain to use */ 94 #endif /* HAS_NIS_MAPS */ 95 extern int am_timeo; /* Cache period */ 96 extern int afs_timeo; /* AFS timeout */ 97 extern int afs_retrans; /* AFS retrans */ 98 extern int am_timeo_w; /* Unmount timeout */ 99 extern char *mtab; /* Mount table */ 100 101 typedef enum { 102 Start, 103 Run, 104 Finishing, 105 Quit, 106 Done 107 } serv_state; 108 109 extern serv_state amd_state; /* Should we go now */ 110 extern int immediate_abort; /* Should close-down unmounts be retried */ 111 extern time_t do_mapc_reload; /* Flush & reload mount map cache */ 112 113 /* 114 * Useful constants 115 */ 116 extern char pid_fsname[]; /* kiska.southseas.nz:(pid%d) */ 117 extern char hostd[]; /* "kiska.southseas.nz" */ 118 extern char *hostdomain; /* "southseas.nz" */ 119 extern char *op_sys; /* "sos4" */ 120 extern char *arch; /* "sun4" */ 121 extern char *karch; /* "sun4c" */ 122 extern char *cluster; /* "r+d-kluster" */ 123 extern char *endian; /* "big" */ 124 extern char *auto_dir; /* "/a" */ 125 extern char copyright[]; /* Copyright info */ 126 extern char version[]; /* Version info */ 127 128 typedef struct am_ops am_ops; 129 typedef struct am_node am_node; 130 typedef struct am_opts am_opts; 131 typedef struct mntfs mntfs; 132 typedef struct fserver fserver; 133 typedef struct fsrvinfo fsrvinfo; 134 135 /* 136 * Debug defns. 137 */ 138 #ifdef DEBUG 139 #define DEBUG_MTAB "./mtab" 140 141 extern int debug_flags; /* Debug options */ 142 143 #define D_DAEMON 0x0001 /* Enter daemon mode */ 144 #define D_TRACE 0x0002 /* Do protocol trace */ 145 #define D_FULL 0x0004 /* Do full trace */ 146 #define D_MTAB 0x0008 /* Use local mtab */ 147 #define D_AMQ 0x0010 /* Register amq program */ 148 #define D_STR 0x0020 /* Debug string munging */ 149 #define D_MEM 0x0040 /* Trace memory allocations */ 150 151 /* 152 * Normally, don't enter daemon mode, and don't register amq 153 */ 154 #define D_TEST (~(D_DAEMON|D_MEM|D_STR)) 155 #endif /* DEBUG */ 156 157 /* 158 * Global variables. 159 */ 160 extern unsigned short nfs_port; /* Our NFS service port */ 161 extern struct in_addr myipaddr; /* (An) IP address of this host */ 162 163 extern int foreground; /* Foreground process */ 164 extern time_t next_softclock; /* Time to call softclock() */ 165 extern int task_notify_todo; /* Task notifier needs running */ 166 #ifdef HAS_TFS 167 extern int nfs_server_code_available; 168 #endif /* HAS_TFS */ 169 extern int last_used_map; /* Last map being used for mounts */ 170 extern AUTH *nfs_auth; /* Dummy uthorisation for remote servers */ 171 extern am_node **exported_ap; /* List of nodes */ 172 extern int first_free_map; /* First free node */ 173 extern am_node *root_node; /* Node for "root" */ 174 extern char *wire; /* Name of primary connected network */ 175 #define NEXP_AP (254) 176 #define NEXP_AP_MARGIN (128) 177 178 typedef int (*task_fun)P((voidp)); 179 typedef void (*cb_fun)P((int, int, voidp)); 180 typedef void (*fwd_fun)P((voidp, int, struct sockaddr_in *, 181 struct sockaddr_in *, voidp, int)); 182 183 /* 184 * String comparison macros 185 */ 186 #define STREQ(s1, s2) (strcmp((s1), (s2)) == 0) 187 #define FSTREQ(s1, s2) ((*(s1) == *(s2)) && STREQ((s1),(s2))) 188 189 /* 190 * Linked list 191 */ 192 typedef struct qelem qelem; 193 struct qelem { 194 qelem *q_forw; 195 qelem *q_back; 196 }; 197 #define FIRST(ty, q) ((ty *) ((q)->q_forw)) 198 #define LAST(ty, q) ((ty *) ((q)->q_back)) 199 #define NEXT(ty, q) ((ty *) (((qelem *) q)->q_forw)) 200 #define PREV(ty, q) ((ty *) (((qelem *) q)->q_back)) 201 #define HEAD(ty, q) ((ty *) q) 202 #define ITER(v, ty, q) \ 203 for ((v) = FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v))) 204 205 /* 206 * List of mount table entries 207 */ 208 typedef struct mntlist mntlist; 209 struct mntlist { 210 struct mntlist *mnext; 211 struct mntent *mnt; 212 }; 213 214 /* 215 * Mount map 216 */ 217 typedef struct mnt_map mnt_map; 218 219 /* 220 * Global routines 221 */ 222 extern int atoi P((Const char *)); /* C */ 223 extern void am_mounted P((am_node*)); 224 extern void am_unmounted P((am_node*)); 225 extern int background(P_void); 226 extern int bind_resv_port P((int, unsigned short*)); 227 extern int compute_mount_flags P((struct mntent *)); 228 extern int softclock(P_void); 229 #ifdef DEBUG 230 extern int debug_option P((char*)); 231 #endif /* DEBUG */ 232 extern void deslashify P((char*)); 233 /*extern void domain_strip P((char*, char*));*/ 234 extern mntfs* dup_mntfs P((mntfs*)); 235 extern fserver* dup_srvr P((fserver*)); 236 extern int eval_fs_opts P((am_opts*, char*, char*, char*, char*, char*)); 237 extern char* expand_key P((char*)); 238 extern am_node* exported_ap_alloc(P_void); 239 extern am_node* find_ap P((char*)); 240 extern am_node* find_mf P((mntfs*)); 241 extern mntfs* find_mntfs P((am_ops*, am_opts*, char*, char*, char*, char*, char*)); 242 extern void flush_mntfs(P_void); 243 extern void flush_nfs_fhandle_cache P((fserver*)); 244 extern void forcibly_timeout_mp P((am_node*)); 245 extern FREE_RETURN_TYPE free P((voidp)); /* C */ 246 extern void free_mntfs P((mntfs*)); 247 extern void free_opts P((am_opts*)); 248 extern void free_map P((am_node*)); 249 extern void free_mntlist P((mntlist*)); 250 extern void free_srvr P((fserver*)); 251 extern int fwd_init(P_void); 252 extern int fwd_packet P((int, voidp, int, struct sockaddr_in *, 253 struct sockaddr_in *, voidp, fwd_fun)); 254 extern void fwd_reply(P_void); 255 extern void get_args P((int, char*[])); 256 extern char *getwire P((void)); 257 #ifdef NEED_MNTOPT_PARSER 258 extern char *hasmntopt P((struct mntent*, char*)); 259 #endif /* NEED_MNTOPT_PARSER */ 260 extern int hasmntval P((struct mntent*, char*)); 261 extern void host_normalize P((char **)); 262 extern char *inet_dquad P((char*, u_int32_t)); 263 extern void init_map P((am_node*, char*)); 264 extern void insert_am P((am_node*, am_node*)); 265 extern void ins_que P((qelem*, qelem*)); 266 extern int islocalnet P((u_int32_t)); 267 extern int make_nfs_auth P((void)); 268 extern void make_root_node(P_void); 269 extern int make_rpc_packet P((char*, int, u_long, struct rpc_msg*, voidp, xdrproc_t, AUTH*)); 270 extern void map_flush_srvr P((fserver*)); 271 extern void mapc_add_kv P((mnt_map*, char*, char*)); 272 extern mnt_map* mapc_find P((char*, char*)); 273 extern void mapc_free P((mnt_map*)); 274 extern int mapc_keyiter P((mnt_map*, void (*)(char*,voidp), voidp)); 275 extern int mapc_search P((mnt_map*, char*, char**)); 276 extern void mapc_reload(P_void); 277 extern void mapc_showtypes P((FILE*)); 278 extern int mkdirs P((char*, int)); 279 extern void mk_fattr P((am_node*, int)); 280 extern void mnt_free P((struct mntent*)); 281 extern int mount_auto_node P((char*, voidp)); 282 extern int mount_automounter P((int)); 283 extern int mount_exported(P_void); 284 extern int mount_fs P((struct mntent*, int, caddr_t, int, MTYPE_TYPE)); 285 /*extern int mount_nfs_fh P((struct fhstatus*, char*, char*, char*, mntfs*));*/ 286 extern int mount_node P((am_node*)); 287 extern mntfs* new_mntfs(P_void); 288 extern void new_ttl P((am_node*)); 289 extern am_node* next_map P((int*)); 290 extern int nfs_srvr_port P((fserver*, u_short*, voidp)); 291 extern void normalize_slash P((char*)); 292 extern void ops_showfstypes P((FILE*)); 293 extern int pickup_rpc_reply P((voidp, int, voidp, xdrproc_t)); 294 extern mntlist* read_mtab P((char*)); 295 extern mntfs* realloc_mntfs P((mntfs*, am_ops*, am_opts*, char*, char*, char*, char*, char*)); 296 extern void rem_que P((qelem*)); 297 extern void reschedule_timeout_mp(P_void); 298 extern void restart(P_void); 299 #ifdef UPDATE_MTAB 300 extern void rewrite_mtab P((mntlist *)); 301 #endif /* UPDATE_MTAB */ 302 extern void rmdirs P((char*)); 303 extern am_node* root_ap P((char*, int)); 304 extern int root_keyiter P((void (*)(char*,voidp), voidp)); 305 extern void root_newmap P((char*, char*, char*)); 306 extern void rpc_msg_init P((struct rpc_msg*, u_long, u_long, u_long)); 307 extern void run_task P((task_fun, voidp, cb_fun, voidp)); 308 extern void sched_task P((cb_fun, voidp, voidp)); 309 extern void show_rcs_info P((Const char*, char*)); 310 extern void sigchld P((int)); 311 extern void srvrlog P((fserver*, char*)); 312 extern char* str3cat P((char*, char*, char*, char*)); 313 extern char* strcat P((char*, Const char*)); /* C */ 314 extern int strcmp P((Const char*, Const char*)); /* C */ 315 extern char* strdup P((Const char*)); 316 extern char* strnsave P((Const char*, int)); 317 extern char* strrchr P((Const char*, int)); /* C */ 318 extern char* strealloc P((char*, char *)); 319 extern char** strsplit P((char*, int, int)); 320 extern int switch_option P((char*)); 321 extern int switch_to_logfile P((char*)); 322 extern void do_task_notify(P_void); 323 extern int timeout P((unsigned int, void (*fn)(), voidp)); 324 extern void timeout_mp(P_void); 325 extern void umount_exported(P_void); 326 extern int umount_fs P((char*)); 327 /*extern int unmount_node P((am_node*)); 328 extern int unmount_node_wrap P((voidp));*/ 329 extern void unregister_amq(P_void); 330 extern void untimeout P((int)); 331 extern int valid_key P((char*)); 332 extern void wakeup P((voidp)); 333 extern void wakeup_task P((int,int,voidp)); 334 extern void wakeup_srvr P((fserver*)); 335 extern void write_mntent P((struct mntent*)); 336 #ifdef UPDATE_MTAB 337 extern void unlock_mntlist P((void)); 338 #else 339 #define unlock_mntlist() 340 #endif /* UPDATE_MTAB */ 341 342 343 #define ALLOC(ty) ((struct ty *) xmalloc(sizeof(struct ty))) 344 345 /* 346 * Options 347 */ 348 struct am_opts { 349 char *fs_glob; /* Smashed copy of global options */ 350 char *fs_local; /* Expanded copy of local options */ 351 char *fs_mtab; /* Mount table entry */ 352 /* Other options ... */ 353 char *opt_dev; 354 char *opt_delay; 355 char *opt_dir; 356 char *opt_fs; 357 char *opt_group; 358 char *opt_mount; 359 char *opt_opts; 360 char *opt_remopts; 361 char *opt_pref; 362 char *opt_cache; 363 char *opt_rfs; 364 char *opt_rhost; 365 char *opt_sublink; 366 char *opt_type; 367 char *opt_unmount; 368 char *opt_user; 369 }; 370 371 /* 372 * File Handle 373 * 374 * This is interpreted by indexing the exported array 375 * by fhh_id. 376 * 377 * The whole structure is mapped onto a standard fhandle_t 378 * when transmitted. 379 */ 380 struct am_fh { 381 int fhh_pid; /* process id */ 382 int fhh_id; /* map id */ 383 int fhh_gen; /* generation number */ 384 }; 385 386 extern am_node *fh_to_mp P((nfs_fh*)); 387 extern am_node *fh_to_mp3 P((nfs_fh*,int*,int)); 388 extern void mp_to_fh P((am_node*, nfs_fh*)); 389 #define fh_to_mp2(fhp, rp) fh_to_mp3(fhp, rp, VLOOK_CREATE) 390 extern int auto_fmount P((am_node *mp)); 391 extern int auto_fumount P((am_node *mp)); 392 393 #define MAX_READDIR_ENTRIES 16 394 395 typedef char* (*vfs_match)P((am_opts*)); 396 typedef int (*vfs_init)P((mntfs*)); 397 typedef int (*vmount_fs)P((am_node*)); 398 typedef int (*vfmount_fs)P((mntfs*)); 399 typedef int (*vumount_fs)P((am_node*)); 400 typedef int (*vfumount_fs)P((mntfs*)); 401 typedef am_node*(*vlookuppn)P((am_node*, char*, int*, int)); 402 typedef int (*vreaddir)P((am_node*, nfscookie, dirlist*, entry*, int)); 403 typedef am_node*(*vreadlink)P((am_node*, int*)); 404 typedef void (*vmounted)P((mntfs*)); 405 typedef void (*vumounted)P((am_node*)); 406 typedef fserver*(*vffserver)P((mntfs*)); 407 408 struct am_ops { 409 char *fs_type; 410 vfs_match fs_match; 411 vfs_init fs_init; 412 vmount_fs mount_fs; 413 vfmount_fs fmount_fs; 414 vumount_fs umount_fs; 415 vfumount_fs fumount_fs; 416 vlookuppn lookuppn; 417 vreaddir readdir; 418 vreadlink readlink; 419 vmounted mounted; 420 vumounted umounted; 421 vffserver ffserver; 422 int fs_flags; 423 }; 424 extern am_node *efs_lookuppn P((am_node*, char*, int*, int)); 425 extern int efs_readdir P((am_node*, nfscookie, dirlist*, entry*, int)); 426 427 #define VLOOK_CREATE 0x1 428 #define VLOOK_DELETE 0x2 429 430 #define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */ 431 #define FS_MBACKGROUND 0x0002 /* Should background this mount */ 432 #define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */ 433 #define FS_MKMNT 0x0008 /* Need to make the mount point */ 434 #define FS_UBACKGROUND 0x0010 /* Unmount in background */ 435 #define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND) 436 #define FS_DISCARD 0x0020 /* Discard immediately on last reference */ 437 #define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */ 438 439 #ifdef SUNOS4_COMPAT 440 extern am_ops *sunos4_match P((am_opts*, char*, char*, char*, char*, char*)); 441 #endif /* SUNOS4_COMPAT */ 442 extern am_ops *ops_match P((am_opts*, char*, char*, char*, char*, char*)); 443 #include "fstype.h" 444 445 /* 446 * Per-mountpoint statistics 447 */ 448 struct am_stats { 449 time_t s_mtime; /* Mount time */ 450 u_short s_uid; /* Uid of mounter */ 451 int s_getattr; /* Count of getattrs */ 452 int s_lookup; /* Count of lookups */ 453 int s_readdir; /* Count of readdirs */ 454 int s_readlink; /* Count of readlinks */ 455 int s_statfs; /* Count of statfs */ 456 }; 457 typedef struct am_stats am_stats; 458 459 /* 460 * System statistics 461 */ 462 struct amd_stats { 463 int d_drops; /* Dropped requests */ 464 int d_stale; /* Stale NFS handles */ 465 int d_mok; /* Succesful mounts */ 466 int d_merr; /* Failed mounts */ 467 int d_uerr; /* Failed unmounts */ 468 }; 469 extern struct amd_stats amd_stats; 470 471 /* 472 * List of fileservers 473 */ 474 struct fserver { 475 qelem fs_q; /* List of fileservers */ 476 int fs_refc; /* Number of references to this node */ 477 char *fs_host; /* Normalized hostname of server */ 478 struct sockaddr_in *fs_ip; /* Network address of server */ 479 int fs_cid; /* Callout id */ 480 int fs_pinger; /* Ping (keepalive) interval */ 481 int fs_flags; /* Flags */ 482 char *fs_type; /* File server type */ 483 voidp fs_private; /* Private data */ 484 void (*fs_prfree)(); /* Free private data */ 485 }; 486 #define FSF_VALID 0x0001 /* Valid information available */ 487 #define FSF_DOWN 0x0002 /* This fileserver is thought to be down */ 488 #define FSF_ERROR 0x0004 /* Permanent error has occured */ 489 #define FSF_WANT 0x0008 /* Want a wakeup call */ 490 #define FSF_PINGING 0x0010 /* Already doing pings */ 491 #define FSRV_ISDOWN(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_DOWN|FSF_VALID)) 492 #define FSRV_ISUP(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_VALID)) 493 494 /* 495 * List of mounted filesystems 496 */ 497 struct mntfs { 498 qelem mf_q; /* List of mounted filesystems */ 499 am_ops *mf_ops; /* Operations on this mountpoint */ 500 am_opts *mf_fo; /* File opts */ 501 char *mf_mount; /* "/a/kiska/home/kiska" */ 502 char *mf_info; /* Mount info */ 503 char *mf_auto; /* Automount opts */ 504 char *mf_mopts; /* FS mount opts */ 505 char *mf_remopts; /* Remote FS mount opts */ 506 fserver *mf_server; /* File server */ 507 int mf_flags; /* Flags */ 508 int mf_error; /* Error code from background mount */ 509 int mf_refc; /* Number of references to this node */ 510 int mf_cid; /* Callout id */ 511 void (*mf_prfree)(); /* Free private space */ 512 voidp mf_private; /* Private - per-fs data */ 513 }; 514 515 #define MFF_MOUNTED 0x0001 /* Node is mounted */ 516 #define MFF_MOUNTING 0x0002 /* Mount is in progress */ 517 #define MFF_UNMOUNTING 0x0004 /* Unmount is in progress */ 518 #define MFF_RESTART 0x0008 /* Restarted node */ 519 #define MFF_MKMNT 0x0010 /* Delete this node's am_mount */ 520 #define MFF_ERROR 0x0020 /* This node failed to mount */ 521 #define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */ 522 #define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */ 523 #define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy */ 524 525 /* 526 * Map of auto-mount points. 527 */ 528 struct am_node { 529 int am_mapno; /* Map number */ 530 mntfs *am_mnt; /* Mounted filesystem */ 531 char *am_name; /* "kiska" 532 Name of this node */ 533 char *am_path; /* "/home/kiska" 534 Path of this node's mount point */ 535 char *am_link; /* "/a/kiska/home/kiska/this/that" 536 Link to sub-directory */ 537 am_node *am_parent, /* Parent of this node */ 538 *am_ysib, /* Younger sibling of this node */ 539 *am_osib, /* Older sibling of this node */ 540 *am_child; /* First child of this node */ 541 struct attrstat am_attr; /* File attributes */ 542 #define am_fattr am_attr.attrstat_u.attributes 543 int am_flags; /* Boolean flags */ 544 int am_error; /* Specific mount error */ 545 time_t am_ttl; /* Time to live */ 546 int am_timeo_w; /* Wait interval */ 547 int am_timeo; /* Timeout interval */ 548 unsigned int am_gen; /* Generation number */ 549 char *am_pref; /* Mount info prefix */ 550 am_stats am_stats; /* Statistics gathering */ 551 }; 552 553 #define AMF_NOTIMEOUT 0x0001 /* This node never times out */ 554 #define AMF_ROOT 0x0002 /* This is a root node */ 555 556 #define ONE_HOUR (60 * 60) /* One hour in seconds */ 557 558 /* 559 * The following values can be tuned... 560 */ 561 #define ALLOWED_MOUNT_TIME 40 /* 40s for a mount */ 562 #define AM_TTL (5 * 60) /* Default cache period */ 563 #define AM_TTL_W (2 * 60) /* Default unmount interval */ 564 #define AM_PINGER 30 /* NFS ping interval for live systems */ 565 #define AFS_TIMEO 8 /* Default afs timeout - .8s */ 566 #define AFS_RETRANS ((ALLOWED_MOUNT_TIME*10+5*afs_timeo)/afs_timeo * 2) 567 /* Default afs retrans - 1/10th seconds */ 568 569 #define RPC_XID_PORTMAP 0 570 #define RPC_XID_MOUNTD 1 571 #define RPC_XID_NFSPING 2 572 #define RPC_XID_MASK (0x0f) /* 16 id's for now */ 573 #define MK_RPC_XID(type_id, uniq) ((type_id) | ((uniq) << 4)) 574