Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/stand/pxeboot Pay attention to the file name p...
details: https://anonhg.NetBSD.org/src/rev/1d1dded2bee2
branches: trunk
changeset: 522335:1d1dded2bee2
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Feb 17 20:14:08 2002 +0000
description:
Pay attention to the file name provided by the DHCP server, using
it rather than the default of "netbsd" if it's in the reply.
diffstat:
sys/arch/i386/stand/pxeboot/devopen.c | 37 ++++++++++++++++++++++++++--------
sys/arch/i386/stand/pxeboot/main.c | 6 ++++-
2 files changed, 33 insertions(+), 10 deletions(-)
diffs (101 lines):
diff -r b116b9ae17f2 -r 1d1dded2bee2 sys/arch/i386/stand/pxeboot/devopen.c
--- a/sys/arch/i386/stand/pxeboot/devopen.c Sun Feb 17 20:08:34 2002 +0000
+++ b/sys/arch/i386/stand/pxeboot/devopen.c Sun Feb 17 20:14:08 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: devopen.c,v 1.1 2002/02/16 03:37:40 thorpej Exp $ */
+/* $NetBSD: devopen.c,v 1.2 2002/02/17 20:14:08 thorpej Exp $ */
/*
- * Copyright 2001 Wasabi Systems, Inc.
+ * Copyright 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
@@ -50,6 +50,7 @@
#ifdef _STANDALONE
struct btinfo_bootpath bibp;
+extern char bootfile[];
#endif
/*
@@ -71,9 +72,23 @@
struct devsw *dp;
char *filename;
size_t fsnamelen;
- int i;
+ int i, error;
+
+ dp = &devsw[0];
+
+ /* Set the default boot file system. */
+ bcopy(pxeboot_fstab[0].fst_ops, file_system, sizeof(struct fs_ops));
- bcopy(pxeboot_fstab[0].fst_ops, file_system, sizeof(struct fs_ops));
+ /* Open the device; this might give us a boot file name. */
+ error = (*dp->dv_open)(f, NULL);
+ if (error)
+ return (error);
+
+ f->f_dev = dp;
+
+ /* If the DHCP server provided a file name, use it. */
+ if (bootfile[0] != '\0')
+ fname = bootfile;
filename = strchr(fname, ':');
if (filename != NULL) {
@@ -89,24 +104,28 @@
if (i == npxeboot_fstab) {
printf("Invalid file system type specified in %s\n",
fname);
- return (EINVAL);
+ error = EINVAL;
+ goto bad;
}
filename++;
if (filename[0] == '\0') {
printf("No file specified in %s\n", fname);
- return (EINVAL);
+ error = EINVAL;
+ goto bad;
}
} else
filename = (char *)fname;
*file = filename;
- dp = &devsw[0];
- f->f_dev = dp;
#ifdef _STANDALONE
strncpy(bibp.bootpath, filename, sizeof(bibp.bootpath));
BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
#endif
- return ((*dp->dv_open)(f, NULL));
+ return (0);
+ bad:
+ (*dp->dv_close)(f);
+ f->f_dev = NULL;
+ return (error);
}
diff -r b116b9ae17f2 -r 1d1dded2bee2 sys/arch/i386/stand/pxeboot/main.c
--- a/sys/arch/i386/stand/pxeboot/main.c Sun Feb 17 20:08:34 2002 +0000
+++ b/sys/arch/i386/stand/pxeboot/main.c Sun Feb 17 20:14:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.2 2002/02/16 16:52:10 thorpej Exp $ */
+/* $NetBSD: main.c,v 1.3 2002/02/17 20:14:08 thorpej Exp $ */
/*
* Copyright (c) 1996
@@ -125,6 +125,10 @@
bootmenu(); /* does not return */
}
+ /*
+ * The file name provided here is just a default. If the
+ * DHCP server provides a file name, we'll use that instead.
+ */
bootit("netbsd", 0);
/*
Home |
Main Index |
Thread Index |
Old Index