summaryrefslogtreecommitdiff
path: root/net/rose
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-25 22:39:45 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-25 22:39:45 -0800
commitc01debcd72ff37dbd87de54d5f0a1d753092775f (patch)
treea14e17c2e368eaae70ce21d0d3c88d419b1183d4 /net/rose
parentd506d2b66af72403912db434453c5e5a31c0b2d3 (diff)
parent651b6a34392167cd0310869cbc0341f91ba4d956 (diff)
Merge bk://kernel.bkbits.net/davem/net-2.6
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'net/rose')
-rw-r--r--net/rose/af_rose.c59
-rw-r--r--net/rose/rose_in.c10
-rw-r--r--net/rose/rose_out.c6
-rw-r--r--net/rose/rose_route.c3
-rw-r--r--net/rose/rose_subr.c12
-rw-r--r--net/rose/rose_timer.c14
6 files changed, 44 insertions, 60 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 4e8ba48834fd..68da687c9142 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -128,24 +128,7 @@ int rosecmpm(rose_address *addr1, rose_address *addr2, unsigned short mask)
static struct sock *rose_alloc_sock(void)
{
- rose_cb *rose;
- struct sock *sk = sk_alloc(PF_ROSE, GFP_ATOMIC, 1, NULL);
-
- if (!sk)
- goto out;
-
- rose = sk->sk_protinfo = kmalloc(sizeof(*rose), GFP_ATOMIC);
- if (!rose)
- goto frees;
-
- memset(rose, 0x00, sizeof(*rose));
- rose->sk = sk;
-out:
- return sk;
-frees:
- sk_free(sk);
- sk = NULL;
- goto out;
+ return sk_alloc(PF_ROSE, GFP_ATOMIC, sizeof(struct rose_sock), NULL);
}
/*
@@ -169,7 +152,7 @@ void rose_kill_by_neigh(struct rose_neigh *neigh)
spin_lock_bh(&rose_list_lock);
sk_for_each(s, node, &rose_list) {
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
if (rose->neighbour == neigh) {
rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
@@ -190,7 +173,7 @@ static void rose_kill_by_device(struct net_device *dev)
spin_lock_bh(&rose_list_lock);
sk_for_each(s, node, &rose_list) {
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
if (rose->device == dev) {
rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
@@ -247,7 +230,7 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
spin_lock_bh(&rose_list_lock);
sk_for_each(s, node, &rose_list) {
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, call) &&
@@ -256,7 +239,7 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
}
sk_for_each(s, node, &rose_list) {
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, &null_ax25_address) &&
@@ -279,7 +262,7 @@ struct sock *rose_find_socket(unsigned int lci, struct rose_neigh *neigh)
spin_lock_bh(&rose_list_lock);
sk_for_each(s, node, &rose_list) {
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
if (rose->lci == lci && rose->neighbour == neigh)
goto found;
@@ -372,7 +355,7 @@ static int rose_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, int optlen)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
int opt;
if (level != SOL_ROSE)
@@ -432,7 +415,7 @@ static int rose_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
int val = 0;
int len;
@@ -491,7 +474,7 @@ static int rose_listen(struct socket *sock, int backlog)
struct sock *sk = sock->sk;
if (sk->sk_state != TCP_LISTEN) {
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
rose->dest_ndigis = 0;
memset(&rose->dest_addr, 0, ROSE_ADDR_LEN);
@@ -508,7 +491,7 @@ static int rose_listen(struct socket *sock, int backlog)
static int rose_create(struct socket *sock, int protocol)
{
struct sock *sk;
- rose_cb *rose;
+ struct rose_sock *rose;
if (sock->type != SOCK_SEQPACKET || protocol != 0)
return -ESOCKTNOSUPPORT;
@@ -547,7 +530,7 @@ static int rose_create(struct socket *sock, int protocol)
static struct sock *rose_make_new(struct sock *osk)
{
struct sock *sk;
- rose_cb *rose, *orose;
+ struct rose_sock *rose, *orose;
if (osk->sk_type != SOCK_SEQPACKET)
return NULL;
@@ -600,7 +583,7 @@ static struct sock *rose_make_new(struct sock *osk)
static int rose_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- rose_cb *rose;
+ struct rose_sock *rose;
if (sk == NULL) return 0;
@@ -646,7 +629,7 @@ static int rose_release(struct socket *sock)
static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
struct net_device *dev;
ax25_address *user, *source;
@@ -705,7 +688,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;
unsigned char cause, diagnostic;
ax25_address *user;
@@ -906,7 +889,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr,
{
struct full_sockaddr_rose *srose = (struct full_sockaddr_rose *)uaddr;
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
int n;
if (peer != 0) {
@@ -935,7 +918,7 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
{
struct sock *sk;
struct sock *make;
- rose_cb *make_rose;
+ struct rose_sock *make_rose;
struct rose_facilities_struct facilities;
int n, len;
@@ -958,7 +941,7 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
/*
* We can't accept the Call Request.
*/
- if (!sk || sk->sk_ack_backlog == sk->sk_max_ack_backlog ||
+ if (sk == NULL || sk_acceptq_is_full(sk) ||
(make = rose_make_new(sk)) == NULL) {
rose_transmit_clear_request(neigh, lci, ROSE_NETWORK_CONGESTION, 120);
return 0;
@@ -1016,7 +999,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sockaddr_rose *usrose = (struct sockaddr_rose *)msg->msg_name;
int err;
struct full_sockaddr_rose srose;
@@ -1186,7 +1169,7 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size, int flags)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sockaddr_rose *srose = (struct sockaddr_rose *)msg->msg_name;
size_t copied;
unsigned char *asmptr;
@@ -1251,7 +1234,7 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,
static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
void __user *argp = (void __user *)arg;
switch (cmd) {
@@ -1386,7 +1369,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
else {
struct sock *s = v;
- rose_cb *rose = rose_sk(s);
+ struct rose_sock *rose = rose_sk(s);
const char *devname, *callsign;
const struct net_device *dev = rose->device;
diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index c6aa8fba6a38..ef475a1bb1ba 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -41,7 +41,7 @@
*/
static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
switch (frametype) {
case ROSE_CALL_ACCEPTED:
@@ -78,7 +78,7 @@ static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int framety
*/
static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
switch (frametype) {
case ROSE_CLEAR_REQUEST:
@@ -106,7 +106,7 @@ static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int framety
*/
static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype, int ns, int nr, int q, int d, int m)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
int queued = 0;
switch (frametype) {
@@ -216,7 +216,7 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety
*/
static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
switch (frametype) {
case ROSE_RESET_REQUEST:
@@ -265,7 +265,7 @@ static int rose_state5_machine(struct sock *sk, struct sk_buff *skb, int framety
/* Higher level upcall for a LAPB frame */
int rose_process_rx_frame(struct sock *sk, struct sk_buff *skb)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
int queued = 0, frametype, ns, nr, q, d, m;
if (rose->state == ROSE_STATE_0)
diff --git a/net/rose/rose_out.c b/net/rose/rose_out.c
index 5e5d4c4b459c..2965ffc83b9b 100644
--- a/net/rose/rose_out.c
+++ b/net/rose/rose_out.c
@@ -33,7 +33,7 @@
*/
static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
if (skb == NULL)
return;
@@ -48,7 +48,7 @@ static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
void rose_kick(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sk_buff *skb, *skbn;
unsigned short start, end;
@@ -112,7 +112,7 @@ void rose_kick(struct sock *sk)
void rose_enquiry_response(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
if (rose->condition & ROSE_COND_OWN_RX_BUSY)
rose_write_internal(sk, ROSE_RNR);
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index d19d931a1a75..ff73ebb912b8 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -899,7 +899,8 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
*/
if ((sk = rose_find_socket(lci, rose_neigh)) != NULL) {
if (frametype == ROSE_CALL_REQUEST) {
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
+
/* Remove an existing unused socket */
rose_clear_queues(sk);
rose->cause = ROSE_NETWORK_CONGESTION;
diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c
index e2cd9d8c9b5b..7db7e1cedc3a 100644
--- a/net/rose/rose_subr.c
+++ b/net/rose/rose_subr.c
@@ -28,7 +28,7 @@
#include <linux/interrupt.h>
#include <net/rose.h>
-static int rose_create_facilities(unsigned char *buffer, rose_cb *rose);
+static int rose_create_facilities(unsigned char *buffer, struct rose_sock *rose);
/*
* This routine purges all of the queues of frames.
@@ -47,7 +47,7 @@ void rose_clear_queues(struct sock *sk)
void rose_frames_acked(struct sock *sk, unsigned short nr)
{
struct sk_buff *skb;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
/*
* Remove all the ack-ed frames from the ack queue.
@@ -85,7 +85,7 @@ void rose_requeue_frames(struct sock *sk)
*/
int rose_validate_nr(struct sock *sk, unsigned short nr)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
unsigned short vc = rose->va;
while (vc != rose->vs) {
@@ -102,7 +102,7 @@ int rose_validate_nr(struct sock *sk, unsigned short nr)
*/
void rose_write_internal(struct sock *sk, int frametype)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
struct sk_buff *skb;
unsigned char *dptr;
unsigned char lci1, lci2;
@@ -396,7 +396,7 @@ int rose_parse_facilities(unsigned char *p,
return 1;
}
-static int rose_create_facilities(unsigned char *buffer, rose_cb *rose)
+static int rose_create_facilities(unsigned char *buffer, struct rose_sock *rose)
{
unsigned char *p = buffer + 1;
char *callsign;
@@ -492,7 +492,7 @@ static int rose_create_facilities(unsigned char *buffer, rose_cb *rose)
void rose_disconnect(struct sock *sk, int reason, int cause, int diagnostic)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
rose_stop_timer(sk);
rose_stop_idletimer(sk);
diff --git a/net/rose/rose_timer.c b/net/rose/rose_timer.c
index 638bb1f58560..84dd4403f792 100644
--- a/net/rose/rose_timer.c
+++ b/net/rose/rose_timer.c
@@ -46,7 +46,7 @@ void rose_start_heartbeat(struct sock *sk)
void rose_start_t1timer(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
del_timer(&rose->timer);
@@ -59,7 +59,7 @@ void rose_start_t1timer(struct sock *sk)
void rose_start_t2timer(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
del_timer(&rose->timer);
@@ -72,7 +72,7 @@ void rose_start_t2timer(struct sock *sk)
void rose_start_t3timer(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
del_timer(&rose->timer);
@@ -85,7 +85,7 @@ void rose_start_t3timer(struct sock *sk)
void rose_start_hbtimer(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
del_timer(&rose->timer);
@@ -98,7 +98,7 @@ void rose_start_hbtimer(struct sock *sk)
void rose_start_idletimer(struct sock *sk)
{
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
del_timer(&rose->idletimer);
@@ -129,7 +129,7 @@ void rose_stop_idletimer(struct sock *sk)
static void rose_heartbeat_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
bh_lock_sock(sk);
switch (rose->state) {
@@ -166,7 +166,7 @@ static void rose_heartbeat_expiry(unsigned long param)
static void rose_timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- rose_cb *rose = rose_sk(sk);
+ struct rose_sock *rose = rose_sk(sk);
bh_lock_sock(sk);
switch (rose->state) {