[CRIU] Re: [PATCH 3/4] protbuf: Add Protocol Buffers (PB) helpers v2

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 6 11:55:01 EDT 2012


On Fri, Jul 06, 2012 at 07:49:38PM +0400, Pavel Emelyanov wrote:
> > +int pb_read_object_with_header(int fd, void **pobj, pb_unpack_t *unpack, bool eof)
> > +{
> > +	void *buf = NULL;
> > +	int ret = -1;
> > +	u32 size;
> > +
> > +	ret = read_img_eof(fd, &size);
> 
> This all is great, but I'd insist you stop using the read/write_img helpers since
> ally they were required for was to factor out eof/errors handling and error message
> report between callers. With pb_read/write helpers we can push the pr_err right
> here and use plain read/write.
> 
> At the very end all the read/write_img should be removed.
> 

ok'll update

> Just a TODO: have a static/onstack variable of e.g. 512 bytes and put the
> image bits _there_ if they fit. This should improve the performance a bit.

sure, my 16K on stack before was serving same purpose, but I wanted to make
code working first, then do optimization. i'll update.

	Cyrill


More information about the CRIU mailing list