Changeset View
Changeset View
Standalone View
Standalone View
sbin/mount_nfs/mount_nfs.c
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <netdb.h> | #include <netdb.h> | ||||
#include <stdbool.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <strings.h> | #include <strings.h> | ||||
#include <sysexits.h> | #include <sysexits.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "mntopts.h" | #include "mntopts.h" | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int c; | int c; | ||||
struct iovec *iov; | struct iovec *iov; | ||||
int num, iovlen; | int num, iovlen; | ||||
char *host, *mntname, *p, *spec, *tmp; | char *host, *mntname, *p, *spec, *tmp; | ||||
char mntpath[MAXPATHLEN], errmsg[255]; | char mntpath[MAXPATHLEN], errmsg[255]; | ||||
char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; | char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; | ||||
const char *gssname, *nmount_errstr; | const char *gssname, *nmount_errstr; | ||||
bool softintr; | |||||
softintr = false; | |||||
iov = NULL; | iov = NULL; | ||||
iovlen = 0; | iovlen = 0; | ||||
memset(errmsg, 0, sizeof(errmsg)); | memset(errmsg, 0, sizeof(errmsg)); | ||||
gssname = NULL; | gssname = NULL; | ||||
while ((c = getopt(argc, argv, | while ((c = getopt(argc, argv, | ||||
"23a:bcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1) | "23a:bcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1) | ||||
switch (c) { | switch (c) { | ||||
Show All 33 Lines | case 'g': | ||||
break; | break; | ||||
case 'I': | case 'I': | ||||
printf("-I deprecated, use -o readdirsize=<value>\n"); | printf("-I deprecated, use -o readdirsize=<value>\n"); | ||||
build_iovec(&iov, &iovlen, "readdirsize", optarg, (size_t)-1); | build_iovec(&iov, &iovlen, "readdirsize", optarg, (size_t)-1); | ||||
break; | break; | ||||
case 'i': | case 'i': | ||||
printf("-i deprecated, use -o intr\n"); | printf("-i deprecated, use -o intr\n"); | ||||
build_iovec(&iov, &iovlen, "intr", NULL, 0); | build_iovec(&iov, &iovlen, "intr", NULL, 0); | ||||
softintr = true; | |||||
break; | break; | ||||
case 'L': | case 'L': | ||||
printf("-L deprecated, use -o nolockd\n"); | printf("-L deprecated, use -o nolockd\n"); | ||||
build_iovec(&iov, &iovlen, "nolockd", NULL, 0); | build_iovec(&iov, &iovlen, "nolockd", NULL, 0); | ||||
break; | break; | ||||
case 'l': | case 'l': | ||||
printf("-l deprecated, -o rdirplus\n"); | printf("-l deprecated, -o rdirplus\n"); | ||||
build_iovec(&iov, &iovlen, "rdirplus", NULL, 0); | build_iovec(&iov, &iovlen, "rdirplus", NULL, 0); | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | case 'o': { | ||||
if (portspec == NULL) | if (portspec == NULL) | ||||
portspec = "2049"; | portspec = "2049"; | ||||
break; | break; | ||||
default: | default: | ||||
errx(1, "illegal nfs version " | errx(1, "illegal nfs version " | ||||
"value -- %s", val); | "value -- %s", val); | ||||
} | } | ||||
pass_flag_to_nmount=0; | pass_flag_to_nmount=0; | ||||
} else if (strcmp(opt, "soft") == 0) { | |||||
softintr = true; | |||||
} else if (strcmp(opt, "intr") == 0) { | |||||
softintr = true; | |||||
} | } | ||||
if (pass_flag_to_nmount) { | if (pass_flag_to_nmount) { | ||||
build_iovec(&iov, &iovlen, opt, | build_iovec(&iov, &iovlen, opt, | ||||
__DECONST(void *, val), | __DECONST(void *, val), | ||||
strlen(val) + 1); | strlen(val) + 1); | ||||
} | } | ||||
opt = pnextopt; | opt = pnextopt; | ||||
} | } | ||||
Show All 13 Lines | case 'R': | ||||
break; | break; | ||||
case 'r': | case 'r': | ||||
printf("-r deprecated, use -o rsize=<rsize>\n"); | printf("-r deprecated, use -o rsize=<rsize>\n"); | ||||
build_iovec(&iov, &iovlen, "rsize", optarg, (size_t)-1); | build_iovec(&iov, &iovlen, "rsize", optarg, (size_t)-1); | ||||
break; | break; | ||||
case 's': | case 's': | ||||
printf("-s deprecated, use -o soft\n"); | printf("-s deprecated, use -o soft\n"); | ||||
build_iovec(&iov, &iovlen, "soft", NULL, 0); | build_iovec(&iov, &iovlen, "soft", NULL, 0); | ||||
softintr = true; | |||||
break; | break; | ||||
case 'T': | case 'T': | ||||
nfsproto = IPPROTO_TCP; | nfsproto = IPPROTO_TCP; | ||||
printf("-T deprecated, use -o tcp\n"); | printf("-T deprecated, use -o tcp\n"); | ||||
break; | break; | ||||
case 't': | case 't': | ||||
printf("-t deprecated, use -o timeout=<value>\n"); | printf("-t deprecated, use -o timeout=<value>\n"); | ||||
build_iovec(&iov, &iovlen, "timeout", optarg, (size_t)-1); | build_iovec(&iov, &iovlen, "timeout", optarg, (size_t)-1); | ||||
Show All 21 Lines | main(int argc, char *argv[]) | ||||
if ((opflags & (BGRND | BGRNDNOW)) == (BGRND | BGRNDNOW)) | if ((opflags & (BGRND | BGRNDNOW)) == (BGRND | BGRNDNOW)) | ||||
errx(1, "Options bg and bgnow are mutually exclusive"); | errx(1, "Options bg and bgnow are mutually exclusive"); | ||||
if (argc != 2) { | if (argc != 2) { | ||||
usage(); | usage(); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
/* Warn that NFSv4 mounts only work correctly as hard mounts. */ | |||||
if (mountmode == V4 && softintr) | |||||
warnx("Warning, options soft and/or intr cannot be safely used" | |||||
" for NFSv4. See the BUGS section of mount_nfs(8)"); | |||||
spec = *argv++; | spec = *argv++; | ||||
mntname = *argv; | mntname = *argv; | ||||
if (retrycnt == -1) | if (retrycnt == -1) | ||||
/* The default is to keep retrying forever. */ | /* The default is to keep retrying forever. */ | ||||
retrycnt = 0; | retrycnt = 0; | ||||
▲ Show 20 Lines • Show All 673 Lines • Show Last 20 Lines |