History log of /freebsd-10.1-release/sys/geom/geom_ccd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 223921 11-Jul-2011 ae

Include sys/sbuf.h directly.

Reviewed by: pjd


# 185318 25-Nov-2008 lulf

- Fix a potential NULL pointer reference. Note that this should not happen in
practice, but it is a good programming practice and allows the kernel to not
depend on userland correctness.
- While there, make sizeof usage match the rest of the code.

Found with: Coverity Prevent(tm)
CID: 660, 662


# 181463 09-Aug-2008 des

Add sbuf_new_auto as a shortcut for the very common case of creating a
completely dynamic sbuf.

Obtained from: Varnish
MFC after: 2 weeks


# 157740 13-Apr-2006 cracauer

Make CCD be able to read and write Linux software raids.

Supported for raid-0 with <n> disks, raid-1 with 2 disks.

Manpages have examples, warnings etc.

Test scripts on
http://www.cons.org/cracauer/ccdconfig-linux/
Reviewed by: alfred


# 157581 07-Apr-2006 marcel

Change gctl_set_param() to return an error instead of setting an
error on the request. Add a wrapper, gctl_set_param_err(), that
sets the error on the request from the error returned by
gctl_set_param() and update current callers of gctl_set_param()
to call gctl_set_param_err() instead.
This makes gctl_set_param() much more usable in situations where
the caller knows better what to do with certain (apparent) error
conditions and setting an error on the request is not one of the
things that need to be done.


# 139778 06-Jan-2005 imp

