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
10a155f2
Commit
10a155f2
authored
Dec 03, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Dec 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] netlink cleanup
switched to explicit devfs_register()/devfs_remove()
parent
2093dc7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
net/netlink/netlink_dev.c
net/netlink/netlink_dev.c
+28
-17
No files found.
net/netlink/netlink_dev.c
View file @
10a155f2
...
...
@@ -170,11 +170,21 @@ static struct file_operations netlink_fops = {
.
release
=
netlink_release
,
};
static
devfs_handle_t
devfs_handle
;
static
struct
{
char
*
name
;
int
minor
;
}
entries
[]
=
{
{
"route"
,
0
},
{
"skip"
,
1
},
{
"usersock"
,
2
},
{
"fwmonitor"
,
3
},
{
"tcpdiag"
,
4
},
{
"arpd"
,
8
},
{
"route6"
,
11
},
{
"ip6_fw"
,
13
},
{
"dnrtmsg"
,
13
},
}
static
void
__init
make_devfs_entries
(
const
char
*
name
,
int
minor
)
{
devfs_register
(
devfs_handle
,
name
,
DEVFS_FL_DEFAULT
,
devfs_register
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
NETLINK_MAJOR
,
minor
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
,
&
netlink_fops
,
NULL
);
...
...
@@ -186,21 +196,18 @@ int __init init_netlink(void)
printk
(
KERN_ERR
"netlink: unable to get major %d
\n
"
,
NETLINK_MAJOR
);
return
-
EIO
;
}
devfs_
handle
=
devfs_
mk_dir
(
NULL
,
"netlink"
,
NULL
);
devfs_mk_dir
(
NULL
,
"netlink"
,
NULL
);
/* Someone tell me the official names for the uppercase ones */
make_devfs_entries
(
"route"
,
0
);
make_devfs_entries
(
"skip"
,
1
);
make_devfs_entries
(
"usersock"
,
2
);
make_devfs_entries
(
"fwmonitor"
,
3
);
make_devfs_entries
(
"tcpdiag"
,
4
);
make_devfs_entries
(
"arpd"
,
8
);
make_devfs_entries
(
"route6"
,
11
);
make_devfs_entries
(
"ip6_fw"
,
13
);
make_devfs_entries
(
"dnrtmsg"
,
13
);
devfs_register_series
(
devfs_handle
,
"tap%u"
,
16
,
DEVFS_FL_DEFAULT
,
NETLINK_MAJOR
,
16
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
,
&
netlink_fops
,
NULL
);
for
(
i
=
0
;
i
<
sizeof
(
entries
)
/
sizeof
(
entries
[
0
]);
i
++
)
{
char
name
[
20
];
sprintf
(
name
,
"netlink/%s"
,
entries
[
i
].
name
);
make_devfs_entries
(
name
,
entries
[
i
].
minor
);
}
for
(
i
=
0
;
i
<
16
;
i
++
)
{
char
name
[
20
];
sprintf
(
name
,
"netlink/tap%d"
,
i
);
make_devfs_entries
(
name
,
i
+
16
);
}
return
0
;
}
...
...
@@ -216,7 +223,11 @@ int init_module(void)
void
cleanup_module
(
void
)
{
devfs_unregister
(
devfs_handle
);
for
(
i
=
0
;
i
<
sizeof
(
entries
)
/
sizeof
(
entries
[
0
]);
i
++
)
devfs_remove
(
"netlink/%s"
,
entries
[
i
].
name
);
for
(
i
=
0
;
i
<
16
;
i
++
)
devfs_remove
(
"netlink/tap%d"
,
i
);
devfs_remove
(
"netlink"
);
unregister_chrdev
(
NETLINK_MAJOR
,
"netlink"
);
}
...
...
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