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

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



On Wed, Sep 22, 2010 at 09:59:20AM +0100, Matthew Booth wrote:
> Except read and write from a block device, although that could be
> fixed with new APIs.

Um yes indeed.  pwrite-device, pread-device.

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

A filename can be used as a handle, except it is a handle that doesn't
need to be opened or closed, so the code simply has to be shorter.
But anyhow if you post the actual code involved then I can try out
both APIs.

The issue with hexedit was managing the handles, specifically making
sure they are closed along all paths.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw


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