/* -> /*- for copyright notices, minor format tweaks as necessary


# 133318 08-Aug-2004 phk

Tag all geom classes in the tree with a version number.


# 133314 08-Aug-2004 phk

Use default method initialization on geoms.


# 125755 12-Feb-2004 phk

Remove the absolute count g_access_abs() function since experience has
shown that it is not useful.

Rename the relative count g_access_rel() function to g_access(), only
the name has changed.

Change all g_access_rel() calls in our CVS tree to call g_access() instead.

Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source
code compatibility.


# 125651 10-Feb-2004 phk

don't call sbuf_clear() right after sbuf_new(), it is not necessary.


# 122550 12-Nov-2003 phk

Make sure to return errors if we have any.

Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>


# 121476 24-Oct-2003 phk

Close the right consumers if we run into trouble opening them all.

Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>


# 119300 22-Aug-2003 ps

Change the the size fields to daddr_t to support greater than 2TB ccd volumes.

Reviewed by: phk


# 119299 22-Aug-2003 phk

Make CCD unloadable.


# 119296 22-Aug-2003 phk

Block all GETATTR calls hitting the CCD, we wouldn't know which child
device should handle them.

This prevents for instance GEOM::ioctl requests from reaching a
lower BSDlabel node, which ps@ found would confuse newfs(8).


# 119295 22-Aug-2003 phk

Check for null softc pointers, these happens when a ccd is withering.

Found by: David Schultz <dschultz@OCF.Berkeley.EDU>


# 118182 29-Jul-2003 phk

Fix a memory leak in CCD's mirror code.


# 116196 11-Jun-2003 obrien

Use __FBSDID().

Approved by: phk


# 116107 09-Jun-2003 phk

Fix error handling for ENOMEM style issues.


# 115953 07-Jun-2003 phk

Polishing and nitpicking.


# 115849 04-Jun-2003 phk

Make this a true GEOM class:
Attach to the component devices using GEOM semantics.
Create a GEOM provider instead of using disk_create()
Use the GEOM OAM api for configuration.

I saw approx ~1% speedup in througput and ~7% in latency in a
simple minded test of a two-disk striped device.

This file was repo-copied from src/sys/dev/ccd/ccd.c.

This is not yet linked into the build.


# 115731 02-Jun-2003 phk

Further devilification of CCD:

Change the list interface to simplify things.
Remove old list ioctls which bogusly exported the softc to userland.
Move the softc and associated structures from the public header to
the source file.


# 115729 02-Jun-2003 phk

Begin deevilification of CCD:

Make CCD a GEOM class.

For now only use this for implementing a OAM config method which
can return a list of configured CCD devices in the format which
"ccdconfig -g[v]" would normally output.


# 115492 31-May-2003 phk

Remove unused variable.

Found by: FlexeLint


# 113464 14-Apr-2003 phk

More correct patch: Only call biofinish if we have not already sent
any children down the mesh.


# 113462 14-Apr-2003 phk

Call biofinish() also when we get a malloc() failure.


# 112946 01-Apr-2003 phk

Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.


# 112367 18-Mar-2003 phk

Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.


# 111979 08-Mar-2003 phk

Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.


# 111863 04-Mar-2003 phk

Initialize the second buffer for mirroring to point to itself and not its
partner.


# 111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


# 111232 21-Feb-2003 phk

NO_GEOM cleanup: Convert CCD(4) to be use "struct disk*" instead of "dev_t"
as "this" handle.


# 111216 21-Feb-2003 phk

NO_GEOM cleanup:

Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 110729 11-Feb-2003 phk

Announce our ability to do MAXPHYS transfers.


# 110188 01-Feb-2003 phk

Eliminate the sc_openmask, ccdopen() and ccdclose() functions, we
can use the flag maintained by geom_disk.c

Having only a strategy method to intialize, don't waste space using
a cdevsw structure to do so.


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 109535 19-Jan-2003 phk

Finally give CCD the disk mini-layer treatment:

CAUTION:

Previously CCD would be different from all other disks in
the system in that there were no "ccd0" device, only a
"ccd0c" device.

This is no longer so after this commit. If you access a
ccd device through the "/dev/ccd0c" device _and_ have not
actually put a BSD disklabel on the device, you will have
to use the name "/dev/ccd0". If your CCD device contains
a BSD disklabel there should be no difference.

You need to recompile ccdconfig(8) using the changed
src/sys/sys/ccdvar.h for the -g "show me" option to work.

I have run the regression test I created before I started
overhauling CCD and it flags no problems, but this code
is mildly evil, so take care. If you would cry if you lost
what's on CCD, make a back before you upgrade.

Create separate cdevsw for the /dev/ccd.ctl device.

Remove the cloning function, the disk-minilayer will do all naming
for us.

Remove the ccdunit and ccdpart functions and carry the softc pointer
in the relevant dev_t's and structures.

Release all memory when a CCD device is unconfigured, previously
the softc would linger behind.

Remove all traces of BSD disklabel fiddling code.

Remove ccdpsize, the disk mini-layer does this for us.

Don't allocate memory with M_WAITOK in ccdstrategy().

Remove boundary checks which the disk mini-layer does for us.

Don't allocate space for more than 2 ccdbuf, RAID was never implemented.

NB: I have not tried to address any of the preexisting ailments of CCD.


# 109534 19-Jan-2003 phk

Unifdef -UDEBUG on the CCD driver. The debugging is mostly useless
and can be added back selectively, should anybody start to interest
themselves for the internal workings of ccd.

This commit will make the diffs for the following commits much more
readable.


# 109486 18-Jan-2003 phk

Inline now trivial functions getccdbuf() and putccdbuf().
Fix another trivial memory-leak.


# 109482 18-Jan-2003 phk

Fix minor memory-leak.


# 109474 18-Jan-2003 phk

Use the M_CCD malloc bucket instead of M_DEVBUF.
Don't keep a private freelist of a low number of trivially small structures.


# 109473 18-Jan-2003 phk

Inline trivial function ccdintr() into its one caller ccdiodone().
Only call ccdfind() once in ccdiodone() and cache the result.


# 109471 18-Jan-2003 phk

Sanitize the copyright section a bit: We do not need two copies of the
four-clause BSD license in the file, one will do.


# 109421 17-Jan-2003 phk

Find places to store the previously implicityly passed unit number in
the three configuration ioctls which need a unit number.

Add a "ccd.ctl" device for config operations.

Implement ioctls on ccd.ctl which rely on the explicityly passed
unit numbers.

Update ccdconfig to use the new ccd.ctl interface.

Add code to the kernel to detect old ccdconfig binaries, and whine
about it.

Add code to ccdconfig to detect old kernels, and whine about it.

These two compatibility measures will be retained only for a limited
period since they are in the way of GEOM'ification of ccd.


# 108593 03-Jan-2003 phk

Remove CCDF_SWAP and CCDF_PARITY, they have never been implemented.


# 108584 03-Jan-2003 phk

Remove unused second argument from BIO_STRATEGY()


# 108470 30-Dec-2002 schweikh

Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.


# 103942 25-Sep-2002 jeff

- Use vrefcnt() instead of v_usecount.


# 103714 20-Sep-2002 phk

(This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)

If struct disklabel is the messenger: kill the messenger.

Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer). This commit changes this communication to use four
explicit fields instead.

Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.

Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.

The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.

This concludes (modulus any mistakes) the series of disklabel related
commits.

I belive it all amounts to a NOP for all the rest of you :-)

Sponsored by: DARPA & NAI Labs.


# 103278 13-Sep-2002 mux

Fix another two printf() format errors which weren't warned
about because the bio_blknos were bogusly casted to long long.


# 103276 13-Sep-2002 mux

Fix another printf() format error which wasn't warned about
because the bio_blkno was bogusly casted to an int.


# 103275 13-Sep-2002 mux

Fix a printf() format error on 64 bits architectures.
Also fix some style bugs on the same line.


# 97272 25-May-2002 bde

Fixed printf format errors. Most of them are 64-bit daddr_t casualties.
Printing daddr_t's using %d format was always an error, but gcc's
warning about it was ignored for supported 64-bit arches and not printed
for supported 32-bit arches. Hundreds if not thousands thousands of
previously "fixed" daddr_t printings are now broken on 32-bit machines
by casting daddr_t's to longs. daddr_t's should be printed using %jd
format, but this fix uses %lld since %j is not implemented in the
kernel yet.

Fixed some nearby format printf errors (style bugs).


# 96475 12-May-2002 phk

Retire the bogus uses of the disklabel field d_sbsize and begin to
initialize it to zero so we don't have to have everbody and their
aunt including FFS specific header files.

Sponsored by: DARPA & NAI Labs.


# 94182 08-Apr-2002 phk

Move generic disk ioctls from <sys/disklabel.h> to <sys/disk.h>.

Sponsored by: DARPA & NAI Labs


# 93657 02-Apr-2002 phk

Retire the bogus ioctl DIOCGPART in toto.

Once again we can notice that badly thought out hacks ferment and infect
far more code than initially expected.

Sponsored by: DARPA and NAI Labs.


# 93653 02-Apr-2002 phk

One less user of the bogus DIOCGPART ioctl.


# 93395 29-Mar-2002 phk

Remove bogus ccddump() function in favour of the standard nodump.


# 92718 19-Mar-2002 alfred

Fix bio->bio_blkno format warning.


# 92363 15-Mar-2002 mckusick

Introduce the new 64-bit size disk block, daddr64_t. Change
the bio and buffer structures to have daddr64_t bio_pblkno,
b_blkno, and b_lblkno fields which allows access to disks
larger than a Terabyte in size. This change also requires
that the VOP_BMAP vnode operation accept and return daddr64_t
blocks. This delta should not affect system operation in
any way. It merely sets up the necessary interfaces to allow
the development of disk drivers that work with these larger
disk block addresses. It also allows for the development of
UFS2 which will use 64-bit block addresses.


# 91406 27-Feb-2002 jhb

Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.


# 88707 30-Dec-2001 phk

Reduce kernel stack usage of ccdinit() by MAXPATHLEN by using MALLOC(9).

Submitted by: Maxim Konovalov <maxim@macomnet.ru>
MFC after: 1 week


# 86479 16-Nov-2001 iedowse

Return EOPNOTSUPP for unknown module events.

PR: kern/18473
Submitted by: "Jeroen C. van Gelderen" <gelderen@systemics.com>


# 83366 12-Sep-2001 julian

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


# 83291 10-Sep-2001 kris

Fix some signed/unsigned integer confusion, and add bounds checking of
arguments to some functions.

Obtained from: NetBSD
Reviewed by: peter
MFC after: 2 weeks


# 82937 04-Sep-2001 phk

Kill the NCCD constant by modernizing the ccd driver.

Submitted by: sobomax
Reviewed by: phk


# 76366 08-May-2001 phk

Polish error handling with biofinish().


# 76322 06-May-2001 phk

Actually biofinish(struct bio *, struct devstat *, int error) is more general
than the bioerror().

Most of this patch is generated by scripts.


# 74993 29-Mar-2001 gallatin

fix a number of printf format string warnings inside DEBUG ifdefs


# 74810 26-Mar-2001 phk

Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.


# 71773 29-Jan-2001 phk

Fix a braino in ccd's clone routine.

Submitted by: tegge


# 71699 26-Jan-2001 jhb

Back out proc locking to protect p_ucred for obtaining additional
references along with the actual obtaining of additional references.


# 71463 23-Jan-2001 jhb

Proc locking in the form of using the proc lock to protect p_ucred while
we obtain another reference to it for vnode operations.


# 69781 08-Dec-2000 dwmalone

Convert more malloc+bzero to malloc+M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>


# 65374 02-Sep-2000 phk

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.


# 65208 29-Aug-2000 phk

Give ccd a cloning function.


# 62550 04-Jul-2000 mckusick

Move the truncation code out of vn_open and into the open system call
after the acquisition of any advisory locks. This fix corrects a case
in which a process tries to open a file with a non-blocking exclusive
lock. Even if it fails to get the lock it would still truncate the
file even though its open failed. With this change, the truncation
is done only after the lock is successfully acquired.

Obtained from: BSD/OS


# 60041 05-May-2000 phk

Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by: peter


# 59841 01-May-2000 phk

Convert to struct bio instead of struct buf.


# 59794 30-Apr-2000 phk

Remove unneeded #include <vm/vm_zone.h>

Generated by: src/tools/tools/kerninclude


# 59249 15-Apr-2000 phk

Complete the bio/buf divorce for all code below devfs::strategy

Exceptions:
Vinum untouched. This means that it cannot be compiled.
Greg Lehey is on the case.

CCD not converted yet, casts to struct buf (still safe)

atapi-cd casts to struct buf to examine B_PHYS


# 58934 02-Apr-2000 phk

Move B_ERROR flag to b_ioflags and call it BIO_ERROR.

(Much of this done by script)

Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED.

Move b_pblkno and b_iodone_chain to struct bio while we transition, they
will be obsoleted once bio structs chain/stack.

Add bio_queue field for struct bio aware disksort.

Address a lot of stylistic issues brought up by bde.


# 58349 20-Mar-2000 phk

Rename the existing BUF_STRATEGY() to DEV_STRATEGY()

substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo)

substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo)

This patch is machine generated except for the ccd.c and buf.h parts.


# 58345 20-Mar-2000 phk

Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd. The b_iocmd is enforced to have
exactly one bit set.

B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.

Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.

Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue. It is likely to write on your disk
where it should have been reading.

This change is a step in the direction towards a stackable BIO capability.

A lot of this patch were machine generated (Thanks to style(9) compliance!)

Vinum users: Greg has not had time to test this yet, be careful.


# 56825 29-Jan-2000 peter

Remove #if NCCD > 0 - it's guaranteed to be true by config if ccd.c is
being compiled. (NCCD is used elsewhere though :-( )


# 56098 16-Jan-2000 phk

Cleanup some remaining bdev fluff.


# 55756 10-Jan-2000 phk

Give vn_isdisk() a second argument where it can return a suitable errno.

Suggested by: bde


# 54934 21-Dec-1999 eivind

Remove unused variable


# 54655 15-Dec-1999 eivind

Introduce NDFREE (and remove VOP_ABORTOP)


# 54279 08-Dec-1999 ken

Revamp the devstat priority system. All disks now have the same priority.
The same goes for CD drivers and tape drivers. In systems with mixed IDE
and SCSI, devices in the same priority class will be sorted in attach
order.

Also, the 'CCD' priority is now the 'ARRAY' priority, and a number of
drivers have been modified to use that priority.

This includes the necessary changes to all drivers, except the ATA drivers.
Soren will modify those separately.

This does not include and does not require any change in the devstat
version number, since no known userland applications use the priority
enumerations.

Reviewed by: msmith, sos, phk, jlemon, mjacob, bde


# 53577 22-Nov-1999 phk

Convert various pieces of code to use vn_isdisk() rather than checking
for vp->v_type == VBLK.

In ccd: we don't need to call VOP_GETATTR to find the type of a vnode.

Reviewed by: sos


# 52965 07-Nov-1999 phk

Remove the devsw magic from DEV_MODULE()


# 51957 05-Oct-1999 n_hibma

Removal of sys/device.h

- Move intrhook stuff into kernel.h
- Remove all occurrences of #device <device.h>
- Add kernel.h were necessary (nowhere)
- delete device.h

This file contained the structures for cfdata (old style config) and is no
longer used. It was included by most drivers.

It confuses the remote debugger as the definition of 'struct device' in
device.h is found before the one in bus_private.h.


# 51714 26-Sep-1999 grog

Correct typo in comment. putccdbuf() releases a buffer, it doesn't allocate one.


# 51701 26-Sep-1999 dillon

Buffer locking code failed to use BUF_KERNPROC and BUF_UNLOCK and
BUF_LOCKFREE a buffer prior to physically freeing it. While these
bugs did not cause a crash, they might in the future.

Added eof handling for unlabeled partitions.

Submitted by: Tor.Egge@fast.no


# 51658 25-Sep-1999 phk

Remove five now unused fields from struct cdevsw. They should never
have been there in the first place. A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags


# 51601 23-Sep-1999 dillon

Cleanup CCD quite a bit, including adding clarifying comments.

Enhance MIRROR code. Add a few more sanity checks and implement
a zone-based disk selector to make use of both disks when reading.

Also implement a read fail-over. If a read error occurs on one
disk, the I/O is retried on the other.

NOTE: CCD's mirroring support cannot deal with write errors properly
in regards to recovery, meaning that 'old' data under a write error may
be read non-deterministically if you reboot after a write error, and CCD
certainly cannot deal with a disk changeout. And it still can't. Use
vinum if you are really serious about mirroring. CCD basically just
implements a poor-man's mirror.


# 51600 23-Sep-1999 dillon

Fix ccdiodone code. The code was using cbp->cb_buf.b_bcount to
sum the total amount of I/O issued to determine when all the I/O
has completed. This fails when the EOF boundry occurs in the middle
of an I/O. Using cbp->cb_buf.b_bufsize works better.


# 51580 22-Sep-1999 dillon

Fix bug in pseudo-geometry calculation code that assumed a sector size
smaller then 1024 bytes.


# 51376 18-Sep-1999 phk

Use devstat_end_transaction_buf() rather than Use devstat_end_transaction()


# 51111 09-Sep-1999 julian

Changes to centralise the default blocksize behaviour.
More likely to follow.

Submitted by: phk@freebsd.org


# 50830 03-Sep-1999 julian

Revert a bunch of contraversial changes by PHK. After
a quick think and discussion among various people some form of some of
these changes will probably be recommitted.

The reversion requested was requested by dg while discussions proceed.
PHK has indicated that he can live with this, and it has been agreed
that some form of some of these changes may return shortly after further
discussion.


# 50623 30-Aug-1999 phk

Make bdev userland access work like cdev userland access unless
the highly non-recommended option ALLOW_BDEV_ACCESS is used.

(bdev access is evil because you don't get write errors reported.)

Kill si_bsize_best before it kills Matt :-)

Use the specfs routines rather having cloned copies in devfs.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 50403 26-Aug-1999 phk

Initialize the dev->si_bsize fields.

Submitted by: tegge
Reviewed by: phk


# 49771 14-Aug-1999 phk

Spring cleaning around strategy and disklabels/slices:

Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout.
please see comment in sys/conf.h about the flag argument.

Remove strategy argument from all the diskslice/label/bad144
implementations, it should be found from the dev_t.

Remove bogus and unused strategy1 routines.

Remove open/close arguments from dssize(). Pick them up from dev_t.

Remove unused and unfinished setgeom support from diskslice/label/bad144 code.


# 48885 18-Jul-1999 phk

Use the vn_todev() function, rather than VOP_GETATTR


# 48865 17-Jul-1999 phk

Fix 2nd arg to udev2dev() call in ccd.c


# 48268 27-Jun-1999 peter

Initialize and hold locks for ccd generated bufs..

Obtained from: Matt Dillon <dillon@backplane.com>


# 47625 30-May-1999 phk

This commit should be a extensive NO-OP:

Reformat and initialize correctly all "struct cdevsw".

Initialize the d_maj and d_bmaj fields.

The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format. Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.


# 47028 11-May-1999 phk

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).


# 46635 07-May-1999 phk

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.)


# 46625 07-May-1999 phk

Introduce two functions: physread() and physwrite() and use these directly
in *devsw[] rather than the 46 local copies of the same functions.

(grog will do the same for vinum when he has time)


# 46576 06-May-1999 phk

Don't use <sys/disk.h>


# 44671 11-Mar-1999 dg

Fixed variable overflow problem.

Obtained from: NetBSD via Mark J. Taylor <mtaylor@cybernet.com>


# 44617 09-Mar-1999 mjacob

Don't forget to remove devstat entries when taking
down the CCD device.


# 44126 18-Feb-1999 ken

Set the devstat priority for ccd devices to DEVSTAT_PRIORITY_CCD
instead of DEVSTAT_PRIORITY_OTHER.


# 43819 09-Feb-1999 ken

Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.

This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed. The devstat version number has been incremented as
well to reflect the change.

This sorts devices in the devstat list in "more interesting" to "less
interesting" order. So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.

The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers. For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.

Also, move the checkversion() call in vmstat(8) to a more logical place.

Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it. Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.

Reviewed by: bde, obrien


# 43295 27-Jan-1999 dillon

Fix warnings preparing for -Wall -Wcast-qual

Also disable one usb module in LINT due to fatal compilation errors,
temporary.


# 43076 22-Jan-1999 peter

Convert ccd to a proper module vs. something started by PSEUDO_SET().


# 39228 15-Sep-1998 gibbs

Update system to new device statistics code.

Submitted by: "Kenneth D. Merry" <ken@plutotech.com>
mike@smith.net.au (Mike Smith)


# 38438 19-Aug-1998 sos

Make struct buf->b_offset reflect the real byte offset which got
in via the uio struct. This enables device drivers to use != DEV_BSIZE
blocking on devices with wierd sector/block sizes (ie CDROM's).


# 37389 04-Jul-1998 julian

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.


# 37384 04-Jul-1998 julian

VOP_STRATEGY grows an (struct vnode *) argument
as the value in b_vp is often not really what you want.
(and needs to be frobbed). more cleanups will follow this.
Reviewed by: Bruce Evans <bde@freebsd.org>


# 36735 07-Jun-1998 dfr

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.


# 34437 09-Mar-1998 julian

Slightly more correct initialisation of the new buf struct for soft-updates.
Submitted by: Chris Csanady <ccsanady@friley585.res.iastate.edu>
Suggested by: Kirk McKusick


# 33740 22-Feb-1998 jkh

Properly bzero() structures after they're returned from getccdbuf().
Submitted by: Chris Csanady <ccsanady@friley585.res.iastate.edu>


# 33365 15-Feb-1998 jkh

Revert part of my previous patch - I don't see the *need*
to call splbio() from within an interrupt handler here. :-)


# 33363 15-Feb-1998 jkh

missing spl() call and off by one error in the handling of the partitions.
Submitted by: Chris Csanady <ccsanady@friley585.res.iastate.edu>
Obtained from: OpenBSD


# 32921 31-Jan-1998 eivind

Remove unused devfs include. (Julian or Satoshi might want to add proper
DEVFS support here; just including the header file doesn't do any good, and
would make this depend on opt_devfs.h)


# 31270 18-Nov-1997 phk

There is no ccdread() nor ccdwrite().


# 30688 24-Oct-1997 phk

Statizice.


# 30294 11-Oct-1997 phk

Remove a #ifndef __FreeBSD__ chunk.


# 26640 14-Jun-1997 bde

Removed unused #includes.


# 25360 01-May-1997 sos

Make ccd use the maxsecsize sector size as denominator, this
fixes ccd on != 512byte devices..


# 24203 24-Mar-1997 bde

Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used. In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.


# 22975 22-Feb-1997 peter

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 22538 10-Feb-1997 mpp

Make ccd compile again after the Lite2 merge.

VOP_UNLOCK was being called with the wrong number of arguments.


# 21673 14-Jan-1997 jkh

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.


# 21470 10-Jan-1997 dyson

Fix CCD for bounced devices.


# 18084 06-Sep-1996 phk

Remove devconf, it never grew up to be of any use.


# 17275 24-Jul-1996 asami

Fail when odd number of disks are specified with mirror flag. Memory
leak fixes. Miscellaneous cleanup.

Partially submitted by: Matt White <mwhite+@CMU.EDU>


# 17264 23-Jul-1996 phk

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 :-)


# 17237 21-Jul-1996 phk

Substitute raw{read|write} for ccd{read|write}


# 16322 12-Jun-1996 gpalmer

Clean up -Wunused warnings.

Reviewed by: bde


# 15765 13-May-1996 asami

Add #ifndef/#endif around the "#define CCD_OFFSET 16", so you can override
it in your kernel config file.

Requested (in essence) by: phk


# 15763 13-May-1996 asami

Leave 16 lines in front of each component partition. It's now safe to
use sd87a or sd237e even if they start at the beginning of the slice.

You can also use sd85c if you prefer, although you need to change the
type field in the disklabel to "4.2BSD".


# 15369 24-Apr-1996 asami

Add missing "int" to static var.


# 14821 26-Mar-1996 asami

Change how mirror writes are handled, according to the discussion on the
mailing list.

When initiating a write, ccdbuffer() returns two "struct ccdbuf *"s
linked together by the cb_mirror field. "cb_pflags &
CCDPF_MIRROR_DONE" is set to 0 on both of them.

When a component returns to ccdiodone(), it checks if "cb_pflags &
CCDPF_MIRROR_DONE" is set or not. If not, it sets the partner's
flag and returns. If it is, it means its partner has already
returned, so it will go to the regular cleanup (which is in the
fallthrough code).

There should be no performance or functionality changes unless the
higher-level scsi driver does something with the resid value. The change
is purely aesthetical and prepares us for the parity implementation.


# 14730 21-Mar-1996 asami

Ported to 2.2-current. Uses [bc]devsw_add(), and is also now a proper
pseudo-device.

Doesn't use devfs correctly yet.


# 13784 31-Jan-1996 asami

Fix one warning and fix one bug found while looking at another warning (but
caused by a different reason):

. #ifndef __FreeBSD__ around check for negative size, FreeBSD size_t is
unsigned

. Disable mirror/parity if interleave size is 0 (i.e., serial concatenation).


# 13775 31-Jan-1996 asami

Mirror support. When CCDF_MIRROR is set:

(1) The reads are always done from the first n/2 disks.

(2) Each write is done twice, to the "data" disk (in the first half) and
the "mirror" disk (in the second half).

ccdbuffer() now takes an extra argument (struct ccdbuf **) and stores
the pointer to ccdbuf in there. In case of a mirrored write, it
allocates and stores two pointers. The "residual" is also doubled
for mirrored writes so that ccdiodone() can correctly tell when all
the writes are done.


# 13764 30-Jan-1996 asami

Prepare for adding mirroring. Check for flags (mirror forces uniform),
reduce the size to half, etc. Right now it only uses the first n/2 disks
for both read and write.


# 13173 02-Jan-1996 asami

Prepare to add support for parity. Report the post-parity size,
allocate space around parity blocks.


# 13070 27-Dec-1995 asami

Added $Id$.


# 13046 27-Dec-1995 asami

Changes to make it work on FreeBSD-2.1.


# 13041 27-Dec-1995 asami

ccd.c and ccd.4 from NetBSD-current circa 12/25/95.