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
ff24870f
Commit
ff24870f
authored
Nov 01, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netns: switch ->get()/->put()/->install()/->inum() to working with &net->ns
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
58be2825
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
net/core/net_namespace.c
net/core/net_namespace.c
+10
-6
No files found.
net/core/net_namespace.c
View file @
ff24870f
...
...
@@ -347,7 +347,7 @@ struct net *get_net_ns_by_fd(int fd)
ei
=
get_proc_ns
(
file_inode
(
file
));
if
(
ei
->
ns_ops
==
&
netns_operations
)
net
=
get_net
(
ei
->
ns
);
net
=
get_net
(
container_of
(
ei
->
ns
,
struct
net
,
ns
)
);
else
net
=
ERR_PTR
(
-
EINVAL
);
...
...
@@ -640,17 +640,22 @@ static void *netns_get(struct task_struct *task)
net
=
get_net
(
nsproxy
->
net_ns
);
task_unlock
(
task
);
return
net
;
return
net
?
&
net
->
ns
:
NULL
;
}
static
inline
struct
net
*
to_net_ns
(
struct
ns_common
*
ns
)
{
return
container_of
(
ns
,
struct
net
,
ns
);
}
static
void
netns_put
(
void
*
ns
)
{
put_net
(
ns
);
put_net
(
to_net_ns
(
ns
)
);
}
static
int
netns_install
(
struct
nsproxy
*
nsproxy
,
void
*
ns
)
{
struct
net
*
net
=
ns
;
struct
net
*
net
=
to_net_ns
(
ns
)
;
if
(
!
ns_capable
(
net
->
user_ns
,
CAP_SYS_ADMIN
)
||
!
ns_capable
(
current_user_ns
(),
CAP_SYS_ADMIN
))
...
...
@@ -663,8 +668,7 @@ static int netns_install(struct nsproxy *nsproxy, void *ns)
static
unsigned
int
netns_inum
(
void
*
ns
)
{
struct
net
*
net
=
ns
;
return
net
->
ns
.
inum
;
return
((
struct
ns_common
*
)
ns
)
->
inum
;
}
const
struct
proc_ns_operations
netns_operations
=
{
...
...
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