[klibc] [PATCH] kinit/nfsmount.c path from bootp
Thayne Harbaugh
tharbaugh at lnxi.com
Wed Jan 5 03:27:59 PST 2005
kinit/nfsmount.c:mount_nfs_root() should use the bootpath specified by
bootp/dhcp. If the "nfsroot" option is specified then it overrides the
boot server bootpath and a message indicating the override is printed.
--- klibc-0.194/kinit/nfsroot.c.orig 2005-01-05 04:13:47.043897880 -0700
+++ klibc-0.194/kinit/nfsroot.c 2005-01-05 04:13:09.316633296 -0700
@@ -66,34 +66,21 @@
const int len = 1024;
struct netdev *dev;
char *path = NULL;
+ char *dev_bootpath = NULL;
char root[len];
char *x, *opts;
int ret = 0;
int a;
- if ((path = get_arg(argc, argv, "nfsroot=")) == NULL) {
- path = (char *) "/tftpboot/%s";
- }
-
- if (*path == '\0') {
- fprintf(stderr, "Root-NFS: no path\n");
- exit(1);
- }
-
a = 1;
- if ((opts = strchr(path, ',')) != NULL) {
- *opts++ = '\0';
- argv[a++] = (char *) "-o";
- argv[a++] = opts;
- }
-
for (dev = ifaces; dev; dev = dev->next) {
print_device_config(dev);
if (dev->ip_server != INADDR_NONE &&
dev->ip_server != INADDR_ANY) {
addr.s_addr = dev->ip_server;
client = dev->ip_addr;
+ dev_bootpath = dev->bootpath;
break;
}
if (dev->ip_addr != INADDR_NONE &&
@@ -102,6 +89,25 @@
}
}
+ /*
+ * if the "nfsroot" option is set then it overrides
+ * bootpath supplied by the boot server.
+ */
+ if ((path = get_arg(argc, argv, "nfsroot=")) == NULL ) {
+ if ((path = dev_bootpath) == NULL || path[0] == '\0')
+ /* no path - set a default */
+ path = (char *) "/tftpboot/%s";
+ } else if (dev_bootpath && dev_bootpath[0] != '\0')
+ fprintf(stderr,
+ "nsfroot=%s overrides boot server bootpath %s\n",
+ path, dev_bootpath);
+
+ if ((opts = strchr(path, ',')) != NULL) {
+ *opts++ = '\0';
+ argv[a++] = (char *) "-o";
+ argv[a++] = opts;
+ }
+
if ((x = strchr(path, ':')) == NULL) {
if (addr.s_addr == INADDR_NONE) {
fprintf(stderr, "Root-NFS: no server defined\n");
--
Thayne Harbaugh
Linux Networx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.zytor.com/pipermail/klibc/attachments/20050105/b06ad3bb/attachment.bin
More information about the klibc
mailing list