Changeset View
Changeset View
Standalone View
Standalone View
sys/nfs/bootp_subr.c
Show First 20 Lines • Show All 1,508 Lines • ▼ Show 20 Lines | bootpc_init(void) | ||||
int error; | int error; | ||||
#ifndef BOOTP_WIRED_TO | #ifndef BOOTP_WIRED_TO | ||||
int ifcnt; | int ifcnt; | ||||
#endif | #endif | ||||
struct nfsv3_diskless *nd; | struct nfsv3_diskless *nd; | ||||
struct thread *td; | struct thread *td; | ||||
int timeout; | int timeout; | ||||
int delay; | int delay; | ||||
char *s; | |||||
timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; | timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; | ||||
delay = hz / 10; | delay = hz / 10; | ||||
nd = &nfsv3_diskless; | nd = &nfsv3_diskless; | ||||
td = curthread; | td = curthread; | ||||
/* | /* | ||||
* If already filled in, don't touch it here | * If already filled in, don't touch it here | ||||
*/ | */ | ||||
if (nfs_diskless_valid != 0) | if (nfs_diskless_valid != 0) | ||||
return; | return; | ||||
/* | |||||
* If "vfs.root.mountfrom" is set and the value is something other | |||||
* than "nfs:", it means the user doesn't want to mount root via nfs, | |||||
* there's no reason to continue with bootpc | |||||
*/ | |||||
if ((s = kern_getenv("vfs.root.mountfrom")) != NULL) { | |||||
if ((strncmp(s, "nfs:", 4)) != 0) { | |||||
sjg: Where might `nfs:` appear if not at the start of the string? | |||||
Done Inline ActionsI'm agnostic on strncmp vs strstr. What would be fore nfs:? imp: I'm agnostic on strncmp vs strstr. What would be fore nfs:? | |||||
Done Inline Actionsyes, it's expected to have "nfs:" right in the beginning. thanks! alfredo: yes, it's expected to have "nfs:" right in the beginning. thanks! | |||||
printf("%s: vfs.root.mountfrom set to %s. " | |||||
"BOOTP aborted.\n", __func__, s); | |||||
freeenv(s); | |||||
return; | |||||
} | |||||
freeenv(s); | |||||
} | |||||
gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO); | gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO); | ||||
STAILQ_INIT(&gctx->interfaces); | STAILQ_INIT(&gctx->interfaces); | ||||
gctx->xid = ~0xFFFF; | gctx->xid = ~0xFFFF; | ||||
gctx->starttime = time_second; | gctx->starttime = time_second; | ||||
/* | /* | ||||
* If ROOTDEVNAME is defined or vfs.root.mountfrom is set then we have | * If ROOTDEVNAME is defined or vfs.root.mountfrom is set then we have | ||||
▲ Show 20 Lines • Show All 297 Lines • Show Last 20 Lines |
Where might nfs: appear if not at the start of the string?