History log of /freebsd-current/sys/geom/geom_ccd.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# b61a5730 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD

The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# bd5d9037 28-Dec-2022 Zhenlei Huang <zlei@FreeBSD.org>

GEOM: Remove redundant NULL pointer check before g_free()

Reviewed by: melifaro, pjd, imp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37779


# 0ff783dc 28-Dec-2021 John Baldwin <jhb@FreeBSD.org>

sys/geom: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33635


# d40bc607 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

geom: clean up empty lines in .c and .h files


# 7201590b 25-Jul-2020 Xin LI <delphij@FreeBSD.org>

Use snprintf instead of sprintf.

MFC after: 2 weeks


# 82b17c8e 19-Jul-2020 Xin LI <delphij@FreeBSD.org>

Fix indent for if clause.

MFC after: 2 weeks


# 74d6c131 10-Apr-2018 Kyle Evans <kevans@FreeBSD.org>

Annotate geom modules with MODULE_VERSION

GEOM ELI may double ask the password during boot. Once at loader time, and
once at init time.

This happens due a module loading bug. By default GEOM ELI caches the
password in the kernel, but without the MODULE_VERSION annotation, the
kernel loads over the kernel module, even if the GEOM ELI was compiled into
the kernel. In this case, the newly loaded module
purges/invalidates/overwrites the GEOM ELI's password cache, which causes
the double asking.

MFC Note: There's a pc98 component to the original submission that is
omitted here due to pc98 removal in head. This part will need to be revived
upon MFC.

Reviewed by: imp
Submitted by: op
Obtained from: opBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14992


# 2afb21f3 29-Dec-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

geom_ccd.c: Fix the licenses properly

The license merging in r109471 didn't take into account that licensing
could change. Just removing the 3rd clause obviates the copyright
assignment to the NetBSD Foundation.

We do have plenty of files that have two or more licensing as in this
case, so fix this properly by splitting back the licenses as they are
upstream.

Obtained from: NetBSD


# 68689f58 29-Dec-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

geom_ccd.c: Update the license with changes from upstream.

Part of this file originated in NetBSD, with the original file
carrying two versions of 4-clause BSD licenses. r109471 attempted to
simplify the situation by putting both licenses together.

Meanwhile, NetBSD dropped Clauses 3 and 4 from their own license, and
eventually NetBSD got permission from the University of Utah to drop the
3rd clause.

Keep the license "simple" by dropping the third clause since both TNF,
Utah/Berkeley and phk agree in principle that it can be dropped.

Obtained from: NetBSD (ccd.c CVS 1.128, 1.138)


# 3728855a 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/geom: adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# e8d57122 29-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/geom: spelling fixes in comments.

No functional change.


# 5d807a0e 10-Jul-2011 Andrey V. Elsukov <ae@FreeBSD.org>

Include sys/sbuf.h directly.

Reviewed by: pjd


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 251048a1 25-Nov-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- 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


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2616144e 09-Aug-2008 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 3f4f4a14 13-Apr-2006 Martin Cracauer <cracauer@FreeBSD.org>

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


# 41063f93 07-Apr-2006 Marcel Moolenaar <marcel@FreeBSD.org>

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.


# fa521b03 06-Jan-2005 Warner Losh <imp@FreeBSD.org>

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


# 5721c9c7 08-Aug-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 650ee351 08-Aug-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Use default method initialization on geoms.


# d2bae332 12-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 99cf2f94 10-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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


# c12ec49e 12-Nov-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Make sure to return errors if we have any.

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


# 7b3c5457 24-Oct-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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

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


# e65b2137 22-Aug-2003 Paul Saab <ps@FreeBSD.org>

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

Reviewed by: phk


# f6367971 22-Aug-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Make CCD unloadable.


# e30b2eda 22-Aug-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 92b5e86e 22-Aug-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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

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


# 114ebb2f 29-Jul-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Fix a memory leak in CCD's mirror code.


# 50b1faef 11-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().

Approved by: phk


# ec421aec 09-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Fix error handling for ENOMEM style issues.


