Commit Graph

259 Commits

Author SHA1 Message Date
Poul-Henning Kamp
5ea98f59b9 Fix a logic bug in the struct dev_t allocation code.
Spotted by:	Neelkanth Natu <neelnatu@yahoo.com>
2002-09-08 15:15:12 +00:00
Bruce Evans
ff557fa1a9 Break the following implementation of panic(3):
#!bin/sh

	# Original version of this by Michael Reifenberger
	# <root@nihil.plaut.de>.

	mdconfig -d -u 11 >/dev/null 2>&1
	dd if=/dev/zero of=zz bs=1m count=1

	while :
	do
		mdconfig -a -t vnode -f zz -u 11
		fdisk -f - -iv /dev/md11 <<EOF1
		g c1 h64 s32
		p 1 165 0 2048
		a 1
	EOF1
		mdconfig -d -u 11
	done

Garbage pointers in __si_u were not cleared by destroy_dev().  Not
clearing si_disk made the above fatal because the disk layer uses
si_disk as a flag to indicate that the dev_t has been completely
initialized.  disk_destroy() clears si_disk for the parent dev_t
but doesn't get called for children.

Not fixed:
- setting the undocumented sysctl debug.free_devt should cause more
  complete destruction of the dev_t including clearing of __si_u, but
  actually causes the above to panic a little earlier.
- the loop leaks 10 memory allocations per iteration (4 DEVFS, 2 devbuf
  and 4 dev_t).

Reviewed by:	timeout by MAINTAINER after 3 months
2002-04-25 13:17:33 +00:00
Poul-Henning Kamp
01de1b13b8 Make the proposed name arg to dev_stdclone() const. 2002-03-10 10:50:05 +00:00
Brian Feldman
1b56782026 (Doing that whole test-immediately-after-commit-thing like obrien sez:)
Forgot to include lock.h and mutex.h for GIANT_REQUIRED.
2002-02-16 17:44:43 +00:00
Brian Feldman
1fd9f8f438 Add revoke_and_destroy_dev(), to be used by devices which decide when
they choose to destroy themselves without regard to whether or not
they are open.
2002-02-16 17:35:05 +00:00
Mike Smith
a7489fe56f Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST,
and devices can be created anytime after that.

Print a warning if an atttempt is made to create a device too early.
2002-01-09 04:58:49 +00:00
Poul-Henning Kamp
24d5c95471 Back out the previous fix to the leading zero problem, I hadn't
noticed it in there already.  That should teach me to check exit
code from cvsup.
2001-11-16 17:07:47 +00:00
Poul-Henning Kamp
10786074c5 Reject leading zeros in dev_stdclone().
PR:		32019
Submitted by:	fenner
2001-11-16 17:05:07 +00:00
Bill Fenner
b519852a02 Do not allow leading zeros on device names in dev_stdclone().
PR:		kern/32019
Reviewed by:	phk
2001-11-15 23:27:46 +00:00
Poul-Henning Kamp
4e13006747 Fix a problem in the disk related hack where device nodes for a physically
non-existent disk in a legacy /dev on a DEVFS system would panic the system
if stat(2)'ed.

Do not whine about anonymous device nodes not having a si_devsw, they're
not supposed to.
2001-10-28 09:39:28 +00:00
Poul-Henning Kamp
4e4a76633b Nudge the axe a bit closer to cdevsw[]:
Make it a panic to repeat make_dev() or destroy_dev(), this check
   should maybe be neutered when -current goes -stable.

   Whine if devsw() is called on anon dev_t's in a devfs system.

   Make a hack to avoid our lazy-eval disk code triggering the above whine.

   Fix the multiple make_dev() in disk code by making ${disk}${unit}s${slice}
   an alias/symlink to ${disk}${unit}s${slice}c
2001-10-27 17:44:21 +00:00
Poul-Henning Kamp
5f7806ab69 Make cdevsw[] static. 2001-10-26 15:31:22 +00:00
Jonathan Lemon
7e7c3f3f33 Add dev_named(dev, name), which is similar in spirit to devtoname().
This function returns success if the device is known by either 'name'
or any of its aliases.
2001-10-17 18:47:12 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Warner Losh
c7021493ba Make the fmt arguments to make_dev and make_dev_alias const char *.
Approved on IRC as long as it didn't cause a large number of warnings by: phk

