mount_nfs.c (24495) | mount_nfs.c (24546) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44/* 45static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95"; 46*/ 47static const char rcsid[] = | 1/* 2 * Copyright (c) 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44/* 45static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95"; 46*/ 47static const char rcsid[] = |
48 "$Id: mount_nfs.c,v 1.18 1997/03/29 03:32:39 imp Exp $"; | 48 "$Id: mount_nfs.c,v 1.19 1997/04/01 17:20:17 guido Exp $"; |
49#endif /* not lint */ 50 51#include <sys/param.h> 52#include <sys/mount.h> 53#include <sys/socket.h> 54#include <sys/socketvar.h> 55#include <sys/stat.h> 56#include <sys/syslog.h> --- 130 unchanged lines hidden (view full) --- 187#ifdef ISO 188struct iso_addr *iso_addr __P((const char *)); 189#endif 190void set_rpc_maxgrouplist __P((int)); 191void usage __P((void)) __dead2; 192int xdr_dir __P((XDR *, char *)); 193int xdr_fh __P((XDR *, struct nfhret *)); 194 | 49#endif /* not lint */ 50 51#include <sys/param.h> 52#include <sys/mount.h> 53#include <sys/socket.h> 54#include <sys/socketvar.h> 55#include <sys/stat.h> 56#include <sys/syslog.h> --- 130 unchanged lines hidden (view full) --- 187#ifdef ISO 188struct iso_addr *iso_addr __P((const char *)); 189#endif 190void set_rpc_maxgrouplist __P((int)); 191void usage __P((void)) __dead2; 192int xdr_dir __P((XDR *, char *)); 193int xdr_fh __P((XDR *, struct nfhret *)); 194 |
195/* 196 * Used to set mount flags with getmntopts. Call with dir=TRUE to 197 * initialise altflags from the current mount flags. Call with 198 * dir=FALSE to update mount flags with the new value of altflags after 199 * the call to getmntopts. 200 */ 201static void 202setflags(int* altflags, int* nfsflags, int dir) 203{ 204#define F2(af, nf) \ 205 if (dir) { \ 206 if (*nfsflags & NFSMNT_##nf) \ 207 *altflags |= ALTF_##af; \ 208 else \ 209 *altflags &= ~ALTF_##af; \ 210 } else { \ 211 if (*altflags & ALTF_##af) \ 212 *nfsflags |= NFSMNT_##nf; \ 213 else \ 214 *nfsflags &= ~NFSMNT_##nf; \ 215 } 216#define F(f) F2(f,f) 217 218 F(NOCONN); 219 F(DUMBTIMR); 220 F2(INTR, INT); 221#ifdef NFSKERB 222 F(KERB); 223#endif 224 F(NFSV3); 225 F(RDIRPLUS); 226 F(RESVPORT); 227 F(NQNFS); 228 F(SOFT); 229 230#undef F 231#undef F2 232} 233 |
|
195int 196main(argc, argv) 197 int argc; 198 char *argv[]; 199{ 200 register int c; 201 register struct nfs_args *nfsargsp; 202 struct nfs_args nfsargs; --- 85 unchanged lines hidden (view full) --- 288 break; 289#ifdef NFSKERB 290 case 'm': 291 (void)strncpy(realm, optarg, REALM_SZ - 1); 292 realm[REALM_SZ - 1] = '\0'; 293 break; 294#endif 295 case 'o': | 234int 235main(argc, argv) 236 int argc; 237 char *argv[]; 238{ 239 register int c; 240 register struct nfs_args *nfsargsp; 241 struct nfs_args nfsargs; --- 85 unchanged lines hidden (view full) --- 327 break; 328#ifdef NFSKERB 329 case 'm': 330 (void)strncpy(realm, optarg, REALM_SZ - 1); 331 realm[REALM_SZ - 1] = '\0'; 332 break; 333#endif 334 case 'o': |
335 altflags = 0; 336 setflags(&altflags, &nfsargsp->flags, TRUE); |
|
296 getmntopts(optarg, mopts, &mntflags, &altflags); | 337 getmntopts(optarg, mopts, &mntflags, &altflags); |
338 setflags(&altflags, &nfsargsp->flags, FALSE); 339 /* 340 * Handle altflags which don't map directly to 341 * mount flags. 342 */ |
|
297 if(altflags & ALTF_BG) 298 opflags |= BGRND; | 343 if(altflags & ALTF_BG) 344 opflags |= BGRND; |
299 if(altflags & ALTF_NOCONN) 300 nfsargsp->flags |= NFSMNT_NOCONN; 301 if(altflags & ALTF_DUMBTIMR) 302 nfsargsp->flags |= NFSMNT_DUMBTIMR; 303 if(altflags & ALTF_INTR) 304 nfsargsp->flags |= NFSMNT_INT; 305#ifdef NFSKERB 306 if(altflags & ALTF_KERB) 307 nfsargsp->flags |= NFSMNT_KERB; 308#endif 309 if(altflags & ALTF_NFSV3) 310 nfsargsp->flags |= NFSMNT_NFSV3; 311 if(altflags & ALTF_RDIRPLUS) 312 nfsargsp->flags |= NFSMNT_RDIRPLUS; | |
313 if(altflags & ALTF_MNTUDP) 314 mnttcp_ok = 0; | 345 if(altflags & ALTF_MNTUDP) 346 mnttcp_ok = 0; |
315 if(altflags & ALTF_RESVPORT) 316 nfsargsp->flags |= NFSMNT_RESVPORT; | |
317#ifdef ISO 318 if(altflags & ALTF_SEQPACKET) 319 nfsargsp->sotype = SOCK_SEQPACKET; 320#endif | 347#ifdef ISO 348 if(altflags & ALTF_SEQPACKET) 349 nfsargsp->sotype = SOCK_SEQPACKET; 350#endif |
321 if(altflags & ALTF_NQNFS) 322 nfsargsp->flags |= (NFSMNT_NQNFS|NFSMNT_NFSV3); 323 if(altflags & ALTF_SOFT) 324 nfsargsp->flags |= NFSMNT_SOFT; | |
325 if(altflags & ALTF_TCP) { 326 nfsargsp->sotype = SOCK_STREAM; 327 nfsproto = IPPROTO_TCP; 328 } 329 if(altflags & ALTF_PORT) 330 port_no = atoi(strstr(optarg, "port=") + 5); | 351 if(altflags & ALTF_TCP) { 352 nfsargsp->sotype = SOCK_STREAM; 353 nfsproto = IPPROTO_TCP; 354 } 355 if(altflags & ALTF_PORT) 356 port_no = atoi(strstr(optarg, "port=") + 5); |
331 altflags = 0; | |
332 break; 333 case 'P': 334 nfsargsp->flags |= NFSMNT_RESVPORT; 335 break; 336#ifdef ISO 337 case 'p': 338 nfsargsp->sotype = SOCK_SEQPACKET; 339 break; --- 438 unchanged lines hidden --- | 357 break; 358 case 'P': 359 nfsargsp->flags |= NFSMNT_RESVPORT; 360 break; 361#ifdef ISO 362 case 'p': 363 nfsargsp->sotype = SOCK_SEQPACKET; 364 break; --- 438 unchanged lines hidden --- |