aboutsummaryrefslogtreecommitdiffstats
path: root/net/rose/af_rose.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /net/rose/af_rose.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'net/rose/af_rose.c')
-rw-r--r--net/rose/af_rose.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 502cce76621d..4fb711a035f4 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -18,6 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/socket.h> 19#include <linux/socket.h>
20#include <linux/in.h> 20#include <linux/in.h>
21#include <linux/slab.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/sched.h> 23#include <linux/sched.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
@@ -512,12 +513,13 @@ static struct proto rose_proto = {
512 .obj_size = sizeof(struct rose_sock), 513 .obj_size = sizeof(struct rose_sock),
513}; 514};
514 515
515static int rose_create(struct net *net, struct socket *sock, int protocol) 516static int rose_create(struct net *net, struct socket *sock, int protocol,
517 int kern)
516{ 518{
517 struct sock *sk; 519 struct sock *sk;
518 struct rose_sock *rose; 520 struct rose_sock *rose;
519 521
520 if (net != &init_net) 522 if (!net_eq(net, &init_net))
521 return -EAFNOSUPPORT; 523 return -EAFNOSUPPORT;
522 524
523 if (sock->type != SOCK_SEQPACKET || protocol != 0) 525 if (sock->type != SOCK_SEQPACKET || protocol != 0)
@@ -1403,29 +1405,13 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1403static void *rose_info_start(struct seq_file *seq, loff_t *pos) 1405static void *rose_info_start(struct seq_file *seq, loff_t *pos)
1404 __acquires(rose_list_lock) 1406 __acquires(rose_list_lock)
1405{ 1407{
1406 int i;
1407 struct sock *s;
1408 struct hlist_node *node;
1409
1410 spin_lock_bh(&rose_list_lock); 1408 spin_lock_bh(&rose_list_lock);
1411 if (*pos == 0) 1409 return seq_hlist_start_head(&rose_list, *pos);
1412 return SEQ_START_TOKEN;
1413
1414 i = 1;
1415 sk_for_each(s, node, &rose_list) {
1416 if (i == *pos)
1417 return s;
1418 ++i;
1419 }
1420 return NULL;
1421} 1410}
1422 1411
1423static void *rose_info_next(struct seq_file *seq, void *v, loff_t *pos) 1412static void *rose_info_next(struct seq_file *seq, void *v, loff_t *pos)
1424{ 1413{
1425 ++*pos; 1414 return seq_hlist_next(v, &rose_list, pos);
1426
1427 return (v == SEQ_START_TOKEN) ? sk_head(&rose_list)
1428 : sk_next((struct sock *)v);
1429} 1415}
1430 1416
1431static void rose_info_stop(struct seq_file *seq, void *v) 1417static void rose_info_stop(struct seq_file *seq, void *v)
@@ -1443,7 +1429,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
1443 "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n"); 1429 "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n");
1444 1430
1445 else { 1431 else {
1446 struct sock *s = v; 1432 struct sock *s = sk_entry(v);
1447 struct rose_sock *rose = rose_sk(s); 1433 struct rose_sock *rose = rose_sk(s);
1448 const char *devname, *callsign; 1434 const char *devname, *callsign;
1449 const struct net_device *dev = rose->device; 1435 const struct net_device *dev = rose->device;
@@ -1509,7 +1495,7 @@ static const struct file_operations rose_info_fops = {
1509}; 1495};
1510#endif /* CONFIG_PROC_FS */ 1496#endif /* CONFIG_PROC_FS */
1511 1497
1512static struct net_proto_family rose_family_ops = { 1498static const struct net_proto_family rose_family_ops = {
1513 .family = PF_ROSE, 1499 .family = PF_ROSE,
1514 .create = rose_create, 1500 .create = rose_create,
1515 .owner = THIS_MODULE, 1501 .owner = THIS_MODULE,