* ports: same syntax as for nvram's vlan*ports (eg. "1 2 3 4 5*")
*/
-#include <linux/config.h>
+#include <linux/autoconf.h>
#include <linux/module.h>
#include <linux/init.h>
#include <asm/uaccess.h>
static ssize_t switch_proc_write(struct file *file, const char *buf, size_t count, void *data);
static struct file_operations switch_proc_fops = {
- read: switch_proc_read,
- write: switch_proc_write
+ .read = (ssize_t (*) (struct file *, char __user *, size_t, loff_t *))switch_proc_read,
+ .write = (ssize_t (*) (struct file *, const char __user *, size_t, loff_t *))switch_proc_write
};
static ssize_t switch_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos)
len = 0;
}
+ kfree(page);
return len;
}
static int handle_driver_name(void *driver, char *buf, int nr)
{
- char *name = ((switch_driver *) driver)->name;
+ const char *name = ((switch_driver *) driver)->name;
return sprintf(buf, "%s\n", name);
}
static int handle_driver_version(void *driver, char *buf, int nr)
{
- char *version = ((switch_driver *) driver)->version;
+ const char *version = ((switch_driver *) driver)->version;
strcpy(buf, version);
return sprintf(buf, "%s\n", version);
}
-static void add_handler(switch_driver *driver, switch_config *handler, struct proc_dir_entry *parent, int nr)
+static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr)
{
switch_priv *priv = (switch_priv *) driver->data;
struct proc_dir_entry *p;
}
}
-static inline void add_handlers(switch_driver *driver, switch_config *handlers, struct proc_dir_entry *parent, int nr)
+static inline void add_handlers(switch_driver *driver, const switch_config *handlers, struct proc_dir_entry *parent, int nr)
{
int i;
memcpy(new, driver, sizeof(switch_driver));
new->name = strdup(driver->name);
new->interface = strdup(driver->interface);
-
+
if ((ret = do_register(new)) < 0) {
kfree(new->name);
kfree(new);
}
}
-static int __init switch_init()
+static int __init switch_init(void)
{
if ((switch_root = proc_mkdir("switch", NULL)) == NULL) {
printk("%s: proc_mkdir failed.\n", __FILE__);
return 0;
}
-static void __exit switch_exit()
+static void __exit switch_exit(void)
{
remove_proc_entry("switch", NULL);
}