History log of /netbsd-current/sbin/raidctl/raidctl.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.83 10-Feb-2024 andvar

fix various typos in comments and log messages.


# 1.82 25-Sep-2023 oster

We no longer need the deprecated copyback functionality now that
incorporating a used spare is automatic.

Copyback has always been an issue, as to do a copyback all IO to
the array had to be suspended, and so was very, very unlikely to
have been used in anything resembling a production system.


# 1.81 21-Sep-2023 oster

Remove a couple of unneeded comments.


# 1.80 21-Sep-2023 oster

Implement command-line configuration of simple RAID sets with raidctl
based on the usage pattern:

raidctl <device> create <level> <component1> <component2> ...

For example,

raidctl raid0 create mirror absent /dev/wd1e

will create a RAID level 1 (mirror) set with an absent first component
and /dev/wd1e as the second component. The resulting RAID device will
be marked as auto-configurable, will have a serial number set (based
on the current time), and parity will be initialized. Reasonable
performance values are automatically used by default for other parameters
normally specified in the configuration file.

Also: Only print out Autoconfig status if being verbose.


# 1.79 17-Sep-2023 oster

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.


Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.78 14-Jun-2022 kre

Implement "raidctl -t config-file"

This does the same config file parse that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.


# 1.77 14-Jun-2022 kre

In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

/*
* After NetBSD 9, convert this to not output the numRow's value,
* which is no longer required or ever used.
*/

We are after NetBSD 9 (well after). The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously). One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).


# 1.76 14-Jun-2022 kre

Reorder the getopts() switch () (slightly) to sort the options. NFCI.


# 1.75 14-Jun-2022 kre

KNF (whitespace & 80 column limits) - NFCI.

This is the first of a series of 5 commits in this
directory, all coming within minutes or now.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.82 25-Sep-2023 oster

We no longer need the deprecated copyback functionality now that
incorporating a used spare is automatic.

Copyback has always been an issue, as to do a copyback all IO to
the array had to be suspended, and so was very, very unlikely to
have been used in anything resembling a production system.


# 1.81 21-Sep-2023 oster

Remove a couple of unneeded comments.


# 1.80 21-Sep-2023 oster

Implement command-line configuration of simple RAID sets with raidctl
based on the usage pattern:

raidctl <device> create <level> <component1> <component2> ...

For example,

raidctl raid0 create mirror absent /dev/wd1e

will create a RAID level 1 (mirror) set with an absent first component
and /dev/wd1e as the second component. The resulting RAID device will
be marked as auto-configurable, will have a serial number set (based
on the current time), and parity will be initialized. Reasonable
performance values are automatically used by default for other parameters
normally specified in the configuration file.

Also: Only print out Autoconfig status if being verbose.


# 1.79 17-Sep-2023 oster

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.


Revision tags: netbsd-10-base
# 1.78 14-Jun-2022 kre

Implement "raidctl -t config-file"

This does the same config file parse that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.


# 1.77 14-Jun-2022 kre

In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

/*
* After NetBSD 9, convert this to not output the numRow's value,
* which is no longer required or ever used.
*/

We are after NetBSD 9 (well after). The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously). One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).


# 1.76 14-Jun-2022 kre

Reorder the getopts() switch () (slightly) to sort the options. NFCI.


# 1.75 14-Jun-2022 kre

KNF (whitespace & 80 column limits) - NFCI.

This is the first of a series of 5 commits in this
directory, all coming within minutes or now.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.81 21-Sep-2023 oster

Remove a couple of unneeded comments.


# 1.80 21-Sep-2023 oster

Implement command-line configuration of simple RAID sets with raidctl
based on the usage pattern:

raidctl <device> create <level> <component1> <component2> ...

For example,

raidctl raid0 create mirror absent /dev/wd1e

will create a RAID level 1 (mirror) set with an absent first component
and /dev/wd1e as the second component. The resulting RAID device will
be marked as auto-configurable, will have a serial number set (based
on the current time), and parity will be initialized. Reasonable
performance values are automatically used by default for other parameters
normally specified in the configuration file.

Also: Only print out Autoconfig status if being verbose.


# 1.79 17-Sep-2023 oster

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.


Revision tags: netbsd-10-base
# 1.78 14-Jun-2022 kre

Implement "raidctl -t config-file"

This does the same config file parse that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.


