summaryrefslogtreecommitdiff
path: root/net/netrom
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/netrom
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/netrom')
-rw-r--r--net/netrom/af_netrom.c47
-rw-r--r--net/netrom/nr_in.c8
-rw-r--r--net/netrom/nr_out.c14
-rw-r--r--net/netrom/nr_subr.c10
-rw-r--r--net/netrom/nr_timer.c18
5 files changed, 40 insertions, 57 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 31307740e897..024217b2f9e5 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -66,24 +66,7 @@ static struct proto_ops nr_proto_ops;
static struct sock *nr_alloc_sock(void)
{
- nr_cb *nr;
- struct sock *sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL);
-
- if (!sk)
- goto out;
-
- nr = sk->sk_protinfo = kmalloc(sizeof(*nr), GFP_ATOMIC);
- if (!nr)
- goto frees;
-
- memset(nr, 0x00, sizeof(*nr));
- nr->sk = sk;
-out:
- return sk;
-frees:
- sk_free(sk);
- sk = NULL;
- goto out;
+ return sk_alloc(PF_NETROM, GFP_ATOMIC, sizeof(struct nr_sock), NULL);
}
/*
@@ -169,7 +152,7 @@ static struct sock *nr_find_socket(unsigned char index, unsigned char id)
spin_lock_bh(&nr_list_lock);
sk_for_each(s, node, &nr_list) {
- nr_cb *nr = nr_sk(s);
+ struct nr_sock *nr = nr_sk(s);
if (nr->my_index == index && nr->my_id == id) {
bh_lock_sock(s);
@@ -193,7 +176,7 @@ static struct sock *nr_find_peer(unsigned char index, unsigned char id,
spin_lock_bh(&nr_list_lock);
sk_for_each(s, node, &nr_list) {
- nr_cb *nr = nr_sk(s);
+ struct nr_sock *nr = nr_sk(s);
if (nr->your_index == index && nr->your_id == id &&
!ax25cmp(&nr->dest_addr, dest)) {
@@ -300,7 +283,7 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, int optlen)
{
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
int opt;
if (level != SOL_NETROM)
@@ -352,7 +335,7 @@ static int nr_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
int val = 0;
int len;
@@ -418,7 +401,7 @@ static int nr_listen(struct socket *sock, int backlog)
static int nr_create(struct socket *sock, int protocol)
{
struct sock *sk;
- nr_cb *nr;
+ struct nr_sock *nr;
if (sock->type != SOCK_SEQPACKET || protocol != 0)
return -ESOCKTNOSUPPORT;
@@ -456,7 +439,7 @@ static int nr_create(struct socket *sock, int protocol)
static struct sock *nr_make_new(struct sock *osk)
{
struct sock *sk;
- nr_cb *nr, *onr;
+ struct nr_sock *nr, *onr;
if (osk->sk_type != SOCK_SEQPACKET)
return NULL;
@@ -508,7 +491,7 @@ static struct sock *nr_make_new(struct sock *osk)
static int nr_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- nr_cb *nr;
+ struct nr_sock *nr;
if (sk == NULL) return 0;
@@ -556,7 +539,7 @@ static int nr_release(struct socket *sock)
static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr;
struct net_device *dev;
ax25_address *user, *source;
@@ -625,7 +608,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
int addr_len, int flags)
{
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr;
ax25_address *user, *source = NULL;
struct net_device *dev;
@@ -822,7 +805,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
{
struct full_sockaddr_ax25 *sax = (struct full_sockaddr_ax25 *)uaddr;
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
lock_sock(sk);
if (peer != 0) {
@@ -850,7 +833,7 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
{
struct sock *sk;
struct sock *make;
- nr_cb *nr_make;
+ struct nr_sock *nr_make;
ax25_address *src, *dest, *user;
unsigned short circuit_index, circuit_id;
unsigned short peer_circuit_index, peer_circuit_id;
@@ -942,7 +925,7 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
user = (ax25_address *)(skb->data + 21);
- if (!sk || sk->sk_ack_backlog == sk->sk_max_ack_backlog ||
+ if (sk == NULL || sk_acceptq_is_full(sk) ||
(make = nr_make_new(sk)) == NULL) {
nr_transmit_refusal(skb, 0);
if (sk)
@@ -1015,7 +998,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
struct sockaddr_ax25 *usax = (struct sockaddr_ax25 *)msg->msg_name;
int err;
struct sockaddr_ax25 sax;
@@ -1275,7 +1258,7 @@ static int nr_info_show(struct seq_file *seq, void *v)
{
struct sock *s = v;
struct net_device *dev;
- nr_cb *nr;
+ struct nr_sock *nr;
const char *devname;
if (v == SEQ_START_TOKEN)
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c
index 7de7f0d818bc..9c44b3794126 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -34,7 +34,7 @@
static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
{
struct sk_buff *skbo, *skbn = skb;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
@@ -76,7 +76,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
{
switch (frametype) {
case NR_CONNACK: {
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
nr_stop_t1timer(sk);
nr_start_idletimer(sk);
@@ -138,7 +138,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
*/
static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{
- nr_cb *nrom = nr_sk(sk);
+ struct nr_sock *nrom = nr_sk(sk);
struct sk_buff_head temp_queue;
struct sk_buff *skbn;
unsigned short save_vr;
@@ -264,7 +264,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
/* Higher level upcall for a LAPB frame - called with sk locked */
int nr_process_rx_frame(struct sock *sk, struct sk_buff *skb)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
int queued = 0, frametype;
if (nr->state == NR_STATE_0)
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c
index d36393da5825..7939ded9c98c 100644
--- a/net/netrom/nr_out.c
+++ b/net/netrom/nr_out.c
@@ -82,7 +82,7 @@ void nr_output(struct sock *sk, struct sk_buff *skb)
*/
static void nr_send_iframe(struct sock *sk, struct sk_buff *skb)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
if (skb == NULL)
return;
@@ -101,7 +101,7 @@ static void nr_send_iframe(struct sock *sk, struct sk_buff *skb)
void nr_send_nak_frame(struct sock *sk)
{
struct sk_buff *skb, *skbn;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
if ((skb = skb_peek(&nr->ack_queue)) == NULL)
return;
@@ -125,7 +125,7 @@ void nr_send_nak_frame(struct sock *sk)
void nr_kick(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
struct sk_buff *skb, *skbn;
unsigned short start, end;
@@ -188,7 +188,7 @@ void nr_kick(struct sock *sk)
void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
unsigned char *dptr;
/*
@@ -223,7 +223,7 @@ void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
void nr_establish_data_link(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
nr->condition = 0x00;
nr->n2count = 0;
@@ -241,7 +241,7 @@ void nr_establish_data_link(struct sock *sk)
*/
void nr_enquiry_response(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
int frametype = NR_INFOACK;
if (nr->condition & NR_COND_OWN_RX_BUSY) {
@@ -259,7 +259,7 @@ void nr_enquiry_response(struct sock *sk)
void nr_check_iframes_acked(struct sock *sk, unsigned short nr)
{
- nr_cb *nrom = nr_sk(sk);
+ struct nr_sock *nrom = nr_sk(sk);
if (nrom->vs == nr) {
nr_frames_acked(sk, nr);
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c
index 474ff6309f10..0627347b14b8 100644
--- a/net/netrom/nr_subr.c
+++ b/net/netrom/nr_subr.c
@@ -34,7 +34,7 @@
*/
void nr_clear_queues(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
skb_queue_purge(&sk->sk_write_queue);
skb_queue_purge(&nr->ack_queue);
@@ -49,7 +49,7 @@ void nr_clear_queues(struct sock *sk)
*/
void nr_frames_acked(struct sock *sk, unsigned short nr)
{
- nr_cb *nrom = nr_sk(sk);
+ struct nr_sock *nrom = nr_sk(sk);
struct sk_buff *skb;
/*
@@ -88,7 +88,7 @@ void nr_requeue_frames(struct sock *sk)
*/
int nr_validate_nr(struct sock *sk, unsigned short nr)
{
- nr_cb *nrom = nr_sk(sk);
+ struct nr_sock *nrom = nr_sk(sk);
unsigned short vc = nrom->va;
while (vc != nrom->vs) {
@@ -104,7 +104,7 @@ int nr_validate_nr(struct sock *sk, unsigned short nr)
*/
int nr_in_rx_window(struct sock *sk, unsigned short ns)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
unsigned short vc = nr->vr;
unsigned short vt = (nr->vl + nr->window) % NR_MODULUS;
@@ -122,7 +122,7 @@ int nr_in_rx_window(struct sock *sk, unsigned short ns)
*/
void nr_write_internal(struct sock *sk, int frametype)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
struct sk_buff *skb;
unsigned char *dptr;
int len, timeout;
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c
index 213d0b400709..faabda8088be 100644
--- a/net/netrom/nr_timer.c
+++ b/net/netrom/nr_timer.c
@@ -38,7 +38,7 @@ static void nr_idletimer_expiry(unsigned long);
void nr_init_timers(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
init_timer(&nr->t1timer);
nr->t1timer.data = (unsigned long)sk;
@@ -63,28 +63,28 @@ void nr_init_timers(struct sock *sk)
void nr_start_t1timer(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t1timer, jiffies + nr->t1);
}
void nr_start_t2timer(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t2timer, jiffies + nr->t2);
}
void nr_start_t4timer(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t4timer, jiffies + nr->t4);
}
void nr_start_idletimer(struct sock *sk)
{
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
if (nr->idle > 0)
mod_timer(&nr->idletimer, jiffies + nr->idle);
@@ -128,7 +128,7 @@ int nr_t1timer_running(struct sock *sk)
static void nr_heartbeat_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
switch (nr->state) {
@@ -167,7 +167,7 @@ static void nr_heartbeat_expiry(unsigned long param)
static void nr_t2timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
if (nr->condition & NR_COND_ACK_PENDING) {
@@ -189,7 +189,7 @@ static void nr_t4timer_expiry(unsigned long param)
static void nr_idletimer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
@@ -217,7 +217,7 @@ static void nr_idletimer_expiry(unsigned long param)
static void nr_t1timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
- nr_cb *nr = nr_sk(sk);
+ struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
switch (nr->state) {