MFC After: 700 hours
2001-08-02 20:35:35 +00:00
Poul-Henning Kamp
3344c5a17e Create a general facility for making dev_t's depend on another
dev_t.  The dev_depends(dev_t, dev_t) function is for tying them
to each other.

When destroy_dev() is called on a dev_t, all dev_t's depending
on it will also be destroyed (depth first order).

Rewrite the make_dev_alias() to use this dependency facility.

kern/subr_disk.c:
Make the disk mini-layer use dependencies to make sure all
relevant dev_t's are removed when the disk disappears.

Make the disk mini-layer precreate some magic sub devices
which the disk/slice/label code expects to be there.

kern/subr_disklabel.c:
Remove some now unneeded variables.

kern/subr_diskmbr.c:
Remove some ancient, commented out code.

kern/subr_diskslice.c:
Minor cleanup.  Use name from dev_t instead of dsname()
2001-05-26 08:27:58 +00:00
Brian Somers
56700d4634 Call strlen() once instead of twice. 2001-04-14 21:33:58 +00:00
Poul-Henning Kamp
15b6f00fd1 Add a KASSERT on unit2minor() so that we catch it if people try to pass
us unit numbers which doesn't fit in 24 bits.
2001-03-20 13:24:24 +00:00
Kirk McKusick
589c7af992 Fixes to track snapshot copy-on-write checking in the specinfo
structure rather than assuming that the device vnode would reside
in the FFS filesystem (which is obviously a broken assumption with
the device filesystem).
2001-03-07 07:09:55 +00:00
Brian Somers
115867175a KASSERT that the minor number passed to make_dev() is valid. 2001-02-02 03:32:11 +00:00
Poul-Henning Kamp
1fd7b93f3f Convert a Debugger(3) to a panic(9) and a EINVAL.
Reminded by:	bde
2001-01-21 21:19:49 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Poul-Henning Kamp
959b7375ed Staticize some malloc M_ instances. 2000-12-08 20:09:00 +00:00
John Baldwin
9842fc8dda Axe some unused variables. 2000-11-10 21:54:19 +00:00
Poul-Henning Kamp
a16d0eb2d7 Deprecate devsw->d_bmaj entirely.
This removes support for booting current kernels with very old bootblocks.

Device driver writers: Please remove initializations for the d_bmaj
field in your cdevsw{}.
2000-10-31 10:58:14 +00:00
Poul-Henning Kamp
fe4e324374 Allow all users to access the dev -> devname sysctl. 2000-10-29 19:50:06 +00:00
Poul-Henning Kamp
b0d17ba69e Rename lminor() to dev2unit(). This function gives a linear unit number
which hides the 'hole' in the minor bits.

Introduce unit2minor() to do the reverse operation.

Fix some some make_dev() calls which didn't use UID_* or GID_* macros.

Kill the v_hashchain alias macro, it hides the real relationship.

Introduce experimental SI_CHEAPCLONE flag set it on cloned bpfs.
2000-09-19 10:28:44 +00:00
Poul-Henning Kamp
5ef2707e6e revent multiple make_dev() calls on the same dev_t and similar bogosities.
A couple of new warnings may be emitted during boot if drivers DTWT.

Tested by:	George Cox <gjvc@gjvc.com>
2000-09-11 17:15:33 +00:00
Poul-Henning Kamp
8d25eb2c3a Add code to devname(3) so it can find the names of devices which
were not present when dev_mkdb(8) was run.

First the dev_mkdb(8) database is searched, this caters for non-DEVFS
cases where people have renamed a device.

If that fails we ask the kernel using sysctl kern.devname if the device
driver has put a name in the dev_t.  This covers DEVFS cloned devices.

If that also fails we format a string which isn't entirely useless.
2000-09-09 11:39:59 +00:00
Poul-Henning Kamp
db90128160 Avoid the modules madness I inadvertently introduced by making the
cloning infrastructure standard in kern_conf.  Modules are now
the same with or without devfs support.

If you need to detect if devfs is present, in modules or elsewhere,
check the integer variable "devfs_present".

This happily removes an ugly hack from kern/vfs_conf.c.

