[CRIU] [PATCH 2/4] mount: decode paths from mountinfo

Andrew Vagin avagin at gmail.com
Fri Jul 17 07:33:11 PDT 2015


On Fri, Jul 17, 2015 at 04:16:06PM +0300, Pavel Emelyanov wrote:
> On 07/17/2015 01:49 PM, Andrey Vagin wrote:
> > mountinfo contains mangled paths. space, tab and back slash were
> > replaced with usual octal escape, so we need to replace these charecter
> > back.
> > 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  proc_parse.c | 36 ++++++++++++++++++++++++++++++++++++
> >  1 file changed, 36 insertions(+)
> > 
> > diff --git a/proc_parse.c b/proc_parse.c
> > index fc2e371..0fa2afe 100644
> > --- a/proc_parse.c
> > +++ b/proc_parse.c
> > @@ -988,6 +988,37 @@ static int parse_mnt_opt(char *str, struct mount_info *mi, int *off)
> >  	return 0;
> >  }
> >  
> > +/*
> > + * mountinfo contains mangled paths. space, tab and back slash were replaced
> > + * with usual octal escape. This function replaces these symbols back.
> > + */
> > +void cure_path(char *path) { int i, len, off = 0;
> 
> static
> 
> > +
> > +	if (strchr(path, '\\') == NULL) /* fast path */
> > +		return;
> 
> What's so fast in it? It scans through the whole string anyway.

strchr can use extended instructions (e.g. sse), so it should work much
faster that for (...)

> 


More information about the CRIU mailing list