Changeset View
Changeset View
Standalone View
Standalone View
sbin/mount_nfs/mount_nfs.c
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | struct nfhret { | ||||
long auth; | long auth; | ||||
long fhsize; | long fhsize; | ||||
u_char nfh[NFS3_FHSIZE]; | u_char nfh[NFS3_FHSIZE]; | ||||
}; | }; | ||||
#define BGRND 1 | #define BGRND 1 | ||||
#define ISBGRND 2 | #define ISBGRND 2 | ||||
#define OF_NOINET4 4 | #define OF_NOINET4 4 | ||||
#define OF_NOINET6 8 | #define OF_NOINET6 8 | ||||
#define BGRNDNOW 0x10 | |||||
static int retrycnt = -1; | static int retrycnt = -1; | ||||
static int opflags = 0; | static int opflags = 0; | ||||
static int nfsproto = IPPROTO_TCP; | static int nfsproto = IPPROTO_TCP; | ||||
static int mnttcp_ok = 1; | static int mnttcp_ok = 1; | ||||
static int noconn = 0; | static int noconn = 0; | ||||
/* The 'portspec' is the server nfs port; NULL means look up via rpcbind. */ | /* The 'portspec' is the server nfs port; NULL means look up via rpcbind. */ | ||||
static const char *portspec = NULL; | static const char *portspec = NULL; | ||||
static struct sockaddr *addr; | static struct sockaddr *addr; | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | case 'o': { | ||||
pval = strchr(opt, '='); | pval = strchr(opt, '='); | ||||
if (pval != NULL) { | if (pval != NULL) { | ||||
*pval = '\0'; | *pval = '\0'; | ||||
val = pval + 1; | val = pval + 1; | ||||
} | } | ||||
if (strcmp(opt, "bg") == 0) { | if (strcmp(opt, "bg") == 0) { | ||||
opflags |= BGRND; | opflags |= BGRND; | ||||
pass_flag_to_nmount=0; | pass_flag_to_nmount=0; | ||||
} else if (strcmp(opt, "bgnow") == 0) { | |||||
opflags |= BGRNDNOW; | |||||
pass_flag_to_nmount=0; | |||||
} else if (strcmp(opt, "fg") == 0) { | } else if (strcmp(opt, "fg") == 0) { | ||||
/* same as not specifying -o bg */ | /* same as not specifying -o bg */ | ||||
pass_flag_to_nmount=0; | pass_flag_to_nmount=0; | ||||
} else if (strcmp(opt, "gssname") == 0) { | } else if (strcmp(opt, "gssname") == 0) { | ||||
pass_flag_to_nmount = 0; | pass_flag_to_nmount = 0; | ||||
gssname = val; | gssname = val; | ||||
} else if (strcmp(opt, "mntudp") == 0) { | } else if (strcmp(opt, "mntudp") == 0) { | ||||
mnttcp_ok = 0; | mnttcp_ok = 0; | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | case 'U': | ||||
break; | break; | ||||
default: | default: | ||||
usage(); | usage(); | ||||
break; | break; | ||||
} | } | ||||
argc -= optind; | argc -= optind; | ||||
argv += optind; | argv += optind; | ||||
if ((opflags & (BGRND | BGRNDNOW)) == (BGRND | BGRNDNOW)) | |||||
errx(1, "Options bg and bgnow mutually exclusive"); | |||||
emaste: Maybe add "are" -- are mutually exclusive?
I know errors are not necessarily full sentences but… | |||||
if (argc != 2) { | if (argc != 2) { | ||||
usage(); | usage(); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
spec = *argv++; | spec = *argv++; | ||||
mntname = *argv; | mntname = *argv; | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | if (getaddrinfo(hostp, portspec, &hints, &ai_nfs) != 0) { | ||||
*/ | */ | ||||
if (got_principal == 0 && secflavor != AUTH_SYS && | if (got_principal == 0 && secflavor != AUTH_SYS && | ||||
ai_nfs->ai_canonname != NULL) { | ai_nfs->ai_canonname != NULL) { | ||||
snprintf(pname, sizeof (pname), "nfs@%s", | snprintf(pname, sizeof (pname), "nfs@%s", | ||||
ai_nfs->ai_canonname); | ai_nfs->ai_canonname); | ||||
build_iovec(iov, iovlen, "principal", pname, | build_iovec(iov, iovlen, "principal", pname, | ||||
strlen(pname) + 1); | strlen(pname) + 1); | ||||
} | } | ||||
} | |||||
if ((opflags & (BGRNDNOW | ISBGRND)) == BGRNDNOW) { | |||||
warnx("Mount %s:%s, backgrounding", | |||||
hostp, spec); | |||||
opflags |= ISBGRND; | |||||
if (daemon(0, 0) != 0) | |||||
err(1, "daemon"); | |||||
} | } | ||||
ret = TRYRET_LOCALERR; | ret = TRYRET_LOCALERR; | ||||
for (;;) { | for (;;) { | ||||
/* | /* | ||||
* Try each entry returned by getaddrinfo(). Note the | * Try each entry returned by getaddrinfo(). Note the | ||||
* occurrence of remote errors by setting `remoteerr'. | * occurrence of remote errors by setting `remoteerr'. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 439 Lines • Show Last 20 Lines |
Maybe add "are" -- are mutually exclusive?
I know errors are not necessarily full sentences but this one is already quite close