summaryrefslogtreecommitdiffstats
path: root/ocaml
Commit message (Collapse)AuthorAgeFilesLines
* ocaml: Combine tests together to reduce number of launches.Richard W.M. Jones2010-11-304-98/+31
| | | | | | Combine launch, lvcreate and readdir tests together into a single 'basic' test, so that we don't launch the appliance so often when testing in this subdirectory.
* 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
|
* ocaml: Translate C examples into OCaml and include documentation.Richard W.M. Jones2010-11-247-48/+286
|
* ocaml: Fix some unused parameter warnings in OCaml bindings.Richard W.M. Jones2010-11-232-1/+11
|
* build: xml-light is no longer required (thanks Maxim Koltsov).Richard W.M. Jones2010-11-112-15/+13
| | | | | | At some point we removed the last thing that required xml-light, but were still testing for it at various places in the build. This removes all traces.
* Revert "Remove ocaml/.depend from git."Richard Jones2010-11-081-0/+5
| | | | | | | | | This reverts commit 064569bcbf854a9cf588ce31851d987d5f114ec8. This commit does the wrong thing: creating an empty ocaml/.depend file is wrong because building the OCaml bindings will fail. Not having this file will prevent automake from running. Therefore this file has to exist with the correct content in git.
* ocaml: Remove the old OCaml viewer program.Richard W.M. Jones2010-11-087-752/+1
| | | | | | This program is obsolete and the code has been reused for guestfs-browser here: http://people.redhat.com/~rjones/guestfs-browser/
* Remove ocaml/.depend from git.Matthew Booth2010-10-281-5/+0
| | | | ocaml/.depend is automatically generated. This patch removes it from git.
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-223-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* ocaml: Create the handle when the object is instantiated.Richard W.M. Jones2010-10-041-1/+1
| | | | | Previously we had only one handle shared between all objects .. oops. This fixes commit 67636f721056d2f2250b0ff8acd981a0294536a9.
* ocaml: Add alternate object-oriented programming style.Richard W.M. Jones2010-10-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | In original style: let () = let filename = Sys.argv.(1) in let g = Guestfs.create () in Guestfs.add_drive_ro g filename; Guestfs.launch g; let roots = Guestfs.inspect_os g in print_endline (Guestfs.inspect_get_product_name g roots.(0)) The same code in the new OO style: let () = let filename = Sys.argv.(1) in let g = new Guestfs.guestfs in g#add_drive_ro filename; g#launch (); let roots = g#inspect_os () in print_endline (g#inspect_get_product_name roots.(0))
* Update OCaml dependencies.Richard Jones2010-09-101-3/+0
|
* ocaml: Add test for progress notification callbacks.Richard Jones2010-09-012-2/+49
|
* ocaml: bindings to progress callback.Richard Jones2010-09-011-2/+91
|
* Remove old ocaml-inspector code.Richard Jones2010-08-172-52/+3
| | | | | Not used by anyone, didn't work well, and replaced now by the C inspection APIs.
* ocaml: Fix thread safety of strings in bindings (RHBZ#604691).Richard Jones2010-06-164-11/+89
| | | | | | | | | | | | | | | | | | | | | | There's a thread safety issue with the current OCaml bindings which is well explained in the bug report: https://bugzilla.redhat.com/show_bug.cgi?id=604691 This commit fixes the safety issue by copying strings temporarily before releasing the thread lock. Updated code looks like this: char *filename = guestfs_safe_strdup (g, String_val (filenamev)); int r; caml_enter_blocking_section (); r = guestfs_add_drive_ro (g, filename); caml_leave_blocking_section (); free (filename); if (r == -1) ocaml_guestfs_raise_error (g, "add_drive_ro"); Also included is a regression test.
* ocaml examples: Fix linking line so it uses local library.Richard Jones2010-03-221-1/+1
|
* Remove separate inspector_generator.ml, combine this with generator.ml.Richard Jones2009-12-311-0/+2
| | | | | | | | | | | This commit combines the previously separate "inspector_generator.ml" program which generated bindings for virt-inspector. Having two separate programs caused no end of troubles for developers, so we now combine them into a single program. NOTE: OCaml xml-light is now *required* in order to rebuild the generated code.
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Generic partition creation interface.Richard Jones2009-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a generic partition creation interface which should be future-proof and extensible, and partially replaces the old sfdisk-based interface. The implementation is based on parted but is hopefully not too dependent on the particulars of parted. The following new calls are introduced: guestfs_part_init: Initialize a disk with a partition table. Unlike the sfdisk- based interface, we also support GPT and other partition types, which is essential to scale to devices larger than 2TB. guestfs_part_add: Add a partition to an existing disk. guestfs_part_disk: Convenience function which combines part_init & part_add, creating a single partition that covers the whole disk. guestfs_part_set_bootable: guestfs_part_set_name: Set various aspects of existing partitions. guestfs_part_list: List partitions on a device. This returns a programming-friendly list of partition structs (in contrast to sfdisk-l which cannot be parsed). guestfs_part_get_parttype: Return the partition table type, eg. "msdos" or "gpt". The following calls are planned, but not added currently: guestfs_part_get_bootable guestfs_part_get_name guestfs_part_set_type guestfs_part_get_type
* ocaml: Update dependencies file.Richard Jones2009-11-091-4/+4
|
* ocaml: Sort the dependencies so they are stable between machines.Richard W.M. Jones2009-11-062-4/+4
|
* ocaml: General improvements to generated code.Richard W.M. Jones2009-11-062-0/+13
|
* Tab to space fixes, now passes 'make syntax-check'Richard Jones2009-10-202-186/+186
|
* Add some missing EXTRA_DIST files.Richard Jones2009-10-141-1/+5
|
* inspector: Generate language bindings for OCaml.Richard Jones2009-10-134-14/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a generic mechanism for deriving language bindings for virt-inspector, and implements one concrete binding, for OCaml. The bindings are generated from the RELAX NG schema (virt-inspector.rng) which is supposed to be a correct and always up to date description of the XML that the virt-inspector program can generate. From the RNG we generate a set of types to describe the output of virt-inspector for the language, plus an XML parser, plus some glue code to actually run an external instance of virt-inspector and parse the resulting XML. At runtime, an external 'virt-inspector --xml <name>' command runs and the XML is parsed into language-specific structures. This has been tested on the four example files (inspector/example?.xml) The only particular difficulty about the OCaml binding is the use of Obj.magic, which is naughty but works because of the isomorphism between the representation of tuples and records in OCaml. This seems to cause no problems in my test program. Apart from this, the OCaml binding is straightforward and could be adapted easily for any other languages that want type-safe virt-inspector bindings. It's important to keep virt-inspector.rng up to date with changes to virt-inspector's XML output format.
* build: avoid parallel ocaml/... build failureJim Meyering2009-10-051-2/+0
| | | | | | | | A parallel build could fail due to the use in ocaml/examples of ocaml/guestfs.cmi before it was built. * Makefile.am (SUBDIRS): Add both ocaml and ocaml/examples, to ensure they're built in this order, and not in parallel. * ocaml/Makefile.am (SUBDIRS): Don't define.
* build: fix compile errorJim Meyering2009-10-021-3/+6
| | | | | | | | Link demo scripts with just-build library, not the installed one. * ocaml/examples/Makefile.am (OCAMLFINDFLAGS): New variable. (lvs, viewer): Use it. This fix is based on a suggestion from Rich Jones. This addresses RHBZ#526917.
* OCaml viewer: Use ocamlduce to replace xpath code.Richard Jones2009-09-305-48/+36
|
* OCaml viewer: Handle exceptions properly.Richard Jones2009-09-291-1/+8
|
* OCaml example: graphical disk usage viewer.Richard Jones2009-09-296-3/+766
| | | | | | | | | This is an example of how to write an app which uses libguestfs and libvirt, and has a responsive user interface (using threads). It is a Gtk-based "graphical virt-df". Read the top of the 'viewer.ml' file first for instructions on how to compile. This program is not compiled by default.
* Remove guestfs_wait_ready (turn it into a no-op).Richard Jones2009-09-214-4/+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.
* build: enable gcc warnings in capitests/ and ocaml/Jim Meyering2009-08-271-1/+2
| | | | | * capitests/Makefile.am: Use $(WARN_CFLAGS) and $(WERROR_CFLAGS). * ocaml/Makefile.am:: Likewise.
* ocaml/guestfs_c.c: avoid warning about missing prototypesJim Meyering2009-08-271-0/+4
| | | | * ocaml/guestfs_c.c (ocaml_guestfs_create, ocaml_guestfs_close): Declare.
* ocaml/guestfs_c.c: avoid warning about initialization discarding "const"Jim Meyering2009-08-271-1/+1
| | | | * ocaml/guestfs_c.c (guestfs_custom_operations): Add a cast.
* ocaml/guestfs_c.c avoid signed/unsigned-comparison warningJim Meyering2009-08-271-1/+1
| | | | | * ocaml/guestfs_c.c (ocaml_guestfs_strings_val): Declare index as unsigned int.
* build: remove trailing blank lines; enable the syntax-check ruleJim Meyering2009-08-041-1/+0
| | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Remove sc_prohibit_trailing_blank_lines. * appliance/Makefile.am: Remove trailing blank line(s). * appliance/debian/modules/y0_install-guestfsd: Likewise. * appliance/make.sh.in: Likewise. * appliance/packagelist.in: Likewise. * appliance/update.sh.in: Likewise. * haskell/run-bindtests: Likewise. * ocaml/run-bindtests: Likewise. * python/run-python-tests: Likewise. * recipes/squashfs.example: Likewise. * ruby/run-ruby-tests: Likewise.
* build: don't emit trailing blanks, remove generated fileJim Meyering2009-08-042-7/+8
| | | | | | * ocaml/Makefile.am (.depend): Don't redirect directly to $@. Filter out trailing blanks. * ocaml/.depend: Regenerate.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-4/+4
| | | | | | | | | | | 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 : $_'
* always include <config.h>Jim Meyering2009-08-031-0/+1
| | | | | | * ocaml/guestfs_c.c: Include <config.h>. * examples/to-xml.c: Likewise. * examples/hello.c: Likewise.
* build: add -I option to get config.h.Jim Meyering2009-08-031-2/+5
| | | | | * ocaml/Makefile.am (AM_CPPFLAGS): Define. (guestfs_c.o, guestfs_c_actions.o): Use it.
* ocaml: Rebuild the tests from source if the main library changes.Richard Jones2009-07-291-0/+5
|
* Fix non-srcdir builds: further fixes to OCaml build rules.Richard Jones2009-07-171-0/+1
|
* Fix non-srcdir builds: fix OCaml build rules.Richard Jones2009-07-161-5/+5
|
* Miscellaneous fixes for non-srcdir builds.Richard Jones2009-07-161-3/+3
|
* Version 1.0.56.1.0.56Richard W.M. Jones2009-07-071-0/+1
|
* Update ocaml/.depend.Richard Jones2009-07-071-1/+0
|
* Whitespace change in ocaml/.depend file.Richard Jones2009-07-061-5/+5
|
* Make it possible to build in a separate directoryMatthew Booth2009-07-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | 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.