Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4e5f89d2
Commit
4e5f89d2
authored
Sep 03, 2003
by
Chas Williams
Committed by
David S. Miller
Sep 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: Convert the /proc/net/atm/br2684 to seq_file interface (from shemminger@osdl.org)
parent
09192db7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
65 deletions
+72
-65
net/atm/br2684.c
net/atm/br2684.c
+72
-65
No files found.
net/atm/br2684.c
View file @
4e5f89d2
...
@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
...
@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
#include <net/arp.h>
#include <net/arp.h>
#include <linux/atm.h>
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/atmdev.h>
#include <linux/seq_file.h>
#include <linux/atmbr2684.h>
#include <linux/atmbr2684.h>
...
@@ -666,31 +667,57 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
...
@@ -666,31 +667,57 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
return
-
ENOIOCTLCMD
;
return
-
ENOIOCTLCMD
;
}
}
/* Never put more than 256 bytes in at once */
#ifdef CONFIG_PROC_FS
static
int
br2684_proc_engine
(
loff_t
pos
,
char
*
buf
)
static
void
*
br2684_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
{
struct
list_head
*
lhd
,
*
lhc
;
loff_t
offs
=
0
;
struct
net_device
*
net_dev
;
struct
br2684_dev
*
brd
;
struct
br2684_dev
*
brdev
;
struct
br2684_vcc
*
brvcc
;
read_lock
(
&
devs_lock
);
list_for_each
(
lhd
,
&
br2684_devs
)
{
net_dev
=
list_entry_brdev
(
lhd
);
list_for_each_entry
(
brd
,
&
br2684_devs
,
br2684_devs
)
{
brdev
=
BRPRIV
(
net_dev
);
if
(
offs
==
*
pos
)
if
(
pos
--
==
0
)
return
brd
;
return
sprintf
(
buf
,
"dev %.16s: num=%d, mac=%02X:%02X:"
++
offs
;
"%02X:%02X:%02X:%02X (%s)
\n
"
,
net_dev
->
name
,
}
brdev
->
number
,
return
NULL
;
net_dev
->
dev_addr
[
0
],
}
net_dev
->
dev_addr
[
1
],
net_dev
->
dev_addr
[
2
],
static
void
*
br2684_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
net_dev
->
dev_addr
[
3
],
{
net_dev
->
dev_addr
[
4
],
struct
br2684_dev
*
brd
=
v
;
net_dev
->
dev_addr
[
5
],
brdev
->
mac_was_set
?
"set"
:
"auto"
);
++*
pos
;
list_for_each
(
lhc
,
&
brdev
->
brvccs
)
{
brvcc
=
list_entry_brvcc
(
lhc
);
brd
=
list_entry
(
brd
->
br2684_devs
.
next
,
if
(
pos
--
==
0
)
struct
br2684_dev
,
br2684_devs
);
return
sprintf
(
buf
,
" vcc %d.%d.%d: encaps=%s"
return
(
&
brd
->
br2684_devs
!=
&
br2684_devs
)
?
brd
:
NULL
;
}
static
void
br2684_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock
(
&
devs_lock
);
}
static
int
br2684_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
const
struct
br2684_dev
*
brdev
=
v
;
const
struct
net_device
*
net_dev
=
brdev
->
net_dev
;
const
struct
br2684_vcc
*
brvcc
;
seq_printf
(
seq
,
"dev %.16s: num=%d, mac=%02X:%02X:"
"%02X:%02X:%02X:%02X (%s)
\n
"
,
net_dev
->
name
,
brdev
->
number
,
net_dev
->
dev_addr
[
0
],
net_dev
->
dev_addr
[
1
],
net_dev
->
dev_addr
[
2
],
net_dev
->
dev_addr
[
3
],
net_dev
->
dev_addr
[
4
],
net_dev
->
dev_addr
[
5
],
brdev
->
mac_was_set
?
"set"
:
"auto"
);
list_for_each_entry
(
brvcc
,
&
brdev
->
brvccs
,
brvccs
)
{
seq_printf
(
seq
,
" vcc %d.%d.%d: encaps=%s"
#ifndef FASTER_VERSION
#ifndef FASTER_VERSION
", failed copies %u/%u"
", failed copies %u/%u"
#endif
/* FASTER_VERSION */
#endif
/* FASTER_VERSION */
...
@@ -711,63 +738,41 @@ static int br2684_proc_engine(loff_t pos, char *buf)
...
@@ -711,63 +738,41 @@ static int br2684_proc_engine(loff_t pos, char *buf)
#undef bs
#undef bs
#undef b1
#undef b1
#endif
/* CONFIG_ATM_BR2684_IPFILTER */
#endif
/* CONFIG_ATM_BR2684_IPFILTER */
}
}
}
return
0
;
return
0
;
}
}
static
ssize_t
br2684_proc_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
static
struct
seq_operations
br2684_seq_ops
=
{
loff_t
*
pos
)
.
start
=
br2684_seq_start
,
.
next
=
br2684_seq_next
,
.
stop
=
br2684_seq_stop
,
.
show
=
br2684_seq_show
,
};
static
int
br2684_proc_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
unsigned
long
page
;
return
seq_open
(
file
,
&
br2684_seq_ops
);
int
len
=
0
,
x
,
left
;
page
=
get_zeroed_page
(
GFP_KERNEL
);
if
(
!
page
)
return
-
ENOMEM
;
left
=
PAGE_SIZE
-
256
;
if
(
count
<
left
)
left
=
count
;
read_lock
(
&
devs_lock
);
for
(;;)
{
x
=
br2684_proc_engine
(
*
pos
,
&
((
char
*
)
page
)[
len
]);
if
(
x
==
0
)
break
;
if
(
x
>
left
)
/*
* This should only happen if the user passed in
* a "count" too small for even one line
*/
x
=
-
EINVAL
;
if
(
x
<
0
)
{
len
=
x
;
break
;
}
len
+=
x
;
left
-=
x
;
(
*
pos
)
++
;
if
(
left
<
256
)
break
;
}
read_unlock
(
&
devs_lock
);
if
(
len
>
0
&&
copy_to_user
(
buf
,
(
char
*
)
page
,
len
))
len
=
-
EFAULT
;
free_page
(
page
);
return
len
;
}
}
static
struct
file_operations
br2684_proc_operations
=
{
static
struct
file_operations
br2684_proc_ops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
read
=
br2684_proc_read
,
.
open
=
br2684_proc_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
};
extern
struct
proc_dir_entry
*
atm_proc_root
;
/* from proc.c */
extern
struct
proc_dir_entry
*
atm_proc_root
;
/* from proc.c */
#endif
static
int
__init
br2684_init
(
void
)
static
int
__init
br2684_init
(
void
)
{
{
#ifdef CONFIG_PROC_FS
struct
proc_dir_entry
*
p
;
struct
proc_dir_entry
*
p
;
if
((
p
=
create_proc_entry
(
"br2684"
,
0
,
atm_proc_root
))
==
NULL
)
if
((
p
=
create_proc_entry
(
"br2684"
,
0
,
atm_proc_root
))
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
p
->
proc_fops
=
&
br2684_proc_operations
;
p
->
proc_fops
=
&
br2684_proc_ops
;
#endif
br2684_ioctl_set
(
br2684_ioctl
);
br2684_ioctl_set
(
br2684_ioctl
);
return
0
;
return
0
;
}
}
...
@@ -779,7 +784,9 @@ static void __exit br2684_exit(void)
...
@@ -779,7 +784,9 @@ static void __exit br2684_exit(void)
struct
br2684_vcc
*
brvcc
;
struct
br2684_vcc
*
brvcc
;
br2684_ioctl_set
(
NULL
);
br2684_ioctl_set
(
NULL
);
#ifdef CONFIG_PROC_FS
remove_proc_entry
(
"br2684"
,
atm_proc_root
);
remove_proc_entry
(
"br2684"
,
atm_proc_root
);
#endif
while
(
!
list_empty
(
&
br2684_devs
))
{
while
(
!
list_empty
(
&
br2684_devs
))
{
net_dev
=
list_entry_brdev
(
br2684_devs
.
next
);
net_dev
=
list_entry_brdev
(
br2684_devs
.
next
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment