summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-02-09 11:13:09 +0000
committerjkh <jkh@FreeBSD.org>1995-02-09 11:13:09 +0000
commit2f624e8b5e33f8fd07401a2da80f44a864d9cab3 (patch)
tree54c9c0b420ae764da33d01a1212cc3c26c6787ec
parent59086912ade649c8d045a5d141c6575d13ca94cc (diff)
downloadFreeBSD-src-2f624e8b5e33f8fd07401a2da80f44a864d9cab3.zip
FreeBSD-src-2f624e8b5e33f8fd07401a2da80f44a864d9cab3.tar.gz
Some scary macros from Heikki Suonsivu <hsu@cs.hut.fi>. Actually, they
make cdev entries look almost readable. If his stuff works for most of the entries in here, it might be worth it to refit them all.
-rw-r--r--sys/i386/i386/conf.c58
1 files changed, 53 insertions, 5 deletions
diff --git a/sys/i386/i386/conf.c b/sys/i386/i386/conf.c
index 7c13d3a..ee5c883 100644
--- a/sys/i386/i386/conf.c
+++ b/sys/i386/i386/conf.c
@@ -41,7 +41,7 @@
* SUCH DAMAGE.
*
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
- * $Id: conf.c,v 1.57 1995/02/05 11:29:38 jkh Exp $
+ * $Id: conf.c,v 1.58 1995/02/06 23:20:03 jkh Exp $
*/
#include <sys/param.h>
@@ -769,6 +769,55 @@ d_mmap_t spigot_mmap;
#define spigot_mmap nommap
#endif
+/*
+ * This stuff from Heikki is kind of bizarre, and I'm not sure how I feel
+ * about it yet (I think I like it about as much as I can like anything in
+ * here), but I'm intrigued enough for now to enable it by default. -jkh
+ *
+ * If you want to use the Cyclades driver, you MUST have this on for now
+ * (or convert Heikki's syntax to the old one).
+ */
+#define NEW_CONF_C_SYNTAX yes
+
+#if defined(NEW_CONF_C_SYNTAX)
+#ifndef __CONCAT
+#define __CONCAT(x,y) x ## y
+#endif
+
+#ifndef dev_decl
+#define dev_decl(n,t) __CONCAT(__CONCAT(d_,t),_t)__CONCAT(n,t)
+#endif
+#ifndef dev_init
+#define dev_init(c,n,t) \
+ ((c) > 0 ? __CONCAT(n,t) : (__CONCAT(__CONCAT(d_,t),_t)((*))) enxio)
+#endif
+
+#ifndef cdev_decl
+#define cdev_decl(n) \
+ dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \
+ dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,stop); \
+ dev_decl(n,reset); dev_decl(n,select); dev_decl(n,mmap); \
+ dev_decl(n,strategy); extern struct tty __CONCAT(n,_tty)[]
+#endif
+
+/* open, close, read, write, ioctl, stop, tty */
+#ifndef dev_tty_init
+#define dev_tty_init(c,n) (c > 0 ? __CONCAT(n,_tty) : 0)
+#endif
+#ifndef cdev_tty_init
+#define cdev_tty_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
+ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
+ (d_reset_t((*))) nullop, dev_tty_init(c,n), ttselect, \
+ (d_mmap_t((*))) enodev, 0 }
+#endif
+
+#include "cy.h"
+cdev_decl(cy);
+
+#endif /* NEW_CONF_C_SYNTAX */
+
+
/* open, close, read, write, ioctl, stop, reset, ttys, select, mmap, strat */
struct cdevsw cdevsw[] =
{
@@ -925,10 +974,9 @@ struct cdevsw cdevsw[] =
{ gscopen, gscclose, gscread, nowrite, /*47*/
gscioctl, nostop, nullreset, NULL, /* gsc */
seltrue, nommap, NULL },
- { (d_open_t *)enxio, (d_close_t *)enxio, (d_rdwr_t *)enxio, /*48*/
- (d_rdwr_t *)enxio, (d_ioctl_t *)enxio, (d_stop_t *)enxio,/* cyclades */
- (d_reset_t *)enxio, NULL, (d_select_t *)enxio,
- (d_mmap_t *)enxio, NULL },
+#if defined(NEW_CONF_C_SYNTAX)
+ cdev_tty_init(NCY,cy), /* cyclades */
+#endif
{ sscopen, sscclose, sscread, sscwrite, /*49*/
sscioctl, nostop, nullreset, NULL, /* scsi super */
sscselect, sscmmap, sscstrategy },
OpenPOWER on IntegriCloud