This forces a rename of the eventhandler and the standard clone
helper function.

Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include
like <sys/queue.h>

Remove all #includes of opt_devfs.h they no longer matter.
2000-09-02 19:17:34 +00:00
Poul-Henning Kamp
3f54a085a6 Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)
Remove old DEVFS support fields from dev_t.

  Make uid, gid & mode members of dev_t and set them in make_dev().

  Use correct uid, gid & mode in make_dev in disk minilayer.

  Add support for registering alias names for a dev_t using the
  new function make_dev_alias().  These will show up as symlinks
  in DEVFS.

  Use makedev() rather than make_dev() for MFSs magic devices to prevent
  DEVFS from noticing this abuse.

  Add a field for DEVFS inode number in dev_t.

  Add new DEVFS in fs/devfs.

  Add devfs cloning to:
        disk minilayer (ie: ad(4), sd(4), cd(4) etc etc)
        md(4), tun(4), bpf(4), fd(4)

  If DEVFS add -d flag to /sbin/inits args to make it mount devfs.

  Add commented out DEVFS to GENERIC
2000-08-20 21:34:39 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Poul-Henning Kamp
192c06ea1b Change the "bdev-whiner" to whine when open is attempted and extend
the deadline a month.
2000-05-09 18:53:57 +00:00
Kris Kennaway
8c6ac5e5a5 Reword warning to make it clearer (I read it as "remove block devices created
before 2000-06-01" which is obviously not what was intended :-)
2000-03-25 21:10:20 +00:00
Poul-Henning Kamp
e004067750 Whine at users who still have block devices in /dev, give them until
june 1st to fix their system.
2000-03-21 19:25:56 +00:00
Boris Popov
8dc74b6288 Backout previous commit. It was a mistake. 2000-01-23 15:47:46 +00:00
Boris Popov
9e991dfa2f Replace non obvious number with SPECNAMELEN constant.
Reviewed by:	phk
2000-01-23 14:58:53 +00:00
Poul-Henning Kamp
fb01c24c11 Be more careful about NOUDEV and NODEV.
Submitted by:	bde
2000-01-04 12:51:50 +00:00
Poul-Henning Kamp
c464420c89 Report swapdevices as cdevs rather than bdevs.
Remove unused dev2budev() function.
1999-11-29 21:37:18 +00:00
Poul-Henning Kamp
38941f351c Remove the now unused chrtoblk() function. 1999-11-29 20:50:58 +00:00
Peter Wemm
900942ba53 Zap devsw_module_handler(). 1999-11-08 08:10:00 +00:00
Poul-Henning Kamp
44d1184e81 Rename remove_dev() to destroy_dev().
Nagged about by:        msmith
1999-11-08 07:44:01 +00:00
Poul-Henning Kamp
d53dedee55 Remove the devsw magic from DEV_MODULE() 1999-11-07 10:01:17 +00:00
Poul-Henning Kamp
662761a74b A little step further in the dev_t cleanups:
Refuse to register a bmajor if the D_DISK flag is not set in cdevsw.

A little bit of cleanup while here.
1999-10-04 11:42:41 +00:00
Bruce Evans
c32cc1493f Const'ify devtoname() and d_name. This exposes some errors (2 non-benign).
Handle negative minor numbers properly in devtoname().
1999-09-13 12:29:32 +00:00
Poul-Henning Kamp
d137accc89 Add dev_t freeing code. Controlled by sysctl debug.free_devt, default
is off.
1999-08-29 09:09:12 +00:00
Poul-Henning Kamp
a87b535090 Put a brief comment on a couple of #defines. 1999-08-28 19:21:36 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Poul-Henning Kamp
9dcbe2404a Convert DEVFS hooks in (most) drivers to make_dev().
Diskslice/label code not yet handled.

Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)

Add the correct hook for devfs to kern_conf.c

The net result of this excercise is that a lot less files depends on DEVFS,
and devtoname() gets more sensible output in many cases.

A few drivers had minor additional cleanups performed relating to cdevsw
registration.

A few drivers don't register a cdevsw{} anymore, but only use make_dev().
1999-08-23 20:59:21 +00:00
Julian Elischer
1744fcd082 First small steps at merging DEVFS and PHK's Dev_t stuff. 1999-08-20 20:25:00 +00:00
Bill Fumerola
b8e49f681b Welcome devtoname(), to most likely be used when printing information
about a dev_t.

