summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* example: Copying a directory between two guests using threads.Richard W.M. Jones2012-03-092-0/+308
|
* Check return values of guestfs_inspect_get_{type,distro} (found by Coverity).Richard W.M. Jones2012-03-081-0/+4
| | | | | | | | | Error: NULL_RETURNS: /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:129: var_assigned: Assigning: "guest_distro" = null return value from "guestfs_inspect_get_distro". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:131: dereference: Dereferencing a pointer that might be null "guest_distro" when calling "__coverity_strcmp". [...] /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:126: var_assigned: Assigning: "guest_type" = null return value from "guestfs_inspect_get_type". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:128: dereference: Dereferencing a pointer that might be null "guest_type" when calling "__coverity_strcmp".
* Add 'display_icon' example program.Richard W.M. Jones2012-03-072-1/+140
| | | | | Running this on a disk image displays the guest icon (using external 'display' program).
* examples: code cleanupsWanlong Gao2012-01-312-2/+2
| | | | | | do a code cleanup by removing the tailing spaces Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* Tempus fugit.Richard W.M. Jones2012-01-182-2/+2
| | | | Update all copyright dates to 2012.
* df, testing: Add notes on virt-df numbers (thanks Kashyap Chamarthy).Richard W.M. Jones2011-11-221-1/+23
|
* guestfs-testing: Link to libguestfs-test-tool.Richard W.M. Jones2011-11-211-0/+5
|
* Add guestfs-testing(1) man page.Richard W.M. Jones2011-11-202-4/+309
| | | | This contains suggested manual tests that users can run.
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* Add Erlang bindings.Richard W.M. Jones2011-09-212-0/+2
|
* out-of-tree build: remove unneeded explicit pathsHilko Bengen2011-08-171-2/+2
|
* recipes: Remove two C file dependencies which are not actually used in the POD.Richard W.M. Jones2011-08-151-1/+1
|
* out-of-tree build: fix documentation generationHilko Bengen2011-08-151-6/+6
|
* java: Add guestfs-java(3) man page.Richard W.M. Jones2011-07-192-0/+2
|
* recipes: in tr command \000 should be \0Richard W.M. Jones2011-06-031-1/+1
|
* Add new guestfs-rescue(1) man page with recipes.Richard W.M. Jones2011-05-183-4/+440
|
* guestfs-examples(3): Remove link to OCaml homepage.Richard W.M. Jones2011-05-181-2/+1
|
* Enable deprecation warnings on all C programs.Richard W.M. Jones2011-05-171-0/+3
|
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-051-23/+8
| | | | | | | | | | | | | | This returns the actual registry key corresponding to CurrentControlSet (eg. it might be "ControlSet001"). Previously the inspection code was hard-coding ControlSet001. Now we use the correct control set, and also make it available to callers through the API. This commit also updates the virt-dhcp-address example so it uses this new API. virt-inspector displays the current control set when available.
* examples: Add virt-dhcp-address program.Richard W.M. Jones2011-03-312-0/+354
| | | | | | This is like the mythical 'virt-ifconfig'. There is not enough certainty around the right way to be doing this for us to make a full virt tool for this. Therefore the code is just an example.
* examples: Use WARN_CFLAGS, WERROR_CFLAGS macros instead of -WallRichard W.M. Jones2011-03-311-5/+11
|
* examples: size_t-correctness change in inspect_vm.cRichard W.M. Jones2011-03-311-2/+2
|
* perl: Translate C examples into Perl and include a manual page.Richard W.M. Jones2011-01-301-0/+1
|
* fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).Richard W.M. Jones2011-01-111-2/+4
| | | | | | | | | | | | | | | | | Fix guestfish (and other C tools) so that they ignore errors when /etc/fstab contains bogus entries. Update the documentation for inspect-get-mountpoints to emphasize that callers must be aware of this when mounting the returned values. Add a regression test. Update the example code ("inspect_vm") to reflect the way this API ought to be called. For more detail see: https://bugzilla.redhat.com/show_bug.cgi?id=668574
* ruby: Translate C examples into Ruby and include documentation.Richard W.M. Jones2010-11-241-0/+1
|
* python: Translate C examples into Python and include documentation.Richard W.M. Jones2010-11-241-0/+1
|
* docs: Standard C examples, and guestfs-examples(3) man page.Richard W.M. Jones2010-11-248-276/+361
|
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-222-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This large commit changes the generator so that optional arguments can be supported for functions. The model for arguments (known as the "style") is changed from (ret, args) to (ret, args, optargs) where optargs is a more limited list of arguments. One function has been added which takes optional arguments, it is "add-drive-opts", modelled as: (RErr, [String "filename"], #required [Bool "readonly"; String "format"; String "iface"]) #optional Note that this function is processed in the library (does not go over the RPC protocol to the daemon). This has allowed us to simplify the current implementation by omitting changes related to RPC or the daemon, although we plan to add these at some point in the future. From C this function can be called in 3 different ways as in these examples: guestfs_add_drive_opts (g, filename, GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", -1); (the argument(s) between 'filename' and '-1' are the optional ones). guestfs_add_drive_opts_va (g, filename, args); where 'args' is a va_list. This works like the first version. struct guestfs_add_drive_opts_argv optargs = { .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK, .readonly = 1, } guestfs_add_drive_opts_argv (g, filename, &optargs); This last form lets you construct lists of optional arguments, and is used by guestfish and the language bindings. In guestfish optional arguments are used like this: add-drive-opts filename readonly:true In OCaml these are mapped naturally to OCaml optional arguments, eg: g#add_drive_opts ~readonly:true filename; In Perl these are mapped to extra arguments, eg: $g->add_drive_opts ($filename, readonly => 1); In Python these are mapped to optional arguments, eg: g.add_drive_opts ("file", readonly = 1, format = "qcow2") In Ruby these are mapped to a final hash argument, eg: g.add_drive_opts("file", {}) g.add_drive_opts("file", :readonly => 1) g.add_drive_opts("file", :readonly => 1, :iface => "virtio") In PHP these are mapped to extra parameters. This is not quite accurate since you cannot omit arbitrary optional parameters, but there's not much than can be done within the limitations of PHP as a language. Unimplemented in: Haskell, C#, Java.
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-202-9/+9
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds an explicit dependency on generator.ml for every file it generates, except java files. Java is left for another time because it's considerably trickier. It also adds a build rule for src/libguestfs.la so it can be rebuilt as required from other directories. It does this by creating a top level make file, subdir-rules.mk, which can be included from sub-directories. sub-directories need to define 'generator_built' to include local files which are built by generator.ml, and they will be updated automatically. This fixes parallel make, and will automatically re-create generated files when make is run from any directory. It also fixes the problem which efad4f53 was targetting. Specifically, src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and therefore generator.ml, despite not being directly created by it. This caused them to be recreated every time generator.ml ran rather than only when src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore appliance update. This patch also changes the contents of the distribution tarball by including files created by rpcgen.
* examples: Don't use STREQ etc in the to-xml.c example.Richard Jones2009-11-101-8/+8
|
* use STREQ, not strcmp: part 1Jim Meyering2009-11-091-3/+3
| | | | | git grep -l 'strcmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
* change strncmp() == 0 to STREQLEN()Jim Meyering2009-11-091-4/+4
| | | | | git grep -l 'strncmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *== *0\b/STREQLEN$1/g'
* change strncmp(...) != 0 to STRNEQLEN(...)Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *!= *0/STRNEQLEN$1/g'
* examples/to-xml.c: Don't depend on Gnulib function.Richard Jones2009-11-021-2/+2
| | | | | Since this program is just an example, it shouldn't require the Gnulib c-ctype functions.
* avoid use of all ctype macrosJim Meyering2009-09-242-3/+5
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
* Remove guestfs_wait_ready (turn it into a no-op).Richard Jones2009-09-212-2/+0
| | | | | | | | | | | | | | This commit changes guestfs_launch so that it both launches the appliance and waits until it is ready (ie. the daemon communicates back to us). Since we removed the pretence that we could implement a low-level asynchronous API, the need to call launch() followed by wait_ready() has looked a bit silly. Now guestfs_wait_ready() is basically a no-op. It is left in the API for backwards compatibility. Any calls to guestfs_wait_ready() can be removed from client code.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-8/+8
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Guard #inclusion of config.h in examples.Jim Meyering2009-08-032-2/+6
| | | | | * examples/hello.c [HAVE_CONFIG_H]: Include <config.h> conditionally. * examples/to-xml.c: Likewise.
* always include <config.h>Jim Meyering2009-08-032-0/+2
| | | | | | * ocaml/guestfs_c.c: Include <config.h>. * examples/to-xml.c: Likewise. * examples/hello.c: Likewise.
* Make it possible to build in a separate directoryMatthew Booth2009-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | This patch allows you to do: mkdir build cd build ../configure ... make This will output all generated files to the build directory. Given that autogen automatically runs configure, you can also do: BUILDDIR=./build ./autogen.sh which will do the right thing. Also: * Fix a dependency bug which means that guestfs_protocol.h isn't automatically rebuilt. * Re-running autogen.sh with no arguments won't blow away your previous configure arguments.
* Move the appliance and build scripts into new appliance/ subdirectory.Richard W.M. Jones2009-05-281-1/+1
|
* build: don't tell "make clean" to remove my '~' backup filesJim Meyering2009-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi Rich, automake's policy on what to remove via "make clean" is reasonable: if running build rules creates it, then "make clean" can and should remove it. However, even if build rules happen to create backup files, please remove only the specific ones they can create, not all of the ones in a directory. Just in case someone relies on those and expect them to hang around... >From 1e8be391ac17b4ddcf9671e8413d2660844e6993 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 30 Apr 2009 15:47:52 +0200 Subject: [PATCH] build: don't tell "make clean" to remove my '~' backup files * Makefile.am (CLEANFILES): Don't remove '~' backup files. * daemon/Makefile.am: Ditto. * examples/Makefile.am: Ditto. * fish/Makefile.am: Ditto. * images/Makefile.am: Ditto. * inspector/Makefile.am: Ditto. * java/Makefile.am: Ditto. * ocaml/Makefile.am: Ditto. * ocaml/examples/Makefile.am: Ditto. * perl/Makefile.am: Ditto. * python/Makefile.am: Ditto. * ruby/Makefile.am: Ditto. * src/Makefile.am: Ditto.
* Add support for ext4 to examples/to-xml.cRichard Jones2009-04-241-5/+7
|
* Fix infinite loop encountered when reading Windows disk in example program.Richard Jones2009-04-221-7/+11
|
* Show byte sizes in example.Richard Jones2009-04-151-3/+11
|
* Display ext2/3 details, and some bug fixes.Richard Jones2009-04-151-4/+34
|
* Added to-xml program.Richard Jones2009-04-153-2/+171
|
* Remove 'df' program from examples - didn't ever work.Richard Jones2009-04-152-35/+2
|
* Remove *~ files when doing 'make clean'.Richard Jones2009-04-091-0/+2
|