diff options
Diffstat (limited to 'net/netrom')
| -rw-r--r-- | net/netrom/af_netrom.c | 21 | ||||
| -rw-r--r-- | net/netrom/nr_route.c | 53 |
2 files changed, 12 insertions, 62 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 71604c6613b5..a249127020a5 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
| @@ -1267,28 +1267,13 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
| 1267 | 1267 | ||
| 1268 | static void *nr_info_start(struct seq_file *seq, loff_t *pos) | 1268 | static void *nr_info_start(struct seq_file *seq, loff_t *pos) |
| 1269 | { | 1269 | { |
| 1270 | struct sock *s; | ||
| 1271 | struct hlist_node *node; | ||
| 1272 | int i = 1; | ||
| 1273 | |||
| 1274 | spin_lock_bh(&nr_list_lock); | 1270 | spin_lock_bh(&nr_list_lock); |
| 1275 | if (*pos == 0) | 1271 | return seq_hlist_start_head(&nr_list, *pos); |
| 1276 | return SEQ_START_TOKEN; | ||
| 1277 | |||
| 1278 | sk_for_each(s, node, &nr_list) { | ||
| 1279 | if (i == *pos) | ||
| 1280 | return s; | ||
| 1281 | ++i; | ||
| 1282 | } | ||
| 1283 | return NULL; | ||
| 1284 | } | 1272 | } |
| 1285 | 1273 | ||
| 1286 | static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos) | 1274 | static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos) |
| 1287 | { | 1275 | { |
| 1288 | ++*pos; | 1276 | return seq_hlist_next(v, &nr_list, pos); |
| 1289 | |||
| 1290 | return (v == SEQ_START_TOKEN) ? sk_head(&nr_list) | ||
| 1291 | : sk_next((struct sock *)v); | ||
| 1292 | } | 1277 | } |
| 1293 | 1278 | ||
| 1294 | static void nr_info_stop(struct seq_file *seq, void *v) | 1279 | static void nr_info_stop(struct seq_file *seq, void *v) |
| @@ -1298,7 +1283,7 @@ static void nr_info_stop(struct seq_file *seq, void *v) | |||
| 1298 | 1283 | ||
| 1299 | static int nr_info_show(struct seq_file *seq, void *v) | 1284 | static int nr_info_show(struct seq_file *seq, void *v) |
| 1300 | { | 1285 | { |
| 1301 | struct sock *s = v; | 1286 | struct sock *s = sk_entry(v); |
| 1302 | struct net_device *dev; | 1287 | struct net_device *dev; |
| 1303 | struct nr_sock *nr; | 1288 | struct nr_sock *nr; |
| 1304 | const char *devname; | 1289 | const char *devname; |
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index e2e2d33cafdf..5cc648012f50 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c | |||
| @@ -863,33 +863,13 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) | |||
| 863 | 863 | ||
| 864 | static void *nr_node_start(struct seq_file *seq, loff_t *pos) | 864 | static void *nr_node_start(struct seq_file *seq, loff_t *pos) |
| 865 | { | 865 | { |
| 866 | struct nr_node *nr_node; | ||
| 867 | struct hlist_node *node; | ||
| 868 | int i = 1; | ||
| 869 | |||
| 870 | spin_lock_bh(&nr_node_list_lock); | 866 | spin_lock_bh(&nr_node_list_lock); |
| 871 | if (*pos == 0) | 867 | return seq_hlist_start_head(&nr_node_list, *pos); |
| 872 | return SEQ_START_TOKEN; | ||
| 873 | |||
| 874 | nr_node_for_each(nr_node, node, &nr_node_list) { | ||
| 875 | if (i == *pos) | ||
| 876 | return nr_node; | ||
| 877 | ++i; | ||
| 878 | } | ||
| 879 | |||
| 880 | return NULL; | ||
| 881 | } | 868 | } |
| 882 | 869 | ||
| 883 | static void *nr_node_next(struct seq_file *seq, void *v, loff_t *pos) | 870 | static void *nr_node_next(struct seq_file *seq, void *v, loff_t *pos) |
| 884 | { | 871 | { |
| 885 | struct hlist_node *node; | 872 | return seq_hlist_next(v, &nr_node_list, pos); |
| 886 | ++*pos; | ||
| 887 | |||
| 888 | node = (v == SEQ_START_TOKEN) | ||
| 889 | ? nr_node_list.first | ||
| 890 | : ((struct nr_node *)v)->node_node.next; | ||
| 891 | |||
| 892 | return hlist_entry(node, struct nr_node, node_node); | ||
| 893 | } | 873 | } |
| 894 | 874 | ||
| 895 | static void nr_node_stop(struct seq_file *seq, void *v) | 875 | static void nr_node_stop(struct seq_file *seq, void *v) |
| @@ -906,7 +886,9 @@ static int nr_node_show(struct seq_file *seq, void *v) | |||
| 906 | seq_puts(seq, | 886 | seq_puts(seq, |
| 907 | "callsign mnemonic w n qual obs neigh qual obs neigh qual obs neigh\n"); | 887 | "callsign mnemonic w n qual obs neigh qual obs neigh qual obs neigh\n"); |
| 908 | else { | 888 | else { |
| 909 | struct nr_node *nr_node = v; | 889 | struct nr_node *nr_node = hlist_entry(v, struct nr_node, |
| 890 | node_node); | ||
| 891 | |||
| 910 | nr_node_lock(nr_node); | 892 | nr_node_lock(nr_node); |
| 911 | seq_printf(seq, "%-9s %-7s %d %d", | 893 | seq_printf(seq, "%-9s %-7s %d %d", |
| 912 | ax2asc(buf, &nr_node->callsign), | 894 | ax2asc(buf, &nr_node->callsign), |
| @@ -949,31 +931,13 @@ const struct file_operations nr_nodes_fops = { | |||
| 949 | 931 | ||
| 950 | static void *nr_neigh_start(struct seq_file *seq, loff_t *pos) | 932 | static void *nr_neigh_start(struct seq_file *seq, loff_t *pos) |
| 951 | { | 933 | { |
| 952 | struct nr_neigh *nr_neigh; | ||
| 953 | struct hlist_node *node; | ||
| 954 | int i = 1; | ||
| 955 | |||
| 956 | spin_lock_bh(&nr_neigh_list_lock); | 934 | spin_lock_bh(&nr_neigh_list_lock); |
| 957 | if (*pos == 0) | 935 | return seq_hlist_start_head(&nr_neigh_list, *pos); |
| 958 | return SEQ_START_TOKEN; | ||
| 959 | |||
| 960 | nr_neigh_for_each(nr_neigh, node, &nr_neigh_list) { | ||
| 961 | if (i == *pos) | ||
| 962 | return nr_neigh; | ||
| 963 | } | ||
| 964 | return NULL; | ||
| 965 | } | 936 | } |
| 966 | 937 | ||
| 967 | static void *nr_neigh_next(struct seq_file *seq, void *v, loff_t *pos) | 938 | static void *nr_neigh_next(struct seq_file *seq, void *v, loff_t *pos) |
| 968 | { | 939 | { |
| 969 | struct hlist_node *node; | 940 | return seq_hlist_next(v, &nr_neigh_list, pos); |
| 970 | ++*pos; | ||
| 971 | |||
| 972 | node = (v == SEQ_START_TOKEN) | ||
| 973 | ? nr_neigh_list.first | ||
| 974 | : ((struct nr_neigh *)v)->neigh_node.next; | ||
| 975 | |||
| 976 | return hlist_entry(node, struct nr_neigh, neigh_node); | ||
| 977 | } | 941 | } |
| 978 | 942 | ||
| 979 | static void nr_neigh_stop(struct seq_file *seq, void *v) | 943 | static void nr_neigh_stop(struct seq_file *seq, void *v) |
| @@ -989,8 +953,9 @@ static int nr_neigh_show(struct seq_file *seq, void *v) | |||
| 989 | if (v == SEQ_START_TOKEN) | 953 | if (v == SEQ_START_TOKEN) |
| 990 | seq_puts(seq, "addr callsign dev qual lock count failed digipeaters\n"); | 954 | seq_puts(seq, "addr callsign dev qual lock count failed digipeaters\n"); |
| 991 | else { | 955 | else { |
| 992 | struct nr_neigh *nr_neigh = v; | 956 | struct nr_neigh *nr_neigh; |
| 993 | 957 | ||
| 958 | nr_neigh = hlist_entry(v, struct nr_neigh, neigh_node); | ||
| 994 | seq_printf(seq, "%05d %-9s %-4s %3d %d %3d %3d", | 959 | seq_printf(seq, "%05d %-9s %-4s %3d %d %3d %3d", |
| 995 | nr_neigh->number, | 960 | nr_neigh->number, |
| 996 | ax2asc(buf, &nr_neigh->callsign), | 961 | ax2asc(buf, &nr_neigh->callsign), |
