From owner-freebsd-arch Sun Jul 16 8:38:29 2000 Delivered-To: freebsd-arch@freebsd.org Received: from berserker.bsdi.com (berserker.twistedbit.com [199.79.183.1]) by hub.freebsd.org (Postfix) with ESMTP id C592737B585; Sun, 16 Jul 2000 08:38:20 -0700 (PDT) (envelope-from cp@berserker.bsdi.com) Received: from berserker.bsdi.com (cp@LOCALHOST [127.0.0.1]) by berserker.bsdi.com (8.9.3/8.9.3) with ESMTP id JAA11844; Sun, 16 Jul 2000 09:35:45 -0600 (MDT) Message-Id: <200007161535.JAA11844@berserker.bsdi.com> To: Poul-Henning Kamp Cc: Robert Watson , Warner Losh , Kelly Yancey , Julian Elischer , Dan Nelson , Adrian Chadd , freebsd-arch@freebsd.org Subject: Re: DEVFS, the complete picture (Was: Re: SysctlFS) From: Chuck Paterson Date: Sun, 16 Jul 2000 09:35:45 -0600 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the context of cloning as you describe it how would system administrators control access permissions and the actual names which get created? Chuck Poul-Henning Kamp wrote on: Sun, 16 Jul 2000 12:29:27 +0200 } }OK, now I finally have time to sit down and write an email with the }complete picture about devfs. } }For a moment, disregard jails and rootmounts and let us just look at }cloning. } }Cloning means that a device driver doesn't have to call make_dev() }on all potential instances up front. } }This makes most difference for pseudo-devices, tun, ppp, slip, pty, }md bpf and so on, but other "actual" drivers like fd could use it }as well to avoid calling make_dev() for every conceiveable format }of floppydisk. } }Implementing cloning without devfs would be a gross hack: we would }have to magically notice that /dev was searched and nothing found, }and I think we might just as well forget everything about that idea. } }Implementing cloning with devfs is simple: } } Device-drivers can call devfs during their initialization and } register a "clone()" function with devfs. (They obviously have } to deregister it again at dettach time). } } When devfs::VOP_LOOKUP() fails to find the name it is being told } to look for, it will call all registered clone() routines } successively with the sought after name as argument. } } Each driver clone routine examine the name, and if it can } instantiate a device of that name, it does so with make_dev() } and return EEXISTS. If it cannot it returns 0. If it } can determine for good that the name should not exist at this } time it returns ENOENT; } } If a clone routine return EEXISTS, devfs::VOP_LOOKUP() } immediately retries the lookup, and returns the result. } } If a clone routine returns ENOENT, devfs::VOP_LOOKUP() fails } with ENOENT; } } When a clone routine returns 0, devfs::VOP_LOOKUP() calls the } next clone routine in turn. } } If when all clone routines have been called none of them have } instantiated, devfs::VOP_LOOKUP() returns ENOENT; } } The dev_t's created this way at not special in any way, all normal } rules and rights apply. The only thing special about this is } the "lazy creation" of dev_t's. } }Summary: } }1. Forget about jails in the context of devfs, we don't need it. } }2. We can argue if we should unionmount the "real root" over a } devfs, or if we should mount devfs on /dev. Both arguments } have some amount of merit: The former is cleaner, the latter } is more like it used to be. } }3. Cloning while not strictly a must, is highly desireable. } }-- }Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 }phk@FreeBSD.ORG | TCP/IP since RFC 956 }FreeBSD coreteam member | BSD since 4.3-tahoe }Never attribute to malice what can adequately be explained by incompetence. } } }To Unsubscribe: send mail to majordomo@FreeBSD.org }with "unsubscribe freebsd-arch" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message