[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PREVIEW ONLY] Refactor data transfer code



On 22/09/10 09:50, Richard W.M. Jones wrote:
On Wed, Sep 22, 2010 at 09:36:41AM +0100, Matthew Booth wrote:
On 21/09/10 20:12, Richard W.M. Jones wrote:

This patch is not using hread/hwrite?

No. That will be required for changing formats, but not for a straight copy.

Anyway I'd be interested in whether you can do all you wanted from
hread/hwrite/hseek/etc using the proposed upload-offset API that I
posted here:

http://www.redhat.com/archives/libguestfs/2010-September/msg00026.html
http://www.redhat.com/archives/libguestfs/2010-September/msg00027.html

No, because the API requires passing in a file, which I don't have.

This is not true.  You can write from anything that you can get into a
file descriptor, by specifying "/dev/fd/NN" as the filename.

However the API does require that the source of the data comes from a
separate thread or process, which is not how virt-v2v works at the
moment.

I suspect you need to just use pwrite.  AFAICT it already does
everything you need.

Except read and write from a block device, although that could be fixed with new APIs.

Also, as I said before, I think the handle-based API is a good alternative for large data-transfer. I don't think your hexedit experience was a good example. For example, I would expect using hread to be less code than using pread for reading the contents of a file into memory in chunks.

Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]