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
e5f747a1
Commit
e5f747a1
authored
Sep 15, 2003
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4]: Convert /proc/net/pnp to seq_file.
parent
1fa12b3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
25 deletions
+28
-25
net/ipv4/ipconfig.c
net/ipv4/ipconfig.c
+28
-25
No files found.
net/ipv4/ipconfig.c
View file @
e5f747a1
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
#include <linux/route.h>
#include <linux/route.h>
#include <linux/udp.h>
#include <linux/udp.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/major.h>
#include <linux/major.h>
#include <linux/root_dev.h>
#include <linux/root_dev.h>
#include <net/arp.h>
#include <net/arp.h>
...
@@ -1092,43 +1093,45 @@ static int __init ic_dynamic(void)
...
@@ -1092,43 +1093,45 @@ static int __init ic_dynamic(void)
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
static
int
pnp_get_info
(
char
*
buffer
,
char
**
start
,
static
int
pnp_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
off_t
offset
,
int
length
)
{
{
int
len
;
int
i
;
int
i
;
if
(
ic_proto_used
&
IC_PROTO
)
if
(
ic_proto_used
&
IC_PROTO
)
sprintf
(
buffer
,
"#PROTO: %s
\n
"
,
seq_printf
(
seq
,
"#PROTO: %s
\n
"
,
(
ic_proto_used
&
IC_RARP
)
?
"RARP"
(
ic_proto_used
&
IC_RARP
)
?
"RARP"
:
(
ic_proto_used
&
IC_USE_DHCP
)
?
"DHCP"
:
"BOOTP"
);
:
(
ic_proto_used
&
IC_USE_DHCP
)
?
"DHCP"
:
"BOOTP"
);
else
else
strcpy
(
buffer
,
"#MANUAL
\n
"
);
seq_puts
(
seq
,
"#MANUAL
\n
"
);
len
=
strlen
(
buffer
);
if
(
ic_domain
[
0
])
if
(
ic_domain
[
0
])
len
+=
sprintf
(
buffer
+
len
,
seq_printf
(
seq
,
"domain %s
\n
"
,
ic_domain
);
"domain %s
\n
"
,
ic_domain
);
for
(
i
=
0
;
i
<
CONF_NAMESERVERS_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
CONF_NAMESERVERS_MAX
;
i
++
)
{
if
(
ic_nameservers
[
i
]
!=
INADDR_NONE
)
if
(
ic_nameservers
[
i
]
!=
INADDR_NONE
)
len
+=
sprintf
(
buffer
+
len
,
seq_printf
(
seq
,
"nameserver %u.%u.%u.%u
\n
"
,
"nameserver %u.%u.%u.%u
\n
"
,
NIPQUAD
(
ic_nameservers
[
i
]));
NIPQUAD
(
ic_nameservers
[
i
]));
}
}
if
(
ic_servaddr
!=
INADDR_NONE
)
if
(
ic_servaddr
!=
INADDR_NONE
)
len
+=
sprintf
(
buffer
+
len
,
seq_printf
(
seq
,
"bootserver %u.%u.%u.%u
\n
"
,
"bootserver %u.%u.%u.%u
\n
"
,
NIPQUAD
(
ic_servaddr
));
NIPQUAD
(
ic_servaddr
));
return
0
;
}
if
(
offset
>
len
)
static
int
pnp_seq_open
(
struct
inode
*
indoe
,
struct
file
*
file
)
offset
=
len
;
{
*
start
=
buffer
+
offset
;
return
single_open
(
file
,
pnp_seq_show
,
NULL
);
if
(
offset
+
length
>
len
)
length
=
len
-
offset
;
return
length
;
}
}
static
struct
file_operations
pnp_seq_fops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
pnp_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
/*
/*
...
@@ -1140,7 +1143,7 @@ static int __init ip_auto_config(void)
...
@@ -1140,7 +1143,7 @@ static int __init ip_auto_config(void)
unsigned
long
jiff
;
unsigned
long
jiff
;
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
proc_net_
create
(
"pnp"
,
0
,
pnp_get_info
);
proc_net_
fops_create
(
"pnp"
,
S_IRUGO
,
&
pnp_seq_fops
);
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
if
(
!
ic_enable
)
if
(
!
ic_enable
)
...
...
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