[PATCH 1/3] Add guestfs_find0 API call which doesn't have limits
The current guestfs_find API call contains an undocumented limit: It needs to marshall the whole list of filenames into a single protocol message. Unfortunately just about any Linux guest breaks this limit if you try 'guestfs_find ("/")' so this isn't much use. These patches add a new API call (find0) which breaks this limit by using a FileOut parameter. It's slightly harder to use than guestfs_find, but better suited to program cases (guestfs_find remains, of course). We also update virt-ls to use this in the 'virt-ls -R' case. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
-- 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
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Mon, Oct 19, 2009 at 06:24:02PM +0100, Richard W.M. Jones wrote:
+/* The code below assumes each path returned can fit into a protocol + * chunk. If this turns out not to be true at some point in the + * future then we'll need to modify the code a bit to handle it, or + * make the chunk size a bit bigger. + */
Actually the comment is wrong: we CAN'T change the chunk size because it's baked into the protocol which we can't change. Instead we'd have to change the code to split the path over two or more chunks.
+ sysrootdir = sysroot_path (dir);
Grrrr ... the code misses a free (sysrootdir) along the non-error path. Garbage collection FTW. Rest looks OK, but when reviewing please imagine that the above two bugs are fixed. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Updated patch with the memory leak and comment fixed. 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
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Missed out the diffstat: daemon/find.c | 99 +++++++++++++++++++++++++++++++++++++++++++++ regressions/Makefile.am | 1 + regressions/test-find0.sh | 39 ++++++++++++++++++ src/MAX_PROC_NR | 2 +- src/generator.ml | 39 +++++++++++++++++- tools/virt-ls | 24 +++++----- 6 files changed, 189 insertions(+), 15 deletions(-) -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
participants (1)
-
Richard W.M. Jones