summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ndiscvt/ndiscvt.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-01-02 04:31:06 +0000
committerwpaul <wpaul@FreeBSD.org>2004-01-02 04:31:06 +0000
commit29f66743387caea20d00f8ca18fe77dbdc30b467 (patch)
tree8c44e4408f2ae6f2841d0e28fa3468e45f244a6e /usr.sbin/ndiscvt/ndiscvt.c
parentd20e44e98c5c75d9defbaa665dce5fd51b9fa1ce (diff)
downloadFreeBSD-src-29f66743387caea20d00f8ca18fe77dbdc30b467.zip
FreeBSD-src-29f66743387caea20d00f8ca18fe77dbdc30b467.tar.gz
Clean up ndiscvt a bit (leaving out the -i flag didn't work) and add
copyrights to the inf parser files. Add a -n flag to ndiscvt to allow the user to override the default device name of NDIS devices. Instead of "ndis0, ndis1, etc..." you can have "foo0, foo1, etc..." This allows you to have more than one kind of NDIS device in the kernel at the same time. Convert from printf() to device_printf() in if_ndis.c, kern_ndis.c and subr_ndis.c. Create UMA zones for ndis_packet and ndis_buffer structs allocated on transmit. The zones are created and destroyed in the modevent handler in kern_ndis.c. printf() and UMA changes submitted by green@freebsd.org
Diffstat (limited to 'usr.sbin/ndiscvt/ndiscvt.c')
-rw-r--r--usr.sbin/ndiscvt/ndiscvt.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.sbin/ndiscvt/ndiscvt.c b/usr.sbin/ndiscvt/ndiscvt.c
index 6e34fae..1fde290 100644
--- a/usr.sbin/ndiscvt/ndiscvt.c
+++ b/usr.sbin/ndiscvt/ndiscvt.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/queue.h>
+#include <sys/socket.h>
+#include <net/if.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
@@ -156,7 +158,7 @@ static void
usage(void)
{
fprintf(stderr, "Usage: %s [-i <inffile>] -s <sysfile> "
- "[-o outfile]\n", __progname);
+ "[-d devname] [-o outfile]\n", __progname);
exit(1);
}
@@ -169,9 +171,10 @@ main(int argc, char *argv[])
unsigned char *ptr;
int i;
char *inffile = NULL, *sysfile = NULL, *outfile = NULL;
+ char *dname = NULL;
int ch;
- while((ch = getopt(argc, argv, "i:s:o:")) != -1) {
+ while((ch = getopt(argc, argv, "i:s:o:n:")) != -1) {
switch(ch) {
case 'i':
inffile = optarg;
@@ -182,6 +185,9 @@ main(int argc, char *argv[])
case 'o':
outfile = optarg;
break;
+ case 'n':
+ dname = optarg;
+ break;
default:
usage();
break;
@@ -218,12 +224,20 @@ main(int argc, char *argv[])
fprintf(outfp, "\n/*\n");
fprintf(outfp, " * Generated from %s and %s (%d bytes)\n",
- inffile, sysfile, fsize);
+ inffile == NULL ? "<notused>" : inffile, sysfile, fsize);
fprintf(outfp, " */\n\n");
- if (fp == NULL) {
+ if (dname != NULL) {
+ if (strlen(dname) > IFNAMSIZ)
+ err(1, "selected device name '%s' is "
+ "too long (max chars: %d)", dname, IFNAMSIZ);
+ fprintf (outfp, "#define NDIS_DEVNAME \"%s\"\n", dname);
+ fprintf (outfp, "#define NDIS_MODNAME %s\n", dname);
+ }
+
+ if (inffile == NULL) {
fprintf (outfp, "ndis_cfg ndis_regvals[] = {\n");
- fprintf (outfp, "\t{ NULL, NULL, ndis_parm_int, { 0 } }\n");
+ fprintf (outfp, "\t{ NULL, NULL, { 0 }, 0 }\n");
fprintf (outfp, "};\n\n");
} else {
OpenPOWER on IntegriCloud