2 * ppp_init.c --- PPP initialization/configuration for OSF/1.
4 * Get rid of svr4-style interface flag since the driver bits use
5 * use the old calling conventions.
7 * Configure should return ENOTSUP instead of EINVAL
9 * Use sysconfigtab framework
11 * Defer initialization callback until later in boot, to avoid panic.
13 * Note: Checks for #ifdef CFG_OP_CONFIGURE is my cheap way of telling
14 * whether this system is V3.0+ or V2.0. Is there a better way? srt
15 * Note: Checks for #ifdef CFG_PT_VM_AVAIL is my cheap way of telling
16 * whether this system is V4.0+ or earlier. smd
19 #include <sys/sysconfig.h>
20 #include <sys/stream.h>
22 static int configured = 0;
23 static struct streamadm tmpl_sa = {
26 { NULL }, /* sa_name, filled in at boot time */
29 "ppp" /* "global" sync across all PPP modules */
32 extern struct streamtab ppp_ahdlcinfo;
33 extern struct streamtab if_pppinfo;
34 extern struct streamtab ppp_compinfo;
35 extern struct streamtab pppinfo;
37 #ifdef CFG_OP_CONFIGURE
38 /* the number of actual PPP interfaces is extended
39 * on-the-fly, as needed
43 cfg_subsys_attr_t ppp_attributes[] = {
44 {"nppp", CFG_ATTR_INTTYPE,
45 CFG_OP_QUERY | CFG_OP_CONFIGURE,
46 (caddr_t) &nppp, 1, 1024, 0},
47 {"", 0, 0, 0, 0, 0, 0} /* must be the last element */
50 typedef sysconfig_op_t cfg_op_t;
53 /* Add the PPP streams modules to the pool of available modules.
54 * If for some reason we can't add one of them, then remove the
55 * ones we did succeed in adding.
64 strcpy(tmpl_sa.sa_name, "if_ppp");
65 if ((devno = strmod_add(NODEV, &if_pppinfo, &tmpl_sa)) == NODEV)
68 strcpy(tmpl_sa.sa_name, "ppp_ahdl");
69 if ((devno = strmod_add(NODEV, &ppp_ahdlcinfo, &tmpl_sa)) == NODEV) {
70 strcpy(tmpl_sa.sa_name, "if_ppp");
71 strmod_del(NODEV, &if_pppinfo, &tmpl_sa);
75 strcpy(tmpl_sa.sa_name, "pppcomp");
76 if ((devno = strmod_add(NODEV, &ppp_compinfo, &tmpl_sa)) == NODEV) {
77 strcpy(tmpl_sa.sa_name, "if_ppp");
78 strmod_del(NODEV, &if_pppinfo, &tmpl_sa);
79 strcpy(tmpl_sa.sa_name, "ppp_ahdl");
80 strmod_del(NODEV, &ppp_ahdlcinfo, &tmpl_sa);
84 strcpy(tmpl_sa.sa_name, "ppp");
85 tmpl_sa.sa_flags = STR_IS_DEVICE;
86 if ((devno = strmod_add(NODEV, &pppinfo, &tmpl_sa)) == NODEV) {
87 tmpl_sa.sa_flags = STR_IS_MODULE;
88 strcpy(tmpl_sa.sa_name, "if_ppp");
89 strmod_del(NODEV, &if_pppinfo, &tmpl_sa);
90 strcpy(tmpl_sa.sa_name, "ppp_ahdl");
91 strmod_del(NODEV, &ppp_ahdlcinfo, &tmpl_sa);
92 strcpy(tmpl_sa.sa_name, "pppcomp");
93 strmod_del(NODEV, &ppp_compinfo, &tmpl_sa);
103 #ifdef CFG_PT_VM_AVAIL
105 ppp_callback(point, order, arg, event_arg)
113 ret = ppp_initialize();
115 return; /* _callback returns void, losing info */
117 #endif /* CFG_PT_VM_AVAIL */
120 ppp_configure(op, indata, indata_size, outdata, outdata_size)
122 char *indata, *outdata;
123 ulong indata_size, outdata_size;
129 #ifdef CFG_OP_CONFIGURE
130 case CFG_OP_CONFIGURE:
132 case SYSCONFIG_CONFIGURE:
133 #endif /* CFG_OP_CONFIGURE */
135 #ifdef CFG_PT_VM_AVAIL
136 ret = register_callback(ppp_callback,
137 CFG_PT_OLD_CONF_ALL, CFG_ORD_DONTCARE, 0L);
139 ret = ppp_initialize();
140 #endif /* CFG_PT_VM_AVAIL */
147 case SYSCONFIG_QUERY:
151 #ifdef CFG_OP_RECONFIGURE
152 case CFG_OP_RECONFIGURE: