aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/clip.c6
-rw-r--r--net/atm/lec.c37
-rw-r--r--net/atm/mpc.c2
-rw-r--r--net/atm/proc.c48
-rw-r--r--net/atm/resources.c5
-rw-r--r--net/atm/svc.c2
6 files changed, 27 insertions, 73 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 2ab1e36098fd..6f8223ebf551 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -612,7 +612,7 @@ static int clip_device_event(struct notifier_block *this, unsigned long event,
612{ 612{
613 struct net_device *dev = arg; 613 struct net_device *dev = arg;
614 614
615 if (dev->nd_net != &init_net) 615 if (dev_net(dev) != &init_net)
616 return NOTIFY_DONE; 616 return NOTIFY_DONE;
617 617
618 if (event == NETDEV_UNREGISTER) { 618 if (event == NETDEV_UNREGISTER) {
@@ -648,10 +648,6 @@ static int clip_inet_event(struct notifier_block *this, unsigned long event,
648 struct in_device *in_dev; 648 struct in_device *in_dev;
649 649
650 in_dev = ((struct in_ifaddr *)ifa)->ifa_dev; 650 in_dev = ((struct in_ifaddr *)ifa)->ifa_dev;
651 if (!in_dev || !in_dev->dev) {
652 printk(KERN_WARNING "clip_inet_event: no device\n");
653 return NOTIFY_DONE;
654 }
655 /* 651 /*
656 * Transitions are of the down-change-up type, so it's sufficient to 652 * Transitions are of the down-change-up type, so it's sufficient to
657 * handle the change on up. 653 * handle the change on up.
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 3235c57615e4..653aca3573ac 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1023,7 +1023,7 @@ static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
1023 1023
1024 if (!e) 1024 if (!e)
1025 e = tbl->first; 1025 e = tbl->first;
1026 if (e == (void *)1) { 1026 if (e == SEQ_START_TOKEN) {
1027 e = tbl->first; 1027 e = tbl->first;
1028 --*l; 1028 --*l;
1029 } 1029 }
@@ -1125,9 +1125,9 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
1125 state->locked = NULL; 1125 state->locked = NULL;
1126 state->arp_table = 0; 1126 state->arp_table = 0;
1127 state->misc_table = 0; 1127 state->misc_table = 0;
1128 state->node = (void *)1; 1128 state->node = SEQ_START_TOKEN;
1129 1129
1130 return *pos ? lec_get_idx(state, *pos) : (void *)1; 1130 return *pos ? lec_get_idx(state, *pos) : SEQ_START_TOKEN;
1131} 1131}
1132 1132
1133static void lec_seq_stop(struct seq_file *seq, void *v) 1133static void lec_seq_stop(struct seq_file *seq, void *v)
@@ -1156,7 +1156,7 @@ static int lec_seq_show(struct seq_file *seq, void *v)
1156 " Status Flags " 1156 " Status Flags "
1157 "VPI/VCI Recv VPI/VCI\n"; 1157 "VPI/VCI Recv VPI/VCI\n";
1158 1158
1159 if (v == (void *)1) 1159 if (v == SEQ_START_TOKEN)
1160 seq_puts(seq, lec_banner); 1160 seq_puts(seq, lec_banner);
1161 else { 1161 else {
1162 struct lec_state *state = seq->private; 1162 struct lec_state *state = seq->private;
@@ -1178,32 +1178,7 @@ static const struct seq_operations lec_seq_ops = {
1178 1178
1179static int lec_seq_open(struct inode *inode, struct file *file) 1179static int lec_seq_open(struct inode *inode, struct file *file)
1180{ 1180{
1181 struct lec_state *state; 1181 return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state));
1182 struct seq_file *seq;
1183 int rc = -EAGAIN;
1184
1185 state = kmalloc(sizeof(*state), GFP_KERNEL);
1186 if (!state) {
1187 rc = -ENOMEM;
1188 goto out;
1189 }
1190
1191 rc = seq_open(file, &lec_seq_ops);
1192 if (rc)
1193 goto out_kfree;
1194 seq = file->private_data;
1195 seq->private = state;
1196out:
1197 return rc;
1198
1199out_kfree:
1200 kfree(state);
1201 goto out;
1202}
1203
1204static int lec_seq_release(struct inode *inode, struct file *file)
1205{
1206 return seq_release_private(inode, file);
1207} 1182}
1208 1183
1209static const struct file_operations lec_seq_fops = { 1184static const struct file_operations lec_seq_fops = {
@@ -1211,7 +1186,7 @@ static const struct file_operations lec_seq_fops = {
1211 .open = lec_seq_open, 1186 .open = lec_seq_open,
1212 .read = seq_read, 1187 .read = seq_read,
1213 .llseek = seq_lseek, 1188 .llseek = seq_lseek,
1214 .release = lec_seq_release, 1189 .release = seq_release_private,
1215}; 1190};
1216#endif 1191#endif
1217 1192
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 9c7f712fc7e9..9db332e7a6c0 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -964,7 +964,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
964 964
965 dev = (struct net_device *)dev_ptr; 965 dev = (struct net_device *)dev_ptr;
966 966
967 if (dev->nd_net != &init_net) 967 if (dev_net(dev) != &init_net)
968 return NOTIFY_DONE; 968 return NOTIFY_DONE;
969 969
970 if (dev->name == NULL || strncmp(dev->name, "lec", 3)) 970 if (dev->name == NULL || strncmp(dev->name, "lec", 3))
diff --git a/net/atm/proc.c b/net/atm/proc.c
index e9693aed7ef8..5c9f3d148135 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -78,7 +78,7 @@ static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l)
78{ 78{
79 struct sock *sk = *sock; 79 struct sock *sk = *sock;
80 80
81 if (sk == (void *)1) { 81 if (sk == SEQ_START_TOKEN) {
82 for (*bucket = 0; *bucket < VCC_HTABLE_SIZE; ++*bucket) { 82 for (*bucket = 0; *bucket < VCC_HTABLE_SIZE; ++*bucket) {
83 struct hlist_head *head = &vcc_hash[*bucket]; 83 struct hlist_head *head = &vcc_hash[*bucket];
84 84
@@ -98,7 +98,7 @@ try_again:
98 sk = sk_head(&vcc_hash[*bucket]); 98 sk = sk_head(&vcc_hash[*bucket]);
99 goto try_again; 99 goto try_again;
100 } 100 }
101 sk = (void *)1; 101 sk = SEQ_START_TOKEN;
102out: 102out:
103 *sock = sk; 103 *sock = sk;
104 return (l < 0); 104 return (l < 0);
@@ -114,31 +114,13 @@ static int __vcc_seq_open(struct inode *inode, struct file *file,
114 int family, const struct seq_operations *ops) 114 int family, const struct seq_operations *ops)
115{ 115{
116 struct vcc_state *state; 116 struct vcc_state *state;
117 struct seq_file *seq;
118 int rc = -ENOMEM;
119 117
120 state = kmalloc(sizeof(*state), GFP_KERNEL); 118 state = __seq_open_private(file, ops, sizeof(*state));
121 if (!state) 119 if (state == NULL)
122 goto out; 120 return -ENOMEM;
123
124 rc = seq_open(file, ops);
125 if (rc)
126 goto out_kfree;
127 121
128 state->family = family; 122 state->family = family;
129 123 return 0;
130 seq = file->private_data;
131 seq->private = state;
132out:
133 return rc;
134out_kfree:
135 kfree(state);
136 goto out;
137}
138
139static int vcc_seq_release(struct inode *inode, struct file *file)
140{
141 return seq_release_private(inode, file);
142} 124}
143 125
144static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) 126static void *vcc_seq_start(struct seq_file *seq, loff_t *pos)
@@ -148,8 +130,8 @@ static void *vcc_seq_start(struct seq_file *seq, loff_t *pos)
148 loff_t left = *pos; 130 loff_t left = *pos;
149 131
150 read_lock(&vcc_sklist_lock); 132 read_lock(&vcc_sklist_lock);
151 state->sk = (void *)1; 133 state->sk = SEQ_START_TOKEN;
152 return left ? vcc_walk(state, left) : (void *)1; 134 return left ? vcc_walk(state, left) : SEQ_START_TOKEN;
153} 135}
154 136
155static void vcc_seq_stop(struct seq_file *seq, void *v) 137static void vcc_seq_stop(struct seq_file *seq, void *v)
@@ -253,7 +235,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
253 "Itf Type ESI/\"MAC\"addr " 235 "Itf Type ESI/\"MAC\"addr "
254 "AAL(TX,err,RX,err,drop) ... [refcnt]\n"; 236 "AAL(TX,err,RX,err,drop) ... [refcnt]\n";
255 237
256 if (v == (void *)1) 238 if (v == SEQ_START_TOKEN)
257 seq_puts(seq, atm_dev_banner); 239 seq_puts(seq, atm_dev_banner);
258 else { 240 else {
259 struct atm_dev *dev = list_entry(v, struct atm_dev, dev_list); 241 struct atm_dev *dev = list_entry(v, struct atm_dev, dev_list);
@@ -287,7 +269,7 @@ static int pvc_seq_show(struct seq_file *seq, void *v)
287 static char atm_pvc_banner[] = 269 static char atm_pvc_banner[] =
288 "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n"; 270 "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n";
289 271
290 if (v == (void *)1) 272 if (v == SEQ_START_TOKEN)
291 seq_puts(seq, atm_pvc_banner); 273 seq_puts(seq, atm_pvc_banner);
292 else { 274 else {
293 struct vcc_state *state = seq->private; 275 struct vcc_state *state = seq->private;
@@ -314,12 +296,12 @@ static const struct file_operations pvc_seq_fops = {
314 .open = pvc_seq_open, 296 .open = pvc_seq_open,
315 .read = seq_read, 297 .read = seq_read,
316 .llseek = seq_lseek, 298 .llseek = seq_lseek,
317 .release = vcc_seq_release, 299 .release = seq_release_private,
318}; 300};
319 301
320static int vcc_seq_show(struct seq_file *seq, void *v) 302static int vcc_seq_show(struct seq_file *seq, void *v)
321{ 303{
322 if (v == (void *)1) { 304 if (v == SEQ_START_TOKEN) {
323 seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", 305 seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s",
324 "Address ", "Itf VPI VCI Fam Flags Reply " 306 "Address ", "Itf VPI VCI Fam Flags Reply "
325 "Send buffer Recv buffer [refcnt]\n"); 307 "Send buffer Recv buffer [refcnt]\n");
@@ -348,7 +330,7 @@ static const struct file_operations vcc_seq_fops = {
348 .open = vcc_seq_open, 330 .open = vcc_seq_open,
349 .read = seq_read, 331 .read = seq_read,
350 .llseek = seq_lseek, 332 .llseek = seq_lseek,
351 .release = vcc_seq_release, 333 .release = seq_release_private,
352}; 334};
353 335
354static int svc_seq_show(struct seq_file *seq, void *v) 336static int svc_seq_show(struct seq_file *seq, void *v)
@@ -356,7 +338,7 @@ static int svc_seq_show(struct seq_file *seq, void *v)
356 static char atm_svc_banner[] = 338 static char atm_svc_banner[] =
357 "Itf VPI VCI State Remote\n"; 339 "Itf VPI VCI State Remote\n";
358 340
359 if (v == (void *)1) 341 if (v == SEQ_START_TOKEN)
360 seq_puts(seq, atm_svc_banner); 342 seq_puts(seq, atm_svc_banner);
361 else { 343 else {
362 struct vcc_state *state = seq->private; 344 struct vcc_state *state = seq->private;
@@ -383,7 +365,7 @@ static const struct file_operations svc_seq_fops = {
383 .open = svc_seq_open, 365 .open = svc_seq_open,
384 .read = seq_read, 366 .read = seq_read,
385 .llseek = seq_lseek, 367 .llseek = seq_lseek,
386 .release = vcc_seq_release, 368 .release = seq_release_private,
387}; 369};
388 370
389static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, 371static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 1bcf6dc8d409..a34ba948af96 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -415,7 +415,7 @@ static __inline__ void *dev_get_idx(loff_t left)
415void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) 415void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
416{ 416{
417 mutex_lock(&atm_dev_mutex); 417 mutex_lock(&atm_dev_mutex);
418 return *pos ? dev_get_idx(*pos) : (void *) 1; 418 return *pos ? dev_get_idx(*pos) : SEQ_START_TOKEN;
419} 419}
420 420
421void atm_dev_seq_stop(struct seq_file *seq, void *v) 421void atm_dev_seq_stop(struct seq_file *seq, void *v)
@@ -426,7 +426,8 @@ void atm_dev_seq_stop(struct seq_file *seq, void *v)
426void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) 426void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
427{ 427{
428 ++*pos; 428 ++*pos;
429 v = (v == (void *)1) ? atm_devs.next : ((struct list_head *)v)->next; 429 v = (v == SEQ_START_TOKEN)
430 ? atm_devs.next : ((struct list_head *)v)->next;
430 return (v == &atm_devs) ? NULL : v; 431 return (v == &atm_devs) ? NULL : v;
431} 432}
432 433
diff --git a/net/atm/svc.c b/net/atm/svc.c
index daf9a48a7db0..de1e4f2f3a43 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -326,7 +326,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
326 326
327 lock_sock(sk); 327 lock_sock(sk);
328 328
329 error = svc_create(sk->sk_net, newsock,0); 329 error = svc_create(sock_net(sk), newsock,0);
330 if (error) 330 if (error)
331 goto out; 331 goto out;
332 332