FreeBSD src
Go to file
Poul-Henning Kamp e606a3c63e Rewamp DEVFS internals pretty severely [1].
Give DEVFS a proper inode called struct cdev_priv.  It is important
to keep in mind that this "inode" is shared between all DEVFS
mountpoints, therefore it is protected by the global device mutex.

Link the cdev_priv's into a list, protected by the global device
mutex.  Keep track of each cdev_priv's state with a flag bit and
of references from mountpoints with a dedicated usecount.

Reap the benefits of much improved kernel memory allocator and the
generally better defined device driver APIs to get rid of the tables
of pointers + serial numbers, their overflow tables,  the atomics
to muck about in them and all the trouble that resulted in.

This makes RAM the only limit on how many devices we can have.

The cdev_priv is actually a super struct containing the normal cdev
as the "public" part, and therefore allocation and freeing has moved
to devfs_devs.c from kern_conf.c.

The overall responsibility is (to be) split such that kern/kern_conf.c
is the stuff that deals with drivers and struct cdev and fs/devfs
handles filesystems and struct cdev_priv and their private liason
exposed only in devfs_int.h.

Move the inode number from cdev to cdev_priv and allocate inode
numbers properly with unr.  Local dirents in the mountpoints
(directories, symlinks) allocate inodes from the same pool to
guarantee against overlaps.

Various other fields are going to migrate from cdev to cdev_priv
in the future in order to hide them.  A few fields may migrate
from devfs_dirent to cdev_priv as well.

Protect the DEVFS mountpoint with an sx lock instead of lockmgr,
this lock also protects the directory tree of the mountpoint.

Give each mountpoint a unique integer index, allocated with unr.
Use it into an array of devfs_dirent pointers in each cdev_priv.
Initially the array points to a single element also inside cdev_priv,
but as more devfs instances are mounted, the array is extended with
malloc(9) as necessary when the filesystem populates its directory
tree.

Retire the cdev alias lists, the cdev_priv now know about all the
relevant devfs_dirents (and their vnodes) and devfs_revoke() will
pick them up from there.  We still spelunk into other mountpoints
and fondle their data without 100% good locking.  It may make better
sense to vector the revoke event into the tty code and there do a
destroy_dev/make_dev on the tty's devices, but that's for further
study.

Lots of shuffling of stuff and churn of bits for no good reason[2].

XXX: There is still nothing preventing the dev_clone EVENTHANDLER
from being invoked at the same time in two devfs mountpoints.  It
is not obvious what the best course of action is here.

XXX: comment out an if statement that lost its body, until I can
find out what should go there so it doesn't do damage in the meantime.

XXX: Leave in a few extra malloc types and KASSERTS to help track
down any remaining issues.

Much testing provided by:		Kris
Much confusion caused by (races in):	md(4)

[1] You are not supposed to understand anything past this point.

[2] This line should simplify life for the peanut gallery.
2005-09-19 19:56:48 +00:00
bin Add a "-q" quiet flag to kenv so that warnings can be suppressed. 2005-09-13 19:01:53 +00:00
contrib Fix get{w,d}{l,b}e, set{w,d}{l,b}e macros on big endian systems. 2005-09-19 08:11:04 +00:00
crypto Regenerate 2005-09-03 07:08:51 +00:00
etc In mountd_precmd(), use rc_args, not mountd_args to 2005-09-18 17:04:26 +00:00
games Remove a duplicate and fix a typo. 2005-09-10 08:27:07 +00:00
gnu Include <sys/defs.h> to get __ISO_C_VISIBLE definition is one is not 2005-09-16 21:24:10 +00:00
include Back out 1.247. On ia64 <osreldate.h> is included from assembler source, 2005-09-14 09:01:06 +00:00
kerberos5 Bump the shared library version number of all libraries that have not 2005-07-22 17:19:05 +00:00
lib When (re)allocating space for an array of pointers to char, use 2005-09-19 18:43:11 +00:00
libexec Clean out the leftovers from the i386_set_gsbase() TLS conversion. 2005-06-29 23:15:36 +00:00
release Add esp(4). 2005-09-18 16:22:20 +00:00
rescue Respect the YES_HESIOD build variable. 2005-08-06 16:53:55 +00:00
sbin Merged from src/sbin/fdisk/fdisk.c revision 1.81. 2005-09-18 02:38:29 +00:00
secure Update for OpenSSH 4.2p1. 2005-09-03 07:10:33 +00:00
share Update the list of supported hardware. 2005-09-19 18:16:29 +00:00
sys Rewamp DEVFS internals pretty severely [1]. 2005-09-19 19:56:48 +00:00
tools Small regression test tool to generate two forms of ENOSPC on a file 2005-09-19 16:29:36 +00:00
usr.bin Setting .nofinger will not hide you from root. 2005-09-19 10:11:47 +00:00
usr.sbin Restore the ability to detach from a tty via SIOCSTTY and document 2005-09-19 13:48:45 +00:00
COPYRIGHT Complete 2005 transition. 2005-01-01 07:29:20 +00:00
LOCKS Document the previously existing RELENG_[45]_* security branch locks. 2005-06-02 22:57:30 +00:00
MAINTAINERS Add myself as a maintainer of Bluetooth code 2005-08-25 17:14:39 +00:00
Makefile Add delete-old and delete-old-libs targets: 2005-07-23 14:23:30 +00:00
Makefile.inc1 Fix a couple of typos 2005-08-23 07:58:55 +00:00
ObsoleteFiles.inc Add the {get,put}ino man pages for those people which got them in the 2005-09-11 18:19:42 +00:00
README KerberosIV de-orbit burn continues. Disconnect from "make world". 2003-03-08 10:01:26 +00:00
UPDATING Be a little more obvious about the steps to build a kernel. 2005-09-09 15:59:17 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html