CPU: Wrong CPU Load %.
[tomato.git] / release / src / router / ppp / sunos4 / if_ppp_vdcmd.c
blob2bf9710f4bf698c0ce9712fb81936b08cf38fbef
1 #include <sys/types.h>
2 #include <sys/errno.h>
3 #include <sys/conf.h>
4 #include <sun/vddrv.h>
6 extern struct streamtab if_pppinfo;
8 static struct vdldrv vd = {
9 VDMAGIC_USER,
10 "if_ppp"
13 static int fmodsw_index = -1;
15 int
16 if_ppp_vdcmd(fun, vdp, vdi, vds)
17 unsigned int fun;
18 struct vddrv *vdp;
19 addr_t vdi;
20 struct vdstat *vds;
22 int n, error;
24 switch (fun) {
25 case VDLOAD:
26 vdp->vdd_vdtab = (struct vdlinkage *) &vd;
27 if (fmodsw_index >= 0)
28 return EBUSY;
29 for (n = 0; n < fmodcnt; ++n)
30 if (fmodsw[n].f_str == 0)
31 break;
32 if (n >= fmodcnt)
33 return ENODEV;
34 strncpy(fmodsw[n].f_name, vd.Drv_name, FMNAMESZ+1);
35 fmodsw[n].f_str = &if_pppinfo;
36 fmodsw_index = n;
37 break;
39 case VDUNLOAD:
40 if (fmodsw_index <= 0)
41 return EINVAL;
42 error = if_ppp_unload();
43 if (error != 0)
44 return error;
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;