aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/proc.c')
-rw-r--r--net/atm/proc.c48
1 files changed, 15 insertions, 33 deletions
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,