[CRIU] [PATCH 10/17] fsnotify: Add fanotify restore

Pavel Emelyanov xemul at parallels.com
Mon Dec 24 08:23:46 EST 2012


On 12/11/2012 01:34 AM, Cyrill Gorcunov wrote:
> 
> The idea is the same as for inotify -- just open
> notification descriptor and hook paths on.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  fsnotify.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 89 insertions(+), 2 deletions(-)
> 


> +static int open_fanotify_fd(struct fsnotify_file_info *info)
> +{
> +	unsigned int faflags = info->ife->faglob->faflags;
> +	struct fsnotify_wd_info *wd_info;
> +	int ret = -1;
> +
> +	if (info->ife->flags & O_CLOEXEC)
> +		faflags |= FAN_CLOEXEC;
> +	if (info->ife->flags & O_NONBLOCK)
> +		faflags |= FAN_NONBLOCK;
> +
> +	ret = sys_fanotify_init(faflags, info->ife->faglob->evflags);

faglob is optional, thus can be NULL.

> +	if (ret < 0) {
> +		errno = -ret;
> +		pr_perror("Can't init fanotify mark (%d)", ret);
> +		return -1;
> +	}
> +
> +	list_for_each_entry(wd_info, &info->marks, list) {
> +		pr_info("\tRestore fanotify for 0x%08x\n", wd_info->iwe->id);
> +		if (retstore_one_fanotify(ret, wd_info)) {
> +			close_safe(&ret);
> +			break;
> +		}
> +	}
> +
> +	return ret;
> +}



More information about the CRIU mailing list