Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
ba983f98
Commit
ba983f98
authored
Nov 07, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ns: Factor out nsid listing code
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
f33908a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
namespaces.c
namespaces.c
+13
-14
No files found.
namespaces.c
View file @
ba983f98
...
...
@@ -120,19 +120,25 @@ struct ns_id *ns_ids = NULL;
static
unsigned
int
ns_next_id
=
1
;
unsigned
long
root_ns_mask
=
0
;
static
void
nsid_add
(
struct
ns_id
*
ns
,
struct
ns_desc
*
nd
,
unsigned
int
id
,
pid_t
pid
)
{
ns
->
nd
=
nd
;
ns
->
id
=
id
;
ns
->
pid
=
pid
;
ns
->
next
=
ns_ids
;
ns_ids
=
ns
;
pr_info
(
"Add %s ns %d pid %d
\n
"
,
nd
->
str
,
ns
->
id
,
ns
->
pid
);
}
struct
ns_id
*
rst_new_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
)
{
struct
ns_id
*
nsid
;
nsid
=
shmalloc
(
sizeof
(
*
nsid
));
if
(
nsid
)
{
nsid
->
nd
=
nd
;
nsid
->
id
=
id
;
nsid
->
pid
=
pid
;
nsid_add
(
nsid
,
nd
,
id
,
pid
);
futex_set
(
&
nsid
->
ns_created
,
0
);
nsid
->
next
=
ns_ids
;
ns_ids
=
nsid
;
}
return
nsid
;
...
...
@@ -154,7 +160,6 @@ int rst_add_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
if
(
nsid
==
NULL
)
return
-
1
;
pr_info
(
"Add namespace %d pid %d
\n
"
,
nsid
->
id
,
nsid
->
pid
);
return
0
;
}
...
...
@@ -245,14 +250,8 @@ static unsigned int generate_ns_id(int pid, unsigned int kid, struct ns_desc *nd
if
(
!
nsid
)
return
0
;
nsid
->
id
=
ns_next_id
++
;
nsid
->
kid
=
kid
;
nsid
->
nd
=
nd
;
nsid
->
next
=
ns_ids
;
nsid
->
pid
=
pid
;
ns_ids
=
nsid
;
pr_info
(
"Collected %u.%s namespace
\n
"
,
nsid
->
id
,
nd
->
str
);
nsid_add
(
nsid
,
nd
,
ns_next_id
++
,
pid
);
found:
if
(
ns_ret
)
...
...
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