Commit 7eb20e7d authored by Pavel Emelyanov's avatar Pavel Emelyanov

fsnotify: Move decoding handle into function

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7bb5ba1f
...@@ -175,6 +175,18 @@ const struct fdtype_ops fanotify_dump_ops = { ...@@ -175,6 +175,18 @@ const struct fdtype_ops fanotify_dump_ops = {
.dump = dump_one_fanotify, .dump = dump_one_fanotify,
}; };
static void decode_handle(fh_t *handle, FhEntry *img)
{
memzero(handle, sizeof(*handle));
handle->type = img->type;
handle->bytes = img->bytes;
memcpy(handle->__handle, img->handle,
min(pb_repeated_size(img, handle),
sizeof(handle->__handle)));
}
static char *get_mark_path(const char *who, struct file_remap *remap, static char *get_mark_path(const char *who, struct file_remap *remap,
FhEntry *f_handle, unsigned long i_ino, FhEntry *f_handle, unsigned long i_ino,
unsigned int s_dev, char *buf, size_t size, unsigned int s_dev, char *buf, size_t size,
...@@ -190,14 +202,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap, ...@@ -190,14 +202,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
return remap->path; return remap->path;
} }
memzero(&handle, sizeof(handle)); decode_handle(&handle, f_handle);
handle.type = f_handle->type;
handle.bytes = f_handle->bytes;
memcpy(handle.__handle, f_handle->handle,
min(pb_repeated_size(f_handle, handle),
sizeof(handle.__handle)));
mntfd = open_mount(s_dev); mntfd = open_mount(s_dev);
if (mntfd < 0) { if (mntfd < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment