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
1f01cc36
Commit
1f01cc36
authored
Nov 24, 2002
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o wireless: convert /proc/net/wireless to seq_file
parent
5d0d0e11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
72 deletions
+85
-72
net/core/dev.c
net/core/dev.c
+16
-6
net/core/wireless.c
net/core/wireless.c
+69
-66
No files found.
net/core/dev.c
View file @
1f01cc36
...
...
@@ -1737,18 +1737,18 @@ static __inline__ struct net_device *dev_get_idx(struct seq_file *seq,
return
i
==
pos
?
dev
:
NULL
;
}
static
void
*
dev_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
void
*
dev_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
read_lock
(
&
dev_base_lock
);
return
*
pos
?
dev_get_idx
(
seq
,
*
pos
)
:
(
void
*
)
1
;
}
static
void
*
dev_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
void
*
dev_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
return
v
==
(
void
*
)
1
?
dev_base
:
((
struct
net_device
*
)
v
)
->
next
;
}
static
void
dev_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
void
dev_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock
(
&
dev_base_lock
);
}
...
...
@@ -1856,6 +1856,14 @@ static struct file_operations dev_seq_fops = {
.
release
=
seq_release
,
};
#ifdef WIRELESS_EXT
extern
int
wireless_proc_init
(
void
);
extern
int
wireless_proc_exit
(
void
);
#else
#define wireless_proc_init() 0
#define wireless_proc_exit()
#endif
static
int
__init
dev_proc_init
(
void
)
{
struct
proc_dir_entry
*
p
;
...
...
@@ -1865,13 +1873,15 @@ static int __init dev_proc_init(void)
if
(
!
p
)
goto
out
;
p
->
proc_fops
=
&
dev_seq_fops
;
if
(
wireless_proc_init
())
goto
out_dev
;
create_proc_read_entry
(
"net/softnet_stat"
,
0
,
0
,
dev_proc_stats
,
NULL
);
#ifdef WIRELESS_EXT
proc_net_create
(
"wireless"
,
0
,
dev_get_wireless_info
);
#endif
rc
=
0
;
out:
return
rc
;
out_dev:
remove_proc_entry
(
"dev"
,
proc_net
);
goto
out
;
}
#else
#define dev_proc_init() 0
...
...
net/core/wireless.c
View file @
1f01cc36
...
...
@@ -47,15 +47,18 @@
/***************************** INCLUDES *****************************/
#include <asm/uaccess.h>
/* copy_to_user() */
#include <linux/config.h>
/* Not needed ??? */
#include <linux/types.h>
/* off_t */
#include <linux/netdevice.h>
/* struct ifreq, dev_get_by_name() */
#include <linux/proc_fs.h>
#include <linux/rtnetlink.h>
/* rtnetlink stuff */
#include <linux/seq_file.h>
#include <linux/wireless.h>
/* Pretty obvious */
#include <net/iw_handler.h>
/* New driver API */
#include <asm/uaccess.h>
/* copy_to_user() */
/**************************** CONSTANTS ****************************/
/* Enough lenience, let's make sure things are proper... */
...
...
@@ -330,83 +333,83 @@ static inline int get_priv_size(__u16 args)
/*
* Print one entry (line) of /proc/net/wireless
*/
static
inline
int
sprintf_wireless_stats
(
char
*
buffer
,
struct
net_device
*
dev
)
static
__inline__
void
wireless_seq_printf_stats
(
struct
seq_file
*
seq
,
struct
net_device
*
dev
)
{
/* Get stats from the driver */
struct
iw_statistics
*
stats
;
int
size
;
struct
iw_statistics
*
stats
=
get_wireless_stats
(
dev
);
stats
=
get_wireless_stats
(
dev
);
if
(
stats
!=
(
struct
iw_statistics
*
)
NULL
)
{
size
=
sprintf
(
buffer
,
"%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d %6d %6d %6d
\n
"
,
dev
->
name
,
stats
->
status
,
stats
->
qual
.
qual
,
if
(
stats
)
{
seq_printf
(
seq
,
"%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d "
"%6d %6d %6d
\n
"
,
dev
->
name
,
stats
->
status
,
stats
->
qual
.
qual
,
stats
->
qual
.
updated
&
1
?
'.'
:
' '
,
((
__u8
)
stats
->
qual
.
level
),
stats
->
qual
.
updated
&
2
?
'.'
:
' '
,
((
__u8
)
stats
->
qual
.
noise
),
stats
->
qual
.
updated
&
4
?
'.'
:
' '
,
stats
->
discard
.
nwid
,
stats
->
discard
.
code
,
stats
->
discard
.
fragment
,
stats
->
discard
.
retries
,
stats
->
discard
.
misc
,
stats
->
miss
.
beacon
);
stats
->
discard
.
nwid
,
stats
->
discard
.
code
,
stats
->
discard
.
fragment
,
stats
->
discard
.
retries
,
stats
->
discard
.
misc
,
stats
->
miss
.
beacon
);
stats
->
qual
.
updated
=
0
;
}
else
size
=
0
;
return
size
;
}
/* ---------------------------------------------------------------- */
/*
* Print info for /proc/net/wireless (print all entries)
*/
int
dev_get_wireless_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
static
int
wireless_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
int
len
=
0
;
off_t
begin
=
0
;
off_t
pos
=
0
;
int
size
;
struct
net_device
*
dev
;
size
=
sprintf
(
buffer
,
"Inter-| sta-| Quality | Discarded packets | Missed
\n
"
" face | tus | link level noise | nwid crypt frag retry misc | beacon
\n
"
);
pos
+=
size
;
len
+=
size
;
read_lock
(
&
dev_base_lock
);
for
(
dev
=
dev_base
;
dev
!=
NULL
;
dev
=
dev
->
next
)
{
size
=
sprintf_wireless_stats
(
buffer
+
len
,
dev
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
break
;
}
read_unlock
(
&
dev_base_lock
);
if
(
v
==
(
void
*
)
1
)
seq_printf
(
seq
,
"Inter-| sta-| Quality | Discarded "
"packets | Missed
\n
"
" face | tus | link level noise | nwid "
"crypt frag retry misc | beacon
\n
"
);
else
wireless_seq_printf_stats
(
seq
,
v
);
return
0
;
}
extern
void
*
dev_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
);
extern
void
*
dev_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
);
extern
void
dev_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
);
static
struct
seq_operations
wireless_seq_ops
=
{
.
start
=
dev_seq_start
,
.
next
=
dev_seq_next
,
.
stop
=
dev_seq_stop
,
.
show
=
wireless_seq_show
,
};
*
start
=
buffer
+
(
offset
-
begin
);
/* Start of wanted data */
len
-=
(
offset
-
begin
);
/* Start slop */
if
(
len
>
length
)
len
=
length
;
/* Ending slop */
if
(
len
<
0
)
len
=
0
;
static
int
wireless_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
wireless_seq_ops
);
}
return
len
;
static
struct
file_operations
wireless_seq_fops
=
{
.
open
=
wireless_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
int
__init
wireless_proc_init
(
void
)
{
struct
proc_dir_entry
*
p
;
int
rc
=
0
;
p
=
create_proc_entry
(
"wireless"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
wireless_seq_fops
;
else
rc
=
-
ENOMEM
;
return
rc
;
}
void
__init
wireless_proc_exit
(
void
)
{
remove_proc_entry
(
"wireless"
,
proc_net
);
}
#endif
/* CONFIG_PROC_FS */
...
...
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