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
5aca627d
Commit
5aca627d
authored
Apr 03, 2002
by
Christopher Goldfarb
Committed by
Jeff Garzik
Apr 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e1000 net drvr updates 10/13:
ProcFS code updates, check for page boundaries.
parent
1fa5412b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
31 deletions
+27
-31
drivers/net/e1000/e1000_proc.c
drivers/net/e1000/e1000_proc.c
+27
-31
No files found.
drivers/net/e1000/e1000_proc.c
View file @
5aca627d
...
@@ -95,7 +95,9 @@
...
@@ -95,7 +95,9 @@
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#define ADAPTERS_PROC_DIR "PRO_LAN_Adapters"
#define ADAPTERS_PROC_DIR "PRO_LAN_Adapters"
#define TAG_MAX_LENGTH 36
#define TAG_MAX_LENGTH 32
#define LINE_MAX_LENGTH 80
#define FIELD_MAX_LENGTH LINE_MAX_LENGTH - TAG_MAX_LENGTH - 3
extern
char
e1000_driver_name
[];
extern
char
e1000_driver_name
[];
extern
char
e1000_driver_version
[];
extern
char
e1000_driver_version
[];
...
@@ -109,7 +111,7 @@ extern char e1000_driver_version[];
...
@@ -109,7 +111,7 @@ extern char e1000_driver_version[];
struct
proc_list
{
struct
proc_list
{
struct
list_head
list
;
/* link list */
struct
list_head
list
;
/* link list */
char
tag
[
TAG_MAX_LENGTH
];
/* attribute name */
char
tag
[
TAG_MAX_LENGTH
+
1
];
/* attribute name */
void
*
data
;
/* attribute data */
void
*
data
;
/* attribute data */
size_t
len
;
/* sizeof data */
size_t
len
;
/* sizeof data */
char
*
(
*
func
)(
void
*
,
size_t
,
char
*
);
/* format data func */
char
*
(
*
func
)(
void
*
,
size_t
,
char
*
);
/* format data func */
...
@@ -141,15 +143,20 @@ e1000_proc_info_read(char *page, char **start, off_t off,
...
@@ -141,15 +143,20 @@ e1000_proc_info_read(char *page, char **start, off_t off,
struct
list_head
*
proc_list_head
=
data
,
*
curr
;
struct
list_head
*
proc_list_head
=
data
,
*
curr
;
struct
proc_list
*
elem
;
struct
proc_list
*
elem
;
char
*
p
=
page
;
char
*
p
=
page
;
char
buf
[
64
];
char
buf
[
FIELD_MAX_LENGTH
+
1
];
list_for_each
(
curr
,
proc_list_head
)
{
list_for_each
(
curr
,
proc_list_head
)
{
elem
=
list_entry
(
curr
,
struct
proc_list
,
list
);
elem
=
list_entry
(
curr
,
struct
proc_list
,
list
);
if
(
strlen
(
elem
->
tag
)
==
0
)
if
(
p
-
page
+
LINE_MAX_LENGTH
>=
PAGE_SIZE
)
break
;
if
(
!
strlen
(
elem
->
tag
))
p
+=
sprintf
(
p
,
"
\n
"
);
p
+=
sprintf
(
p
,
"
\n
"
);
else
else
p
+=
sprintf
(
p
,
"%-32s %s
\n
"
,
elem
->
tag
,
p
+=
sprintf
(
p
,
"%-*.*s %.*s
\n
"
,
TAG_MAX_LENGTH
,
TAG_MAX_LENGTH
,
elem
->
tag
,
FIELD_MAX_LENGTH
,
elem
->
func
(
elem
->
data
,
elem
->
len
,
buf
));
elem
->
func
(
elem
->
data
,
elem
->
len
,
buf
));
}
}
...
@@ -164,7 +171,8 @@ e1000_proc_single_read(char *page, char **start, off_t off,
...
@@ -164,7 +171,8 @@ e1000_proc_single_read(char *page, char **start, off_t off,
{
{
struct
proc_list
*
elem
=
data
;
struct
proc_list
*
elem
=
data
;
sprintf
(
page
,
"%s"
,
elem
->
func
(
elem
->
data
,
elem
->
len
,
page
));
sprintf
(
page
,
"%.*s"
,
FIELD_MAX_LENGTH
,
elem
->
func
(
elem
->
data
,
elem
->
len
,
page
));
return
e1000_proc_read
(
page
,
start
,
off
,
count
,
eof
);
return
e1000_proc_read
(
page
,
start
,
off
,
count
,
eof
);
}
}
...
@@ -178,8 +186,7 @@ e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
...
@@ -178,8 +186,7 @@ e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
for
(
intel_proc_dir
=
proc_net
->
subdir
;
intel_proc_dir
;
for
(
intel_proc_dir
=
proc_net
->
subdir
;
intel_proc_dir
;
intel_proc_dir
=
intel_proc_dir
->
next
)
{
intel_proc_dir
=
intel_proc_dir
->
next
)
{
if
((
intel_proc_dir
->
namelen
==
strlen
(
ADAPTERS_PROC_DIR
))
&&
if
((
intel_proc_dir
->
namelen
==
strlen
(
ADAPTERS_PROC_DIR
))
&&
(
memcmp
(
intel_proc_dir
->
name
,
!
memcmp
(
intel_proc_dir
->
name
,
ADAPTERS_PROC_DIR
,
strlen
(
ADAPTERS_PROC_DIR
)))
ADAPTERS_PROC_DIR
,
strlen
(
ADAPTERS_PROC_DIR
))
==
0
))
break
;
break
;
}
}
...
@@ -223,8 +230,6 @@ e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
...
@@ -223,8 +230,6 @@ e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
if
(
!
proc_dir
)
if
(
!
proc_dir
)
remove_proc_entry
(
ADAPTERS_PROC_DIR
,
proc_net
);
remove_proc_entry
(
ADAPTERS_PROC_DIR
,
proc_net
);
return
;
}
}
...
@@ -240,7 +245,7 @@ e1000_proc_singles_create(struct proc_dir_entry *parent,
...
@@ -240,7 +245,7 @@ e1000_proc_singles_create(struct proc_dir_entry *parent,
elem
=
list_entry
(
curr
,
struct
proc_list
,
list
);
elem
=
list_entry
(
curr
,
struct
proc_list
,
list
);
if
(
strlen
(
elem
->
tag
)
==
0
)
if
(
!
strlen
(
elem
->
tag
)
)
continue
;
continue
;
if
(
!
(
proc_entry
=
if
(
!
(
proc_entry
=
...
@@ -255,8 +260,9 @@ e1000_proc_singles_create(struct proc_dir_entry *parent,
...
@@ -255,8 +260,9 @@ e1000_proc_singles_create(struct proc_dir_entry *parent,
return
1
;
return
1
;
}
}
static
int
__devinit
static
void
__devinit
e1000_proc_dirs_create
(
char
*
name
,
struct
list_head
*
proc_list_head
)
e1000_proc_dirs_create
(
void
*
data
,
char
*
name
,
struct
list_head
*
proc_list_head
)
{
{
struct
proc_dir_entry
*
intel_proc_dir
,
*
proc_dir
,
*
info_entry
;
struct
proc_dir_entry
*
intel_proc_dir
,
*
proc_dir
,
*
info_entry
;
char
info_name
[
strlen
(
name
)
+
strlen
(
".info"
)];
char
info_name
[
strlen
(
name
)
+
strlen
(
".info"
)];
...
@@ -264,8 +270,7 @@ e1000_proc_dirs_create(char *name, struct list_head *proc_list_head)
...
@@ -264,8 +270,7 @@ e1000_proc_dirs_create(char *name, struct list_head *proc_list_head)
for
(
intel_proc_dir
=
proc_net
->
subdir
;
intel_proc_dir
;
for
(
intel_proc_dir
=
proc_net
->
subdir
;
intel_proc_dir
;
intel_proc_dir
=
intel_proc_dir
->
next
)
{
intel_proc_dir
=
intel_proc_dir
->
next
)
{
if
((
intel_proc_dir
->
namelen
==
strlen
(
ADAPTERS_PROC_DIR
))
&&
if
((
intel_proc_dir
->
namelen
==
strlen
(
ADAPTERS_PROC_DIR
))
&&
(
memcmp
(
intel_proc_dir
->
name
,
!
memcmp
(
intel_proc_dir
->
name
,
ADAPTERS_PROC_DIR
,
strlen
(
ADAPTERS_PROC_DIR
)))
ADAPTERS_PROC_DIR
,
strlen
(
ADAPTERS_PROC_DIR
))
==
0
))
break
;
break
;
}
}
...
@@ -273,28 +278,26 @@ e1000_proc_dirs_create(char *name, struct list_head *proc_list_head)
...
@@ -273,28 +278,26 @@ e1000_proc_dirs_create(char *name, struct list_head *proc_list_head)
if
(
!
(
intel_proc_dir
=
if
(
!
(
intel_proc_dir
=
create_proc_entry
(
ADAPTERS_PROC_DIR
,
create_proc_entry
(
ADAPTERS_PROC_DIR
,
S_IFDIR
,
proc_net
)))
S_IFDIR
,
proc_net
)))
return
0
;
return
;
if
(
!
(
proc_dir
=
if
(
!
(
proc_dir
=
create_proc_entry
(
name
,
S_IFDIR
,
intel_proc_dir
)))
create_proc_entry
(
name
,
S_IFDIR
,
intel_proc_dir
)))
return
0
;
return
;
SET_MODULE_OWNER
(
proc_dir
);
SET_MODULE_OWNER
(
proc_dir
);
if
(
!
e1000_proc_singles_create
(
proc_dir
,
proc_list_head
))
if
(
!
e1000_proc_singles_create
(
proc_dir
,
proc_list_head
))
return
0
;
return
;
strcpy
(
info_name
,
name
);
strcpy
(
info_name
,
name
);
strcat
(
info_name
,
".info"
);
strcat
(
info_name
,
".info"
);
if
(
!
(
info_entry
=
if
(
!
(
info_entry
=
create_proc_entry
(
info_name
,
S_IFREG
,
intel_proc_dir
)))
create_proc_entry
(
info_name
,
S_IFREG
,
intel_proc_dir
)))
return
0
;
return
;
SET_MODULE_OWNER
(
info_entry
);
SET_MODULE_OWNER
(
info_entry
);
info_entry
->
read_proc
=
e1000_proc_info_read
;
info_entry
->
read_proc
=
e1000_proc_info_read
;
info_entry
->
data
=
proc_list_head
;
info_entry
->
data
=
proc_list_head
;
return
1
;
}
}
static
void
__devinit
static
void
__devinit
...
@@ -314,8 +317,6 @@ e1000_proc_list_add(struct list_head *proc_list_head, char *tag,
...
@@ -314,8 +317,6 @@ e1000_proc_list_add(struct list_head *proc_list_head, char *tag,
new
->
func
=
func
;
new
->
func
=
func
;
list_add_tail
(
&
new
->
list
,
proc_list_head
);
list_add_tail
(
&
new
->
list
,
proc_list_head
);
return
;
}
}
static
void
__devexit
static
void
__devexit
...
@@ -328,8 +329,6 @@ e1000_proc_list_free(struct list_head *proc_list_head)
...
@@ -328,8 +329,6 @@ e1000_proc_list_free(struct list_head *proc_list_head)
list_del
(
&
elem
->
list
);
list_del
(
&
elem
->
list
);
kfree
(
elem
);
kfree
(
elem
);
}
}
return
;
}
}
/*
/*
...
@@ -706,7 +705,6 @@ e1000_proc_list_setup(struct e1000_adapter *adapter)
...
@@ -706,7 +705,6 @@ e1000_proc_list_setup(struct e1000_adapter *adapter)
e1000_proc_rx_status
);
e1000_proc_rx_status
);
}
}
return
;
}
}
/*
/*
...
@@ -719,9 +717,9 @@ e1000_proc_dev_setup(struct e1000_adapter *adapter)
...
@@ -719,9 +717,9 @@ e1000_proc_dev_setup(struct e1000_adapter *adapter)
{
{
e1000_proc_list_setup
(
adapter
);
e1000_proc_list_setup
(
adapter
);
e1000_proc_dirs_create
(
adapter
->
netdev
->
name
,
&
adapter
->
proc_list_head
);
e1000_proc_dirs_create
(
adapter
,
adapter
->
netdev
->
name
,
return
;
&
adapter
->
proc_list_head
)
;
}
}
/*
/*
...
@@ -735,8 +733,6 @@ e1000_proc_dev_free(struct e1000_adapter *adapter)
...
@@ -735,8 +733,6 @@ e1000_proc_dev_free(struct e1000_adapter *adapter)
e1000_proc_dirs_free
(
adapter
->
netdev
->
name
,
&
adapter
->
proc_list_head
);
e1000_proc_dirs_free
(
adapter
->
netdev
->
name
,
&
adapter
->
proc_list_head
);
e1000_proc_list_free
(
&
adapter
->
proc_list_head
);
e1000_proc_list_free
(
&
adapter
->
proc_list_head
);
return
;
}
}
#else
/* CONFIG_PROC_FS */
#else
/* 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