|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution is only permitted until one year after the first shipment
6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
7: * binary forms are permitted provided that: (1) source distributions retain
8: * this entire copyright notice and comment, and (2) distributions including
9: * binaries display the following acknowledgement: This product includes
10: * software developed by the University of California, Berkeley and its
11: * contributors'' in the documentation or other materials provided with the
12: * distribution and in all advertising materials mentioning features or use
13: * of this software. Neither the name of the University nor the names of
14: * its contributors may be used to endorse or promote products derived from
15: * this software without specific prior written permission.
16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19: *
20: * @(#)conf.c 7.2 (Berkeley) 7/1/90
21: */
22:
23: #include "saio.h"
24:
25: devread(io)
26: register struct iob *io;
27: {
28: int cc;
29:
30: /* check for interrupt */
31: (void) peekchar();
32:
33: io->i_flgs |= F_RDDATA;
34: io->i_error = 0;
35: cc = (*devsw[io->i_dev].dv_strategy)(io, READ);
36: io->i_flgs &= ~F_TYPEMASK;
37: return (cc);
38: }
39:
40: devwrite(io)
41: register struct iob *io;
42: {
43: int cc;
44:
45: io->i_flgs |= F_WRDATA;
46: io->i_error = 0;
47: cc = (*devsw[io->i_dev].dv_strategy)(io, WRITE);
48: io->i_flgs &= ~F_TYPEMASK;
49: return (cc);
50: }
51:
52: devopen(io)
53: register struct iob *io;
54: {
55:
56: (*devsw[io->i_dev].dv_open)(io);
57: }
58:
59: devclose(io)
60: register struct iob *io;
61: {
62:
63: (*devsw[io->i_dev].dv_close)(io);
64: }
65:
66: devioctl(io, cmd, arg)
67: register struct iob *io;
68: int cmd;
69: caddr_t arg;
70: {
71:
72: return ((*devsw[io->i_dev].dv_ioctl)(io, cmd, arg));
73: }
74:
75: /*ARGSUSED*/
76: nullsys(io)
77: struct iob *io;
78: {
79:
80: ;
81: }
82:
83: /*ARGSUSED*/
84: nullioctl(io, cmd, arg)
85: struct iob *io;
86: int cmd;
87: caddr_t arg;
88: {
89:
90: return (ECMD);
91: }
92:
93: int nullsys(), nullioctl();
94: int rdstrategy(), rdopen(), rdioctl();
95: int sdstrategy(), sdopen(), sdioctl();
96: #ifndef BOOT
97: int ctstrategy(), ctopen(), ctclose();
98: #endif
99:
100: struct devsw devsw[] = {
101: { "rd", rdstrategy, rdopen, nullsys, nullioctl },
102: { "sd", sdstrategy, sdopen, nullsys, nullioctl },
103: #ifndef BOOT
104: { "ct", ctstrategy, ctopen, ctclose, nullioctl },
105: #endif
106: { 0, 0, 0, 0, 0 },
107: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.