mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 15:55:53 +00:00
proc-parse: Add parsing of fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
05bb44960f
commit
d5927a47f1
@@ -9,6 +9,12 @@
|
|||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "crtools.h"
|
#include "crtools.h"
|
||||||
|
|
||||||
|
struct fsnotify_params {
|
||||||
|
u32 id;
|
||||||
|
u32 faflags;
|
||||||
|
u32 evflags;
|
||||||
|
};
|
||||||
|
|
||||||
extern int is_inotify_link(int lfd);
|
extern int is_inotify_link(int lfd);
|
||||||
extern int is_fanotify_link(int lfd);
|
extern int is_fanotify_link(int lfd);
|
||||||
extern int dump_inotify(struct fd_parms *p, int lfd, const int fdinfo);
|
extern int dump_inotify(struct fd_parms *p, int lfd, const int fdinfo);
|
||||||
|
@@ -134,6 +134,7 @@ union fdinfo_entries {
|
|||||||
EventpollTfdEntry epl;
|
EventpollTfdEntry epl;
|
||||||
SignalfdEntry sfd;
|
SignalfdEntry sfd;
|
||||||
InotifyWdEntry ify;
|
InotifyWdEntry ify;
|
||||||
|
FanotifyMarkEntry ffy;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int parse_fdinfo(int fd, int type,
|
extern int parse_fdinfo(int fd, int type,
|
||||||
|
75
proc_parse.c
75
proc_parse.c
@@ -15,6 +15,7 @@
|
|||||||
#include "crtools.h"
|
#include "crtools.h"
|
||||||
#include "mount.h"
|
#include "mount.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "fsnotify.h"
|
||||||
|
|
||||||
#include "proc_parse.h"
|
#include "proc_parse.h"
|
||||||
#include "protobuf.h"
|
#include "protobuf.h"
|
||||||
@@ -922,6 +923,80 @@ int parse_fdinfo(int fd, int type,
|
|||||||
entry_met = true;
|
entry_met = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (fdinfo_field(str, "fanotify flags")) {
|
||||||
|
struct fsnotify_params *p = arg;
|
||||||
|
|
||||||
|
if (type != FD_TYPES__FANOTIFY)
|
||||||
|
goto parse_err;
|
||||||
|
|
||||||
|
ret = sscanf(str, "fanotify flags:%x event-flags:%x",
|
||||||
|
&p->faflags, &p->evflags);
|
||||||
|
if (ret != 2)
|
||||||
|
goto parse_err;
|
||||||
|
entry_met = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (fdinfo_field(str, "fanotify ino")) {
|
||||||
|
FhEntry f_handle = FH_ENTRY__INIT;
|
||||||
|
int hoff;
|
||||||
|
|
||||||
|
if (type != FD_TYPES__FANOTIFY)
|
||||||
|
goto parse_err;
|
||||||
|
|
||||||
|
fanotify_mark_entry__init(&entry.ffy);
|
||||||
|
entry.ffy.f_handle = &f_handle;
|
||||||
|
|
||||||
|
ret = sscanf(str,
|
||||||
|
"fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x "
|
||||||
|
"fhandle-bytes:%x fhandle-type:%x f_handle: %n",
|
||||||
|
&entry.ffy.i_ino, &entry.ffy.s_dev,
|
||||||
|
&entry.ffy.mflags, &entry.ffy.mask, &entry.ffy.ignored_mask,
|
||||||
|
&entry.ffy.f_handle->bytes, &entry.ffy.f_handle->type,
|
||||||
|
&hoff);
|
||||||
|
if (ret != 7)
|
||||||
|
goto parse_err;
|
||||||
|
|
||||||
|
f_handle.n_handle = FH_ENTRY_SIZES__min_entries;
|
||||||
|
f_handle.handle = xmalloc(pb_repeated_size(&f_handle, handle));
|
||||||
|
if (!f_handle.handle)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
parse_fhandle_encoded(str + hoff, entry.ffy.f_handle);
|
||||||
|
|
||||||
|
entry.ffy.has_mnt_id = false;
|
||||||
|
entry.ffy.type = MARK_TYPE__INODE;
|
||||||
|
ret = cb(&entry, arg);
|
||||||
|
|
||||||
|
xfree(f_handle.handle);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
entry_met = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (fdinfo_field(str, "fanotify mnt_id")) {
|
||||||
|
if (type != FD_TYPES__FANOTIFY)
|
||||||
|
goto parse_err;
|
||||||
|
|
||||||
|
fanotify_mark_entry__init(&entry.ffy);
|
||||||
|
|
||||||
|
ret = sscanf(str,
|
||||||
|
"fanotify mnt_id:%x mflags:%x mask:%x ignored_mask:%x",
|
||||||
|
&entry.ffy.mnt_id, &entry.ffy.mflags,
|
||||||
|
&entry.ffy.mask, &entry.ffy.ignored_mask);
|
||||||
|
if (ret != 4)
|
||||||
|
goto parse_err;
|
||||||
|
|
||||||
|
entry.ffy.has_mnt_id = true;
|
||||||
|
entry.ffy.type = MARK_TYPE__MOUNT;
|
||||||
|
ret = cb(&entry, arg);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
entry_met = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (fdinfo_field(str, "inotify wd")) {
|
if (fdinfo_field(str, "inotify wd")) {
|
||||||
FhEntry f_handle = FH_ENTRY__INIT;
|
FhEntry f_handle = FH_ENTRY__INIT;
|
||||||
int hoff;
|
int hoff;
|
||||||
|
Reference in New Issue
Block a user