[CRIU] Re: [PATCH 1/2] proc_parse: Add ability to not print error if entry is optional

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 12 03:46:18 EDT 2012


On Wed, Sep 12, 2012 at 10:59:47AM +0400, Pavel Emelyanov wrote:
> > @@ -714,7 +714,7 @@ static void parse_fhandle_encoded(char *tok, FhEntry *fh)
> >  
> >  #define fdinfo_field(str, field)	!strncmp(str, field":", sizeof(field))
> >  
> > -int parse_fdinfo(int fd, int type,
> > +int parse_fdinfo(int fd, int type, bool optional,
> >  		int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
> >  {
> >  	FILE *f;
> > @@ -825,8 +825,11 @@ int parse_fdinfo(int fd, int type,
> >  
> >  	fclose(f);
> >  	if (!entry_met) {
> > -		pr_err("No records of type %d found in fdinfo file\n", type);
> > -		goto parse_err;
> > +		if (!optional) {
> > +			pr_err("No records of type %d found in fdinfo file\n", type);
> > +			goto parse_err;
> > +		} else
> > +			return -2;
> >  	}
> >  
> >  	return 0;
> 
> No need in one more argument. The parse_fdinfo may decide that a line is
> optional itself (it does know about types already).

Wait, if !entry_met we're yielding error, while there is no error if
epoll created but no target assigned. You mean to drop thie error
message completely?

	Cyrill


More information about the CRIU mailing list