xref: /original-bsd/sys/hp300/stand/conf.c (revision c8876cb1)
1 /*
2  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)conf.c	7.2 (Berkeley) 07/01/90
8  */
9 
10 #include "saio.h"
11 
12 devread(io)
13 	register struct iob *io;
14 {
15 	int cc;
16 
17 	/* check for interrupt */
18 	(void) peekchar();
19 
20 	io->i_flgs |= F_RDDATA;
21 	io->i_error = 0;
22 	cc = (*devsw[io->i_dev].dv_strategy)(io, READ);
23 	io->i_flgs &= ~F_TYPEMASK;
24 	return (cc);
25 }
26 
27 devwrite(io)
28 	register struct iob *io;
29 {
30 	int cc;
31 
32 	io->i_flgs |= F_WRDATA;
33 	io->i_error = 0;
34 	cc = (*devsw[io->i_dev].dv_strategy)(io, WRITE);
35 	io->i_flgs &= ~F_TYPEMASK;
36 	return (cc);
37 }
38 
39 devopen(io)
40 	register struct iob *io;
41 {
42 
43 	(*devsw[io->i_dev].dv_open)(io);
44 }
45 
46 devclose(io)
47 	register struct iob *io;
48 {
49 
50 	(*devsw[io->i_dev].dv_close)(io);
51 }
52 
53 devioctl(io, cmd, arg)
54 	register struct iob *io;
55 	int cmd;
56 	caddr_t arg;
57 {
58 
59 	return ((*devsw[io->i_dev].dv_ioctl)(io, cmd, arg));
60 }
61 
62 /*ARGSUSED*/
63 nullsys(io)
64 	struct iob *io;
65 {
66 
67 	;
68 }
69 
70 /*ARGSUSED*/
71 nullioctl(io, cmd, arg)
72 	struct iob *io;
73 	int cmd;
74 	caddr_t arg;
75 {
76 
77 	return (ECMD);
78 }
79 
80 int	nullsys(), nullioctl();
81 int	rdstrategy(), rdopen(), rdioctl();
82 int	sdstrategy(), sdopen(), sdioctl();
83 #ifndef BOOT
84 int	ctstrategy(), ctopen(), ctclose();
85 #endif
86 
87 struct devsw devsw[] = {
88 	{ "rd",	rdstrategy,	rdopen,		nullsys,	nullioctl },
89 	{ "sd",	sdstrategy,	sdopen,		nullsys,	nullioctl },
90 #ifndef BOOT
91 	{ "ct",	ctstrategy,	ctopen,		ctclose,	nullioctl },
92 #endif
93 	{ 0, 0, 0, 0, 0 },
94 };
95