Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/chio Update for changes to the changer driver.
details: https://anonhg.NetBSD.org/src/rev/5f13b5292545
branches: trunk
changeset: 476218:5f13b5292545
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Sep 09 23:24:29 1999 +0000
description:
Update for changes to the changer driver.
diffstat:
bin/chio/chio.1 | 62 +++++++---
bin/chio/chio.c | 287 +++++++++++++++++++++++++++++++++++---------------
bin/chio/defs.h | 68 ++++++-----
bin/chio/pathnames.h | 43 ++++---
4 files changed, 300 insertions(+), 160 deletions(-)
diffs (truncated from 789 to 300 lines):
diff -r 0146589bd4f1 -r 5f13b5292545 bin/chio/chio.1
--- a/bin/chio/chio.1 Thu Sep 09 23:24:11 1999 +0000
+++ b/bin/chio/chio.1 Thu Sep 09 23:24:29 1999 +0000
@@ -1,8 +1,12 @@
-.\" $NetBSD: chio.1,v 1.8 1999/08/05 02:47:09 hubertf Exp $
+.\" $NetBSD: chio.1,v 1.9 1999/09/09 23:24:29 thorpej Exp $
.\"
-.\" Copyright (c) 1996, 1998 Jason R. Thorpe <thorpej%and.com@localhost>
+.\" Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+.\" NASA Ames Research Center.
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -12,25 +16,26 @@
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgements:
-.\" This product includes software developed by Jason R. Thorpe
-.\" for And Communications, http://www.and.com/
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 11, 1998
+.Dd September 8, 1999
.Dt CHIO 1
.Os
.Sh NAME
@@ -166,7 +171,8 @@
.Pp
.Nm
.Ic status
-.Op Ar <type>
+.Oo Ar <type> Oo unit Oo count Oc Oc Oc
+.Op Ar voltags
.Pp
Report the status of all elements in the changer. If
.Pa <type>
@@ -189,6 +195,16 @@
Element supports receiving media (importing) from an outside human operator.
.El
.Pp
+If the element is a drive, the device name of the drive will be reported
+if it is available.
+.Pp
+If the
+.Op Ar voltags
+option is specified, primary and alternate volume tag information will
+be reported, if available.
+.Pp
+If the previous location of the media is available, it will also be reported.
+.Pp
.Nm
.Ic ielem
.Pp
@@ -237,5 +253,7 @@
.Sh AUTHOR
The
.Nm
-program and SCSI changer driver were written by Jason R. Thorpe
-<thorpej%and.com@localhost> for And Communications, http://www.and.com/
+program and SCSI changer driver were originally written by Jason R. Thorpe
+for And Communications, http://www.and.com/. Additional development was
+done by Jason R. Thorpe for the Numerical Aerospace Simulation Facility,
+NASA Ames Research Center.
diff -r 0146589bd4f1 -r 5f13b5292545 bin/chio/chio.c
--- a/bin/chio/chio.c Thu Sep 09 23:24:11 1999 +0000
+++ b/bin/chio/chio.c Thu Sep 09 23:24:29 1999 +0000
@@ -1,9 +1,13 @@
-/* $NetBSD: chio.c,v 1.12 1999/09/08 04:57:37 thorpej Exp $ */
+/* $NetBSD: chio.c,v 1.13 1999/09/09 23:24:29 thorpej Exp $ */
-/*
- * Copyright (c) 1996, 1998 Jason R. Thorpe <thorpej%and.com@localhost>
+/*-
+ * Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,24 +17,26 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgements:
- * This product includes software developed by Jason R. Thorpe
- * for And Communications, http://www.and.com/
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
+
/*
* Additional Copyright (c) 1997, by Matthew Jacob, for NASA/Ames Research Ctr.
*/
@@ -38,14 +44,16 @@
#include <sys/cdefs.h>
#ifndef lint
__COPYRIGHT(
- "@(#) Copyright (c) 1996, 1998 Jason R. Thorpe. All rights reserved.");
-__RCSID("$NetBSD: chio.c,v 1.12 1999/09/08 04:57:37 thorpej Exp $");
+"@(#) Copyright (c) 1996, 1998, 1999\
+ The NetBSD Foundation, Inc. All rights reserved.");
+__RCSID("$NetBSD: chio.c,v 1.13 1999/09/09 23:24:29 thorpej Exp $");
#endif
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/chio.h>
#include <sys/cdio.h> /* for ATAPI CD changer; too bad it uses a lame API */
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -58,26 +66,26 @@
#include "defs.h"
#include "pathnames.h"
-extern char *__progname; /* from crt0.o */
+extern const char *__progname; /* from crt0.o */
int main __P((int, char *[]));
static void usage __P((void));
static void cleanup __P((void));
-static int parse_element_type __P((char *));
-static int parse_element_unit __P((char *));
-static int parse_special __P((char *));
-static int is_special __P((char *));
+static int parse_element_type __P((const char *));
+static int parse_element_unit __P((const char *));
+static int parse_special __P((const char *));
+static int is_special __P((const char *));
static const char *bits_to_string __P((int, const char *));
-static int do_move __P((char *, int, char **));
-static int do_exchange __P((char *, int, char **));
-static int do_position __P((char *, int, char **));
-static int do_params __P((char *, int, char **));
-static int do_getpicker __P((char *, int, char **));
-static int do_setpicker __P((char *, int, char **));
-static int do_status __P((char *, int, char **));
-static int do_ielem __P((char *, int, char **));
-static int do_cdlu __P((char *, int, char **));
+static int do_move __P((const char *, int, char **));
+static int do_exchange __P((const char *, int, char **));
+static int do_position __P((const char *, int, char **));
+static int do_params __P((const char *, int, char **));
+static int do_getpicker __P((const char *, int, char **));
+static int do_setpicker __P((const char *, int, char **));
+static int do_status __P((const char *, int, char **));
+static int do_ielem __P((const char *, int, char **));
+static int do_cdlu __P((const char *, int, char **));
/* Valid changer element types. */
const struct element_type elements[] = {
@@ -108,7 +116,7 @@
{ "setpicker", " <picker>",
do_setpicker },
- { "status", " [<element type>]",
+ { "status", " [<ET> [unit [count]]] [voltags]",
do_status },
{ "ielem", "",
@@ -127,6 +135,7 @@
{ "inv", SW_INVERT },
{ "inv1", SW_INVERT1 },
{ "inv2", SW_INVERT2 },
+ { "voltags", SW_VOLTAGS },
{ NULL, 0 },
};
@@ -184,11 +193,11 @@
static int
do_move(cname, argc, argv)
- char *cname;
+ const char *cname;
int argc;
char **argv;
{
- struct changer_move cmd;
+ struct changer_move_request cmd;
int val;
/*
@@ -247,11 +256,11 @@
static int
do_exchange(cname, argc, argv)
- char *cname;
+ const char *cname;
int argc;
char **argv;
{
- struct changer_exchange cmd;
+ struct changer_exchange_request cmd;
int val;
/*
@@ -335,11 +344,11 @@
static int
do_position(cname, argc, argv)
- char *cname;
+ const char *cname;
int argc;
char **argv;
{
- struct changer_position cmd;
+ struct changer_position_request cmd;
int val;
/*
@@ -391,7 +400,7 @@
/* ARGSUSED */
static int
do_params(cname, argc, argv)
- char *cname;
+ const char *cname;
int argc;
char **argv;
{
@@ -408,14 +417,19 @@
if (ioctl(changer_fd, CHIOGPARAMS, &data))
err(1, "%s: CHIOGPARAMS", changer_name);
+#define PLURAL(n) (n) > 1 ? "s" : ""
+
(void) printf("%s: %d slot%s, %d drive%s, %d picker%s",
changer_name,
- data.cp_nslots, (data.cp_nslots > 1) ? "s" : "",
- data.cp_ndrives, (data.cp_ndrives > 1) ? "s" : "",
Home |
Main Index |
Thread Index |
Old Index