aboutsummaryrefslogtreecommitdiff
path: root/bin/chio/chio.c
Commit message (Collapse)AuthorAgeFilesLines
* chio(8): Fix typo in the copyright sectionWilbert Allen Koeswoyo Suwito2024-02-131-1/+1
| | | | | Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Pull Request: https://github.com/freebsd/freebsd-src/pull/978
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-8/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-07-071-1/+1
| | | | | | | | In most cases, usage does not return, so mark them as __dead2. For the cases where they do return, they have not been marked __dead2. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/735
* chio: Mark some arguments as unused.Warner Losh2022-10-251-2/+2
| | | | Sponsored by: Netflix
* chio: avoid out of bounds readEd Maste2020-07-261-1/+1
| | | | | | | | | | | ch_ces is alloacated with space for total_elem entries. CID: 1418536 Reported by: Coverity Scan Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=363563
* Update chio(1) and ch(4) to support reporting element designators.Kenneth D. Merry2013-04-191-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato <hrs@> for the explaining UTF-8 printing and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h: Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c: Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong MFC After: 1 week Notes: svn path=/head/; revision=249658
* Add static keywords to chio(1).Ed Schouten2011-12-111-3/+3
| | | | | | | | All other global variables are already marked static, so for consistency sake, add them to these three arrays as well. Notes: svn path=/head/; revision=228423
* Zero struct before reading from itUlrich Spörlein2010-06-021-0/+1
| | | | | | | | | PR: 140384 Found by: clang static analyzer MFC after: 3 weeks Notes: svn path=/head/; revision=208730
* When running a "chio return" operation using a physical source unitJoerg Wunsch2008-10-301-4/+6
| | | | | | | | | | | | | | | rather than a voltag name, do not set the CESR_VOLTAGS flags in the CHIOGSTATUS command requesting the current status. As voltags are an optional feature that must be handled as "reserved" by media changers not implementing the feature, always setting CESR_VOLTAGS resulted in the command being aborted with an `Invalid field in CDB', and consequently the "chio return" failed, for media changers that do not support voltags. MFC after: 1 week Notes: svn path=/head/; revision=184484
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-101-1/+1
| | | | Notes: svn path=/head/; revision=139969
* Quiet warnings about copyright[].David E. O'Brien2003-05-011-0/+2
| | | | Notes: svn path=/head/; revision=114433
* Remove double #include <sys/cdef.h> and __FBSDID.David Malone2002-07-011-2/+0
| | | | | | | | PR: 40053 Submitted by: Dan Lukes <dan@obluda.cz> Notes: svn path=/head/; revision=99205
* Consistently use __FBSDIDDavid E. O'Brien2002-06-301-0/+2
| | | | Notes: svn path=/head/; revision=99109
* Replace use of __progname with the functionally identical and moreMark Murray2002-03-241-15/+14
| | | | | | | acceptable getprogname(3). Notes: svn path=/head/; revision=93101
* Use ANSI-99 int names (uintXX_t) over traditional BSD int namesWarner Losh2002-03-051-5/+6
| | | | | | | (u_intXX_t). Notes: svn path=/head/; revision=91665
* Fix a boatload of warnings inspired by lint, a commercial lintMark Murray2002-02-221-16/+14
| | | | | | | and WARNS=4. Notes: svn path=/head/; revision=91086
* Modernization effort for bin/c*:Warner Losh2002-02-021-88/+44
| | | | | | | | | | | | | | | o __P has been reoved o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. Approved by: arch@, new style(9) Notes: svn path=/head/; revision=90107
* Fix warnings on alpha and re-enable WARNS=2.Mike Heffner2001-07-041-13/+17
| | | | | | | Submitted by: Mike Barcroft <mike@q9media.com> Notes: svn path=/head/; revision=79253
* Constify and lockdown with WARNS=2.Mike Heffner2001-07-031-21/+21
| | | | | | | | Submitted by: Mike Barcroft <mike@q9media.com> MFC after: 2 weeks Notes: svn path=/head/; revision=79121
* Add two new features to chio(1):Kenneth D. Merry2000-09-181-9/+274
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - The ability to specify elements by volume tag instead of their actual physical location. e.g., instead of: chio move slot 3 slot 4 you would now use: chio move voltag FOO slot 4 - The ability to return an element to its previous location, as specified by the source element. e.g., instead of: chio move drive 0 slot 4 you would now use: chio return drive 0 or chio return voltag FOO These features will obviously only work with changers that support volume tags and/or source element IDs. chio(1) should fail gracefully if the user attempts to use these new features and the source element ID or volume tag are not found. PR: bin/21178 Submitted by: "C. Stephen Gunn" <csg@waterspout.com> Reviewed by: ken Notes: svn path=/head/; revision=66019
* Don't explicitly declare optarg and optind. These are declared inWarner Losh2000-08-161-1/+0
| | | | | | | unistd.h, which is already included. Notes: svn path=/head/; revision=64692
* $Id$ -> $FreeBSD$Peter Wemm1999-08-271-1/+1
| | | | Notes: svn path=/head/; revision=50471
* Correct some style issues in my previous commit.Kris Kennaway1999-07-221-2/+2
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=48983
* Undo some of the reversions from previous revisions, and attempt toKris Kennaway1999-06-211-52/+83
| | | | | | | | | minimize diffs with {Net,Open}BSD Hinted-More-Or-Less-By: bde Notes: svn path=/head/; revision=48073
* Changes from OpenBSD:Kris Kennaway1999-06-071-12/+23
| | | | | | | | | | | | | * Better usage() - correct syntax, display available commands instead of examples * Accept command abbreviations * sprintf -> snprintf (for paranoia) * manpage capitalisation tweak Obtained from: OpenBSD Notes: svn path=/head/; revision=47816
* getopt(3) returns -1 not EOF.Warner Losh1999-05-231-2/+2
| | | | Notes: svn path=/head/; revision=47442
* First set of fixes to keep egcs happy. These include {} around singleWarner Losh1999-04-251-1/+2
| | | | | | | | | | | | | statement if blocks[*] when the else could be ambiguous, not defaulting to int type and removal of some unused variables. [*] This is explicitly allowed by style(9) when the single statement spans more than one line. Reviewed by: obrien, chuckr Notes: svn path=/head/; revision=46073
* Fixed printf format errors (new bugs in rev.1.7). Fixed a spelling errorBruce Evans1998-12-071-7/+7
| | | | | | | | (rev.1.7 blew away most of rev.1.2-1.6; I'm only fixing blowing away of rev.1.4). Notes: svn path=/head/; revision=41579
* Fix 'chio params' so that it actually prints out the current picker.Kenneth D. Merry1998-10-011-0/+7
| | | | | | | | | (This was broken when the volume tag changes went in.) Submitted by: Josef Karthauser <joe@pavilion.net> Notes: svn path=/head/; revision=39876
* Updated the ch(4) driver and chio(1) command to include volumeJustin T. Gibbs1998-09-151-126/+361
| | | | | | | | | | | | | | | | | | | | tag support. These changes have been tested with a Breeze Hill Q47 DLT and a DEC DLT2500 media changer. The latter has no volume tag support. The chio(1) command was updated to include various flags to the status subcommand. These flags can be used to select additional information to be displayed (like volume tags). A new chio(1) subcommand named 'voltag' has been added which allows for changes to volume tags inside the media changer controller. This could not be tested as the Q47 does not provide the functio- nality. Submitted by: Hans Huebner Notes: svn path=/head/; revision=39227
* Do not remove include of <sys/param.h> and <sys/types.h>. They shouldPhilippe Charnier1998-05-131-1/+2
| | | | | | | | be here before including almost any POSIX header. Requested by: Bruce Notes: svn path=/head/; revision=36001
* Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.Philippe Charnier1998-05-061-6/+5
| | | | Notes: svn path=/head/; revision=35773
* spellingEivind Eklund1998-02-111-2/+2
| | | | | | | Obtained from: OpenBSD (src/bin/chio/chio.c rev 1.7) by todd@openbsd.org Notes: svn path=/head/; revision=33238
* Do not use __progname.Philippe Charnier1997-06-061-16/+12
| | | | Notes: svn path=/head/; revision=26464
* Remove unused variables. Suppress -Wall warnings. Check for potential bufferPhilippe Charnier1997-06-021-5/+13
| | | | | | | | overflow. Display available command in usage string. Obtained from: {Net|Open}BSD Notes: svn path=/head/; revision=26361
* Import Jason Thorpe's contribution for an updated SCSI media changerJoerg Wunsch1997-03-061-0/+663
device (now, finally!). Notes: svn path=/vendor/jthorpe/dist/; revision=23449