blob: 270c3d55f281335fc140dbf8879b21e92eb059ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
** dynamically loadable chu driver
**
** william robertson <rob@agate.berkeley.edu>
*/
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/errno.h>
#include <sys/stream.h>
#include <sys/syslog.h>
#include <sun/openprom.h>
#include <sun/vddrv.h>
extern int findmod(); /* os/str_io.c */
extern struct streamtab chuinfo;
struct vdldrv vd = {
VDMAGIC_USER,
"chu"
};
int
xxxinit(function_code, vdp, vdi, vds)
unsigned int function_code;
struct vddrv *vdp;
addr_t vdi;
struct vdstat *vds;
{
register int i = 0;
register int j;
switch (function_code) {
case VDLOAD:
if (findmod("chu") >= 0) {
log(LOG_ERR, "chu stream module already loaded\n");
return (EADDRINUSE);
}
i = findmod("\0");
if (i == -1 || fmodsw[i].f_name[0] != '\0')
return(-1);
for (j = 0; vd.Drv_name[j] != '\0'; j++) /* XXX check bounds */
fmodsw[i].f_name[j] = vd.Drv_name[j];
fmodsw[i].f_name[j] = '\0';
fmodsw[i].f_str = &chuinfo;
vdp->vdd_vdtab = (struct vdlinkage *) &vd;
return(0);
case VDUNLOAD:
if ((i = findmod(vd.Drv_name)) == -1)
return(-1);
fmodsw[i].f_name[0] = '\0';
fmodsw[i].f_str = 0;
return(0);
case VDSTAT:
return(0);
default:
return(EIO);
}
}
|