Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / hp700 / stand / common / ct.c
blob21f206e425a966769af199171e715561c2128bdd
1 /* $NetBSD: ct.c,v 1.4 2009/05/08 09:33:59 skrll Exp $ */
3 /* $OpenBSD: ct.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
5 /*
6 * Copyright (c) 1998-2004 Michael Shalayeff
7 * All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
31 * Copyright 1996 1995 by Open Software Foundation, Inc.
32 * All Rights Reserved
34 * Permission to use, copy, modify, and distribute this software and
35 * its documentation for any purpose and without fee is hereby granted,
36 * provided that the above copyright notice appears in all copies and
37 * that both the copyright notice and this permission notice appear in
38 * supporting documentation.
40 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
41 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
42 * FOR A PARTICULAR PURPOSE.
44 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
45 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
46 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
47 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
48 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
52 #include "libsa.h"
54 #include <sys/param.h>
55 #include <sys/disklabel.h>
56 #include <sys/reboot.h>
58 #include <machine/pdc.h>
59 #include <machine/iomod.h>
61 #include "dev_hppa.h"
63 struct pz_device ctdev;
64 iodcio_t ctiodc; /* cartridge tape IODC entry point */
65 int ctcode[IODC_MAXSIZE/sizeof(int)];
67 int
68 ctopen(struct open_file *f, ...)
70 struct hppa_dev *dp = f->f_devdata;
71 int ret;
73 if (ctiodc == 0) {
75 if ((ret = (*pdc)(PDC_IODC, PDC_IODC_READ, pdcbuf, ctdev.pz_hpa,
76 IODC_IO, ctcode, IODC_MAXSIZE)) < 0) {
77 printf("ct: device ENTRY_IO Read ret'd %d\n", ret);
78 return (EIO);
79 } else
80 ctdev.pz_iodc_io = ctiodc = (iodcio_t) ctcode;
83 dp->pz_dev = &ctdev;
85 if (ctiodc != NULL)
86 if ((ret = (*ctiodc)(ctdev.pz_hpa, IODC_IO_READ, ctdev.pz_spa,
87 ctdev.pz_layers, pdcbuf, 0,
88 dp->buf, 0, 0)) < 0)
89 printf("ct: device rewind ret'd %d\n", ret);
91 return (0);
94 /*ARGSUSED*/
95 int
96 ctclose(struct open_file *f)
98 dealloc(f->f_devdata, sizeof(struct hppa_dev));
99 f->f_devdata = NULL;
100 return 0;