diff options
author | kbyanc <kbyanc@FreeBSD.org> | 2000-08-08 06:24:17 +0000 |
---|---|---|
committer | kbyanc <kbyanc@FreeBSD.org> | 2000-08-08 06:24:17 +0000 |
commit | 8f0afc6b0aa752cb23dfcf91f2285bf6c825405d (patch) | |
tree | 034cb732a278c59e0304f2f93947626f19ea5385 /lib/libcam | |
parent | 18a0d975369707cba8c9deeb3de4db05dafb9487 (diff) | |
download | FreeBSD-src-8f0afc6b0aa752cb23dfcf91f2285bf6c825405d.zip FreeBSD-src-8f0afc6b0aa752cb23dfcf91f2285bf6c825405d.tar.gz |
This is an overhaul of the mode page handling in camcontrol as well as
related patches. These include:
* Mode page editting can be scripted. This involves two
things: first, if stdin is not a tty, changes are read from
stdin rather than invoking $EDITOR. Second, and more
importantly, not all modepage entries must be included in the
change set. This means that camcontrol can now gracefully handle
more intrusive editting from the $EDITOR, including removal or
rearrangement of lines. It also means that you can do stuff
like:
# echo "WCE: 1" | camcontrol modepage da3 -m 8 -e
# newfs /dev/da3
# echo "WCE: 0" | camcontrol modepage da3 -m 8 -e
* Range-checking on user-supplied input values. modeedit.c now
uses the field width specifiers to determine the maximum
allowable value for a field. If the user enters a value larger
than the maximum, it clips the value to the max and warns the
user. This also involved patching cam_cmdparse.c to be more
consistent with regards to the "count" parameter to arg_put
(previously is was the length of strings and 1 for all integral
types). The cam_cdbparse(3) man page was also updated to reflect
the revised semantics.
* In the process, I removed the 64 entry limit on mode pages (not
that we were even close to hitting that limit). This was a nice
side-effect of the other changes.
* Technically, the new mode editting functionality allows editting
of character array entries in mode pages (type 'c' or 'z'),
however since buff_encode doesn't grok them it is currently
useless.
* Camcontrol gained two new options related to mode pages: -l and
-b. The former lists all available mode pages for a given
device. The latter forces mode page display in binary format
(the default when no mode page definition was found in
scsi_modes).
* Added support for mode page names to scsi_modes. Allows names to
be displayed alongside mode numbers in the mode page
listing. Updated scsi_modes to use the new functionality. This
also adds the semicolon into the scsi_modes syntax as an
optional mode page definition terminator. This is needed to name
pages without providing a page format definition.
* Updated scsi_all.h to include a structure describing mode page
headers.
* Added $FreeBSD$ line to scsi_modes.
Inspired by: dwhite
Reviewed by: ken
Diffstat (limited to 'lib/libcam')
-rw-r--r-- | lib/libcam/cam_cdbparse.3 | 4 | ||||
-rw-r--r-- | lib/libcam/scsi_cmdparse.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/libcam/cam_cdbparse.3 b/lib/libcam/cam_cdbparse.3 index 5b9b073..0edbb6a 100644 --- a/lib/libcam/cam_cdbparse.3 +++ b/lib/libcam/cam_cdbparse.3 @@ -444,9 +444,9 @@ function. .It Fa val is a void pointer to the value being passed into the function. .It Fa count -is the number of arguments being passed into the +is the size of the value being passed into the .Fn arg_put -function. At present this will only be set to 1. +function. The argument format determines the unit of measure. .It Fa name This is a text description of the field, if one was provided in the .Fa fmt . diff --git a/lib/libcam/scsi_cmdparse.c b/lib/libcam/scsi_cmdparse.c index ad1cbb0..37d76cd6 100644 --- a/lib/libcam/scsi_cmdparse.c +++ b/lib/libcam/scsi_cmdparse.c @@ -119,7 +119,8 @@ do_buff_decode(u_int8_t *databuf, size_t len, if (arg_put) \ (*arg_put)(puthook, (letter == 't' ? \ 'b' : letter), \ - (void *)((long)(ARG)), 1, field_name); \ + (void *)((long)(ARG)), width, \ + field_name); \ else \ *(va_arg(ap, int *)) = (ARG); \ assigned++; \ |