* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
[not found] <20030925170342.GA74937@compsoc.man.ac.uk>
@ 2003-09-25 19:28 ` chas williams
2003-09-25 19:41 ` Mitchell Blank Jr
0 siblings, 1 reply; 7+ messages in thread
From: chas williams @ 2003-09-25 19:28 UTC (permalink / raw)
To: John Levon; +Cc: davem, netdev
In message <20030925170342.GA74937@compsoc.man.ac.uk>,John Levon writes:
>atm-ioctl6.diff isn't applying properly now for some reason though.
it applies to a bk pull from this morning w/o any trouble afaict.
>I guess it's fine to apply the old patchset anyway, it should be pretty
>easy for Mitchell to add a diff before his stuff that represents the
>changes between my two sets of patches.
i redid your patch set a bit to just get from point a to b w/o
the phantom ioctl.h and with the ATM_VF_IS_CLIP change discussed earlier.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
2003-09-25 19:28 ` [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org) chas williams
@ 2003-09-25 19:41 ` Mitchell Blank Jr
2003-09-26 3:55 ` David S. Miller
0 siblings, 1 reply; 7+ messages in thread
From: Mitchell Blank Jr @ 2003-09-25 19:41 UTC (permalink / raw)
To: chas williams; +Cc: John Levon, netdev
chas williams wrote:
> i redid your patch set a bit to just get from point a to b w/o
> the phantom ioctl.h and with the ATM_VF_IS_CLIP change discussed earlier.
If you merge my patches the vcc->clip would go away on its own (its not needed
once CLIP gets a atm_backend->decribe_vcc() method)
-Mitch
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
2003-09-25 19:41 ` Mitchell Blank Jr
@ 2003-09-26 3:55 ` David S. Miller
2003-09-26 13:48 ` chas williams
0 siblings, 1 reply; 7+ messages in thread
From: David S. Miller @ 2003-09-26 3:55 UTC (permalink / raw)
To: Mitchell Blank Jr; +Cc: chas, levon, netdev
What I'm going to do is just merge in all of what Chas posted
today, you can send me new patches to update this to John's
latest code.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
2003-09-26 3:55 ` David S. Miller
@ 2003-09-26 13:48 ` chas williams
2003-09-26 14:05 ` David S. Miller
0 siblings, 1 reply; 7+ messages in thread
From: chas williams @ 2003-09-26 13:48 UTC (permalink / raw)
To: David S. Miller; +Cc: Mitchell Blank Jr, levon, netdev
In message <20030925205530.2a166ccc.davem@redhat.com>,"David S. Miller" writes:
>What I'm going to do is just merge in all of what Chas posted
>today, you can send me new patches to update this to John's
>latest code.
that seems very reasonable. i believe the following attached patch
will provide the initial backend interface that mitch's patchset
depends on (its really just name changes). mitch, perhaps you could
just submit this as patch 0/N when you are ready to submit your
atm_backend changes.
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1458 -> 1.1459
# net/atm/br2684.c 1.12 -> 1.13
# net/atm/lec.c 1.41 -> 1.42
# net/atm/ioctl.c 1.7 -> 1.8
# drivers/atm/atmtcp.c 1.20 -> 1.21
# net/atm/pppoatm.c 1.15 -> 1.16
# net/atm/mpc.c 1.29 -> 1.30
# include/linux/atmdev.h 1.32 -> 1.33
# net/atm/clip.c 1.29 -> 1.30
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/26 chas@relax.cmf.nrl.navy.mil 1.1459
# [ATM]: initial backend support (from levon@movementarian.org)
# --------------------------------------------
#
diff -Nru a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
--- a/drivers/atm/atmtcp.c Fri Sep 26 09:43:45 2003
+++ b/drivers/atm/atmtcp.c Fri Sep 26 09:43:45 2003
@@ -460,21 +460,21 @@
return err;
}
-static struct atm_ioctl atmtcp_ioctl_ops = {
+static struct atm_backend atmtcp_ops = {
.owner = THIS_MODULE,
.ioctl = atmtcp_ioctl,
};
static __init int atmtcp_init(void)
{
- register_atm_ioctl(&atmtcp_ioctl_ops);
+ register_atm_backend(&atmtcp_ops);
return 0;
}
static void __exit atmtcp_exit(void)
{
- deregister_atm_ioctl(&atmtcp_ioctl_ops);
+ deregister_atm_backend(&atmtcp_ops);
}
MODULE_LICENSE("GPL");
diff -Nru a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h Fri Sep 26 09:43:45 2003
+++ b/include/linux/atmdev.h Fri Sep 26 09:43:45 2003
@@ -448,7 +448,7 @@
void vcc_release_async(struct atm_vcc *vcc, int reply);
-struct atm_ioctl {
+struct atm_backend {
struct module *owner;
/* A module reference is kept if appropriate over this call.
* Return -ENOIOCTLCMD if you don't handle it. */
@@ -457,18 +457,14 @@
};
/**
- * register_atm_ioctl - register handler for ioctl operations
- *
- * Special (non-device) handlers of ioctl's should
- * register here. If you're a normal device, you should
- * set .ioctl in your atmdev_ops instead.
+ * register_atm_backend - register an ATM backend
*/
-void register_atm_ioctl(struct atm_ioctl *);
+void register_atm_backend(struct atm_backend *);
/**
- * deregister_atm_ioctl - remove the ioctl handler
+ * deregister_atm_backend - remove a backend
*/
-void deregister_atm_ioctl(struct atm_ioctl *);
+void deregister_atm_backend(struct atm_backend *);
#endif /* __KERNEL__ */
diff -Nru a/net/atm/br2684.c b/net/atm/br2684.c
--- a/net/atm/br2684.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/br2684.c Fri Sep 26 09:43:45 2003
@@ -669,7 +669,7 @@
return -ENOIOCTLCMD;
}
-static struct atm_ioctl br2684_ioctl_ops = {
+static struct atm_backend br2684_ops = {
.owner = THIS_MODULE,
.ioctl = br2684_ioctl,
};
@@ -782,7 +782,7 @@
return -ENOMEM;
p->proc_fops = &br2684_proc_ops;
#endif
- register_atm_ioctl(&br2684_ioctl_ops);
+ register_atm_backend(&br2684_ops);
return 0;
}
@@ -791,7 +791,7 @@
struct net_device *net_dev;
struct br2684_dev *brdev;
struct br2684_vcc *brvcc;
- deregister_atm_ioctl(&br2684_ioctl_ops);
+ deregister_atm_backend(&br2684_ops);
#ifdef CONFIG_PROC_FS
remove_proc_entry("br2684", atm_proc_root);
diff -Nru a/net/atm/clip.c b/net/atm/clip.c
--- a/net/atm/clip.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/clip.c Fri Sep 26 09:43:45 2003
@@ -804,7 +804,7 @@
return err;
}
-static struct atm_ioctl clip_ioctl_ops = {
+static struct atm_backend clip_ops = {
.owner = THIS_MODULE,
.ioctl = clip_ioctl,
};
@@ -1035,7 +1035,7 @@
skb_queue_head_init(&clip_tbl.proxy_queue);
clip_tbl_hook = &clip_tbl;
- register_atm_ioctl(&clip_ioctl_ops);
+ register_atm_backend(&clip_ops);
return 0;
}
@@ -1046,7 +1046,7 @@
remove_proc_entry("arp", atm_proc_root);
- deregister_atm_ioctl(&clip_ioctl_ops);
+ deregister_atm_backend(&clip_ops);
neigh_ifdown(&clip_tbl, NULL);
dev = clip_devs;
diff -Nru a/net/atm/ioctl.c b/net/atm/ioctl.c
--- a/net/atm/ioctl.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/ioctl.c Fri Sep 26 09:43:45 2003
@@ -23,26 +23,26 @@
#include "signaling.h" /* for WAITING and sigd_attach */
-static DECLARE_MUTEX(ioctl_mutex);
-static LIST_HEAD(ioctl_list);
+static DECLARE_MUTEX(backend_mutex);
+static LIST_HEAD(backend_list);
-void register_atm_ioctl(struct atm_ioctl *ioctl)
+void register_atm_backend(struct atm_backend *backend)
{
- down(&ioctl_mutex);
- list_add_tail(&ioctl->list, &ioctl_list);
- up(&ioctl_mutex);
+ down(&backend_mutex);
+ list_add_tail(&backend->list, &backend_list);
+ up(&backend_mutex);
}
-void deregister_atm_ioctl(struct atm_ioctl *ioctl)
+void deregister_atm_backend(struct atm_backend *backend)
{
- down(&ioctl_mutex);
- list_del(&ioctl->list);
- up(&ioctl_mutex);
+ down(&backend_mutex);
+ list_del(&backend->list);
+ up(&backend_mutex);
}
-EXPORT_SYMBOL(register_atm_ioctl);
-EXPORT_SYMBOL(deregister_atm_ioctl);
+EXPORT_SYMBOL(register_atm_backend);
+EXPORT_SYMBOL(deregister_atm_backend);
int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
@@ -120,9 +120,9 @@
error = -ENOIOCTLCMD;
- down(&ioctl_mutex);
- list_for_each(pos, &ioctl_list) {
- struct atm_ioctl * ic = list_entry(pos, struct atm_ioctl, list);
+ down(&backend_mutex);
+ list_for_each(pos, &backend_list) {
+ struct atm_backend * ic = list_entry(pos, struct atm_backend, list);
if (try_module_get(ic->owner)) {
error = ic->ioctl(sock, cmd, arg);
module_put(ic->owner);
@@ -130,7 +130,7 @@
break;
}
}
- up(&ioctl_mutex);
+ up(&backend_mutex);
if (error != -ENOIOCTLCMD)
goto done;
diff -Nru a/net/atm/lec.c b/net/atm/lec.c
--- a/net/atm/lec.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/lec.c Fri Sep 26 09:43:45 2003
@@ -1115,7 +1115,7 @@
return err;
}
-static struct atm_ioctl lane_ioctl_ops = {
+static struct atm_backend lec_ops = {
.owner = THIS_MODULE,
.ioctl = lane_ioctl,
};
@@ -1130,7 +1130,7 @@
p->proc_fops = &lec_seq_fops;
#endif
- register_atm_ioctl(&lane_ioctl_ops);
+ register_atm_backend(&lec_ops);
printk("lec.c: " __DATE__ " " __TIME__ " initialized\n");
return 0;
}
@@ -1142,7 +1142,7 @@
remove_proc_entry("lec", atm_proc_root);
- deregister_atm_ioctl(&lane_ioctl_ops);
+ deregister_atm_backend(&lec_ops);
for (i = 0; i < MAX_LEC_ITF; i++) {
if (dev_lec[i] != NULL) {
diff -Nru a/net/atm/mpc.c b/net/atm/mpc.c
--- a/net/atm/mpc.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/mpc.c Fri Sep 26 09:43:45 2003
@@ -1388,14 +1388,14 @@
}
-static struct atm_ioctl atm_ioctl_ops = {
+static struct atm_backend mpoa_ops = {
.owner = THIS_MODULE,
.ioctl = atm_mpoa_ioctl,
};
static __init int atm_mpoa_init(void)
{
- register_atm_ioctl(&atm_ioctl_ops);
+ register_atm_backend(&mpoa_ops);
#ifdef CONFIG_PROC_FS
if (mpc_proc_init() != 0)
@@ -1421,7 +1421,7 @@
del_timer(&mpc_timer);
unregister_netdevice_notifier(&mpoa_notifier);
- deregister_atm_ioctl(&atm_ioctl_ops);
+ deregister_atm_backend(&mpoa_ops);
mpc = mpcs;
mpcs = NULL;
diff -Nru a/net/atm/pppoatm.c b/net/atm/pppoatm.c
--- a/net/atm/pppoatm.c Fri Sep 26 09:43:45 2003
+++ b/net/atm/pppoatm.c Fri Sep 26 09:43:45 2003
@@ -343,20 +343,20 @@
return -ENOIOCTLCMD;
}
-struct atm_ioctl pppoatm_ioctl_ops = {
+static struct atm_backend pppoatm_backend_ops = {
.owner = THIS_MODULE,
.ioctl = pppoatm_ioctl,
};
static int __init pppoatm_init(void)
{
- register_atm_ioctl(&pppoatm_ioctl_ops);
+ register_atm_backend(&pppoatm_backend_ops);
return 0;
}
static void __exit pppoatm_exit(void)
{
- deregister_atm_ioctl(&pppoatm_ioctl_ops);
+ deregister_atm_backend(&pppoatm_backend_ops);
}
module_init(pppoatm_init);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
2003-09-26 13:48 ` chas williams
@ 2003-09-26 14:05 ` David S. Miller
0 siblings, 0 replies; 7+ messages in thread
From: David S. Miller @ 2003-09-26 14:05 UTC (permalink / raw)
To: chas williams; +Cc: mitch, levon, netdev
On Fri, 26 Sep 2003 09:48:03 -0400
chas williams <chas@cmf.nrl.navy.mil> wrote:
> that seems very reasonable. i believe the following attached patch
> will provide the initial backend interface that mitch's patchset
> depends on (its really just name changes). mitch, perhaps you could
> just submit this as patch 0/N when you are ready to submit your
> atm_backend changes.
Wait a bit for Linus to suck in the stuff I applied last night,
then you guys can unload the next set of patches on me. :)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
[not found] <20030925161740.GA71011@compsoc.man.ac.uk>
@ 2003-09-25 16:45 ` chas williams
0 siblings, 0 replies; 7+ messages in thread
From: chas williams @ 2003-09-25 16:45 UTC (permalink / raw)
To: John Levon; +Cc: davem, netdev
In message <20030925161740.GA71011@compsoc.man.ac.uk>,John Levon writes:
>Chas, this appears to be the first set of patches I sent you, rather
>than the revised edition ?
this was the set available from your website. i assumed
that was the latest version.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
@ 2003-09-25 16:09 chas williams
0 siblings, 0 replies; 7+ messages in thread
From: chas williams @ 2003-09-25 16:09 UTC (permalink / raw)
To: davem; +Cc: netdev
please apply to 2.6 -- thanks
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1447 -> 1.1448
# net/atm/Makefile 1.11 -> 1.12
# net/atm/common.c 1.53 -> 1.54
# (new) -> 1.1 net/atm/ioctl.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/23 chas@relax.cmf.nrl.navy.mil 1.1448
# [ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org)
# --------------------------------------------
#
diff -Nru a/net/atm/Makefile b/net/atm/Makefile
--- a/net/atm/Makefile Thu Sep 25 09:24:00 2003
+++ b/net/atm/Makefile Thu Sep 25 09:24:00 2003
@@ -2,7 +2,7 @@
# Makefile for the ATM Protocol Families.
#
-atm-y := addr.o pvc.o signaling.o svc.o common.o atm_misc.o raw.o resources.o
+atm-y := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o
mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o
obj-$(CONFIG_ATM) += atm.o
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c Thu Sep 25 09:24:00 2003
+++ b/net/atm/common.c Thu Sep 25 09:24:00 2003
@@ -9,9 +9,6 @@
#include <linux/net.h> /* struct socket, struct proto_ops */
#include <linux/atm.h> /* ATM stuff */
#include <linux/atmdev.h>
-#include <linux/atmclip.h> /* CLIP_*ENCAP */
-#include <linux/atmarp.h> /* manifest constants */
-#include <linux/sonet.h> /* for ioctls */
#include <linux/socket.h> /* SOL_SOCKET */
#include <linux/errno.h> /* error codes */
#include <linux/capability.h>
@@ -26,147 +23,12 @@
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <asm/poll.h>
-#include <asm/ioctls.h>
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
-#include <linux/atmlec.h>
-#include "lec.h"
-#include "lec_arpc.h"
-struct atm_lane_ops *atm_lane_ops;
-static DECLARE_MUTEX(atm_lane_ops_mutex);
-
-void atm_lane_ops_set(struct atm_lane_ops *hook)
-{
- down(&atm_lane_ops_mutex);
- atm_lane_ops = hook;
- up(&atm_lane_ops_mutex);
-}
-
-int try_atm_lane_ops(void)
-{
- down(&atm_lane_ops_mutex);
- if (atm_lane_ops && try_module_get(atm_lane_ops->owner)) {
- up(&atm_lane_ops_mutex);
- return 1;
- }
- up(&atm_lane_ops_mutex);
- return 0;
-}
-
-#if defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_ATM_MPOA_MODULE)
-EXPORT_SYMBOL(atm_lane_ops);
-EXPORT_SYMBOL(try_atm_lane_ops);
-EXPORT_SYMBOL(atm_lane_ops_set);
-#endif
-#endif
-
-#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
-#include <linux/atmmpc.h>
-#include "mpc.h"
-struct atm_mpoa_ops *atm_mpoa_ops;
-static DECLARE_MUTEX(atm_mpoa_ops_mutex);
-
-void atm_mpoa_ops_set(struct atm_mpoa_ops *hook)
-{
- down(&atm_mpoa_ops_mutex);
- atm_mpoa_ops = hook;
- up(&atm_mpoa_ops_mutex);
-}
-
-int try_atm_mpoa_ops(void)
-{
- down(&atm_mpoa_ops_mutex);
- if (atm_mpoa_ops && try_module_get(atm_mpoa_ops->owner)) {
- up(&atm_mpoa_ops_mutex);
- return 1;
- }
- up(&atm_mpoa_ops_mutex);
- return 0;
-}
-#ifdef CONFIG_ATM_MPOA_MODULE
-EXPORT_SYMBOL(atm_mpoa_ops);
-EXPORT_SYMBOL(try_atm_mpoa_ops);
-EXPORT_SYMBOL(atm_mpoa_ops_set);
-#endif
-#endif
-
-#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
-#include <linux/atm_tcp.h>
-#ifdef CONFIG_ATM_TCP_MODULE
-struct atm_tcp_ops atm_tcp_ops;
-EXPORT_SYMBOL(atm_tcp_ops);
-#endif
-#endif
-
-#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
-#include <net/atmclip.h>
-struct atm_clip_ops *atm_clip_ops;
-static DECLARE_MUTEX(atm_clip_ops_mutex);
-
-void atm_clip_ops_set(struct atm_clip_ops *hook)
-{
- down(&atm_clip_ops_mutex);
- atm_clip_ops = hook;
- up(&atm_clip_ops_mutex);
-}
-
-int try_atm_clip_ops(void)
-{
- down(&atm_clip_ops_mutex);
- if (atm_clip_ops && try_module_get(atm_clip_ops->owner)) {
- up(&atm_clip_ops_mutex);
- return 1;
- }
- up(&atm_clip_ops_mutex);
- return 0;
-}
-
-#ifdef CONFIG_ATM_CLIP_MODULE
-EXPORT_SYMBOL(atm_clip_ops);
-EXPORT_SYMBOL(try_atm_clip_ops);
-EXPORT_SYMBOL(atm_clip_ops_set);
-#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
#include "resources.h" /* atm_find_dev */
#include "common.h" /* prototypes */
#include "protocols.h" /* atm_init_<transport> */
#include "addr.h" /* address registry */
-#ifdef CONFIG_ATM_CLIP
-#include <net/atmclip.h> /* for clip_create */
-#endif
#include "signaling.h" /* for WAITING and sigd_attach */
@@ -760,272 +622,6 @@
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
return mask;
-}
-
-
-int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
-{
- struct atm_vcc *vcc;
- int error;
-
- vcc = ATM_SD(sock);
- switch (cmd) {
- case SIOCOUTQ:
- if (sock->state != SS_CONNECTED ||
- !test_bit(ATM_VF_READY, &vcc->flags)) {
- error = -EINVAL;
- goto done;
- }
- error = put_user(vcc->sk->sk_sndbuf -
- atomic_read(&vcc->sk->sk_wmem_alloc),
- (int *) arg) ? -EFAULT : 0;
- goto done;
- case SIOCINQ:
- {
- struct sk_buff *skb;
-
- if (sock->state != SS_CONNECTED) {
- error = -EINVAL;
- goto done;
- }
- skb = skb_peek(&vcc->sk->sk_receive_queue);
- error = put_user(skb ? skb->len : 0,
- (int *) arg) ? -EFAULT : 0;
- goto done;
- }
- case SIOCGSTAMP: /* borrowed from IP */
- if (!vcc->sk->sk_stamp.tv_sec) {
- error = -ENOENT;
- goto done;
- }
- error = copy_to_user((void *)arg, &vcc->sk->sk_stamp,
- sizeof(struct timeval)) ? -EFAULT : 0;
- goto done;
- case ATM_SETSC:
- printk(KERN_WARNING "ATM_SETSC is obsolete\n");
- error = 0;
- goto done;
- case ATMSIGD_CTRL:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- /*
- * The user/kernel protocol for exchanging signalling
- * info uses kernel pointers as opaque references,
- * so the holder of the file descriptor can scribble
- * on the kernel... so we should make sure that we
- * have the same privledges that /proc/kcore needs
- */
- if (!capable(CAP_SYS_RAWIO)) {
- error = -EPERM;
- goto done;
- }
- error = sigd_attach(vcc);
- if (!error)
- sock->state = SS_CONNECTED;
- goto done;
-#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
- case SIOCMKCLIP:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_clip_ops()) {
- error = atm_clip_ops->clip_create(arg);
- module_put(atm_clip_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
- case ATMARPD_CTRL:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
-#if defined(CONFIG_ATM_CLIP_MODULE)
- if (!atm_clip_ops)
- request_module("clip");
-#endif
- if (try_atm_clip_ops()) {
- error = atm_clip_ops->atm_init_atmarp(vcc);
- if (!error)
- sock->state = SS_CONNECTED;
- } else
- error = -ENOSYS;
- goto done;
- case ATMARP_MKIP:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_clip_ops()) {
- error = atm_clip_ops->clip_mkip(vcc, arg);
- module_put(atm_clip_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
- case ATMARP_SETENTRY:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_clip_ops()) {
- error = atm_clip_ops->clip_setentry(vcc, arg);
- module_put(atm_clip_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
- case ATMARP_ENCAP:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_clip_ops()) {
- error = atm_clip_ops->clip_encap(vcc, arg);
- module_put(atm_clip_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
-#endif
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
- case ATMLEC_CTRL:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
-#if defined(CONFIG_ATM_LANE_MODULE)
- if (!atm_lane_ops)
- request_module("lec");
-#endif
- if (try_atm_lane_ops()) {
- error = atm_lane_ops->lecd_attach(vcc, (int) arg);
- module_put(atm_lane_ops->owner);
- if (error >= 0)
- sock->state = SS_CONNECTED;
- } else
- error = -ENOSYS;
- goto done;
- case ATMLEC_MCAST:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_lane_ops()) {
- error = atm_lane_ops->mcast_attach(vcc, (int) arg);
- module_put(atm_lane_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
- case ATMLEC_DATA:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_lane_ops()) {
- error = atm_lane_ops->vcc_attach(vcc, (void *) arg);
- module_put(atm_lane_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
-#endif
-#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
- case ATMMPC_CTRL:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
-#if defined(CONFIG_ATM_MPOA_MODULE)
- if (!atm_mpoa_ops)
- request_module("mpoa");
-#endif
- if (try_atm_mpoa_ops()) {
- error = atm_mpoa_ops->mpoad_attach(vcc, (int) arg);
- module_put(atm_mpoa_ops->owner);
- if (error >= 0)
- sock->state = SS_CONNECTED;
- } else
- error = -ENOSYS;
- goto done;
- case ATMMPC_DATA:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (try_atm_mpoa_ops()) {
- error = atm_mpoa_ops->vcc_attach(vcc, arg);
- module_put(atm_mpoa_ops->owner);
- } else
- error = -ENOSYS;
- goto done;
-#endif
-#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
- case SIOCSIFATMTCP:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (!atm_tcp_ops.attach) {
- error = -ENOPKG;
- goto done;
- }
- fops_get(&atm_tcp_ops);
- error = atm_tcp_ops.attach(vcc, (int) arg);
- if (error >= 0)
- sock->state = SS_CONNECTED;
- else
- fops_put (&atm_tcp_ops);
- goto done;
- case ATMTCP_CREATE:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (!atm_tcp_ops.create_persistent) {
- error = -ENOPKG;
- goto done;
- }
- error = atm_tcp_ops.create_persistent((int) arg);
- if (error < 0)
- fops_put (&atm_tcp_ops);
- goto done;
- case ATMTCP_REMOVE:
- if (!capable(CAP_NET_ADMIN)) {
- error = -EPERM;
- goto done;
- }
- if (!atm_tcp_ops.remove_persistent) {
- error = -ENOPKG;
- goto done;
- }
- error = atm_tcp_ops.remove_persistent((int) arg);
- fops_put(&atm_tcp_ops);
- goto done;
-#endif
- default:
- break;
- }
- error = -ENOIOCTLCMD;
-#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);
-
-done:
- return error;
}
diff -Nru a/net/atm/ioctl.c b/net/atm/ioctl.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/net/atm/ioctl.c Thu Sep 25 09:24:00 2003
@@ -0,0 +1,420 @@
+/* net/atm/common.c - ATM sockets (common part for PVC and SVC) */
+
+/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kmod.h>
+#include <linux/net.h> /* struct socket, struct proto_ops */
+#include <linux/atm.h> /* ATM stuff */
+#include <linux/atmdev.h>
+#include <linux/atmclip.h> /* CLIP_*ENCAP */
+#include <linux/atmarp.h> /* manifest constants */
+#include <linux/sonet.h> /* for ioctls */
+#include <linux/atmsvc.h>
+#include <asm/ioctls.h>
+
+#ifdef CONFIG_ATM_CLIP
+#include <net/atmclip.h> /* for clip_create */
+#endif
+#include "resources.h" /* atm_find_dev */
+#include "signaling.h" /* for WAITING and sigd_attach */
+
+#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+#include <linux/atmlec.h>
+#include "lec.h"
+#include "lec_arpc.h"
+struct atm_lane_ops *atm_lane_ops;
+static DECLARE_MUTEX(atm_lane_ops_mutex);
+
+void atm_lane_ops_set(struct atm_lane_ops *hook)
+{
+ down(&atm_lane_ops_mutex);
+ atm_lane_ops = hook;
+ up(&atm_lane_ops_mutex);
+}
+
+int try_atm_lane_ops(void)
+{
+ down(&atm_lane_ops_mutex);
+ if (atm_lane_ops && try_module_get(atm_lane_ops->owner)) {
+ up(&atm_lane_ops_mutex);
+ return 1;
+ }
+ up(&atm_lane_ops_mutex);
+ return 0;
+}
+
+#if defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_ATM_MPOA_MODULE)
+EXPORT_SYMBOL(atm_lane_ops);
+EXPORT_SYMBOL(try_atm_lane_ops);
+EXPORT_SYMBOL(atm_lane_ops_set);
+#endif
+#endif
+
+#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
+#include <linux/atmmpc.h>
+#include "mpc.h"
+struct atm_mpoa_ops *atm_mpoa_ops;
+static DECLARE_MUTEX(atm_mpoa_ops_mutex);
+
+void atm_mpoa_ops_set(struct atm_mpoa_ops *hook)
+{
+ down(&atm_mpoa_ops_mutex);
+ atm_mpoa_ops = hook;
+ up(&atm_mpoa_ops_mutex);
+}
+
+int try_atm_mpoa_ops(void)
+{
+ down(&atm_mpoa_ops_mutex);
+ if (atm_mpoa_ops && try_module_get(atm_mpoa_ops->owner)) {
+ up(&atm_mpoa_ops_mutex);
+ return 1;
+ }
+ up(&atm_mpoa_ops_mutex);
+ return 0;
+}
+#ifdef CONFIG_ATM_MPOA_MODULE
+EXPORT_SYMBOL(atm_mpoa_ops);
+EXPORT_SYMBOL(try_atm_mpoa_ops);
+EXPORT_SYMBOL(atm_mpoa_ops_set);
+#endif
+#endif
+
+#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
+#include <linux/atm_tcp.h>
+#ifdef CONFIG_ATM_TCP_MODULE
+struct atm_tcp_ops atm_tcp_ops;
+EXPORT_SYMBOL(atm_tcp_ops);
+#endif
+#endif
+
+#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
+#include <net/atmclip.h>
+struct atm_clip_ops *atm_clip_ops;
+static DECLARE_MUTEX(atm_clip_ops_mutex);
+
+void atm_clip_ops_set(struct atm_clip_ops *hook)
+{
+ down(&atm_clip_ops_mutex);
+ atm_clip_ops = hook;
+ up(&atm_clip_ops_mutex);
+}
+
+int try_atm_clip_ops(void)
+{
+ down(&atm_clip_ops_mutex);
+ if (atm_clip_ops && try_module_get(atm_clip_ops->owner)) {
+ up(&atm_clip_ops_mutex);
+ return 1;
+ }
+ up(&atm_clip_ops_mutex);
+ return 0;
+}
+
+#ifdef CONFIG_ATM_CLIP_MODULE
+EXPORT_SYMBOL(atm_clip_ops);
+EXPORT_SYMBOL(try_atm_clip_ops);
+EXPORT_SYMBOL(atm_clip_ops_set);
+#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
+
+
+int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+{
+ struct atm_vcc *vcc;
+ int error;
+
+ vcc = ATM_SD(sock);
+ switch (cmd) {
+ case SIOCOUTQ:
+ if (sock->state != SS_CONNECTED ||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
+ error = -EINVAL;
+ goto done;
+ }
+ error = put_user(vcc->sk->sk_sndbuf -
+ atomic_read(&vcc->sk->sk_wmem_alloc),
+ (int *) arg) ? -EFAULT : 0;
+ goto done;
+ case SIOCINQ:
+ {
+ struct sk_buff *skb;
+
+ if (sock->state != SS_CONNECTED) {
+ error = -EINVAL;
+ goto done;
+ }
+ skb = skb_peek(&vcc->sk->sk_receive_queue);
+ error = put_user(skb ? skb->len : 0,
+ (int *) arg) ? -EFAULT : 0;
+ goto done;
+ }
+ case SIOCGSTAMP: /* borrowed from IP */
+ if (!vcc->sk->sk_stamp.tv_sec) {
+ error = -ENOENT;
+ goto done;
+ }
+ error = copy_to_user((void *)arg, &vcc->sk->sk_stamp,
+ sizeof(struct timeval)) ? -EFAULT : 0;
+ goto done;
+ case ATM_SETSC:
+ printk(KERN_WARNING "ATM_SETSC is obsolete\n");
+ error = 0;
+ goto done;
+ case ATMSIGD_CTRL:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ /*
+ * The user/kernel protocol for exchanging signalling
+ * info uses kernel pointers as opaque references,
+ * so the holder of the file descriptor can scribble
+ * on the kernel... so we should make sure that we
+ * have the same privledges that /proc/kcore needs
+ */
+ if (!capable(CAP_SYS_RAWIO)) {
+ error = -EPERM;
+ goto done;
+ }
+ error = sigd_attach(vcc);
+ if (!error)
+ sock->state = SS_CONNECTED;
+ goto done;
+#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
+ case SIOCMKCLIP:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_clip_ops()) {
+ error = atm_clip_ops->clip_create(arg);
+ module_put(atm_clip_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMARPD_CTRL:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+#if defined(CONFIG_ATM_CLIP_MODULE)
+ if (!atm_clip_ops)
+ request_module("clip");
+#endif
+ if (try_atm_clip_ops()) {
+ error = atm_clip_ops->atm_init_atmarp(vcc);
+ if (!error)
+ sock->state = SS_CONNECTED;
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMARP_MKIP:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_clip_ops()) {
+ error = atm_clip_ops->clip_mkip(vcc, arg);
+ module_put(atm_clip_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMARP_SETENTRY:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_clip_ops()) {
+ error = atm_clip_ops->clip_setentry(vcc, arg);
+ module_put(atm_clip_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMARP_ENCAP:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_clip_ops()) {
+ error = atm_clip_ops->clip_encap(vcc, arg);
+ module_put(atm_clip_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+#endif
+#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+ case ATMLEC_CTRL:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+#if defined(CONFIG_ATM_LANE_MODULE)
+ if (!atm_lane_ops)
+ request_module("lec");
+#endif
+ if (try_atm_lane_ops()) {
+ error = atm_lane_ops->lecd_attach(vcc, (int) arg);
+ module_put(atm_lane_ops->owner);
+ if (error >= 0)
+ sock->state = SS_CONNECTED;
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMLEC_MCAST:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_lane_ops()) {
+ error = atm_lane_ops->mcast_attach(vcc, (int) arg);
+ module_put(atm_lane_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMLEC_DATA:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_lane_ops()) {
+ error = atm_lane_ops->vcc_attach(vcc, (void *) arg);
+ module_put(atm_lane_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+#endif
+#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
+ case ATMMPC_CTRL:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+#if defined(CONFIG_ATM_MPOA_MODULE)
+ if (!atm_mpoa_ops)
+ request_module("mpoa");
+#endif
+ if (try_atm_mpoa_ops()) {
+ error = atm_mpoa_ops->mpoad_attach(vcc, (int) arg);
+ module_put(atm_mpoa_ops->owner);
+ if (error >= 0)
+ sock->state = SS_CONNECTED;
+ } else
+ error = -ENOSYS;
+ goto done;
+ case ATMMPC_DATA:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (try_atm_mpoa_ops()) {
+ error = atm_mpoa_ops->vcc_attach(vcc, arg);
+ module_put(atm_mpoa_ops->owner);
+ } else
+ error = -ENOSYS;
+ goto done;
+#endif
+#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
+ case SIOCSIFATMTCP:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (!atm_tcp_ops.attach) {
+ error = -ENOPKG;
+ goto done;
+ }
+ fops_get(&atm_tcp_ops);
+ error = atm_tcp_ops.attach(vcc, (int) arg);
+ if (error >= 0)
+ sock->state = SS_CONNECTED;
+ else
+ fops_put (&atm_tcp_ops);
+ goto done;
+ case ATMTCP_CREATE:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (!atm_tcp_ops.create_persistent) {
+ error = -ENOPKG;
+ goto done;
+ }
+ error = atm_tcp_ops.create_persistent((int) arg);
+ if (error < 0)
+ fops_put (&atm_tcp_ops);
+ goto done;
+ case ATMTCP_REMOVE:
+ if (!capable(CAP_NET_ADMIN)) {
+ error = -EPERM;
+ goto done;
+ }
+ if (!atm_tcp_ops.remove_persistent) {
+ error = -ENOPKG;
+ goto done;
+ }
+ error = atm_tcp_ops.remove_persistent((int) arg);
+ fops_put(&atm_tcp_ops);
+ goto done;
+#endif
+ default:
+ break;
+ }
+ error = -ENOIOCTLCMD;
+#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);
+
+done:
+ return error;
+}
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-09-26 14:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20030925170342.GA74937@compsoc.man.ac.uk>
2003-09-25 19:28 ` [PATCH][ATM]: [ioctl][1/8] move vcc_ioctl() to ioctl.c (from levon@movementarian.org) chas williams
2003-09-25 19:41 ` Mitchell Blank Jr
2003-09-26 3:55 ` David S. Miller
2003-09-26 13:48 ` chas williams
2003-09-26 14:05 ` David S. Miller
[not found] <20030925161740.GA71011@compsoc.man.ac.uk>
2003-09-25 16:45 ` chas williams
2003-09-25 16:09 chas williams
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.