tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
An anomaly in config(1)
While looking at config(1), and particularly the code that emits the
devsw.c file, I notice that we generate a
extern const struct bdevsw xxx_bdevsw;
line for every _character_ device we encountered in the configuration!
So, for example, the first line generated is for cons_bdevsw, even
though the console is a character-only device.
This doesn't really hurt too much, since we never generate any reference
to the cons_bdevsw. But it seems to me that we should not generate
these extern at all. The code change is actually quite simple.
Index: mkdevsw.c
===================================================================
RCS file: /cvsroot/src/usr.bin/config/mkdevsw.c,v
retrieving revision 1.14
diff -u -p -r1.14 mkdevsw.c
--- mkdevsw.c 3 Sep 2015 13:53:36 -0000 1.14
+++ mkdevsw.c 16 Jul 2016 06:26:17 -0000
@@ -131,7 +131,7 @@ emitdevm(FILE *fp)
fputs("\n/* device switch table for block device */\n", fp);
for (i = 0; i <= maxbdevm ; i++)
- dentry(fp, cdevmtab, i, 'b');
+ dentry(fp, bdevmtab, i, 'b');
fputs("\nconst struct bdevsw *bdevsw0[] = {\n", fp);
Is there a reason for emitting these unused externs?
+------------------+--------------------------+------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
Home |
Main Index |
Thread Index |
Old Index