# 1.77 14-Jun-2022 kre

In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

/*
* After NetBSD 9, convert this to not output the numRow's value,
* which is no longer required or ever used.
*/

We are after NetBSD 9 (well after). The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously). One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).


# 1.76 14-Jun-2022 kre

Reorder the getopts() switch () (slightly) to sort the options. NFCI.


# 1.75 14-Jun-2022 kre

KNF (whitespace & 80 column limits) - NFCI.

This is the first of a series of 5 commits in this
directory, all coming within minutes or now.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.79 17-Sep-2023 oster

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.


Revision tags: netbsd-10-base
# 1.78 14-Jun-2022 kre

Implement "raidctl -t config-file"

This does the same config file parse that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.


# 1.77 14-Jun-2022 kre

In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

/*
* After NetBSD 9, convert this to not output the numRow's value,
* which is no longer required or ever used.
*/

We are after NetBSD 9 (well after). The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously). One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).


# 1.76 14-Jun-2022 kre

Reorder the getopts() switch () (slightly) to sort the options. NFCI.


# 1.75 14-Jun-2022 kre

KNF (whitespace & 80 column limits) - NFCI.

This is the first of a series of 5 commits in this
directory, all coming within minutes or now.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.78 14-Jun-2022 kre

Implement "raidctl -t config-file"

This does the same config file parse that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.


# 1.77 14-Jun-2022 kre

In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

/*
* After NetBSD 9, convert this to not output the numRow's value,
* which is no longer required or ever used.
*/

We are after NetBSD 9 (well after). The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously). One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).


# 1.76 14-Jun-2022 kre

Reorder the getopts() switch () (slightly) to sort the options. NFCI.


# 1.75 14-Jun-2022 kre

KNF (whitespace & 80 column limits) - NFCI.

This is the first of a series of 5 commits in this
directory, all coming within minutes or now.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.74 02-Aug-2021 oster

Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.73 01-Aug-2021 oster

Move case 'l' to be in sorted order. No functional change.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.72 13-Sep-2020 mlelstv

Allow components to be specified by wedge name.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.71 26-Sep-2019 mlelstv

Need MIN in userland. Also some more signed/unsigned clashes.


# 1.70 26-Sep-2019 mlelstv

nspares is now unsigned. Validate and use as positive integer.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

branches: 1.67.2;
Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.69 06-Feb-2019 oster

Correct printed IOCTL name that was incorrect since rev 1.5.


# 1.68 04-Feb-2019 mrg

- add the string length as an explicit parameter to get_time_string()
- remove casts when the same type is used on both sides
- expand hours_buffer[] to fit the range of hours in an 'int'
- add a work around for the sprintf() truncation checker that fails
to detect that 'minutes' and 'seconds' have a small range


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330
# 1.67 24-Mar-2018 nakayama

Follow the ioctl arg changes of RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_CHECK_*_STATUS_EXT.

This should fix strange raidctl -s outputs reported in
current-users ML.


Revision tags: pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.66 18-Jan-2018 mrg

branches: 1.66.2;
implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


# 1.66 18-Jan-2018 mrg

implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.65 06-Jan-2016 wiz

Use standard sort order for options.

Add -U to usage.


# 1.64 06-Jan-2016 christos

Access to the SET_LAST_UNIT ioctl.


# 1.63 08-Sep-2015 bad

Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


# 1.62 21-Jul-2015 mrg

convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G". now this actually works when fed back
into raidctl -[cC].


# 1.61 30-Jun-2015 sborrill

Compare correct length string for force option to -A


# 1.60 26-Jun-2015 pooka

&stars[offset] -> stars+offset. It's shorter!

Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345


# 1.59 27-May-2015 christos

use strtou


# 1.58 27-May-2015 manu

Better sanity check numbers given to raidctl(8)

Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.57 03-Apr-2014 christos

branches: 1.57.4;
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.56 19-Oct-2013 christos

fix unused variable warnings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.55 12-Oct-2011 christos

branches: 1.55.2; 1.55.4; 1.55.8;
PR/45456: Tetsuya Isaki: Don't mix stdio and write.


# 1.54 28-Sep-2011 mrg

print the serial number as an unsigned number.


# 1.53 29-Aug-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase
# 1.52 19-Feb-2011 enami

Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.


Revision tags: bouyer-quota2-base
# 1.51 09-Feb-2011 pooka

