Commit 8bedf7c7 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: [ioctl][3/8] Use new code for pppoatm and br2684 (from levon@movementarian.org)

parent 2267e86d
...@@ -634,9 +634,11 @@ static int br2684_create(unsigned long arg) ...@@ -634,9 +634,11 @@ static int br2684_create(unsigned long arg)
* This handles ioctls actually performed on our vcc - we must return * This handles ioctls actually performed on our vcc - we must return
* -ENOIOCTLCMD for any unrecognized ioctl * -ENOIOCTLCMD for any unrecognized ioctl
*/ */
static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, static int br2684_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct atm_vcc *atmvcc = ATM_SD(sock);
int err; int err;
switch(cmd) { switch(cmd) {
case ATM_SETBACKEND: case ATM_SETBACKEND:
...@@ -667,6 +669,12 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, ...@@ -667,6 +669,12 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
static struct atm_ioctl br2684_ioctl_ops = {
.owner = THIS_MODULE,
.ioctl = br2684_ioctl,
};
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void *br2684_seq_start(struct seq_file *seq, loff_t *pos) static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
{ {
...@@ -774,7 +782,7 @@ static int __init br2684_init(void) ...@@ -774,7 +782,7 @@ static int __init br2684_init(void)
return -ENOMEM; return -ENOMEM;
p->proc_fops = &br2684_proc_ops; p->proc_fops = &br2684_proc_ops;
#endif #endif
br2684_ioctl_set(br2684_ioctl); register_atm_ioctl(&br2684_ioctl_ops);
return 0; return 0;
} }
...@@ -783,7 +791,7 @@ static void __exit br2684_exit(void) ...@@ -783,7 +791,7 @@ static void __exit br2684_exit(void)
struct net_device *net_dev; struct net_device *net_dev;
struct br2684_dev *brdev; struct br2684_dev *brdev;
struct br2684_vcc *brvcc; struct br2684_vcc *brvcc;
br2684_ioctl_set(NULL); deregister_atm_ioctl(&br2684_ioctl_ops);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
remove_proc_entry("br2684", atm_proc_root); remove_proc_entry("br2684", atm_proc_root);
......
...@@ -122,38 +122,6 @@ EXPORT_SYMBOL(atm_clip_ops_set); ...@@ -122,38 +122,6 @@ EXPORT_SYMBOL(atm_clip_ops_set);
#endif #endif
#endif #endif
#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE)
static DECLARE_MUTEX(pppoatm_ioctl_mutex);
static int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
void pppoatm_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long))
{
down(&pppoatm_ioctl_mutex);
pppoatm_ioctl_hook = hook;
up(&pppoatm_ioctl_mutex);
}
#ifdef CONFIG_PPPOATM_MODULE
EXPORT_SYMBOL(pppoatm_ioctl_set);
#endif
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
static DECLARE_MUTEX(br2684_ioctl_mutex);
static int (*br2684_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
void br2684_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long))
{
down(&br2684_ioctl_mutex);
br2684_ioctl_hook = hook;
up(&br2684_ioctl_mutex);
}
#ifdef CONFIG_ATM_BR2684_MODULE
EXPORT_SYMBOL(br2684_ioctl_set);
#endif
#endif
static DECLARE_MUTEX(ioctl_mutex); static DECLARE_MUTEX(ioctl_mutex);
static LIST_HEAD(ioctl_list); static LIST_HEAD(ioctl_list);
...@@ -434,23 +402,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -434,23 +402,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if (error != -ENOIOCTLCMD) if (error != -ENOIOCTLCMD)
goto done; goto done;
#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE)
down(&pppoatm_ioctl_mutex);
if (pppoatm_ioctl_hook)
error = pppoatm_ioctl_hook(vcc, cmd, arg);
up(&pppoatm_ioctl_mutex);
if (error != -ENOIOCTLCMD)
goto done;
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
down(&br2684_ioctl_mutex);
if (br2684_ioctl_hook)
error = br2684_ioctl_hook(vcc, cmd, arg);
up(&br2684_ioctl_mutex);
if (error != -ENOIOCTLCMD)
goto done;
#endif
error = atm_dev_ioctl(cmd, arg); error = atm_dev_ioctl(cmd, arg);
done: done:
......
...@@ -315,9 +315,11 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg) ...@@ -315,9 +315,11 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg)
* This handles ioctls actually performed on our vcc - we must return * This handles ioctls actually performed on our vcc - we must return
* -ENOIOCTLCMD for any unrecognized ioctl * -ENOIOCTLCMD for any unrecognized ioctl
*/ */
static int pppoatm_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, static int pppoatm_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct atm_vcc *atmvcc = ATM_SD(sock);
if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push) if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push)
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
switch (cmd) { switch (cmd) {
...@@ -341,15 +343,20 @@ static int pppoatm_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, ...@@ -341,15 +343,20 @@ static int pppoatm_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
struct atm_ioctl pppoatm_ioctl_ops = {
.owner = THIS_MODULE,
.ioctl = pppoatm_ioctl,
};
static int __init pppoatm_init(void) static int __init pppoatm_init(void)
{ {
pppoatm_ioctl_set(pppoatm_ioctl); register_atm_ioctl(&pppoatm_ioctl_ops);
return 0; return 0;
} }
static void __exit pppoatm_exit(void) static void __exit pppoatm_exit(void)
{ {
pppoatm_ioctl_set(NULL); deregister_atm_ioctl(&pppoatm_ioctl_ops);
} }
module_init(pppoatm_init); module_init(pppoatm_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment