]> git.ozlabs.org Git - ppp.git/blob - sunos4/ppp_comp_vdcmd.c
syslog stuff back to main.c; take out npmode setting in sifup
[ppp.git] / sunos4 / ppp_comp_vdcmd.c
1 #include <sys/types.h>
2 #include <sys/errno.h>
3 #include <sys/conf.h>
4 #include <sun/vddrv.h>
5
6 extern struct streamtab ppp_compinfo;
7 extern int ppp_comp_count;
8
9 static struct vdldrv vd = {
10     VDMAGIC_USER,
11     "ppp_comp"
12 };
13
14 static int fmodsw_index = -1;
15
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;
22 {
23     int n;
24
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;
39
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;
49
50     case VDSTAT:
51         break;
52
53     default:
54         return EIO;
55     }
56     return 0;
57 }