Commit Graph

169 Commits

Author SHA1 Message Date
mlelstv edc4e8445d Allow components to be specified by wedge name. 2020-09-13 06:04:53 +00:00
mrg 07b516d274 avoid trying to printf() a NULL as %s. fixes likely bug. 2020-09-06 05:31:46 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
mlelstv dacdd9d9b5 Need MIN in userland. Also some more signed/unsigned clashes. 2019-09-26 10:47:30 +00:00
mlelstv 3a8aa0a47c nspares is now unsigned. Validate and use as positive integer. 2019-09-26 10:33:30 +00:00
oster 6b6fd5e205 Correct printed IOCTL name that was incorrect since rev 1.5. 2019-02-06 22:38:10 +00:00
mrg 7b743cfc69 - 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
2019-02-04 09:31:22 +00:00
nakayama 6ebbd813f6 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.
2018-03-24 19:41:35 +00:00
mrg f2b04ca083 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.
2018-01-18 00:32:48 +00:00
kre 70c1fd98e2 Several more cleanups:
1. Don't force use of "for" when "while" works better.
2. No need to check c != '\0' when we also check (c == ' ' || c == '\t')
3. Use the size of the buffer we're using, rather than a different one
   (not really a concern, they're the same size)
4. Don't use fscanf() to read file data, use fgets() & sscanf().
5. After using a pointer as a char *, validate alignment before switching
   to int * (can only fail if kernel #define gets set stupidly)   Or #6...
6. Validate sparemap file name isn't too long for assigned space.
7. recognise that strlen() returns size_t - don't shove it into an int.
8. On out of mem, be more clear which allocation failed in warning msg.

ATF tests all pass.   But I don't think they use sparemap files.
2017-11-22 00:31:31 +00:00
christos dbab137455 Avoid needless pointer calisthenics: &foo[0] -> foo 2017-11-21 16:31:37 +00:00
kre e8f6b3ae2f With char bug[SIZE] using sizeof(bug[0]) is kind of boring, use
sizeof(bug) instead...
2017-11-21 16:19:31 +00:00
kre 24b75d09bd White space and comment formatting. NFC. 2017-11-20 22:16:23 +00:00
christos 6937a5d56d stop using magic constants
wrap long lines
use warn{,x}
make static
knf
2017-11-20 19:10:45 +00:00
kardel cb7aeb8243 support NAME=<wedge name> syntax for disks and spares 2017-11-20 18:37:56 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
christos cc8b3fb098 need <sys/stat.h> for fstat() 2017-01-10 20:47:05 +00:00
christos c5f07454d1 PR/50921: David Binderman: Fix memory leak 2016-03-09 19:53:32 +00:00
wiz 704ad63c75 Use standard sort order for options.
Add -U to usage.
2016-01-06 22:57:44 +00:00
christos c4e0e8f498 Access to the SET_LAST_UNIT ioctl. 2016-01-06 17:41:36 +00:00
bad 6c69384dad 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.
2015-09-08 08:59:09 +00:00
mrg ec5f69b6a6 convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G".  now this actually works when fed back
into raidctl -[cC].
2015-07-21 05:54:44 +00:00
wiz e485731cb1 Bump date for previous. Add whitespace.
Fix some mandoc warnings.
2015-06-30 22:16:12 +00:00
sborrill 9a9013c60c Clarify that what was previously known as -A root is now -A forceroot, not
-A softroot and that -A root can still be used for historical reasons.
2015-06-30 17:18:13 +00:00
sborrill 06ac39463d Compare correct length string for force option to -A 2015-06-30 17:02:14 +00:00
pooka 8da4f44455 &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
2015-06-26 01:16:54 +00:00
christos e304a25c5b use strtou 2015-05-27 17:55:23 +00:00
manu 05c0668e69 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...
2015-05-27 15:31:15 +00:00
christos 52334fd887 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).
2014-04-03 18:54:10 +00:00
christos 3e4993b396 fix unused variable warnings. 2013-10-19 01:09:58 +00:00
jdc 6dc8fb4754 Belatedly note root on RAIDframe support for sandpoint. 2013-10-07 10:50:37 +00:00
tron b0eb4d7e9b Note that NetBSD/amd64 can boot of RAID volumes. 2013-09-20 06:43:57 +00:00
njoly af97374da1 Remove unexpected newline between Em macro and text. 2012-03-23 18:28:13 +00:00
christos f42bf26590 PR/45456: Tetsuya Isaki: Don't mix stdio and write. 2011-10-12 16:45:37 +00:00
mrg 1ca3e5d8c0 print the serial number as an unsigned number. 2011-09-28 10:29:41 +00:00
joerg baa8e84b6f Use __dead 2011-08-29 14:34:58 +00:00
wiz 1bd615d150 New sentence, new line. 2011-08-02 10:28:00 +00:00
buhrow 3dd51f1b7e Document the need for zeroing out the first 64 blocks of a replacement
component in a failed RAID set in order to avoid potentially configuring
RAId 1 sets with erroneous values taken from random extent data in the
replacement component partitions.
2011-07-28 18:25:22 +00:00
enami ec02ea412c Define accessors for number of blocks and partition size in the
component label and use them where appropriate.  Disscussed on tech-kern.
2011-02-19 07:11:09 +00:00
pooka a804f47907 Exterminate a bug I created in 2009. 2011-02-09 11:22:49 +00:00
pooka db818c53ab Use RUMPPRG.
ok Greg Oster
2010-12-15 18:37:55 +00:00
pooka f1d4214202 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.
2010-11-08 12:42:35 +00:00
jld 9abd7e4959 Give a more polite message for `raidctl -m` on a non-parity RAID set. 2010-03-16 03:23:47 +00:00
plunky 858911baa2 fix sign-compare issue 2010-03-13 13:45:05 +00:00
jld 8ccd0f67a6 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`.
2010-03-13 07:21:37 +00:00
christos 13a5940614 use warn/err appropriately. 2010-01-27 18:34:02 +00:00
pooka 03fdf6b025 error message: \n\n -> \n 2010-01-27 17:02:06 +00:00
wiz e08d841a54 + Fatal errors due to uninitialized components are ignored.
for -C. For dillo@
2010-01-27 09:26:16 +00:00
wiz 4421a69224 Consistently use "START disks" in examples. Bump date. 2010-01-27 08:56:08 +00:00
jld 9bd6e2661a 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.
2009-12-10 20:20:59 +00:00