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

Pavel Emelyanov xemul at parallels.com
Wed Sep 12 02:59:47 EDT 2012


> @@ -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).


More information about the CRIU mailing list