patch-2.2.0-pre1 linux/net/wanrouter/wanmain.c
Next file: linux/scripts/Menuconfig
Previous file: linux/net/sunrpc/xprt.c
Back to the patch index
Back to the overall index
- Lines: 99
- Date:
Mon Dec 28 11:07:13 1998
- Orig file:
v2.1.132/linux/net/wanrouter/wanmain.c
- Orig date:
Tue Dec 22 14:16:59 1998
diff -u --recursive --new-file v2.1.132/linux/net/wanrouter/wanmain.c linux/net/wanrouter/wanmain.c
@@ -27,6 +27,9 @@
* May 17, 1998 K. Baranowski Fixed SNAP encapsulation in wan_encapsulate
* Dec 15, 1998 Arnaldo Melo support for firmwares of up to 128000 bytes
* check wandev->setup return value
+* Dec 22, 1998 Arnaldo Melo vmalloc/vfree used in device_setup to allocate
+* kernel memory and copy configuration data to
+* kernel space (for big firmwares)
*****************************************************************************/
#include <linux/stddef.h> /* offsetof(), etc. */
@@ -36,6 +39,7 @@
#include <linux/malloc.h> /* kmalloc(), kfree() */
#include <linux/mm.h> /* verify_area(), etc. */
#include <linux/string.h> /* inline mem*, str* functions */
+#include <linux/vmalloc.h> /* vmalloc, vfree */
#include <asm/segment.h> /* kernel <-> user copy */
#include <asm/byteorder.h> /* htons(), etc. */
#include <asm/uaccess.h> /* copy_to/from_user */
@@ -100,7 +104,30 @@
static unsigned char oui_802_2[] = { 0x00, 0x80, 0xC2 };
#endif
-#ifdef MODULE
+#ifndef MODULE
+
+int wanrouter_init(void)
+{
+ int err;
+ extern void wanpipe_init(void);
+
+ printk(KERN_INFO "%s v%u.%u %s\n",
+ fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright);
+ err = wanrouter_proc_init();
+ if (err)
+ printk(KERN_ERR "%s: can't create entry in proc filesystem!\n", modname);
+
+ /*
+ * Initialise compiled in boards
+ */
+
+#ifdef CONFIG_VENDOR_SANGOMA
+ wanpipe_init();
+#endif
+ return err;
+}
+
+#else
/*
* Kernel Loadable Module Entry Points
@@ -139,14 +166,6 @@
wanrouter_proc_cleanup();
}
-#else
-
-__initfunc(void wanrouter_init(void))
-{
- int err = wanrouter_proc_init();
- if (err) printk(KERN_ERR
- "%s: can't create entry in proc filesystem!\n", modname);
-}
#endif
/*
@@ -440,7 +459,7 @@
static int device_setup (wan_device_t* wandev, wandev_conf_t* u_conf)
{
void* data;
- wandev_conf_t* conf;
+ wandev_conf_t *conf;
int err= -EINVAL;
if (wandev->setup == NULL) /* Nothing to do ? */
@@ -464,7 +483,7 @@
if(conf->data_size > 128000 || conf->data_size < 0){
goto bail;
}
- data = kmalloc(conf->data_size, GFP_KERNEL);
+ data = vmalloc(conf->data_size);
if (data)
{
if(!copy_from_user(data, conf->data, conf->data_size))
@@ -473,10 +492,13 @@
err = wandev->setup(wandev,conf);
}
else
- err = -ENOBUFS;
+ err = -EFAULT;
}
+ else
+ err = -ENOBUFS;
+
if (data)
- kfree(data);
+ vfree(data);
}
bail:
kfree(conf);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov