Re: [PATCH 1/3] util/iov: add iov_discard_undo()

2020-09-16 Thread Li Qiang
Stefan Hajnoczi 于2020年9月16日周三 下午6:09写道: > > On Sun, Aug 16, 2020 at 04:26:45PM +0800, Li Qiang wrote: > > Stefan Hajnoczi 于2020年8月12日周三 下午6:52写道: > > Thanks for your review! > > > > +/* Discard more bytes than vector size */ > > > +iov_random(&iov, &iov_cnt); > > > +iov_orig = g_memdu

Re: [PATCH 1/3] util/iov: add iov_discard_undo()

2020-09-16 Thread Stefan Hajnoczi
On Sun, Aug 16, 2020 at 04:26:45PM +0800, Li Qiang wrote: > Stefan Hajnoczi 于2020年8月12日周三 下午6:52写道: Thanks for your review! > > +/* Discard more bytes than vector size */ > > +iov_random(&iov, &iov_cnt); > > +iov_orig = g_memdup(iov, sizeof(iov[0]) * iov_cnt); > > +iov_tmp = iov;

Re: [PATCH 1/3] util/iov: add iov_discard_undo()

2020-08-16 Thread Li Qiang
Stefan Hajnoczi 于2020年8月12日周三 下午6:52写道: > The iov_discard_front/back() operations are useful for parsing iovecs > but they modify the array elements. If the original array is needed > after parsing finishes there is currently no way to restore it. > > Although g_memdup() can be used before perfor

[PATCH 1/3] util/iov: add iov_discard_undo()

2020-08-12 Thread Stefan Hajnoczi
The iov_discard_front/back() operations are useful for parsing iovecs but they modify the array elements. If the original array is needed after parsing finishes there is currently no way to restore it. Although g_memdup() can be used before performing destructive iov_discard_front/back() operation