mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 00:05:26 +00:00
proc_parse: parse mnt_id from /proc/PID/fdinfo/FD
It will be used for restoring files from proper mounts. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
8bcffef6b9
commit
bed13a58ec
2
files.c
2
files.c
@@ -205,7 +205,7 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
struct fdinfo_common fdinfo;
|
struct fdinfo_common fdinfo = { .mnt_id = -1 };
|
||||||
|
|
||||||
if (fstat(lfd, &p->stat) < 0) {
|
if (fstat(lfd, &p->stat) < 0) {
|
||||||
pr_perror("Can't stat fd %d", lfd);
|
pr_perror("Can't stat fd %d", lfd);
|
||||||
|
@@ -156,6 +156,7 @@ union fdinfo_entries {
|
|||||||
struct fdinfo_common {
|
struct fdinfo_common {
|
||||||
off64_t pos;
|
off64_t pos;
|
||||||
int flags;
|
int flags;
|
||||||
|
int mnt_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int parse_fdinfo(int fd, int type,
|
extern int parse_fdinfo(int fd, int type,
|
||||||
|
@@ -1021,7 +1021,8 @@ static int parse_fdinfo_pid_s(char *pid, int fd, int type,
|
|||||||
union fdinfo_entries entry;
|
union fdinfo_entries entry;
|
||||||
|
|
||||||
if (fdinfo_field(str, "pos") ||
|
if (fdinfo_field(str, "pos") ||
|
||||||
fdinfo_field(str, "flags")) {
|
fdinfo_field(str, "flags") ||
|
||||||
|
fdinfo_field(str, "mnt_id")) {
|
||||||
unsigned long long val;
|
unsigned long long val;
|
||||||
struct fdinfo_common *fdinfo = arg;
|
struct fdinfo_common *fdinfo = arg;
|
||||||
|
|
||||||
@@ -1035,6 +1036,8 @@ static int parse_fdinfo_pid_s(char *pid, int fd, int type,
|
|||||||
fdinfo->pos = val;
|
fdinfo->pos = val;
|
||||||
else if (fdinfo_field(str, "flags"))
|
else if (fdinfo_field(str, "flags"))
|
||||||
fdinfo->flags = val;
|
fdinfo->flags = val;
|
||||||
|
else if (fdinfo_field(str, "mnt_id"))
|
||||||
|
fdinfo->mnt_id = val;
|
||||||
|
|
||||||
entry_met = true;
|
entry_met = true;
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user