Update patchlevel date
[mpls-ppp.git] / sunos4 / ppp_comp_vdcmd.c
blobb81bc47e8953cbb6506f53901e186d19a3c9fbe8
1 #include <sys/types.h>
2 #include <sys/errno.h>
3 #include <sys/conf.h>
4 #include <sun/vddrv.h>
6 extern struct streamtab ppp_compinfo;
7 extern int ppp_comp_count;
9 static struct vdldrv vd = {
10 VDMAGIC_USER,
11 "ppp_comp"
14 static int fmodsw_index = -1;
16 int
17 ppp_comp_vdcmd(fun, vdp, vdi, vds)
18 unsigned int fun;
19 struct vddrv *vdp;
20 addr_t vdi;
21 struct vdstat *vds;
23 int n;
25 switch (fun) {
26 case VDLOAD:
27 vdp->vdd_vdtab = (struct vdlinkage *) &vd;
28 if (fmodsw_index >= 0)
29 return EBUSY;
30 for (n = 0; n < fmodcnt; ++n)
31 if (fmodsw[n].f_str == 0)
32 break;
33 if (n >= fmodcnt)
34 return ENODEV;
35 strncpy(fmodsw[n].f_name, vd.Drv_name, FMNAMESZ+1);
36 fmodsw[n].f_str = &ppp_compinfo;
37 fmodsw_index = n;
38 break;
40 case VDUNLOAD:
41 if (ppp_comp_count > 0)
42 return EBUSY;
43 if (fmodsw_index <= 0)
44 return EINVAL;
45 fmodsw[fmodsw_index].f_name[0] = 0;
46 fmodsw[fmodsw_index].f_str = 0;
47 fmodsw_index = -1;
48 break;
50 case VDSTAT:
51 break;
53 default:
54 return EIO;
56 return 0;