2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

mount: save relative path in mi->mountpoint

"relative path" is absolute path with dot at the beginning.

We already use relative paths on restore. In this patch we add "."
on dump too. It's convinient, because we needed to add dot each time
when we want to access this mount point.
Before this patch we had to created a temporary copy.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2014-04-16 14:48:00 +04:00
committed by Pavel Emelyanov
parent 946eadd598
commit 8df879941d
3 changed files with 28 additions and 17 deletions

View File

@@ -857,13 +857,22 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new)
char *opt;
char *fstype;
ret = sscanf(str, "%i %i %u:%u %ms %ms %ms %n",
&new->mnt_id, &new->parent_mnt_id,
&kmaj, &kmin, &new->root, &new->mountpoint,
&opt, &n);
if (ret != 7)
new->mountpoint = xmalloc(PATH_MAX);
if (new->mountpoint == NULL)
return -1;
new->mountpoint[0] = '.';
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
&new->mnt_id, &new->parent_mnt_id,
&kmaj, &kmin, &new->root, new->mountpoint + 1,
&opt, &n);
if (ret != 7) {
xfree(new->mountpoint);
return -1;
}
new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1);
new->s_dev = MKKDEV(kmaj, kmin);
new->flags = 0;
if (parse_mnt_flags(opt, &new->flags))