patch-2.1.22 linux/net/appletalk/ddp.c
Next file: linux/net/ax25/af_ax25.c
Previous file: linux/net/802/llc_macinit.c
Back to the patch index
Back to the overall index
- Lines: 234
- Date:
Sun Jan 19 15:47:27 1997
- Orig file:
v2.1.21/linux/net/appletalk/ddp.c
- Orig date:
Thu Jan 2 15:55:26 1997
diff -u --recursive --new-file v2.1.21/linux/net/appletalk/ddp.c linux/net/appletalk/ddp.c
@@ -248,6 +248,7 @@
{
*iface = tmp->next;
kfree_s(tmp, sizeof(struct atalk_iface));
+ dev->atalk_ptr=NULL;
}
else
iface = &tmp->next;
@@ -262,6 +263,7 @@
if(iface==NULL)
return NULL;
iface->dev=dev;
+ dev->atalk_ptr=iface;
iface->address= *sa;
iface->status=0;
save_flags(flags);
@@ -377,10 +379,9 @@
struct at_addr *atalk_find_dev_addr(struct device *dev)
{
- struct atalk_iface *iface;
- for(iface=atalk_iface_list;iface!=NULL;iface=iface->next)
- if(iface->dev==dev)
- return &iface->address;
+ struct atalk_iface *iface=dev->atalk_ptr;
+ if(iface)
+ return &iface->address;
return NULL;
}
@@ -390,24 +391,10 @@
for(iface=atalk_iface_list;iface!=NULL;iface=iface->next)
if(!(iface->dev->flags&IFF_LOOPBACK))
return &iface->address;
- if ( atalk_iface_list != NULL ) {
- return &atalk_iface_list->address;
- } else {
- return NULL;
- }
-}
-
-/*
- * Give a device find its atif control structure
- */
-
-struct atalk_iface *atalk_find_dev(struct device *dev)
-{
- struct atalk_iface *iface;
- for(iface=atalk_iface_list;iface!=NULL;iface=iface->next)
- if(iface->dev==dev)
- return iface;
- return NULL;
+ if ( atalk_iface_list != NULL )
+ return &atalk_iface_list->address;
+ else
+ return NULL;
}
/*
@@ -472,7 +459,7 @@
/*
* Given an appletalk network find the device to use. This can be
- * a simple lookup. Funny stuff like routers can wait 8)
+ * a simple lookup.
*/
static struct device *atrtr_get_dev(struct at_addr *sa)
@@ -925,52 +912,13 @@
}
/*
- * Generic fcntl calls are already dealt with. If we don't need funny ones
- * this is the all you need. Async I/O is also separate.
- */
-
-static int atalk_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg)
-{
-/* struct sock *sk=sock->sk;*/
- switch(cmd)
- {
- default:
- return(-EINVAL);
- }
-}
-
-/*
* Set 'magic' options for appletalk. If we don't have any this is fine
* as it is.
*/
static int atalk_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
{
- struct sock *sk;
- int err,opt;
-
- sk=sock->sk;
-
- if(optval==NULL)
- return(-EINVAL);
-
- err = get_user(opt, (int *)optval);
- if (err)
- return err;
-
- switch(level)
- {
- case SOL_ATALK:
- switch(optname)
- {
- default:
- return -EOPNOTSUPP;
- }
- break;
-
- default:
- return -EOPNOTSUPP;
- }
+ return -EOPNOTSUPP;
}
@@ -981,30 +929,7 @@
static int atalk_getsockopt(struct socket *sock, int level, int optname,
char *optval, int *optlen)
{
- struct sock *sk;
- int val=0;
- int err;
-
- sk=sock->sk;
-
- switch(level)
- {
-
- case SOL_ATALK:
- switch(optname)
- {
- default:
- return -ENOPROTOOPT;
- }
- break;
-
- default:
- return -EOPNOTSUPP;
- }
- err = put_user(sizeof(int),optlen);
- if (!err)
- err = put_user(val, (int *) optval);
- return err;
+ return -ENOPROTOOPT;
}
/*
@@ -1017,34 +942,6 @@
}
/*
- * These are standard.
- */
-
-static void def_callback1(struct sock *sk)
-{
- if(!sk->dead)
- wake_up_interruptible(sk->sleep);
-}
-
-static void def_callback2(struct sock *sk, int len)
-{
- if(!sk->dead)
- {
- wake_up_interruptible(sk->sleep);
- sock_wake_async(sk->socket,1);
- }
-}
-
-static void def_callback3(struct sock *sk)
-{
- if(!sk->dead)
- {
- wake_up_interruptible(sk->sleep);
- sock_wake_async(sk->socket, 2);
- }
-}
-
-/*
* Create a socket. Initialise the socket, blank the addresses
* set the state.
*/
@@ -1071,32 +968,10 @@
MOD_INC_USE_COUNT;
- sk->no_check=0; /* Checksums on by default */
- sk->allocation=GFP_KERNEL;
- sk->rcvbuf=SK_RMEM_MAX;
- sk->sndbuf=SK_WMEM_MAX;
- sk->pair=NULL;
- sk->priority=1;
- skb_queue_head_init(&sk->receive_queue);
- skb_queue_head_init(&sk->write_queue);
- skb_queue_head_init(&sk->back_log);
- sk->state=TCP_CLOSE;
- sk->socket=sock;
- sk->type=sock->type;
-
+ sock_init_data(sock,sk);
+
+ /* Checksums on by default */
sk->mtu=DDP_MAXSZ;
-
- if(sock!=NULL)
- {
- sk->sleep=&sock->wait;
- sock->sk=sk;
- }
-
- sk->state_change=def_callback1;
- sk->data_ready=def_callback2;
- sk->write_space=def_callback3;
- sk->error_report=def_callback1;
-
sk->zapped=1;
return(0);
}
@@ -1909,7 +1784,7 @@
atalk_shutdown,
atalk_setsockopt,
atalk_getsockopt,
- atalk_fcntl,
+ sock_no_fcntl,
atalk_sendmsg,
atalk_recvmsg
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov