Update patchlevel date
[mpls-ppp.git] / sunos4 / ppp_ahdlc_vdcmd.c
blob2dbe8262b5673b4e7ee26759bc06fc01d5665840
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_ahdlcinfo;
7 extern int ppp_ahdlc_count;
9 static struct vdldrv vd = {
10 VDMAGIC_USER,
11 "ppp_ahdl"
14 static int fmodsw_index = -1;
16 int
17 ppp_ahdlc_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_ahdlcinfo;
37 fmodsw_index = n;
38 break;
40 case VDUNLOAD:
41 if (ppp_ahdlc_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;