Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2001 20:27:15 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        freebsd-current@freebsd.org
Cc:        yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   Please review and test: rc driver patch
Message-ID:  <200107131127.UAA18366@zodiac.mech.utsunomiya-u.ac.jp>

next in thread | raw e-mail | index | archive | help
Would somebody please review and test the attached patch for the rc
driver?

I don't have hardware to test this.

It will make the rc driver to use ttymalloc(), rather than to maintain
static array of struct tty.

Kazu

Index: rc.c
===================================================================
RCS file: /src/CVS/src/sys/i386/isa/rc.c,v
retrieving revision 1.63
diff -u -r1.63 rc.c
--- rc.c	2001/05/15 23:22:22	1.63
+++ rc.c	2001/07/06 01:23:05
@@ -142,10 +142,6 @@
 
 static int rc_scheduled_event = 0;
 
-/* for pstat -t */
-static struct tty rc_tty[NRC * CD180_NCHAN];
-static const int  nrc_tty = NRC * CD180_NCHAN;
-
 /* Flags */
 #define RC_DTR_OFF      0x0001          /* DTR wait, for close/open     */
 #define RC_ACTOUT       0x0002          /* Dial-out port active         */
@@ -259,15 +255,24 @@
 		rc->rc_dtrwait = 3 * hz;
 		rc->rc_dcdwaits= 0;
 		rc->rc_hotchar = 0;
-		tp = rc->rc_tp = &rc_tty[chan + (dvp->id_unit * CD180_NCHAN)];
+		tp = rc->rc_tp = ttymalloc(rc->rc_tp);
 		ttychars(tp);
 		tp->t_lflag = tp->t_iflag = tp->t_oflag = 0;
 		tp->t_cflag = TTYDEF_CFLAG;
 		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+		if (!rc_started) {
+			make_dev(&rc_cdevsw,
+				 rcb->rcb_unit*CD180_NCHAN + chan,
+				 UID_ROOT, GID_WHEEL, 0600, "ttym%r",
+				 rcb->rcb_unit*CD180_NCHAN + chan);
+			make_dev(&rc_cdevsw,
+				 rcb->rcb_unit*CD180_NCHAN + chan + 128,
+				 UID_ROOT, GID_WHEEL, 0660, "cuam%r",
+				 rcb->rcb_unit*CD180_NCHAN + chan + 128);
+		}
 	}
 	rcb->rcb_probed = RC_ATTACHED;
 	if (!rc_started) {
-		cdevsw_add(&rc_cdevsw);
 		swi_add(&tty_ithd, "tty:rc", rcpoll, NULL, SWI_TTY, 0, &rc_ih);
 		rc_wakeup((void *)NULL);
 		rc_started = 1;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107131127.UAA18366>