printf("%x", dev) now becomes printf("%s", devtoname(dev)) because
printing actual information about the device is much more useful then
printing a pointer to an address that would never help the developer debug.

Submitted by:	phk, bde
1999-08-17 20:25:50 +00:00
Poul-Henning Kamp
9a27d57978 Introduce lminor(dev_t dev), which returns a linear minor number,
ie: hides the fact that the major number is stuck in the middle.
1999-08-15 09:32:47 +00:00
Poul-Henning Kamp
7dc5cd047f The bdevsw() and cdevsw() are now identical, so kill the former. 1999-08-13 10:29:38 +00:00
Poul-Henning Kamp
0ef1c82630 Decommision miscfs/specfs/specdev.h. Most of it goes into <sys/conf.h>,
a few lines into <sys/vnode.h>.

Add a few fields to struct specinfo, paving the way for the fun part.
1999-08-08 18:43:05 +00:00
Greg Lehey
32c0c324d5 cdevsw_remove: place correct value in bmaj2cmaj. This had caused
warnings of the following nature on reloading a kld:

  WARNING: "vinum" is usurping "console"'s bmaj

This only applies to cases where "console" is mentioned.

Broken-by:	  grog
1999-08-08 00:34:00 +00:00
Brian Feldman
57d86fc695 Fix a REALLY embarrassing mistake. Don't look; I warned you. 1999-07-20 21:51:12 +00:00
Brian Feldman
fb30b5bdaf Make a dev2budev() function, and use it. This refixes pstat (working, broken,
working, broken, working) and savecore (working, working, broken, working,
working).

Sorta Reviewed by:	phk
1999-07-20 21:29:13 +00:00
Poul-Henning Kamp
698bfad7f2 Now a dev_t is a pointer to struct specinfo which is shared by all specdev
vnodes referencing this device.

Details:
        cdevsw->d_parms has been removed, the specinfo is available
        now (== dev_t) and the driver should modify it directly
        when applicable, and the only driver doing so, does so:
        vn.c.  I am not sure the logic in checking for "<" was right
        before, and it looks even less so now.

        An intial pool of 50 struct specinfo are depleted during
        early boot, after that malloc had better work.  It is
        likely that fewer than 50 would do.

        Hashing is done from udev_t to dev_t with a prime number
        remainder hash, experiments show no better hash available
        for decent cost (MD5 is only marginally better)  The prime
        number used should not be close to a power of two, we use
        83 for now.

        Add new checkalias2() to get around the loss of info from
        dev2udev() in bdevvp();

        The aliased vnodes are hung on a list straight of the dev_t,
        and speclisth[SPECSZ] is unused.  The sharing of struct
        specinfo means that the v_specnext moves into the vnode
        which grows by 4 bytes.

        Don't use a VBLK dev_t which doesn't make sense in MFS, now
        we hang a dummy cdevsw on B/Cmaj 253 so that things look sane.

	Storage overhead from all of this is O(50k).

        Bump __FreeBSD_version to 400009

The next step will add the stuff needed so device-drivers can start to
hang things from struct specinfo
1999-07-20 09:47:55 +00:00
Poul-Henning Kamp
3de280c443 [click] Now all dev_t's in the kernel have their char device major.
Only know casualy of this is swapinfo/pstat which should be fixes
the right way:  Store the actual pathname in the kernel like mount
does.  [Volounteers sought for this task]

The road map from here is roughly:  expand struct specinfo into struct
based dev_t.  Add dev_t registration facilities for device drivers and
start to use them.
1999-07-19 09:37:59 +00:00
Poul-Henning Kamp
d21c632c4b Use 256 as magic in bmaj2cmaj[]. Treat BLK/CHR dev_t more correctly. 1999-07-17 19:57:25 +00:00
Poul-Henning Kamp
f008cfcc1a I have not one single time remembered the name of this function correctly
so obviously I gave it the wrong name.  s/umakedev/makeudev/g
1999-07-17 18:43:50 +00:00
Poul-Henning Kamp
03016f421b Remove cmaj and bmaj args from DEV_DRIVER_MODULE. 1999-07-04 14:58:56 +00:00
Poul-Henning Kamp
c31558b215 Warn about drivers which take over other drivers cdevsw entries, but still
grant them squatters right.
1999-07-03 08:22:30 +00:00
Doug Rabson
6d4ce7aa8c * Call cdevsw_remove from the MOD_UNLOAD event.
* Fix a couple of warnings while I'm here.
1999-06-26 11:39:27 +00:00
Greg Lehey
9a9eb2b92b Add function cdevsw_remove, the opposite of cdevsw_add: remove an
entry in cdevsw (and bdevsw if appropriate).