Exterminate a bug I created in 2009.


Revision tags: matt-mips64-premerge-20101231
# 1.50 15-Dec-2010 pooka

branches: 1.50.2;
Use RUMPPRG.

ok Greg Oster


# 1.49 08-Nov-2010 pooka

Update RUMP_ACTION to use rumpclient.

The server must of course have some disks configured. Let's say
we have this simple server with disks as a few sparse host files:

main()
{
rump_init();
rump_pub_etfs_register("/disk1", "./disk1.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk2", "./disk2.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk3", "./disk3.img", RUMP_ETFS_BLK);
rump_pub_etfs_register("/disk4", "./disk4.img", RUMP_ETFS_BLK);
pause();
}

And we run the server:

mainbus0 (root)
Kernelized RAIDframe activated
/disk1: hostpath ./disk1.img (97 GB)
/disk2: hostpath ./disk2.img (97 GB)
/disk3: hostpath ./disk3.img (97 GB)
/disk4: hostpath ./disk4.img (97 GB)

We can then configure the raid against the server:

> ./raidctl -c theraid.conf raid0

And lo, we have evidence of a level1 raid in the server dmesg:

raid0: RAID Level 1
raid0: Components: /disk1 /disk2 /disk3 /disk4
raid0: Total Sectors: 409599744 (199999 MB)

yea, i initialized it already in a previous run:

> ./raidctl -S raid0
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.


# 1.48 16-Mar-2010 jld

Give a more polite message for `raidctl -m` on a non-parity RAID set.


# 1.47 13-Mar-2010 plunky

fix sign-compare issue


# 1.46 13-Mar-2010 jld

Exclude parity map regions that don't actually exist from the dirty region count
in `raidctl -m`. Makes for less confusing output during `raidctl -i`.


# 1.45 27-Jan-2010 christos

use warn/err appropriately.


# 1.44 27-Jan-2010 pooka

error message: \n\n -> \n


Revision tags: matt-premerge-20091211
# 1.43 10-Dec-2009 jld

Slight change to the wording of the parity map info: the parity is
"marked clean" after however much inactivity; it is *actually* clean
as soon as the component disks all do their thing (on the order of ms,
usually), just the same as before.

The bikeshed is now less of a taupe and more of an ecru.


# 1.42 17-Nov-2009 jld

Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.


# 1.41 11-Oct-2009 pooka

Support RUMP_ACTION, i.e. compile-time switch to make this execute
rump syscalls to configure raidframe in a rump kernel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.40 26-Jan-2009 tron

Use correct format to print the "numBlocks" element in a RAIDframe
component label. raidctl(8) should now print the correct number of
blocks for RAID sets larger than 1TB.

Patch supplied by Bernhard Moellemann in PR bin/40479.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 28-Apr-2008 martin

branches: 1.39.4;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.38 02-Jun-2005 lukem

branches: 1.38.4; 1.38.16; 1.38.20; 1.38.22;
appease gcc -Wuninitialized


# 1.37 01-May-2005 oster

Cleanup the meter code a bit -- a bunch of stuff wasn't even being used.
Fix a few overflow issues. (Thanks to beefy and pooka, among others)


Revision tags: netbsd-3-base
# 1.36 09-Feb-2005 xtraeme

branches: 1.36.2;
Kill __P(), use ANSI function declarations; WARNS=3.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.35 29-Feb-2004 oster

As suggested by Paul Ripke, have raidctl use raw devices by default.


# 1.34 21-Oct-2003 fvdl

Don't compare argc to NULL.


# 1.33 23-Jun-2003 agc

Add NetBSD RCS Ids.


# 1.32 15-Apr-2003 itojun

correct questionable use of strncpy().


Revision tags: fvdl_fs64_base
# 1.31 16-Nov-2002 oster

Cleanup and update usage().


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.30 21-Mar-2002 simonb

Open the raid device read-only for the commands that don't need
write access. With the default set up this allows users in group
operator to query the status of the raid devices.

Fixes PR admin/15840.


# 1.29 04-Oct-2001 oster

