[Libguestfs] [PATCH 0/2] Implement upload-offset, download-offset APIs, and hexedit guestfish command

Richard W.M. Jones rjones at redhat.com
Mon Sep 20 17:35:11 UTC 2010


This two-part patch implements the 'hexedit' command described here:

http://rwmj.wordpress.com/2010/09/18/new-feature-guestfish-hexedit/#content

The first part implements two new APIs for partial writing and reading
of files.  These are modelled after guestfs_upload and
guestfs_download but allow you to specify an offset and (for download
only) a size:

int guestfs_download_offset (guestfs_h *g,
  const char *remotefilename, const char *filename,
  int64_t offset, int64_t size);
int guestfs_upload_offset (guestfs_h *g,
  const char *filename, const char *remotefilename,
  int64_t offset);

Since these calls use the streaming FileIn/FileOut part of the
protocol, they are both efficient and unlimited in the amount and type
of data that can be streamed.

http://libguestfs.org/guestfs.3.html#functions_that_have_filein_parameters

I also wrote the hexedit command using the putative hread/hwrite API
and the code was much longer and more involved.  Although there is an
advantage to hread/hwrite which is you can read and write to and from
memory.

The second part of the patch implements the hexedit command itself in
guestfish.

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




More information about the Libguestfs mailing list