[CRIU] Re: [PATCH 13/14] inotify: Add checkpoint/restore

Pavel Emelyanov xemul at parallels.com
Thu May 3 08:58:58 EDT 2012


On 04/29/2012 05:14 PM, Cyrill Gorcunov wrote:
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  Makefile          |    1 +
>  cr-dump.c         |   13 ++
>  cr-restore.c      |    8 ++
>  cr-show.c         |   44 +++++++
>  crtools.c         |   14 ++
>  include/crtools.h |    6 +
>  include/image.h   |   18 +++
>  include/inotify.h |   16 +++
>  include/mount.h   |    2 +
>  include/types.h   |    7 +
>  inotify.c         |  345 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  mount.c           |   25 ++++
>  12 files changed, 499 insertions(+), 0 deletions(-)
>  create mode 100644 include/inotify.h
>  create mode 100644 inotify.c
> 

> +static char nybble(const char n)
> +{
> +       if      (n >= '0' && n <= '9') return n - '0';
> +       else if (n >= 'A' && n <= 'F') return n - ('A' - 10);
> +       else if (n >= 'a' && n <= 'f') return n - ('a' - 10);
> +       return 0;
> +}
> +
> +static void parse_fhandle_encoded(char *tok, fh_t *f)
> +{
> +	char *d = (char *)f->__handle;
> +	int i = 0;
> +
> +	memzero(d, sizeof(f->__handle));
> +
> +	while (*tok == ' ')
> +		tok++;
> +
> +	while (*tok) {
> +		if (i >= sizeof(f->__handle))
> +			break;
> +		d[i++] = (nybble(tok[0]) << 4) | nybble(tok[1]);
> +		if (tok[1])
> +			tok += 2;
> +		else
> +			break;
> +	}
> +}
> +

Is strtol not enough for that? Why?

> +int open_mount(unsigned int s_dev)
> +{
> +	return open_mnt_root(s_dev, mntinfo, nr_mntinfo);
> +}
> +

Please, clean this out -- merge the open_mnt_root's code into the open_mount
and just use the static mntinfo/nr_mntinfo-s in it.

Thanks,
Pavel


More information about the CRIU mailing list