# c44c213f 07-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Polishing and nitpicking.


# 3a3fcd72 04-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 0f557e0a 02-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 189337d8 02-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# d6b602d4 31-May-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unused variable.

Found by: FlexeLint


# 77154759 14-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 2f912fc9 14-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 891619a6 01-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# b4b138c2 18-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 60794e04 08-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 0238f932 04-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 7ac40f5f 02-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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)


# ad3467e1 21-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# b82ff758 21-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# a163d034 18-Feb-2003 Warner Losh <imp@FreeBSD.org>

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

Approved by: trb


# 7e579a7c 11-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Announce our ability to do MAXPHYS transfers.


# 806d5cff 01-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 44956c98 21-Jan-2003 Alfred Perlstein <alfred@FreeBSD.org>

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


# 0f76d6d8 19-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 1dccd08a 19-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# e9fe7d1f 17-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 6b267654 18-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Fix minor memory-leak.


# b51ea356 18-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 360d71d1 18-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 3b1746df 18-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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


# ddbf51af 17-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# f05f44f0 03-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Remove CCDF_SWAP and CCDF_PARITY, they have never been implemented.


# d616ee08 02-Jan-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unused second argument from BIO_STRATEGY()


# d64ada50 30-Dec-2002 Jens Schweikhardt <schweikh@FreeBSD.org>

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


# 37ab0e0d 24-Sep-2002 Jeff Roberson <jeff@FreeBSD.org>

- Use vrefcnt() instead of v_usecount.


# 7812d86f 20-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 2dfbcdd4 13-Sep-2002 Maxime Henrion <mux@FreeBSD.org>

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


# 92faa7b5 13-Sep-2002 Maxime Henrion <mux@FreeBSD.org>

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


# f368af93 13-Sep-2002 Maxime Henrion <mux@FreeBSD.org>

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


# ff8cc2eb 25-May-2002 Bruce Evans <bde@FreeBSD.org>

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


# 77068a7f 12-May-2002 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 2dd527b3 08-Apr-2002 Poul-Henning Kamp <phk@FreeBSD.org>

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

Sponsored by: DARPA & NAI Labs


# 408ab1b8 02-Apr-2002 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# ffee6e99 02-Apr-2002 Poul-Henning Kamp <phk@FreeBSD.org>

One less user of the bogus DIOCGPART ioctl.


# 6ede0acc 29-Mar-2002 Poul-Henning Kamp <phk@FreeBSD.org>

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


# be167382 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Fix bio->bio_blkno format warning.


# 0d2af521 15-Mar-2002 Kirk McKusick <mckusick@FreeBSD.org>

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.


# a854ed98 27-Feb-2002 John Baldwin <jhb@FreeBSD.org>

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


# e3f4d3b5 30-Dec-2001 Poul-Henning Kamp <phk@FreeBSD.org>

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

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


# 55a13f7d 16-Nov-2001 Ian Dowse <iedowse@FreeBSD.org>

Return EOPNOTSUPP for unknown module events.

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


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

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


# bf61e266 10-Sep-2001 Kris Kennaway <kris@FreeBSD.org>

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


# 01706d20 04-Sep-2001 Poul-Henning Kamp <phk@FreeBSD.org>

Kill the NCCD constant by modernizing the ccd driver.

Submitted by: sobomax
Reviewed by: phk


# 724682d2 08-May-2001 Poul-Henning Kamp <phk@FreeBSD.org>

Polish error handling with biofinish().


# a468031c 06-May-2001 Poul-Henning Kamp <phk@FreeBSD.org>

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

Most of this patch is generated by scripts.


# 6a5a4d0a 29-Mar-2001 Andrew Gallatin <gallatin@FreeBSD.org>

fix a number of printf format string warnings inside DEBUG ifdefs


# f8388051 25-Mar-2001 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 896dba5a 28-Jan-2001 Poul-Henning Kamp <phk@FreeBSD.org>

Fix a braino in ccd's clone routine.

Submitted by: tegge