Reviewed-by: phk
1999-06-25 07:49:01 +00:00
Dmitrij Tejblum
4ea5ad99d5 || vs && confusion in cdevsw_add(). 1999-06-01 20:41:26 +00:00
Poul-Henning Kamp
6fcd8a7c93 Introduce the makebdev() function, it does the same as the makedev()
function for now, but that will change.
1999-06-01 18:56:26 +00:00
Poul-Henning Kamp
2447bec829 Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it.  cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables.  Most places they were used
bogusly.  Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
        72 bogus makedev() calls
        26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed.  Patches emailed to authors.  LINT
probably broken until they catch up.
1999-05-31 11:29:30 +00:00
Luoqi Chen
519566d2e3 Avoid negative numbers in dev_t manipulation. This should fix recent MFS
related crashes.
1999-05-18 13:14:43 +00:00
Poul-Henning Kamp
e519e78b42 braino. 1999-05-12 13:06:34 +00:00
Poul-Henning Kamp
adfea48f2b Produce compiler warning if dev_t and udev_t is confused. 1999-05-12 11:06:56 +00:00
Poul-Henning Kamp
bfbb9ce670 Divorce "dev_t" from the "major|minor" bitmap, which is now called
udev_t in the kernel but still called dev_t in userland.

Provide functions to manipulate both types:
        major()         umajor()
        minor()         uminor()
        makedev()       umakedev()
        dev2udev()      udev2dev()

For now they're functions, they will become in-line functions
after one of the next two steps in this process.

Return major/minor/makedev to macro-hood for userland.

Register a name in cdevsw[] for the "filedescriptor" driver.

In the kernel the udev_t appears in places where we have the
major/minor number combination, (ie: a potential device: we
may not have the driver nor the device), like in inodes, vattr,
cdevsw registration and so on, whereas the dev_t appears where
we carry around a reference to a actual device.

In the future the cdevsw and the aliased-from vnode will be hung
directly from the dev_t, along with up to two softc pointers for
the device driver and a few houskeeping bits.  This will essentially
replace the current "alias" check code (same buck, bigger bang).

A little stunt has been provided to try to catch places where the
wrong type is being used (dev_t vs udev_t), if you see something
not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if
it makes a difference.  If it does, please try to track it down
(many hands make light work) or at least try to reproduce it
as simply as possible, and describe how to do that.

Without DEVT_FASCIST I belive this patch is a no-op.

