aboutsummaryrefslogtreecommitdiffstats
path: root/net/netrom/af_netrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netrom/af_netrom.c')
-rw-r--r--net/netrom/af_netrom.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 7a834952f67f..fa07f044b599 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/socket.h> 16#include <linux/socket.h>
17#include <linux/in.h> 17#include <linux/in.h>
18#include <linux/slab.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/timer.h> 21#include <linux/timer.h>
@@ -425,12 +426,13 @@ static struct proto nr_proto = {
425 .obj_size = sizeof(struct nr_sock), 426 .obj_size = sizeof(struct nr_sock),
426}; 427};
427 428
428static int nr_create(struct net *net, struct socket *sock, int protocol) 429static int nr_create(struct net *net, struct socket *sock, int protocol,
430 int kern)
429{ 431{
430 struct sock *sk; 432 struct sock *sk;
431 struct nr_sock *nr; 433 struct nr_sock *nr;
432 434
433 if (net != &init_net) 435 if (!net_eq(net, &init_net))
434 return -EAFNOSUPPORT; 436 return -EAFNOSUPPORT;
435 437
436 if (sock->type != SOCK_SEQPACKET || protocol != 0) 438 if (sock->type != SOCK_SEQPACKET || protocol != 0)
@@ -1266,28 +1268,13 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1266 1268
1267static void *nr_info_start(struct seq_file *seq, loff_t *pos) 1269static void *nr_info_start(struct seq_file *seq, loff_t *pos)
1268{ 1270{
1269 struct sock *s;
1270 struct hlist_node *node;
1271 int i = 1;
1272
1273 spin_lock_bh(&nr_list_lock); 1271 spin_lock_bh(&nr_list_lock);
1274 if (*pos == 0) 1272 return seq_hlist_start_head(&nr_list, *pos);
1275 return SEQ_START_TOKEN;
1276
1277 sk_for_each(s, node, &nr_list) {
1278 if (i == *pos)
1279 return s;
1280 ++i;
1281 }
1282 return NULL;
1283} 1273}
1284 1274
1285static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos) 1275static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos)
1286{ 1276{
1287 ++*pos; 1277 return seq_hlist_next(v, &nr_list, pos);
1288
1289 return (v == SEQ_START_TOKEN) ? sk_head(&nr_list)
1290 : sk_next((struct sock *)v);
1291} 1278}
1292 1279
1293static void nr_info_stop(struct seq_file *seq, void *v) 1280static void nr_info_stop(struct seq_file *seq, void *v)
@@ -1297,7 +1284,7 @@ static void nr_info_stop(struct seq_file *seq, void *v)
1297 1284
1298static int nr_info_show(struct seq_file *seq, void *v) 1285static int nr_info_show(struct seq_file *seq, void *v)
1299{ 1286{
1300 struct sock *s = v; 1287 struct sock *s = sk_entry(v);
1301 struct net_device *dev; 1288 struct net_device *dev;
1302 struct nr_sock *nr; 1289 struct nr_sock *nr;
1303 const char *devname; 1290 const char *devname;
@@ -1372,7 +1359,7 @@ static const struct file_operations nr_info_fops = {
1372}; 1359};
1373#endif /* CONFIG_PROC_FS */ 1360#endif /* CONFIG_PROC_FS */
1374 1361
1375static struct net_proto_family nr_family_ops = { 1362static const struct net_proto_family nr_family_ops = {
1376 .family = PF_NETROM, 1363 .family = PF_NETROM,
1377 .create = nr_create, 1364 .create = nr_create,
1378 .owner = THIS_MODULE, 1365 .owner = THIS_MODULE,