From owner-p4-projects@FreeBSD.ORG Wed Aug 6 11:27:20 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 09FF41065682; Wed, 6 Aug 2008 11:27:20 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1236106567C for ; Wed, 6 Aug 2008 11:27:19 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B01648FC23 for ; Wed, 6 Aug 2008 11:27:19 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m76BRJop016558 for ; Wed, 6 Aug 2008 11:27:19 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m76BRJFX016556 for perforce@freebsd.org; Wed, 6 Aug 2008 11:27:19 GMT (envelope-from ed@FreeBSD.org) Date: Wed, 6 Aug 2008 11:27:19 GMT Message-Id: <200808061127.m76BRJFX016556@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 146763 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Aug 2008 11:27:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=146763 Change 146763 by ed@ed_flippo on 2008/08/06 11:26:38 Minor fixes to nmdm(4): - Also hook up the wakeup routine to the input side. - Don't pass privileges for now. This makes nmdm(4) root-only, like it originally works. - Don't depend on vnode_if.h. Right now nmdm(4) supports no actual hotplugging. I tried to add this, but it's harder than it seems. One of the problems I was dealing with, is when the task is queued again right after the taskqueue is unlocked and the task is being executed. There's no rush. Affected files ... .. //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#6 edit .. //depot/projects/mpsafetty/sys/modules/nmdm/Makefile#3 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#6 (text+ko) ==== @@ -54,13 +54,14 @@ MALLOC_DEFINE(M_NMDM, "nullmodem", "nullmodem data structures"); -static tsw_outwakeup_t nmdm_outwakeup; +static void nmdm_wakeup(struct tty *); static tsw_param_t nmdm_param; static tsw_modem_t nmdm_modem; static struct ttydevsw nmdm_class = { .tsw_flags = TF_NOPREFIX, - .tsw_outwakeup = nmdm_outwakeup, + .tsw_inwakeup = nmdm_wakeup, + .tsw_outwakeup = nmdm_wakeup, .tsw_param = nmdm_param, .tsw_modem = nmdm_modem, }; @@ -93,7 +94,7 @@ static int nmdm_count = 0; static struct nmdmsoftc * -nmdm_alloc(unsigned long unit, struct ucred *cr) +nmdm_alloc(unsigned long unit) { struct nmdmsoftc *ns; struct tty *tp; @@ -117,11 +118,11 @@ /* Create device nodes */ tp = ns->ns_part1.np_tty = tty_alloc(&nmdm_class, &ns->ns_part1, &ns->ns_mtx); - tty_makedev(tp, cr, "nmdm%luA", unit); + tty_makedev(tp, NULL, "nmdm%luA", unit); tp = ns->ns_part2.np_tty = tty_alloc(&nmdm_class, &ns->ns_part2, &ns->ns_mtx); - tty_makedev(tp, cr, "nmdm%luB", unit); + tty_makedev(tp, NULL, "nmdm%luB", unit); return (ns); } @@ -147,7 +148,8 @@ if ((end[0] != 'A' && end[0] != 'B') || end[1] != '\0') return; - ns = nmdm_alloc(unit, cred); + /* XXX: pass privileges? */ + ns = nmdm_alloc(unit); if (end[0] == 'A') *dev = ns->ns_part1.np_tty->t_dev; @@ -318,11 +320,10 @@ } static void -nmdm_outwakeup(struct tty *tp) +nmdm_wakeup(struct tty *tp) { struct nmdmpart *np = tty_softc(tp); - np = tty_softc(tp); taskqueue_enqueue(taskqueue_swi, &np->np_task); } ==== //depot/projects/mpsafetty/sys/modules/nmdm/Makefile#3 (text+ko) ==== @@ -4,6 +4,5 @@ KMOD= nmdm SRCS= nmdm.c -SRCS+= vnode_if.h .include