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
dd11a50c
Commit
dd11a50c
authored
Sep 20, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ext: Add more helpers to mess with external resources.
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
8ce76653
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
external.c
criu/external.c
+19
-0
external.h
criu/include/external.h
+15
-0
No files found.
criu/external.c
View file @
dd11a50c
...
@@ -40,3 +40,22 @@ char *external_lookup_by_key(char *key)
...
@@ -40,3 +40,22 @@ char *external_lookup_by_key(char *key)
return
NULL
;
return
NULL
;
}
}
int
external_for_each_type
(
char
*
type
,
int
(
*
cb
)(
struct
external
*
,
void
*
),
void
*
arg
)
{
struct
external
*
ext
;
int
ln
=
strlen
(
type
);
int
ret
=
0
;
list_for_each_entry
(
ext
,
&
opts
.
external
,
node
)
{
if
(
strncmp
(
ext
->
id
,
type
,
ln
))
continue
;
if
(
ext
->
id
[
ln
]
!=
'['
)
continue
;
ret
=
cb
(
ext
,
arg
);
if
(
ret
)
break
;
}
return
ret
;
}
criu/include/external.h
View file @
dd11a50c
...
@@ -8,4 +8,19 @@ struct external {
...
@@ -8,4 +8,19 @@ struct external {
extern
int
add_external
(
char
*
key
);
extern
int
add_external
(
char
*
key
);
extern
bool
external_lookup_id
(
char
*
id
);
extern
bool
external_lookup_id
(
char
*
id
);
extern
char
*
external_lookup_by_key
(
char
*
id
);
extern
char
*
external_lookup_by_key
(
char
*
id
);
extern
int
external_for_each_type
(
char
*
type
,
int
(
*
cb
)(
struct
external
*
,
void
*
),
void
*
arg
);
static
inline
char
*
external_val
(
struct
external
*
e
)
{
char
*
aux
;
aux
=
strchr
(
e
->
id
,
'['
);
if
(
aux
)
{
aux
=
strchr
(
aux
+
1
,
']'
);
if
(
aux
&&
aux
[
1
]
==
':'
)
return
aux
+
2
;
}
return
NULL
;
}
#endif
#endif
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