summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-09-22 04:43:05 -0300
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-09-22 04:43:05 -0300
commit6e2144b76840be09924de1626e2dcd7b315f75b3 (patch)
tree33044cb63f368270229e2b40aa2ad024325c7e8b /include/net
parent04e4223f44b89e50f275cb6b95a58ebe2c4909be (diff)
downloadop-kernel-dev-6e2144b76840be09924de1626e2dcd7b315f75b3.zip
op-kernel-dev-6e2144b76840be09924de1626e2dcd7b315f75b3.tar.gz
[LLC]: Use refcounting with struct llc_sap
Signed-off-by: Jochen Friedrich <jochen@scram.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/llc.h16
-rw-r--r--include/net/llc_conn.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/include/net/llc.h b/include/net/llc.h
index 8b8e2be..93e5b44 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -17,6 +17,8 @@
#include <linux/list.h>
#include <linux/spinlock.h>
+#include <asm/atomic.h>
+
struct net_device;
struct packet_type;
struct sk_buff;
@@ -44,6 +46,7 @@ struct llc_sap {
unsigned char state;
unsigned char p_bit;
unsigned char f_bit;
+ atomic_t refcnt;
int (*rcv_func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt,
@@ -81,7 +84,18 @@ extern struct llc_sap *llc_sap_open(unsigned char lsap,
struct net_device *dev,
struct packet_type *pt,
struct net_device *orig_dev));
-extern void llc_sap_close(struct llc_sap *sap);
+static inline void llc_sap_hold(struct llc_sap *sap)
+{
+ atomic_inc(&sap->refcnt);
+}
+
+static inline void llc_sap_put(struct llc_sap *sap)
+{
+ extern void llc_sap_close(struct llc_sap *sap);
+
+ if (atomic_dec_and_test(&sap->refcnt))
+ llc_sap_close(sap);
+}
extern struct llc_sap *llc_sap_find(unsigned char sap_value);
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index 8a8ff48..b288921 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -115,5 +115,4 @@ extern void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
extern u8 llc_data_accept_state(u8 state);
extern void llc_build_offset_table(void);
-extern int llc_release_sockets(struct llc_sap *sap);
#endif /* LLC_CONN_H */
OpenPOWER on IntegriCloud