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
f2240db0
Commit
f2240db0
authored
Sep 20, 2003
by
Amir Noam
Committed by
Stephen Hemminger
Sep 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] [bonding 2.6] Consolidate /proc code, add CHANGENAME handler
parent
5f3360af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
22 deletions
+60
-22
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_main.c
+59
-22
drivers/net/bonding/bonding.h
drivers/net/bonding/bonding.h
+1
-0
No files found.
drivers/net/bonding/bond_main.c
View file @
f2240db0
...
@@ -3492,6 +3492,45 @@ static int bond_read_proc(char *buf, char **start, off_t off, int count, int *eo
...
@@ -3492,6 +3492,45 @@ static int bond_read_proc(char *buf, char **start, off_t off, int count, int *eo
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
static
int
bond_create_proc_info
(
struct
bonding
*
bond
)
{
#ifdef CONFIG_PROC_FS
struct
net_device
*
dev
=
bond
->
device
;
bond
->
bond_proc_dir
=
proc_mkdir
(
dev
->
name
,
proc_net
);
if
(
bond
->
bond_proc_dir
==
NULL
)
{
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/
\n
"
,
dev
->
name
,
dev
->
name
);
return
-
ENOMEM
;
}
bond
->
bond_proc_dir
->
owner
=
THIS_MODULE
;
bond
->
bond_proc_info_file
=
create_proc_read_entry
(
"info"
,
0
,
bond
->
bond_proc_dir
,
bond_read_proc
,
bond
);
if
(
bond
->
bond_proc_info_file
==
NULL
)
{
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/info
\n
"
,
dev
->
name
,
dev
->
name
);
remove_proc_entry
(
dev
->
name
,
proc_net
);
return
-
ENOMEM
;
}
bond
->
bond_proc_info_file
->
owner
=
THIS_MODULE
;
memcpy
(
bond
->
procdir_name
,
dev
->
name
,
IFNAMSIZ
);
#endif
/* CONFIG_PROC_FS */
return
0
;
}
static
void
bond_destroy_proc_info
(
struct
bonding
*
bond
)
{
#ifdef CONFIG_PROC_FS
remove_proc_entry
(
"info"
,
bond
->
bond_proc_dir
);
remove_proc_entry
(
bond
->
procdir_name
,
proc_net
);
memset
(
bond
->
procdir_name
,
0
,
IFNAMSIZ
);
bond
->
bond_proc_dir
=
NULL
;
#endif
/* CONFIG_PROC_FS */
}
/*
/*
* Change HW address
* Change HW address
*
*
...
@@ -3640,10 +3679,7 @@ static void bond_deinit(struct net_device *dev)
...
@@ -3640,10 +3679,7 @@ static void bond_deinit(struct net_device *dev)
list_del
(
&
bond
->
bond_list
);
list_del
(
&
bond
->
bond_list
);
#ifdef CONFIG_PROC_FS
bond_destroy_proc_info
(
bond
);
remove_proc_entry
(
"info"
,
bond
->
bond_proc_dir
);
remove_proc_entry
(
dev
->
name
,
proc_net
);
#endif
}
}
static
void
bond_free_all
(
void
)
static
void
bond_free_all
(
void
)
...
@@ -3659,10 +3695,15 @@ static void bond_free_all(void)
...
@@ -3659,10 +3695,15 @@ static void bond_free_all(void)
}
}
}
}
/*
* Does not allocate but creates a /proc entry.
* Allowed to fail.
*/
static
int
__init
bond_init
(
struct
net_device
*
dev
)
static
int
__init
bond_init
(
struct
net_device
*
dev
)
{
{
struct
bonding
*
bond
;
struct
bonding
*
bond
;
int
count
;
int
count
;
int
err
=
0
;
#ifdef BONDING_DEBUG
#ifdef BONDING_DEBUG
printk
(
KERN_INFO
"Begin bond_init for %s
\n
"
,
dev
->
name
);
printk
(
KERN_INFO
"Begin bond_init for %s
\n
"
,
dev
->
name
);
...
@@ -3741,30 +3782,26 @@ static int __init bond_init(struct net_device *dev)
...
@@ -3741,30 +3782,26 @@ static int __init bond_init(struct net_device *dev)
printk
(
"out ARP monitoring
\n
"
);
printk
(
"out ARP monitoring
\n
"
);
}
}
#ifdef CONFIG_PROC_FS
err
=
bond_create_proc_info
(
bond
);
bond
->
bond_proc_dir
=
proc_mkdir
(
dev
->
name
,
proc_net
);
if
(
err
)
{
if
(
bond
->
bond_proc_dir
==
NULL
)
{
printk
(
KERN_ERR
"%s: Failed to create proc entry
\n
"
,
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/
\n
"
,
dev
->
name
);
dev
->
name
,
dev
->
name
);
return
err
;
return
-
ENOMEM
;
}
}
bond
->
bond_proc_dir
->
owner
=
THIS_MODULE
;
bond
->
bond_proc_info_file
=
/* Future:
create_proc_read_entry
(
"info"
,
0
,
bond
->
bond_proc_dir
,
* If anything fails beyond this point
bond_read_proc
,
bond
);
* make sure to destroy the proc entry
if
(
bond
->
bond_proc_info_file
==
NULL
)
{
*/
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/info
\n
"
,
dev
->
name
,
dev
->
name
);
remove_proc_entry
(
dev
->
name
,
proc_net
);
return
-
ENOMEM
;
}
bond
->
bond_proc_info_file
->
owner
=
THIS_MODULE
;
#endif
/* CONFIG_PROC_FS */
list_add_tail
(
&
bond
->
bond_list
,
&
bond_dev_list
);
list_add_tail
(
&
bond
->
bond_list
,
&
bond_dev_list
);
return
0
;
return
0
;
/*
err_out:
bond_destroy_proc_info(bond);
return err;
*/
}
}
/*
/*
...
...
drivers/net/bonding/bonding.h
View file @
f2240db0
...
@@ -103,6 +103,7 @@ typedef struct bonding {
...
@@ -103,6 +103,7 @@ typedef struct bonding {
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
struct
proc_dir_entry
*
bond_proc_dir
;
struct
proc_dir_entry
*
bond_proc_dir
;
struct
proc_dir_entry
*
bond_proc_info_file
;
struct
proc_dir_entry
*
bond_proc_info_file
;
char
procdir_name
[
IFNAMSIZ
];
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
struct
list_head
bond_list
;
struct
list_head
bond_list
;
struct
net_device
*
device
;
struct
net_device
*
device
;
...
...
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