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
6cf77f67
Commit
6cf77f67
authored
Sep 23, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remap: Rename fields for easier grep
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
7ca6cc1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
files-reg.c
files-reg.c
+24
-24
fsnotify.c
fsnotify.c
+3
-3
files-reg.h
include/files-reg.h
+2
-2
No files found.
files-reg.c
View file @
6cf77f67
...
...
@@ -71,7 +71,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, char *root,
int
gfd
,
ghost_flags
,
ret
=
-
1
;
char
path
[
PATH_MAX
];
snprintf
(
path
,
sizeof
(
path
),
"%s/%s"
,
root
,
gf
->
remap
.
path
);
snprintf
(
path
,
sizeof
(
path
),
"%s/%s"
,
root
,
gf
->
remap
.
r
path
);
if
(
S_ISFIFO
(
gfe
->
mode
))
{
if
(
mknod
(
path
,
gfe
->
mode
,
0
))
{
pr_perror
(
"Can't create node for ghost file"
);
...
...
@@ -150,9 +150,9 @@ static int open_remap_ghost(struct reg_file_info *rfi,
gf
=
shmalloc
(
sizeof
(
*
gf
));
if
(
!
gf
)
return
-
1
;
gf
->
remap
.
path
=
xmalloc
(
PATH_MAX
);
gf
->
remap
.
mnt_id
=
rfi
->
rfe
->
mnt_id
;
if
(
!
gf
->
remap
.
path
)
gf
->
remap
.
r
path
=
xmalloc
(
PATH_MAX
);
gf
->
remap
.
r
mnt_id
=
rfi
->
rfe
->
mnt_id
;
if
(
!
gf
->
remap
.
r
path
)
goto
err
;
img
=
open_image
(
CR_FD_GHOST_FILE
,
O_RSTR
,
rfe
->
remap_id
);
...
...
@@ -171,9 +171,9 @@ static int open_remap_ghost(struct reg_file_info *rfi,
gf
->
ino
=
gfe
->
ino
;
if
(
S_ISDIR
(
gfe
->
mode
))
strncpy
(
gf
->
remap
.
path
,
rfi
->
path
,
PATH_MAX
);
strncpy
(
gf
->
remap
.
r
path
,
rfi
->
path
,
PATH_MAX
);
else
snprintf
(
gf
->
remap
.
path
,
PATH_MAX
,
"%s.cr.%x.ghost"
,
rfi
->
path
,
rfe
->
remap_id
);
snprintf
(
gf
->
remap
.
r
path
,
PATH_MAX
,
"%s.cr.%x.ghost"
,
rfi
->
path
,
rfe
->
remap_id
);
if
(
create_ghost
(
gf
,
gfe
,
root
,
img
))
goto
close_ifd
;
...
...
@@ -195,7 +195,7 @@ close_ifd:
err:
if
(
gfe
)
ghost_file_entry__free_unpacked
(
gfe
,
NULL
);
xfree
(
gf
->
remap
.
path
);
xfree
(
gf
->
remap
.
r
path
);
shfree_last
(
gf
);
return
-
1
;
}
...
...
@@ -234,11 +234,11 @@ static int open_remap_linked(struct reg_file_info *rfi,
owner
=
st
.
st_uid
;
}
rm
->
path
=
rrfi
->
path
;
rm
->
r
path
=
rrfi
->
path
;
rm
->
users
=
0
;
rm
->
is_dir
=
false
;
rm
->
owner
=
owner
;
rm
->
mnt_id
=
rfi
->
rfe
->
mnt_id
;
rm
->
r
mnt_id
=
rfi
->
rfe
->
mnt_id
;
rfi
->
remap
=
rm
;
return
0
;
}
...
...
@@ -383,10 +383,10 @@ void remap_put(struct file_remap *remap)
if
(
--
remap
->
users
==
0
)
{
int
mntns_root
;
pr_info
(
"Unlink the ghost %s
\n
"
,
remap
->
path
);
pr_info
(
"Unlink the ghost %s
\n
"
,
remap
->
r
path
);
mntns_root
=
mntns_get_root_by_mnt_id
(
remap
->
mnt_id
);
unlinkat
(
mntns_root
,
remap
->
path
,
0
);
mntns_root
=
mntns_get_root_by_mnt_id
(
remap
->
r
mnt_id
);
unlinkat
(
mntns_root
,
remap
->
r
path
,
0
);
}
mutex_unlock
(
ghost_file_mutex
);
}
...
...
@@ -960,20 +960,20 @@ static int rfi_remap(struct reg_file_info *rfi)
/* Know nothing about mountpoints */
mntns_root
=
mntns_get_root_by_mnt_id
(
-
1
);
path
=
rfi
->
path
;
rpath
=
rfi
->
remap
->
path
;
rpath
=
rfi
->
remap
->
r
path
;
goto
out_root
;
}
mi
=
lookup_mnt_id
(
rfi
->
rfe
->
mnt_id
);
if
(
rfi
->
rfe
->
mnt_id
==
rfi
->
remap
->
mnt_id
)
{
if
(
rfi
->
rfe
->
mnt_id
==
rfi
->
remap
->
r
mnt_id
)
{
/* Both links on the same mount point */
tmi
=
mi
;
path
=
rfi
->
path
;
rpath
=
rfi
->
remap
->
path
;
rpath
=
rfi
->
remap
->
r
path
;
goto
out
;
}
rmi
=
lookup_mnt_id
(
rfi
->
remap
->
mnt_id
);
rmi
=
lookup_mnt_id
(
rfi
->
remap
->
r
mnt_id
);
/*
* Find the common bind-mount. We know that one mount point was
...
...
@@ -988,7 +988,7 @@ static int rfi_remap(struct reg_file_info *rfi)
/* Calcalate paths on the device (root mount) */
convert_path_from_another_mp
(
rfi
->
path
,
path
,
sizeof
(
_path
),
mi
,
tmi
);
convert_path_from_another_mp
(
rfi
->
remap
->
path
,
rpath
,
sizeof
(
_rpath
),
rmi
,
tmi
);
convert_path_from_another_mp
(
rfi
->
remap
->
r
path
,
rpath
,
sizeof
(
_rpath
),
rmi
,
tmi
);
out:
pr_debug
(
"%d: Link %s -> %s
\n
"
,
tmi
->
mnt_id
,
rpath
,
path
);
...
...
@@ -1017,13 +1017,13 @@ int open_path(struct file_desc *d,
* Will have to open it under the ghost one :(
*/
orig_path
=
rfi
->
path
;
rfi
->
path
=
rfi
->
remap
->
path
;
rfi
->
path
=
rfi
->
remap
->
r
path
;
}
else
if
(
rfi_remap
(
rfi
)
<
0
)
{
static
char
tmp_path
[
PATH_MAX
];
if
(
errno
!=
EEXIST
)
{
pr_err
(
"Can't link %s -> %s"
,
rfi
->
path
,
rfi
->
remap
->
path
);
rfi
->
remap
->
r
path
);
return
-
1
;
}
...
...
@@ -1040,7 +1040,7 @@ int open_path(struct file_desc *d,
orig_path
=
rfi
->
path
;
rfi
->
path
=
tmp_path
;
snprintf
(
tmp_path
,
sizeof
(
tmp_path
),
"%s.cr_link"
,
orig_path
);
pr_debug
(
"Fake %s -> %s link
\n
"
,
rfi
->
path
,
rfi
->
remap
->
path
);
pr_debug
(
"Fake %s -> %s link
\n
"
,
rfi
->
path
,
rfi
->
remap
->
r
path
);
if
(
rfi_remap
(
rfi
)
<
0
)
{
pr_perror
(
"Can't create even fake link!"
);
...
...
@@ -1086,9 +1086,9 @@ int open_path(struct file_desc *d,
BUG_ON
(
!
rfi
->
remap
->
users
);
if
(
--
rfi
->
remap
->
users
==
0
)
{
pr_info
(
"Unlink the ghost %s
\n
"
,
rfi
->
remap
->
path
);
mntns_root
=
mntns_get_root_by_mnt_id
(
rfi
->
remap
->
mnt_id
);
unlinkat
(
mntns_root
,
rfi
->
remap
->
path
,
rfi
->
remap
->
is_dir
?
AT_REMOVEDIR
:
0
);
pr_info
(
"Unlink the ghost %s
\n
"
,
rfi
->
remap
->
r
path
);
mntns_root
=
mntns_get_root_by_mnt_id
(
rfi
->
remap
->
r
mnt_id
);
unlinkat
(
mntns_root
,
rfi
->
remap
->
r
path
,
rfi
->
remap
->
is_dir
?
AT_REMOVEDIR
:
0
);
}
if
(
orig_path
)
...
...
@@ -1192,7 +1192,7 @@ static void remap_get(struct file_desc *fdesc, char typ)
rfi
=
container_of
(
fdesc
,
struct
reg_file_info
,
d
);
if
(
rfi
->
remap
)
{
pr_debug
(
"One more remap user (%c) for %s
\n
"
,
typ
,
rfi
->
remap
->
path
);
typ
,
rfi
->
remap
->
r
path
);
/* No lock, we're still sngle-process here */
rfi
->
remap
->
users
++
;
}
...
...
fsnotify.c
View file @
6cf77f67
...
...
@@ -419,11 +419,11 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
if
(
remap
)
{
int
mntns_root
;
mntns_root
=
mntns_get_root_by_mnt_id
(
remap
->
mnt_id
);
mntns_root
=
mntns_get_root_by_mnt_id
(
remap
->
r
mnt_id
);
pr_debug
(
"
\t\t
Restore %s watch for 0x%08x:0x%016lx (via %s)
\n
"
,
who
,
s_dev
,
i_ino
,
remap
->
path
);
*
target
=
openat
(
mntns_root
,
remap
->
path
,
O_PATH
);
who
,
s_dev
,
i_ino
,
remap
->
r
path
);
*
target
=
openat
(
mntns_root
,
remap
->
r
path
,
O_PATH
);
}
else
if
(
f_handle
->
path
)
{
int
mntns_root
;
...
...
include/files-reg.h
View file @
6cf77f67
...
...
@@ -12,9 +12,9 @@ struct cr_imgset;
struct
fd_parms
;
struct
file_remap
{
char
*
path
;
char
*
r
path
;
bool
is_dir
;
int
mnt_id
;
int
r
mnt_id
;
unsigned
int
users
;
uid_t
owner
;
};
...
...
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