# ba88dfc7 26-Jan-2001 John Baldwin <jhb@FreeBSD.org>

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


# 14c3599a 23-Jan-2001 John Baldwin <jhb@FreeBSD.org>

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


# 7cc0979f 08-Dec-2000 David Malone <dwmalone@FreeBSD.org>

Convert more malloc+bzero to malloc+M_ZERO.

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


# db901281 02-Sep-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# a6b1634e 29-Aug-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Give ccd a cloning function.


# e6796b67 03-Jul-2000 Kirk McKusick <mckusick@FreeBSD.org>

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


# 9626b608 05-May-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 9d7f7369 01-May-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Convert to struct bio instead of struct buf.


# 2c9b67a8 30-Apr-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unneeded #include <vm/vm_zone.h>

Generated by: src/tools/tools/kerninclude


# 8177437d 14-Apr-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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


# c244d2de 02-Apr-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# b99c307a 20-Mar-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 21144e3b 20-Mar-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 0b5436a7 29-Jan-2000 Peter Wemm <peter@FreeBSD.org>

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


# af8862e4 16-Jan-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Cleanup some remaining bdev fluff.


# ba4ad1fc 09-Jan-2000 Poul-Henning Kamp <phk@FreeBSD.org>

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

Suggested by: bde


# 20465773 21-Dec-1999 Eivind Eklund <eivind@FreeBSD.org>

Remove unused variable


# 762e6b85 15-Dec-1999 Eivind Eklund <eivind@FreeBSD.org>

Introduce NDFREE (and remove VOP_ABORTOP)


# 86b2c846 07-Dec-1999 Kenneth D. Merry <ken@FreeBSD.org>

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


# 38224dcd 22-Nov-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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


# d53dedee 07-Nov-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Remove the devsw magic from DEV_MODULE()


# 3e2c6ca3 05-Oct-1999 Nick Hibma <n_hibma@FreeBSD.org>

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.


# 1441456f 26-Sep-1999 Greg Lehey <grog@FreeBSD.org>

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


# 74427f90 26-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

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


# d6a0e38a 25-Sep-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 1464240e 23-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

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.


# 25d1a00b 23-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

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.


# e322ec4c 22-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

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


# 2186cd9e 18-Sep-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Use devstat_end_transaction_buf() rather than Use devstat_end_transaction()


# 85a219d2 09-Sep-1999 Julian Elischer <julian@FreeBSD.org>

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

Submitted by: phk@freebsd.org


# 7012bab9 02-Sep-1999 Julian Elischer <julian@FreeBSD.org>

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.


# 02e15769 30-Aug-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 9c93810d 26-Aug-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Initialize the dev->si_bsize fields.

Submitted by: tegge
Reviewed by: phk


# 49ff4deb 14-Aug-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 684adede 18-Jul-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Use the vn_todev() function, rather than VOP_GETATTR


# 59c4226d 17-Jul-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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


# b52ab6b5 27-Jun-1999 Peter Wemm <peter@FreeBSD.org>

Initialize and hold locks for ccd generated bufs..

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


# 4e2f199e 30-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# bfbb9ce6 11-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 46eede00 07-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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


# c48d1775 07-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

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)


# 6cc5a722 06-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Don't use <sys/disk.h>


# 40969e38 11-Mar-1999 David Greenman <dg@FreeBSD.org>

Fixed variable overflow problem.

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


# 21c3b31e 09-Mar-1999 Matt Jacob <mjacob@FreeBSD.org>

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


# 043653d4 18-Feb-1999 Kenneth D. Merry <ken@FreeBSD.org>

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


# 2a888f93 09-Feb-1999 Kenneth D. Merry <ken@FreeBSD.org>

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


# b4e36adf 27-Jan-1999 Matthew Dillon <dillon@FreeBSD.org>

Fix warnings preparing for -Wall -Wcast-qual

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


# b7b98418 22-Jan-1999 Peter Wemm <peter@FreeBSD.org>

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


# b2dfb1f9 15-Sep-1998 Justin T. Gibbs <gibbs@FreeBSD.org>

