mount_fs.c (82809) | mount_fs.c (119682) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1997-2001 Erez Zadok | 2 * Copyright (c) 1997-2003 Erez Zadok |
3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * --- 22 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * %W% (Berkeley) %G% 40 * | 3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * --- 22 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * %W% (Berkeley) %G% 40 * |
41 * $Id: mount_fs.c,v 1.11.2.5 2001/04/14 21:08:25 ezk Exp $ 42 * $FreeBSD: head/contrib/amd/libamu/mount_fs.c 82809 2001-09-02 19:14:18Z obrien $ | 41 * $Id: mount_fs.c,v 1.11.2.11 2003/05/08 17:57:53 ib42 Exp $ 42 * $FreeBSD: head/contrib/amd/libamu/mount_fs.c 119682 2003-09-02 15:42:57Z mbr $ |
43 * 44 */ 45 46#ifdef HAVE_CONFIG_H 47# include <config.h> 48#endif /* HAVE_CONFIG_H */ 49#include <am_defs.h> 50#include <amu.h> --- 50 unchanged lines hidden (view full) --- 101#if defined(MNT2_GEN_OPT_SYNC) && defined(MNTTAB_OPT_SYNC) 102 {MNTTAB_OPT_SYNC, MNT2_GEN_OPT_SYNC}, 103#endif /* defined(MNT2_GEN_OPT_SYNC) && defined(MNTTAB_OPT_SYNC) */ 104 105#if defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) 106 {MNTTAB_OPT_OVERLAY, MNT2_GEN_OPT_OVERLAY}, 107#endif /* defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) */ 108 | 43 * 44 */ 45 46#ifdef HAVE_CONFIG_H 47# include <config.h> 48#endif /* HAVE_CONFIG_H */ 49#include <am_defs.h> 50#include <amu.h> --- 50 unchanged lines hidden (view full) --- 101#if defined(MNT2_GEN_OPT_SYNC) && defined(MNTTAB_OPT_SYNC) 102 {MNTTAB_OPT_SYNC, MNT2_GEN_OPT_SYNC}, 103#endif /* defined(MNT2_GEN_OPT_SYNC) && defined(MNTTAB_OPT_SYNC) */ 104 105#if defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) 106 {MNTTAB_OPT_OVERLAY, MNT2_GEN_OPT_OVERLAY}, 107#endif /* defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) */ 108 |
109#if defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) 110 {MNTTAB_OPT_PROPLIST, MNT2_NFS_OPT_PROPLIST}, 111#endif /* defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) */ | 109 /* 110 * Do not define MNT2_NFS_OPT_* entries here! This is for generic 111 * mount(2) options only, not for NFS mount options. 112 */ |
112 | 113 |
113#if defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) 114 {MNTTAB_OPT_NOLOCK, MNT2_NFS_OPT_NONLM}, 115#endif /* defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) */ 116 | |
117 {0, 0} 118}; 119 120 121/* compute generic mount flags */ 122int 123compute_mount_flags(mntent_t *mntp) 124{ 125 struct opt_tab *opt; | 114 {0, 0} 115}; 116 117 118/* compute generic mount flags */ 119int 120compute_mount_flags(mntent_t *mntp) 121{ 122 struct opt_tab *opt; |
126 int flags; | 123 int flags = 0; |
127 | 124 |
128 /* start: this must come first */ | |
129#ifdef MNT2_GEN_OPT_NEWTYPE 130 flags = MNT2_GEN_OPT_NEWTYPE; | 125#ifdef MNT2_GEN_OPT_NEWTYPE 126 flags = MNT2_GEN_OPT_NEWTYPE; |
131#else /* not MNT2_GEN_OPT_NEWTYPE */ 132 /* Not all machines have MNT2_GEN_OPT_NEWTYPE (HP-UX 9.01) */ 133 flags = 0; 134#endif /* not MNT2_GEN_OPT_NEWTYPE */ | 127#endif /* MNT2_GEN_OPT_NEWTYPE */ 128#ifdef MNT2_GEN_OPT_AUTOMOUNTED 129 flags |= MNT2_GEN_OPT_AUTOMOUNTED; 130#endif /* not MNT2_GEN_OPT_AUTOMOUNTED */ |
135 | 131 |
136#if defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) | |
137 /* | 132 /* |
138 * Overlay this amd mount (presumably on another amd which died 139 * before and left the machine hung). This will allow a new amd or 140 * hlfsd to be remounted on top of another one. 141 */ 142 if (hasmntopt(mntp, MNTTAB_OPT_OVERLAY)) { 143 flags |= MNT2_GEN_OPT_OVERLAY; 144 plog(XLOG_INFO, "using an overlay mount"); 145 } 146#endif /* defined(MNT2_GEN_OVERLAY) && defined(MNTOPT_OVERLAY) */ 147 148 /* | |
149 * Crack basic mount options 150 */ 151 for (opt = mnt_flags; opt->opt; opt++) { 152 flags |= hasmntopt(mntp, opt->opt) ? opt->flag : 0; 153 } 154 155 return flags; 156} --- 139 unchanged lines hidden (view full) --- 296 297 /* finally, store the options into the mount table structure */ 298 mnt->mnt_opts = zopts; 299 300 /* 301 * Additional fields in mntent_t 302 * are fixed up here 303 */ | 133 * Crack basic mount options 134 */ 135 for (opt = mnt_flags; opt->opt; opt++) { 136 flags |= hasmntopt(mntp, opt->opt) ? opt->flag : 0; 137 } 138 139 return flags; 140} --- 139 unchanged lines hidden (view full) --- 280 281 /* finally, store the options into the mount table structure */ 282 mnt->mnt_opts = zopts; 283 284 /* 285 * Additional fields in mntent_t 286 * are fixed up here 287 */ |
304# ifdef HAVE_FIELD_MNTENT_T_MNT_CNODE | 288# ifdef HAVE_MNTENT_T_MNT_CNODE |
305 mnt->mnt_cnode = 0; | 289 mnt->mnt_cnode = 0; |
306# endif /* HAVE_FIELD_MNTENT_T_MNT_CNODE */ | 290# endif /* HAVE_MNTENT_T_MNT_CNODE */ |
307 | 291 |
308# ifdef HAVE_FIELD_MNTENT_T_MNT_RO | 292# ifdef HAVE_MNTENT_T_MNT_RO |
309 mnt->mnt_ro = (hasmntopt(mnt, MNTTAB_OPT_RO) != NULL); | 293 mnt->mnt_ro = (hasmntopt(mnt, MNTTAB_OPT_RO) != NULL); |
310# endif /* HAVE_FIELD_MNTENT_T_MNT_RO */ | 294# endif /* HAVE_MNTENT_T_MNT_RO */ |
311 | 295 |
312# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME 313# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME_STRING | 296# ifdef HAVE_MNTENT_T_MNT_TIME 297# ifdef HAVE_MNTENT_T_MNT_TIME_STRING |
314 { /* allocate enough space for a long */ 315 char *str = (char *) xmalloc(13 * sizeof(char)); 316 sprintf(str, "%ld", time((time_t *) NULL)); 317 mnt->mnt_time = str; 318 } | 298 { /* allocate enough space for a long */ 299 char *str = (char *) xmalloc(13 * sizeof(char)); 300 sprintf(str, "%ld", time((time_t *) NULL)); 301 mnt->mnt_time = str; 302 } |
319# else /* not HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */ | 303# else /* not HAVE_MNTENT_T_MNT_TIME_STRING */ |
320 mnt->mnt_time = time((time_t *) NULL); | 304 mnt->mnt_time = time((time_t *) NULL); |
321# endif /* not HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */ 322# endif /* HAVE_FIELD_MNTENT_T_MNT_TIME */ | 305# endif /* not HAVE_MNTENT_T_MNT_TIME_STRING */ 306# endif /* HAVE_MNTENT_T_MNT_TIME */ |
323 324 write_mntent(mnt, mnttabname); 325 326# ifdef MNTTAB_OPT_DEV 327 if (xopts) { 328 XFREE(mnt->mnt_opts); 329 mnt->mnt_opts = xopts; 330 } --- 39 unchanged lines hidden (view full) --- 370#ifdef HAVE_FS_NFS3 371 if (nfs_version == NFS_VERSION3) { 372 memset((voidp) &fh3, 0, sizeof(am_nfs_fh3)); 373 fh3.fh3_length = fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_len; 374 memmove(fh3.fh3_u.data, 375 fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_val, 376 fh3.fh3_length); 377 | 307 308 write_mntent(mnt, mnttabname); 309 310# ifdef MNTTAB_OPT_DEV 311 if (xopts) { 312 XFREE(mnt->mnt_opts); 313 mnt->mnt_opts = xopts; 314 } --- 39 unchanged lines hidden (view full) --- 354#ifdef HAVE_FS_NFS3 355 if (nfs_version == NFS_VERSION3) { 356 memset((voidp) &fh3, 0, sizeof(am_nfs_fh3)); 357 fh3.fh3_length = fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_len; 358 memmove(fh3.fh3_u.data, 359 fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_val, 360 fh3.fh3_length); 361 |
378# if defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) | 362# if defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) |
379 /* 380 * Some systems (Irix/bsdi3) have a separate field in nfs_args for 381 * the length of the file handle for NFS V3. They insist that 382 * the file handle set in nfs_args be plain bytes, and not 383 * include the length field. 384 */ 385 NFS_FH_DREF(nap->NFS_FH_FIELD, &(fh3.fh3_u.data)); | 363 /* 364 * Some systems (Irix/bsdi3) have a separate field in nfs_args for 365 * the length of the file handle for NFS V3. They insist that 366 * the file handle set in nfs_args be plain bytes, and not 367 * include the length field. 368 */ 369 NFS_FH_DREF(nap->NFS_FH_FIELD, &(fh3.fh3_u.data)); |
386# else /* not defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) */ | 370# else /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */ |
387 NFS_FH_DREF(nap->NFS_FH_FIELD, &fh3); | 371 NFS_FH_DREF(nap->NFS_FH_FIELD, &fh3); |
388# endif /* not defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) */ | 372# endif /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */ |
389# ifdef MNT2_NFS_OPT_NFSV3 390 nap->flags |= MNT2_NFS_OPT_NFSV3; 391# endif /* MNT2_NFS_OPT_NFSV3 */ 392# ifdef MNT2_NFS_OPT_VER3 393 nap->flags |= MNT2_NFS_OPT_VER3; 394# endif /* MNT2_NFS_OPT_VER3 */ 395 } else 396#endif /* HAVE_FS_NFS3 */ 397 NFS_FH_DREF(nap->NFS_FH_FIELD, &(fhp->v2.fhs_fh)); 398 | 373# ifdef MNT2_NFS_OPT_NFSV3 374 nap->flags |= MNT2_NFS_OPT_NFSV3; 375# endif /* MNT2_NFS_OPT_NFSV3 */ 376# ifdef MNT2_NFS_OPT_VER3 377 nap->flags |= MNT2_NFS_OPT_VER3; 378# endif /* MNT2_NFS_OPT_VER3 */ 379 } else 380#endif /* HAVE_FS_NFS3 */ 381 NFS_FH_DREF(nap->NFS_FH_FIELD, &(fhp->v2.fhs_fh)); 382 |
399#ifdef HAVE_FIELD_NFS_ARGS_T_FHSIZE | 383#ifdef HAVE_NFS_ARGS_T_FHSIZE |
400# ifdef HAVE_FS_NFS3 401 if (nfs_version == NFS_VERSION3) 402 nap->fhsize = fh3.fh3_length; 403 else 404# endif /* HAVE_FS_NFS3 */ 405 nap->fhsize = FHSIZE; | 384# ifdef HAVE_FS_NFS3 385 if (nfs_version == NFS_VERSION3) 386 nap->fhsize = fh3.fh3_length; 387 else 388# endif /* HAVE_FS_NFS3 */ 389 nap->fhsize = FHSIZE; |
406#endif /* HAVE_FIELD_NFS_ARGS_T_FHSIZE */ | 390#endif /* HAVE_NFS_ARGS_T_FHSIZE */ |
407 408 /* this is the version of the nfs_args structure, not of NFS! */ | 391 392 /* this is the version of the nfs_args structure, not of NFS! */ |
409#ifdef HAVE_FIELD_NFS_ARGS_T_FH_LEN | 393#ifdef HAVE_NFS_ARGS_T_FH_LEN |
410# ifdef HAVE_FS_NFS3 411 if (nfs_version == NFS_VERSION3) 412 nap->fh_len = fh3.fh3_length; 413 else 414# endif /* HAVE_FS_NFS3 */ 415 nap->fh_len = FHSIZE; | 394# ifdef HAVE_FS_NFS3 395 if (nfs_version == NFS_VERSION3) 396 nap->fh_len = fh3.fh3_length; 397 else 398# endif /* HAVE_FS_NFS3 */ 399 nap->fh_len = FHSIZE; |
416#endif /* HAVE_FIELD_NFS_ARGS_T_FH_LEN */ | 400#endif /* HAVE_NFS_ARGS_T_FH_LEN */ |
417 418 /************************************************************************/ 419 /*** HOST NAME ***/ 420 /************************************************************************/ 421 NFS_HN_DREF(nap->hostname, host_name); 422#ifdef MNT2_NFS_OPT_HOSTNAME 423 nap->flags |= MNT2_NFS_OPT_HOSTNAME; 424#endif /* MNT2_NFS_OPT_HOSTNAME */ --- 11 unchanged lines hidden (view full) --- 436 * Regardless of the value of acval, mount flags are set based directly 437 * on the values of the attribute caches. 438 */ 439#ifdef MNTTAB_OPT_ACTIMEO 440 acval = hasmntval(mntp, MNTTAB_OPT_ACTIMEO); /* attr cache timeout (sec) */ 441#endif /* MNTTAB_OPT_ACTIMEO */ 442 443 if (acval) { | 401 402 /************************************************************************/ 403 /*** HOST NAME ***/ 404 /************************************************************************/ 405 NFS_HN_DREF(nap->hostname, host_name); 406#ifdef MNT2_NFS_OPT_HOSTNAME 407 nap->flags |= MNT2_NFS_OPT_HOSTNAME; 408#endif /* MNT2_NFS_OPT_HOSTNAME */ --- 11 unchanged lines hidden (view full) --- 420 * Regardless of the value of acval, mount flags are set based directly 421 * on the values of the attribute caches. 422 */ 423#ifdef MNTTAB_OPT_ACTIMEO 424 acval = hasmntval(mntp, MNTTAB_OPT_ACTIMEO); /* attr cache timeout (sec) */ 425#endif /* MNTTAB_OPT_ACTIMEO */ 426 427 if (acval) { |
444#ifdef HAVE_FIELD_NFS_ARGS_T_ACREGMIN | 428#ifdef HAVE_NFS_ARGS_T_ACREGMIN |
445 nap->acregmin = acval; /* min ac timeout for reg files (sec) */ 446 nap->acregmax = acval; /* max ac timeout for reg files (sec) */ | 429 nap->acregmin = acval; /* min ac timeout for reg files (sec) */ 430 nap->acregmax = acval; /* max ac timeout for reg files (sec) */ |
447#endif /* HAVE_FIELD_NFS_ARGS_T_ACREGMIN */ 448#ifdef HAVE_FIELD_NFS_ARGS_T_ACDIRMIN | 431#endif /* HAVE_NFS_ARGS_T_ACREGMIN */ 432#ifdef HAVE_NFS_ARGS_T_ACDIRMIN |
449 nap->acdirmin = acval; /* min ac timeout for dirs (sec) */ 450 nap->acdirmax = acval; /* max ac timeout for dirs (sec) */ | 433 nap->acdirmin = acval; /* min ac timeout for dirs (sec) */ 434 nap->acdirmax = acval; /* max ac timeout for dirs (sec) */ |
451#endif /* HAVE_FIELD_NFS_ARGS_T_ACDIRMIN */ | 435#endif /* HAVE_NFS_ARGS_T_ACDIRMIN */ |
452 } else { 453#ifdef MNTTAB_OPT_ACREGMIN 454 nap->acregmin = hasmntval(mntp, MNTTAB_OPT_ACREGMIN); 455#endif /* MNTTAB_OPT_ACREGMIN */ 456#ifdef MNTTAB_OPT_ACREGMAX 457 nap->acregmax = hasmntval(mntp, MNTTAB_OPT_ACREGMAX); 458#endif /* MNTTAB_OPT_ACREGMAX */ 459#ifdef MNTTAB_OPT_ACDIRMIN --- 39 unchanged lines hidden (view full) --- 499 /************************************************************************/ 500 /*** NFS PROTOCOL (UDP, TCP) AND VERSION ***/ 501 /************************************************************************/ 502#ifdef MNT2_NFS_OPT_TCP 503 if (nfs_proto && STREQ(nfs_proto, "tcp")) 504 nap->flags |= MNT2_NFS_OPT_TCP; 505#endif /* MNT2_NFS_OPT_TCP */ 506 | 436 } else { 437#ifdef MNTTAB_OPT_ACREGMIN 438 nap->acregmin = hasmntval(mntp, MNTTAB_OPT_ACREGMIN); 439#endif /* MNTTAB_OPT_ACREGMIN */ 440#ifdef MNTTAB_OPT_ACREGMAX 441 nap->acregmax = hasmntval(mntp, MNTTAB_OPT_ACREGMAX); 442#endif /* MNTTAB_OPT_ACREGMAX */ 443#ifdef MNTTAB_OPT_ACDIRMIN --- 39 unchanged lines hidden (view full) --- 483 /************************************************************************/ 484 /*** NFS PROTOCOL (UDP, TCP) AND VERSION ***/ 485 /************************************************************************/ 486#ifdef MNT2_NFS_OPT_TCP 487 if (nfs_proto && STREQ(nfs_proto, "tcp")) 488 nap->flags |= MNT2_NFS_OPT_TCP; 489#endif /* MNT2_NFS_OPT_TCP */ 490 |
507#ifdef HAVE_FIELD_NFS_ARGS_T_SOTYPE | 491#ifdef HAVE_NFS_ARGS_T_SOTYPE |
508 /* bsdi3 uses this */ 509 if (nfs_proto) { 510 if (STREQ(nfs_proto, "tcp")) 511 nap->sotype = SOCK_STREAM; 512 else if (STREQ(nfs_proto, "udp")) 513 nap->sotype = SOCK_DGRAM; 514 } | 492 /* bsdi3 uses this */ 493 if (nfs_proto) { 494 if (STREQ(nfs_proto, "tcp")) 495 nap->sotype = SOCK_STREAM; 496 else if (STREQ(nfs_proto, "udp")) 497 nap->sotype = SOCK_DGRAM; 498 } |
515#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ | 499#endif /* HAVE_NFS_ARGS_T_SOTYPE */ |
516 | 500 |
517#ifdef HAVE_FIELD_NFS_ARGS_T_PROTO | 501#ifdef HAVE_NFS_ARGS_T_PROTO |
518 nap->proto = 0; /* bsdi3 sets this field to zero */ 519# ifdef IPPROTO_TCP 520 if (nfs_proto) { 521 if (STREQ(nfs_proto, "tcp")) /* AIX 4.2.x needs this */ 522 nap->proto = IPPROTO_TCP; 523 else if (STREQ(nfs_proto, "udp")) 524 nap->proto = IPPROTO_UDP; 525 } 526# endif /* IPPROTO_TCP */ | 502 nap->proto = 0; /* bsdi3 sets this field to zero */ 503# ifdef IPPROTO_TCP 504 if (nfs_proto) { 505 if (STREQ(nfs_proto, "tcp")) /* AIX 4.2.x needs this */ 506 nap->proto = IPPROTO_TCP; 507 else if (STREQ(nfs_proto, "udp")) 508 nap->proto = IPPROTO_UDP; 509 } 510# endif /* IPPROTO_TCP */ |
527#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ | 511#endif /* HAVE_NFS_ARGS_T_SOTYPE */ |
528 | 512 |
529#ifdef HAVE_FIELD_NFS_ARGS_T_VERSION | 513#ifdef HAVE_NFS_ARGS_T_VERSION |
530# ifdef NFS_ARGSVERSION 531 nap->version = NFS_ARGSVERSION; /* BSDI 3.0 and OpenBSD 2.2 */ 532# endif /* NFS_ARGSVERSION */ 533# ifdef DG_MOUNT_NFS_VERSION 534 nap->version = DG_MOUNT_NFS_VERSION; /* dg-ux */ 535# endif /* DG_MOUNT_NFS_VERSION */ | 514# ifdef NFS_ARGSVERSION 515 nap->version = NFS_ARGSVERSION; /* BSDI 3.0 and OpenBSD 2.2 */ 516# endif /* NFS_ARGSVERSION */ 517# ifdef DG_MOUNT_NFS_VERSION 518 nap->version = DG_MOUNT_NFS_VERSION; /* dg-ux */ 519# endif /* DG_MOUNT_NFS_VERSION */ |
536#endif /* HAVE_FIELD_NFS_ARGS_VERSION */ | 520#endif /* HAVE_NFS_ARGS_VERSION */ |
537 538 /************************************************************************/ 539 /*** OTHER NFS SOCKET RELATED OPTIONS AND FLAGS ***/ 540 /************************************************************************/ 541#ifdef MNT2_NFS_OPT_NOCONN 542 /* check if user specified to use unconnected or connected sockets */ 543 if (hasmntopt(mntp, MNTTAB_OPT_NOCONN) != NULL) 544 nap->flags |= MNT2_NFS_OPT_NOCONN; --- 165 unchanged lines hidden (view full) --- 710#endif /* defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) */ 711 712#if defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) 713 nap->maxgrouplist = hasmntval(mntp, MNTTAB_OPT_MAXGROUPS); 714 if (nap->maxgrouplist != NULL) 715 nap->flags |= MNT2_NFS_OPT_MAXGRPS; 716#endif /* defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) */ 717 | 521 522 /************************************************************************/ 523 /*** OTHER NFS SOCKET RELATED OPTIONS AND FLAGS ***/ 524 /************************************************************************/ 525#ifdef MNT2_NFS_OPT_NOCONN 526 /* check if user specified to use unconnected or connected sockets */ 527 if (hasmntopt(mntp, MNTTAB_OPT_NOCONN) != NULL) 528 nap->flags |= MNT2_NFS_OPT_NOCONN; --- 165 unchanged lines hidden (view full) --- 694#endif /* defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) */ 695 696#if defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) 697 nap->maxgrouplist = hasmntval(mntp, MNTTAB_OPT_MAXGROUPS); 698 if (nap->maxgrouplist != NULL) 699 nap->flags |= MNT2_NFS_OPT_MAXGRPS; 700#endif /* defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) */ 701 |
718#ifdef HAVE_FIELD_NFS_ARGS_T_OPTSTR | 702#if defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) 703 if (hasmntopt(mntp, MNTTAB_OPT_NOLOCK) != NULL) 704 nap->flags |= MNT2_NFS_OPT_NONLM; 705#endif /* defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) */ 706 707#ifdef HAVE_NFS_ARGS_T_OPTSTR |
719 nap->optstr = mntp->mnt_opts; | 708 nap->optstr = mntp->mnt_opts; |
720#endif /* HAVE_FIELD_NFS_ARGS_T_OPTSTR */ | 709#endif /* HAVE_NFS_ARGS_T_OPTSTR */ |
721 722 /************************************************************************/ 723 /*** FINAL ACTIONS ***/ 724 /************************************************************************/ 725 | 710 711 /************************************************************************/ 712 /*** FINAL ACTIONS ***/ 713 /************************************************************************/ 714 |
726#ifdef HAVE_FIELD_NFS_ARGS_T_GFS_FLAGS | 715#ifdef HAVE_NFS_ARGS_T_GFS_FLAGS |
727 /* Ultrix stores generic flags in nfs_args.gfs_flags. */ 728 nap->gfs_flags = genflags; | 716 /* Ultrix stores generic flags in nfs_args.gfs_flags. */ 717 nap->gfs_flags = genflags; |
729#endif /* HAVE_FIELD_NFS_ARGS_T_FLAGS */ | 718#endif /* HAVE_NFS_ARGS_T_FLAGS */ |
730 731 return; /* end of compute_nfs_args() function */ 732} 733 734 735/* 736 * Fill in special values for flags and fields of nfs_args, for an 737 * automounter NFS mount. --- 121 unchanged lines hidden (view full) --- 859#ifdef HAVE_TRANSPORT_TYPE_TLI 860 nbp = nap->addr; 861 plog(XLOG_DEBUG, "NA->addr {netbuf} (maxlen=%d, len=%d) = \"%s\"", 862 nbp->maxlen, nbp->len, 863 get_hex_string(nbp->len, nbp->buf)); 864 nbp = nap->syncaddr; 865 plog(XLOG_DEBUG, "NA->syncaddr {netbuf} 0x%x", (int) nbp); 866 kncp = nap->knconf; | 719 720 return; /* end of compute_nfs_args() function */ 721} 722 723 724/* 725 * Fill in special values for flags and fields of nfs_args, for an 726 * automounter NFS mount. --- 121 unchanged lines hidden (view full) --- 848#ifdef HAVE_TRANSPORT_TYPE_TLI 849 nbp = nap->addr; 850 plog(XLOG_DEBUG, "NA->addr {netbuf} (maxlen=%d, len=%d) = \"%s\"", 851 nbp->maxlen, nbp->len, 852 get_hex_string(nbp->len, nbp->buf)); 853 nbp = nap->syncaddr; 854 plog(XLOG_DEBUG, "NA->syncaddr {netbuf} 0x%x", (int) nbp); 855 kncp = nap->knconf; |
867 plog(XLOG_DEBUG, "NA->knconf->semantics %lu", (unsigned long) kncp->knc_semantics); | 856 plog(XLOG_DEBUG, "NA->knconf->semantics %lu", (u_long) kncp->knc_semantics); |
868 plog(XLOG_DEBUG, "NA->knconf->protofmly \"%s\"", kncp->knc_protofmly); 869 plog(XLOG_DEBUG, "NA->knconf->proto \"%s\"", kncp->knc_proto); | 857 plog(XLOG_DEBUG, "NA->knconf->protofmly \"%s\"", kncp->knc_protofmly); 858 plog(XLOG_DEBUG, "NA->knconf->proto \"%s\"", kncp->knc_proto); |
870 plog(XLOG_DEBUG, "NA->knconf->rdev %lu", kncp->knc_rdev); | 859 plog(XLOG_DEBUG, "NA->knconf->rdev %lu", (u_long) kncp->knc_rdev); |
871 /* don't print knconf->unused field */ 872#else /* not HAVE_TRANSPORT_TYPE_TLI */ 873 sap = (struct sockaddr_in *) &nap->addr; 874 plog(XLOG_DEBUG, "NA->addr {sockaddr_in} (len=%d) = \"%s\"", 875 (int) sizeof(struct sockaddr_in), 876 get_hex_string(sizeof(struct sockaddr_in), (const char *)sap)); | 860 /* don't print knconf->unused field */ 861#else /* not HAVE_TRANSPORT_TYPE_TLI */ 862 sap = (struct sockaddr_in *) &nap->addr; 863 plog(XLOG_DEBUG, "NA->addr {sockaddr_in} (len=%d) = \"%s\"", 864 (int) sizeof(struct sockaddr_in), 865 get_hex_string(sizeof(struct sockaddr_in), (const char *)sap)); |
877#ifdef HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN | 866#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN |
878 plog(XLOG_DEBUG, "NA->addr.sin_len = \"%d\"", sap->sin_len); | 867 plog(XLOG_DEBUG, "NA->addr.sin_len = \"%d\"", sap->sin_len); |
879#endif /* HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN */ | 868#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ |
880 plog(XLOG_DEBUG, "NA->addr.sin_family = \"%d\"", sap->sin_family); 881 plog(XLOG_DEBUG, "NA->addr.sin_port = \"%d\"", sap->sin_port); 882 plog(XLOG_DEBUG, "NA->addr.sin_addr = \"%s\"", 883 get_hex_string(sizeof(struct in_addr), (const char *) &sap->sin_addr)); 884#endif /* not HAVE_TRANSPORT_TYPE_TLI */ 885 886 plog(XLOG_DEBUG, "NA->hostname = \"%s\"", nap->hostname ? nap->hostname : "null"); | 869 plog(XLOG_DEBUG, "NA->addr.sin_family = \"%d\"", sap->sin_family); 870 plog(XLOG_DEBUG, "NA->addr.sin_port = \"%d\"", sap->sin_port); 871 plog(XLOG_DEBUG, "NA->addr.sin_addr = \"%s\"", 872 get_hex_string(sizeof(struct in_addr), (const char *) &sap->sin_addr)); 873#endif /* not HAVE_TRANSPORT_TYPE_TLI */ 874 875 plog(XLOG_DEBUG, "NA->hostname = \"%s\"", nap->hostname ? nap->hostname : "null"); |
887#ifdef HAVE_FIELD_NFS_ARGS_T_NAMLEN | 876#ifdef HAVE_NFS_ARGS_T_NAMLEN |
888 plog(XLOG_DEBUG, "NA->namlen = %d", nap->namlen); | 877 plog(XLOG_DEBUG, "NA->namlen = %d", nap->namlen); |
889#endif /* HAVE_FIELD_NFS_ARGS_T_NAMLEN */ | 878#endif /* HAVE_NFS_ARGS_T_NAMLEN */ |
890 891#ifdef MNT2_NFS_OPT_FSNAME 892 plog(XLOG_DEBUG, "NA->fsname = \"%s\"", nap->fsname ? nap->fsname : "null"); 893#endif /* MNT2_NFS_OPT_FSNAME */ 894 | 879 880#ifdef MNT2_NFS_OPT_FSNAME 881 plog(XLOG_DEBUG, "NA->fsname = \"%s\"", nap->fsname ? nap->fsname : "null"); 882#endif /* MNT2_NFS_OPT_FSNAME */ 883 |
895#ifdef HAVE_FIELD_NFS_ARGS_T_FHSIZE | 884#ifdef HAVE_NFS_ARGS_T_FHSIZE |
896 plog(XLOG_DEBUG, "NA->fhsize = %d", nap->fhsize); 897 fhlen = nap->fhsize; | 885 plog(XLOG_DEBUG, "NA->fhsize = %d", nap->fhsize); 886 fhlen = nap->fhsize; |
898#endif /* HAVE_FIELD_NFS_ARGS_T_FHSIZE */ 899#ifdef HAVE_FIELD_NFS_ARGS_T_FH_LEN | 887#endif /* HAVE_NFS_ARGS_T_FHSIZE */ 888#ifdef HAVE_NFS_ARGS_T_FH_LEN |
900 plog(XLOG_DEBUG, "NA->fh_len = %d", nap->fh_len); 901 fhlen = nap->fh_len; | 889 plog(XLOG_DEBUG, "NA->fh_len = %d", nap->fh_len); 890 fhlen = nap->fh_len; |
902#endif /* HAVE_FIELD_NFS_ARGS_T_FH_LEN */ | 891#endif /* HAVE_NFS_ARGS_T_FH_LEN */ |
903 904 /* 905 * XXX: need to figure out how to correctly print file handles, 906 * since some times they are pointers, and sometimes the real structure 907 * is stored in nfs_args. Even if it is a pointer, it can be the actual 908 * char[] array, or a structure containing multiple fields. 909 */ 910 plog(XLOG_DEBUG, "NA->filehandle = \"%s\"", 911 get_hex_string(fhlen, (const char *) &nap->NFS_FH_FIELD)); 912 | 892 893 /* 894 * XXX: need to figure out how to correctly print file handles, 895 * since some times they are pointers, and sometimes the real structure 896 * is stored in nfs_args. Even if it is a pointer, it can be the actual 897 * char[] array, or a structure containing multiple fields. 898 */ 899 plog(XLOG_DEBUG, "NA->filehandle = \"%s\"", 900 get_hex_string(fhlen, (const char *) &nap->NFS_FH_FIELD)); 901 |
913#ifdef HAVE_FIELD_NFS_ARGS_T_SOTYPE | 902#ifdef HAVE_NFS_ARGS_T_SOTYPE |
914 plog(XLOG_DEBUG, "NA->sotype = %d", nap->sotype); | 903 plog(XLOG_DEBUG, "NA->sotype = %d", nap->sotype); |
915#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ 916#ifdef HAVE_FIELD_NFS_ARGS_T_PROTO | 904#endif /* HAVE_NFS_ARGS_T_SOTYPE */ 905#ifdef HAVE_NFS_ARGS_T_PROTO |
917 plog(XLOG_DEBUG, "NA->proto = %d", (int) nap->proto); | 906 plog(XLOG_DEBUG, "NA->proto = %d", (int) nap->proto); |
918#endif /* HAVE_FIELD_NFS_ARGS_T_PROTO */ 919#ifdef HAVE_FIELD_NFS_ARGS_T_VERSION | 907#endif /* HAVE_NFS_ARGS_T_PROTO */ 908#ifdef HAVE_NFS_ARGS_T_VERSION |
920 plog(XLOG_DEBUG, "NA->version = %d", nap->version); | 909 plog(XLOG_DEBUG, "NA->version = %d", nap->version); |
921#endif /* HAVE_FIELD_NFS_ARGS_T_VERSION */ | 910#endif /* HAVE_NFS_ARGS_T_VERSION */ |
922 923 plog(XLOG_DEBUG, "NA->flags = 0x%x", (int) nap->flags); 924 925 plog(XLOG_DEBUG, "NA->rsize = %d", (int) nap->rsize); 926 plog(XLOG_DEBUG, "NA->wsize = %d", (int) nap->wsize); | 911 912 plog(XLOG_DEBUG, "NA->flags = 0x%x", (int) nap->flags); 913 914 plog(XLOG_DEBUG, "NA->rsize = %d", (int) nap->rsize); 915 plog(XLOG_DEBUG, "NA->wsize = %d", (int) nap->wsize); |
927#ifdef HAVE_FIELD_NFS_ARGS_T_BSIZE | 916#ifdef HAVE_NFS_ARGS_T_BSIZE |
928 plog(XLOG_DEBUG, "NA->bsize = %d", nap->bsize); | 917 plog(XLOG_DEBUG, "NA->bsize = %d", nap->bsize); |
929#endif /* HAVE_FIELD_NFS_ARGS_T_BSIZE */ | 918#endif /* HAVE_NFS_ARGS_T_BSIZE */ |
930 plog(XLOG_DEBUG, "NA->timeo = %d", (int) nap->timeo); 931 plog(XLOG_DEBUG, "NA->retrans = %d", (int) nap->retrans); 932 | 919 plog(XLOG_DEBUG, "NA->timeo = %d", (int) nap->timeo); 920 plog(XLOG_DEBUG, "NA->retrans = %d", (int) nap->retrans); 921 |
933#ifdef HAVE_FIELD_NFS_ARGS_T_ACREGMIN | 922#ifdef HAVE_NFS_ARGS_T_ACREGMIN |
934 plog(XLOG_DEBUG, "NA->acregmin = %d", (int) nap->acregmin); 935 plog(XLOG_DEBUG, "NA->acregmax = %d", (int) nap->acregmax); 936 plog(XLOG_DEBUG, "NA->acdirmin = %d", (int) nap->acdirmin); 937 plog(XLOG_DEBUG, "NA->acdirmax = %d", (int) nap->acdirmax); | 923 plog(XLOG_DEBUG, "NA->acregmin = %d", (int) nap->acregmin); 924 plog(XLOG_DEBUG, "NA->acregmax = %d", (int) nap->acregmax); 925 plog(XLOG_DEBUG, "NA->acdirmin = %d", (int) nap->acdirmin); 926 plog(XLOG_DEBUG, "NA->acdirmax = %d", (int) nap->acdirmax); |
938#endif /* HAVE_FIELD_NFS_ARGS_T_ACREGMIN */ | 927#endif /* HAVE_NFS_ARGS_T_ACREGMIN */ |
939#ifdef MNTTAB_OPT_SYMTTL 940 plog(XLOG_DEBUG, "NA->symttl = %d", nap->symttl); 941#endif /* MNTTAB_OPT_SYMTTL */ 942#ifdef MNTTAB_OPT_PG_THRESH 943 plog(XLOG_DEBUG, "NA->pg_thresh = %d", nap->pg_thresh); 944#endif /* MNTTAB_OPT_PG_THRESH */ 945 946#ifdef MNT2_NFS_OPT_BIODS 947 plog(XLOG_DEBUG, "NA->biods = %d", nap->biods); 948#endif /* MNT2_NFS_OPT_BIODS */ 949 950} 951#endif /* DEBUG */ | 928#ifdef MNTTAB_OPT_SYMTTL 929 plog(XLOG_DEBUG, "NA->symttl = %d", nap->symttl); 930#endif /* MNTTAB_OPT_SYMTTL */ 931#ifdef MNTTAB_OPT_PG_THRESH 932 plog(XLOG_DEBUG, "NA->pg_thresh = %d", nap->pg_thresh); 933#endif /* MNTTAB_OPT_PG_THRESH */ 934 935#ifdef MNT2_NFS_OPT_BIODS 936 plog(XLOG_DEBUG, "NA->biods = %d", nap->biods); 937#endif /* MNT2_NFS_OPT_BIODS */ 938 939} 940#endif /* DEBUG */ |