rf_configure.c
- remove dependence on stuff in sys/dev/raidframe
- now rely on <dev/raidframe/*>
- bring in some needed prototypes for local functions
- nuke RF_ASSERT's.
- drag in some needed RF_ERRORMSG's

raidctl.c
- rely on <dev/raidframe/*>
- welcome to the New Way of doing RAIDframe #includes.

(No functional changes.)


# 1.28 26-Sep-2001 oster

Since this is the only place it's used, nuke RF_DEV2RAIDID and
replace it with DISKUNIT.


# 1.27 10-Jul-2001 lukem

* add -G, which lists the configuration of the given raid set in the
same configuration format that -c and -C use.
this is useful if you're using autoconfig and you've misplaced the
/etc/raidXXX.conf files
* "filesystem" -> "file system", and other man page cleanups.


# 1.26 19-Feb-2001 cgd

convert to use getprogname()


# 1.25 31-Oct-2000 lukem

- use opendisk(3) instead of homegrown solution
- separate items in -s output with commas; much easier to read
- add maxOutstanding (aka queue len) to -s output
- sort #includes (per knf)


# 1.24 19-Aug-2000 oster

It is impolite to poll in a tight loop. (Thanks to Christos for noting
the problem.)


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.23 03-Jun-2000 oster

branches: 1.23.2;
In certain cases (e.g. where it makes sense) read/display the
component label for spare disks too.


# 1.22 31-May-2000 oster

Make sure we handle the 'no progress' case properly.
Thanks to Manuel Bouyer for noting the problem (and supplying a patch!).


# 1.21 28-May-2000 oster

Obtaining component labels from spares is not supported yet, but add
some code that makes some progress in that direction.


# 1.20 28-May-2000 oster

Cleanup ETA calculation stuff.


# 1.19 28-May-2000 oster

Have raidctl use the fine-grained progress info. ETA calculation stuff
needs to be cleaned up.


Revision tags: minoura-xpg4dl-base
# 1.18 23-May-2000 thorpej

branches: 1.18.2;
Build with WARNS=2.


# 1.17 23-May-2000 thorpej

ioctl(2) commands are u_long, so do_meter() must take the same.


# 1.16 14-Apr-2000 simonb

Don't declare 'extern opt*' getopt variables.


# 1.15 23-Mar-2000 oster

When displaying component labels, indicate whether or not the set is
marked as being the one that should be used for the root partition.


# 1.14 25-Feb-2000 oster

Reorganize a few things. Make the general status ('-s') a bit more verbose
by including component labels, and less verbose by removing some other stuff.


# 1.13 24-Feb-2000 oster

Document the new autoconfiguration switches, and update the Usage: line.
More doc changes expected soon.


# 1.12 13-Feb-2000 oster

- support for autoconfig setup and / on RAID setup
- new parts are still work-in-progress (no docs yet either)


# 1.11 09-Jan-2000 oster

Nuke a debugging printf that I forgot to remove before last commit.


# 1.10 05-Jan-2000 oster

- add '-v' (Verbose) option, which, most notably, provides
a spiffy lukemftp-inspired progress bar for parity re-writing,
reconstructs, copybacks, et al.

- make 'raidctl -P' wait until the parity has been updated before exiting
(it waited previously, but only because the parity re-write ioctl wouldn't
exit until the parity was successfully re-written)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.9 15-Aug-1999 oster

rf_MakeConfig succeeds only if it returns 0, not if it returns
values 0 or greater.


# 1.8 15-Aug-1999 oster

Display the parity status as part of the status ('-s') display.


# 1.7 10-Aug-1999 oster

Add two more options to raidctl:
-p check (and return) the status of the parity
-P check the status of the parity, and rebuild if necessary

Addresses PR#7494


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.6 02-Mar-1999 oster

Update for recent changes: component labels, clean bits, adding hot
spares, and rebuilding components in-place. Re-arrange the
letters/options to make more sense (and make better use of the alphabet).


# 1.5 24-Feb-1999 oster

Clean things up a bit. Teach raidctl a little about component labels
and hot-adding of spares. New code is there, but not enabled (yet).


# 1.4 04-Feb-1999 oster

Add missing NetBSD RCS ID's! Thanks to SAITOH Masanobu (msaitoh@netbsd.org)
for pointing this out.


# 1.3 26-Jan-1999 oster

Take care of a few minor things due to the major RAIDframe cleanup.

Again, no functionality changes.


# 1.2 12-Jan-1999 mjacob

recover from errno.h changes


# 1.1 13-Nov-1998 oster

RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.

raidctl is our userland configuration tool for RAIDframe.