From owner-freebsd-current Tue Nov 7 9:28: 8 2000 Delivered-To: freebsd-current@freebsd.org Received: from ruby.digisle.com (ruby.digisle.net [167.216.192.43]) by hub.freebsd.org (Postfix) with ESMTP id 2BE3437B4CF; Tue, 7 Nov 2000 09:27:58 -0800 (PST) Received: from guinness.digisle.net (guinness.digisle.net [167.216.152.33]) by ruby.digisle.com (8.9.3/8.9.3/mx) with ESMTP id RAA17890; Tue, 7 Nov 2000 17:27:56 GMT Received: from digisle.com (comanche.digisle.com [206.220.227.145]) by guinness.digisle.net (8.9.3/8.9.3/digisle) with ESMTP id RAA21536; Tue, 7 Nov 2000 17:27:55 GMT Message-ID: <3A083B9A.4C1DDD82@digisle.com> Date: Tue, 07 Nov 2000 09:27:54 -0800 From: Maksim Yevmenkin Organization: Digital Island X-Mailer: Mozilla 4.72 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Harti Brandt Cc: current@freebsd.org, hackers@freebsd.org Subject: [PATCH] Please review and commit (Re: if_tap and devfs) References: Content-Type: multipart/mixed; boundary="------------367164509B202DD0CF71424B" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------367164509B202DD0CF71424B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello Harti, > > > is there somebody working to make if_tap devfs-ready? Or I'm doing > > > something wrong? > > > > [SNIP] > > it seems to me that it did not get commited. i will look into it again > > today and re-send patch to the list. > > Great! It works. (Minus a spelling error: the parameter in > tapclone() should spell 'namelen'). Would nice if it get's committed. ooops :) sorry about that. unfortunately, i can not commit it. we have to ask one of the commiters. To ALL: anyone wants to review and commit the attached patch? thanks, emax --------------367164509B202DD0CF71424B Content-Type: text/plain; charset=us-ascii; name="if_tap.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_tap.c.diff" *** if_tap.c.orig Mon Nov 6 09:24:08 2000 --- if_tap.c Mon Nov 6 10:26:35 2000 *************** *** 79,84 **** --- 79,85 ---- static int tapmodevent __P((module_t, int, void *)); /* device */ + static void tapclone __P((void *, char *, int, dev_t *)); static void tapcreate __P((dev_t)); /* network interface */ *************** *** 131,157 **** int type; void *data; { ! static int attached = 0; ! struct ifnet *ifp = NULL; ! int unit, s; switch (type) { case MOD_LOAD: if (attached) return (EEXIST); cdevsw_add(&tap_cdevsw); attached = 1; break; ! case MOD_UNLOAD: if (taprefcnt > 0) return (EBUSY); cdevsw_remove(&tap_cdevsw); unit = 0; while (unit <= taplastunit) { s = splimp(); TAILQ_FOREACH(ifp, &ifnet, if_link) if ((strcmp(ifp->if_name, TAP) == 0) || --- 132,164 ---- int type; void *data; { ! static int attached = 0; ! static eventhandler_tag eh_tag = NULL; switch (type) { case MOD_LOAD: if (attached) return (EEXIST); + eh_tag = EVENTHANDLER_REGISTER(dev_clone, tapclone, 0, 1000); cdevsw_add(&tap_cdevsw); attached = 1; break; ! case MOD_UNLOAD: { ! int unit; ! if (taprefcnt > 0) return (EBUSY); + EVENTHANDLER_DEREGISTER(dev_clone, eh_tag); cdevsw_remove(&tap_cdevsw); unit = 0; while (unit <= taplastunit) { + int s; + struct ifnet *ifp = NULL; + s = splimp(); TAILQ_FOREACH(ifp, &ifnet, if_link) if ((strcmp(ifp->if_name, TAP) == 0) || *************** *** 179,185 **** } attached = 0; ! break; default: return (EOPNOTSUPP); --- 186,192 ---- } attached = 0; ! } break; default: return (EOPNOTSUPP); *************** *** 187,192 **** --- 194,234 ---- return (0); } /* tapmodevent */ + + + /* + * DEVFS handler + * + * We need to support two kind of devices - tap and vmnet + */ + static void + tapclone(arg, name, namelen, dev) + void *arg; + char *name; + int namelen; + dev_t *dev; + { + int unit, minor; + char *device_name = NULL; + + if (*dev != NODEV) + return; + + device_name = TAP; + if (dev_stdclone(name, NULL, device_name, &unit) != 1) { + device_name = VMNET; + + if (dev_stdclone(name, NULL, device_name, &unit) != 1) + return; + + minor = (unit | VMNET_DEV_MASK); + } + else + minor = unit; + + *dev = make_dev(&tap_cdevsw, minor, UID_ROOT, GID_WHEEL, 0600, "%s%d", + device_name, unit); + } /* tapclone */ /* --------------367164509B202DD0CF71424B-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message