2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
5 * responsibility and is not changed in any way.
7 * I hate legaleese, don't you ?
10 * 29/12/94 Added code from Marc Huber <huber@fzi.de> to allow it to allocate
11 * its own major char number! Way cool patch!
13 #include <sys/types.h>
18 #include <sys/syslog.h>
20 #include <sys/param.h>
21 #include <sys/errno.h>
23 #include <sys/vnode.h>
24 #include <sundev/mbvar.h>
25 #include <sun/autoconf.h>
26 #include <sun/vddrv.h>
27 #if defined(sun4c) || defined(sun4m)
28 #include <sun/openprom.h>
32 #define IPL_NAME "/dev/ipl"
35 extern int iplattach(), iplopen(), iplclose(), iplioctl(), iplread();
36 extern int nulldev(), iplidentify(), errno
;
38 struct cdevsw ipldevsw
=
40 iplopen
, iplclose
, iplread
, nulldev
,
41 iplioctl
, nulldev
, nulldev
, nulldev
,
46 struct dev_ops ipl_ops
=
84 VDMAGIC_PSEUDO
, /* magic */
87 &ipl_ops
, /* dev_ops */
89 NULL
, /* struct mb_ctlr *mb_ctlr */
90 NULL
, /* struct mb_driver *mb_driver */
91 NULL
, /* struct mb_device *mb_device */
96 &ipldevsw
, /* cdevsw */
102 extern int vd_unuseddev();
103 extern struct cdevsw cdevsw
[];
106 xxxinit(fc
, vdp
, vdi
, vds
)
118 while (ipl_major
< nchrdev
&&
119 cdevsw
[ipl_major
].d_open
!= vd_unuseddev
)
121 if (ipl_major
== nchrdev
)
123 vd
.Drv_charmajor
= ipl_major
;
124 vdp
->vdd_vdtab
= (struct vdlinkage
*)&vd
;
125 return ipl_attach(vdi
);
127 return unload(vdp
, vdi
);
137 static unload(vdp
, vdi
)
139 struct vdioctl_unload
*vdi
;
143 (void) vn_remove(IPL_NAME
, UIO_SYSSPACE
, FILE);
148 static int ipl_attach(vdi
)
149 struct vdioctl_load
*vdi
;
153 int error
= 0, fmode
= S_IFCHR
|0600;
155 (void) vn_remove(IPL_NAME
, UIO_SYSSPACE
, FILE);
157 vattr
.va_type
= MFTOVT(fmode
);
158 vattr
.va_mode
= (fmode
& 07777);
159 vattr
.va_rdev
= ipl_major
<<8;
161 error
= vn_create(IPL_NAME
, UIO_SYSSPACE
, &vattr
, EXCL
, 0, &vp
);