Update system to new device statistics code.

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


# e620a1cb 19-Aug-1998 Søren Schmidt <sos@FreeBSD.org>

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


# f7ea2f55 04-Jul-1998 Julian Elischer <julian@FreeBSD.org>

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.


# fd5d1124 04-Jul-1998 Julian Elischer <julian@FreeBSD.org>

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>


# ecbb00a2 07-Jun-1998 Doug Rabson <dfr@FreeBSD.org>

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.


# 19ab6a40 09-Mar-1998 Julian Elischer <julian@FreeBSD.org>

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


# b5068bbb 22-Feb-1998 Jordan K. Hubbard <jkh@FreeBSD.org>

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


# 500117e4 15-Feb-1998 Jordan K. Hubbard <jkh@FreeBSD.org>

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


# 7d15435c 15-Feb-1998 Jordan K. Hubbard <jkh@FreeBSD.org>

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


# eaa22ef7 30-Jan-1998 Eivind Eklund <eivind@FreeBSD.org>

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)


# fdfcd4ae 18-Nov-1997 Poul-Henning Kamp <phk@FreeBSD.org>

There is no ccdread() nor ccdwrite().


# e2738b4f 24-Oct-1997 Poul-Henning Kamp <phk@FreeBSD.org>

Statizice.


# f541e4a4 11-Oct-1997 Poul-Henning Kamp <phk@FreeBSD.org>

Remove a #ifndef __FreeBSD__ chunk.


# 958aaa7e 14-Jun-1997 Bruce Evans <bde@FreeBSD.org>

Removed unused #includes.


# e59f3105 01-May-1997 Søren Schmidt <sos@FreeBSD.org>

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


# fce002fd 24-Mar-1997 Bruce Evans <bde@FreeBSD.org>

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.


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

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


# 06bcc9e5 10-Feb-1997 Mike Pritchard <mpp@FreeBSD.org>

Make ccd compile again after the Lite2 merge.

VOP_UNLOCK was being called with the wrong number of arguments.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

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.


# c0b89506 09-Jan-1997 John Dyson <dyson@FreeBSD.org>

Fix CCD for bounced devices.


# bfbb029d 06-Sep-1996 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 34f35216 24-Jul-1996 Satoshi Asami <asami@FreeBSD.org>

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

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


# cba8a5dd 23-Jul-1996 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 10bc064c 21-Jul-1996 Poul-Henning Kamp <phk@FreeBSD.org>

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


# c23670e2 11-Jun-1996 Gary Palmer <gpalmer@FreeBSD.org>

Clean up -Wunused warnings.

Reviewed by: bde


# 1af0e025 13-May-1996 Satoshi Asami <asami@FreeBSD.org>

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

Requested (in essence) by: phk


# 0d88ef07 13-May-1996 Satoshi Asami <asami@FreeBSD.org>

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


# 52faebb2 24-Apr-1996 Satoshi Asami <asami@FreeBSD.org>

Add missing "int" to static var.


# e7322872 25-Mar-1996 Satoshi Asami <asami@FreeBSD.org>

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.


# e2a13e8c 20-Mar-1996 Satoshi Asami <asami@FreeBSD.org>

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

Doesn't use devfs correctly yet.


# b8e29b55 31-Jan-1996 Satoshi Asami <asami@FreeBSD.org>

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


# 3bc746be 30-Jan-1996 Satoshi Asami <asami@FreeBSD.org>

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.


# 09b59204 30-Jan-1996 Satoshi Asami <asami@FreeBSD.org>

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.


# 7ecb65fa 02-Jan-1996 Satoshi Asami <asami@FreeBSD.org>

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


# aa8bdaec 27-Dec-1995 Satoshi Asami <asami@FreeBSD.org>

Added $Id$.


# d8594dfb 27-Dec-1995 Satoshi Asami <asami@FreeBSD.org>

Changes to make it work on FreeBSD-2.1.


# a56bb8a5 27-Dec-1995 Satoshi Asami <asami@FreeBSD.org>

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