Stylistic/posixoid comments about the userland view of the <sys/*.h>
files welcome now, from userland they now contain the end result.

Next planned step: make all dev_t's refer to the same devsw[] which
means convert BLK's to CHR's at the perimeter of the vnodes and
other places where they enter the game (bootdev, mknod, sysctl).
1999-05-11 19:55:07 +00:00
Poul-Henning Kamp
52400704e9 Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between
a major number for a dev_t.
1999-05-09 13:00:50 +00:00
Poul-Henning Kamp
8f0024a54a Peter beat me to half this patch, but didn't do the other half:
set d_bmaj

	don't cast a dev_t to int before comparing to NODEV
1999-05-09 08:18:12 +00:00
Peter Wemm
0da14f00bf Comment advising ordering of cdevsw_add and bdevsw_add is obsolete (no
bdevsw_add any more).
1999-05-09 08:10:17 +00:00
Poul-Henning Kamp
4be2eb8c49 I got tired of seeing all the cdevsw[major(foo)] all over the place.
Made a new (inline) function devsw(dev_t dev) and substituted it.

Changed to the BDEV variant to this format as well: bdevsw(dev_t dev)

DEVFS will eventually benefit from this change too.
1999-05-08 06:40:31 +00:00
Poul-Henning Kamp
46eede0058 Continue where Julian left off in July 1998:
Virtualize bdevsw[] from cdevsw.  bdevsw() is now an (inline)
        function.

        Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention
        to the order of the cmaj/bmaj arguments!)

        Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE
        (ditto!)

(Next step will be to convert all bdev dev_t's to cdev dev_t's
before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
1999-05-07 10:11:40 +00:00
Doug Rabson
6ca34d85be Call the module's unload handler before removing the device from the
cdevsw list.  This allows a handler to veto the load without losing its
place in the list.

PR:	kern/10653
1999-03-23 21:11:47 +00:00
Matthew Dillon
d254af07a1 Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile
1999-01-27 21:50:00 +00:00
Garrett Wollman
14177d72cd My changes to the new device interface:
- Interface wth the new resource manager.
	- Allow for multiple drivers implementing a single devclass.
	- Remove ordering dependencies between header files.
	- Style cleanup.
	- Add DEVICE_SUSPEND and DEVICE_RESUME methods.
	- Move to a single-phase interrupt setup scheme.

Kernel builds on the Alpha are brken until Doug gets a chance to incorporate
these changes on that side.

Agreed to in principle by: dfr
1998-11-14 21:58:51 +00:00
Poul-Henning Kamp
f5ef029e92 Nitpicking and dusting performed on a train. Removes trivial warnings
about unused variables, labels and other lint.
1998-10-25 17:44:59 +00:00
Julian Elischer
f7ea2f55d1 There is no such thing any more as "struct bdevsw".
There is only cdevsw (which should be renamed in a later edit to deventry
or something). cdevsw contains the union of what were in both bdevsw an
cdevsw entries.  The bdevsw[] table stiff exists and is a second pointer
to the cdevsw entry of the device. it's major is in d_bmaj rather than
d_maj. some cleanup still to happen (e.g. dsopen now gets two pointers
to the same cdevsw struct instead of one to a bdevsw and one to a cdevsw).

rawread()/rawwrite() went away as part of this though it's not strictly
the same  patch, just that it involves all the same lines in the drivers.

cdroms no longer have write() entries (they did have rawwrite (?)).
tapes no longer have support for bdev operations.

Reviewed by: Eivind Eklund and Mike Smith
	Changes suggested by eivind.
1998-07-04 22:30:26 +00:00
Poul-Henning Kamp
7c281842e3 Remove isdisk() hacks. 1998-06-26 18:14:25 +00:00
Poul-Henning Kamp
b62591052c Remove bdevsw_add(), change the only two users to use bdevsw_add_generic().
Extend cdevsw to be superset of bdevsw.
Remove non-functional bdev lkm support.
Teach wcd what the open() args mean.
1998-06-25 11:28:07 +00:00
Doug Rabson
ecbb00a262 This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
Bruce Evans
cb451ebdbd Staticized. 1997-11-22 08:35:46 +00:00
KATO Takenori
81bca6ddae Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW
   bits of the mnt_flag.  The sysctl variables, vfs.foo.doclusterread
   and vfs.foo.doclusterwrite are deleted.  Only mount option can
   control clustered I/O from userland.
2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR
   and D_CLUSTERW bits of the d_flags member in the block device switch
   table.  If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR /
   MNT_NOCLUSTERW bits will be set.  In this case, MNT_NOCLUSTERR and
   MNT_NOCLUSTERW cannot be cleared from userland.
3. Vnode driver disables both clustered read and write.
4. Union filesystem disables clutered write.

Reviewed by:	bde
1997-09-27 13:40:20 +00:00
Julian Elischer
e29b30aa7d urk, fix spelling error in comment I just fixed. 1997-09-21 22:20:12 +00:00
Julian Elischer
4010d6d962 Fix a comment. 1997-09-21 22:14:54 +00:00
Peter Wemm
51338ea83c Various select -> poll changes 1997-09-14 02:52:18 +00:00
Bruce Evans
1fd0b0588f Removed unused #includes. 1997-08-02 14:33:27 +00:00
Julian Elischer
939c19614c tiny spelling fix in comment 1997-06-02 04:56:38 +00:00
Peter Wemm
6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
John Dyson
996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>
1997-02-10 02:22:35 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Bruce Evans
f7f70b3d0f Fixed a null pointer panic in ADDENTRY(). Unloading the lkm and joy
modules sort of works now.  Their devswitch entries aren't cleaned
up, so accessing them after they have been unloaded causes a panic
in spec_open().

Submitted by:	durian@plutotech.com (Mike Durian), IIRC
1996-12-06 12:47:05 +00:00
Poul-Henning Kamp
19060a3ad9 init_main.c: pass -d to init if DEVFS_ROOT
kern_conf.c:	gd driver is a disk.
vfs_subr.c:	include opt_devfs.h
1996-10-28 11:34:57 +00:00
Julian Elischer
313861b896 for kern_conf.c, start allocating dynamic major numbers
half way through the range rather than possibly colliding with
fixed elements. Increase the size of the arrays to take this into account..
remember that each element in the array is now only 1 ponter  so this
isn't that much..

also note a possible bug in debugging code in uipc_socket2.c (add XXX)
1996-08-19 19:22:26 +00:00
Poul-Henning Kamp
cba8a5ddd3 Make a "DWIM" function for adding [bc]devsw entries for bdev drivers.
Saves about 280 butes of source per driver, 56 bytes in object size
and another 56 bytes moves from data to bss.

No functional change intended nor expected.

GENERIC should be about one k smaller now :-)
1996-07-23 21:52:43 +00:00
Poul-Henning Kamp
79c0c4b77f kern_conf.c: remove a now unused variable.
vfs_cache.c: Fix a very rare probelm in the vnode-cache.
Submitted by:	Terry Lambert <terry@lambert.org>
1995-12-22 15:56:35 +00:00
Julian Elischer
1dfcbb0ce3 i386/i386/conf.c is no longer needed.. remove it from files.i386
redistribute a few last routines to beter places and shoot the file

I haven't act actually 'deleted' the file yet togive people time
to
have done a config.. I.e. they are likely to have done one in a week or so
so I'll remove it then..
 it's now empty.
makes the question of a USL copyright rather moot.
1995-12-21 20:09:46 +00:00
Julian Elischer
6ba9ebce28 devsw tables are now arrays of POINTERS to struct [cb]devsw
seems to work hre just fine though  I can't check every file
that changed due to limmited h/w, however I've checked enught to be petty
happy withe hte code..

WARNING... struct lkm[mumble] has changed
so it might be an idea to recompile any lkm related programs
1995-12-13 15:13:57 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
Julian Elischer
de1676f933 A pair of really tiny patches that not only allow it all to compile
but also IT ACTUALLY WORKS!
FreeBSD with options  JREMOD now runs with no entries in the devsw tables
prior to the devices puting their own entries there..

Thanks to bde and terry for thoughts and comments.
next stop 'Real' devfs support in devices.
1995-11-30 05:59:09 +00:00
Julian Elischer
adb2dc299a #ifdef out nearly the entire file of conf.c when JREMOD is defined
add a few safety checks in specfs because
now it's possible to get entries in [cd]devsw[] which are ALL NULL
so it's better to discover this BEFORE jumping into the d_open() entry..

more check to come later.. this getsthe code to the stage where I
can start testing it, even if I haven't caught every little error case...
I guess I'll find them quick enough..
1995-11-29 12:38:49 +00:00
Julian Elischer
4c1a35b2a6 fix REALLY STUPID bug/typo
don't look at the diffs.. it's too embarassing :)
1995-10-04 08:58:00 +00:00
Julian Elischer
f8a760b32a actually compiles.. (previous commit was to just get it into the tree) 1995-10-02 10:15:40 +00:00
Julian Elischer
26453f354f Obtained from: well it has a relationship with the LKM code..
This is a place for all things to do with conf.c and conf.h
that are not machine specific.
Other things that are at present in i386/isa/conf.c might
migrate into here..
It's the first small step in cleaning up the device interface
to make it more dynamic and to assist in more modular drivers
(i.e. both loadable via LKMs and linked in..
e.g able to add a device without having to edit conf.c)

this code is not yet used and the whole thing will be conditionally
compiled in for a while till proven useful :)
1995-10-02 09:24:44 +00:00