Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jul 2000 09:35:45 -0600
From:      Chuck Paterson <cp@bsdi.com>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Robert Watson <rwatson@freebsd.org>, Warner Losh <imp@village.org>, Kelly Yancey <kbyanc@posi.net>, Julian Elischer <julian@elischer.org>, Dan Nelson <dnelson@emsphone.com>, Adrian Chadd <adrian@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: DEVFS, the complete picture (Was: Re: SysctlFS) 
Message-ID:  <200007161535.JAA11844@berserker.bsdi.com>

next in thread | raw e-mail | index | archive | help

	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




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