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
nexedi
linux
Commits
6e934547
Commit
6e934547
authored
Jun 02, 2004
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] Introduce and use several common stuff for snmp item list.
parent
7dff71fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
+25
-18
include/net/snmp.h
include/net/snmp.h
+15
-1
net/ipv6/proc.c
net/ipv6/proc.c
+10
-17
No files found.
include/net/snmp.h
View file @
6e934547
...
...
@@ -41,7 +41,21 @@
* cacheline machine it makes a *lot* of sense -AK
*/
struct
snmp_item
{
char
*
name
;
int
offset
;
};
#define SNMP_ITEM(mib,entry,procname) { \
.name = procname, \
.offset = offsetof(mib, entry), \
}
#define SNMP_ITEM_SENTINEL { \
.name = NULL, \
.offset = 0, \
}
/*
* RFC 1213: MIB-II
* RFC 2011 (updates 1213): SNMPv2-MIB-IP
...
...
net/ipv6/proc.c
View file @
6e934547
...
...
@@ -57,16 +57,9 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
return
0
;
}
struct
snmp6_item
{
char
*
name
;
int
offset
;
};
#define SNMP6_SENTINEL { .name = NULL, .offset = 0 }
static
struct
snmp6_item
snmp6_ipv6_list
[]
=
{
static
struct
snmp_item
snmp6_ipv6_list
[]
=
{
/* ipv6 mib according to RFC 2465 */
#define SNMP6_GEN(x)
{ .name = #x , .offset = offsetof(struct ipv6_mib, x) }
#define SNMP6_GEN(x)
SNMP_ITEM(struct ipv6_mib, x, "Ip6" #x)
SNMP6_GEN
(
Ip6InReceives
),
SNMP6_GEN
(
Ip6InHdrErrors
),
SNMP6_GEN
(
Ip6InTooBigErrors
),
...
...
@@ -90,10 +83,10 @@ static struct snmp6_item snmp6_ipv6_list[] = {
SNMP6_GEN
(
Ip6InMcastPkts
),
SNMP6_GEN
(
Ip6OutMcastPkts
),
#undef SNMP6_GEN
SNMP
6
_SENTINEL
SNMP
_ITEM
_SENTINEL
};
static
struct
snmp
6
_item
snmp6_icmp6_list
[]
=
{
static
struct
snmp_item
snmp6_icmp6_list
[]
=
{
/* icmpv6 mib according to RFC 2466
Exceptions: {In|Out}AdminProhibs are removed, because I see
...
...
@@ -104,7 +97,7 @@ static struct snmp6_item snmp6_icmp6_list[] = {
OutRouterAdvertisements too.
OutGroupMembQueries too.
*/
#define SNMP6_GEN(x)
{ .name = #x , .offset = offsetof(struct icmpv6_mib, x) }
#define SNMP6_GEN(x)
SNMP_ITEM(struct icmpv6_mib, x, #x)
SNMP6_GEN
(
Icmp6InMsgs
),
SNMP6_GEN
(
Icmp6InErrors
),
SNMP6_GEN
(
Icmp6InDestUnreachs
),
...
...
@@ -134,17 +127,17 @@ static struct snmp6_item snmp6_icmp6_list[] = {
SNMP6_GEN
(
Icmp6OutGroupMembResponses
),
SNMP6_GEN
(
Icmp6OutGroupMembReductions
),
#undef SNMP6_GEN
SNMP
6
_SENTINEL
SNMP
_ITEM
_SENTINEL
};
static
struct
snmp
6
_item
snmp6_udp6_list
[]
=
{
#define SNMP6_GEN(x)
{ .name = "Udp6" #x , .offset = offsetof(struct udp_mib, Udp##x) }
static
struct
snmp_item
snmp6_udp6_list
[]
=
{
#define SNMP6_GEN(x)
SNMP_ITEM(struct udp_mib, Udp##x, "Udp6" #x)
SNMP6_GEN
(
InDatagrams
),
SNMP6_GEN
(
NoPorts
),
SNMP6_GEN
(
InErrors
),
SNMP6_GEN
(
OutDatagrams
),
#undef SNMP6_GEN
SNMP
6
_SENTINEL
SNMP
_ITEM
_SENTINEL
};
static
unsigned
long
...
...
@@ -167,7 +160,7 @@ fold_field(void *mib[], int offt)
}
static
inline
void
snmp6_seq_show_item
(
struct
seq_file
*
seq
,
void
**
mib
,
struct
snmp
6
_item
*
itemlist
)
snmp6_seq_show_item
(
struct
seq_file
*
seq
,
void
**
mib
,
struct
snmp_item
*
itemlist
)
{
int
i
;
for
(
i
=
0
;
itemlist
[
i
].
name
;
i
++
)
...
...
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