summaryrefslogtreecommitdiffstats
path: root/generator
Commit message (Collapse)AuthorAgeFilesLines
* inspection: Implement "openbsd" type and distro.Richard W.M. Jones2012-11-291-0/+8
|
* lua: fix build error due to LUA_GLOBALSINDEX usageOlaf Hering2012-11-231-1/+1
| | | | | | | lua 5.2 changed API, LUA_GLOBALSINDEX is no longer available. http://www.lua.org/manual/5.2/manual.html#8.3 Signed-off-by: Olaf Hering <olaf@aepfle.de>
* New APIs: Implement Linux filesystem capabilities.Richard W.M. Jones2012-11-221-0/+28
| | | | | | This adds the following new APIs: - cap_get_file - cap_set_file
* New APIs: Implement POSIX ACLs.Richard W.M. Jones2012-11-221-0/+82
| | | | | | | This adds the following new APIs: - acl_get_file - acl_set_file - acl_delete_def_file
* lua: Replace internal lua_guestfs_* functions with guestfs_lua_*.Richard W.M. Jones2012-11-201-19/+19
| | | | | This is just code motion. It just ensures there is no possible conflict with lua_* symbols.
* lua: Attach __tostring functions exceptions.Richard W.M. Jones2012-11-201-0/+29
| | | | This includes a test.
* lua: Fix whitespace.Richard W.M. Jones2012-11-201-2/+0
|
* lua: Various fixes to the bindings (thanks Jerome Vuarand).Richard W.M. Jones2012-11-202-13/+39
| | | | | | | | | | | | See http://article.gmane.org/gmane.comp.lang.lua.general/95065 Note that this is incompatible with existing code. You have to do: local G = require "guestfs" local g = G.create () ie. give the module your own name ("G" in that example).
* lua: Print the error thrown by callbacks.Richard W.M. Jones2012-11-201-2/+18
|
* lua: Add comment (not fix) for incorrect 'g' argument in callbacks.Richard W.M. Jones2012-11-201-1/+4
| | | | Thanks Jerome Vuarand.
* lua: Add bindtests.Richard W.M. Jones2012-11-202-0/+57
|
* lua: Use lua_rawgeti to read elements from lists of strings.Richard W.M. Jones2012-11-201-2/+1
| | | | | | This is faster, but more importantly it avoids the strange error 'lua: attempt to index a string value' which appears with (some) single element lists.
* lua: Add LuaStyle of commenting to the generator.Richard W.M. Jones2012-11-201-2/+4
|
* lua: Allow regular int to be passed as a 64 bit integer.Richard W.M. Jones2012-11-201-4/+13
|
* lua: Simplify get_event function.Richard W.M. Jones2012-11-201-21/+12
| | | | Use luaL_checkoption which is designed for this purpose.
* lua: Add global Guestfs.event_all (list of all events).Richard W.M. Jones2012-11-191-0/+15
|
* lua: Various fixes and enhancements:Richard W.M. Jones2012-11-191-27/+299
| | | | | | | | | - add support for events (with test) - test progress messages - update documentation to describe events - refactor handle closing code - refactor error code - use 'assert' in test code instead of 'if ... then error end'
* lua: Don't use %m since Lua string formatter doesn't understand it.Richard W.M. Jones2012-11-181-2/+5
| | | | Use %s + strerror as a replacement.
* lua: Add some missing features.Richard W.M. Jones2012-11-171-7/+33
| | | | | | | | - Remove default error handler. - User cancel. - Add the errno to the object which is thrown on error. Still no events.
* Add Lua bindings.Richard W.M. Jones2012-11-173-0/+564
| | | | | | | | These are relatively complete, although only lightly tested. Missing: - events - last_errno - user_cancel
* tests: Remove double-test for availability.Richard W.M. Jones2012-11-092-16/+29
| | | | | | | | | | If you have a function which is in the X optgroup, and also has IfAvailable X, then two tests for the optgroup are added to the output. Check for this case and give an error. This also fixes existing APIs.
* tests: More efficient use of strings in the object code.Richard W.M. Jones2012-11-091-37/+32
| | | | No functional change.
* tests: Use guestfs_{push,pop}_error_handler.Richard W.M. Jones2012-11-091-13/+7
| | | | | | Replace the custom error handler with calls to guestfs_{push,pop}_error_handler only where necessary. This simplifies the generated code.
* tests: Cleanup code that prints each test name.Richard W.M. Jones2012-11-091-12/+18
| | | | This is just code motion.
* tests: Change code for printing warnings about untested functions.Richard W.M. Jones2012-11-091-3/+12
| | | | Just code cleanup, no functional change.
* tests: Remove dead code in generated output.Richard W.M. Jones2012-11-091-10/+0
|
* tests: Format the generated code properly.Richard W.M. Jones2012-11-091-6/+12
| | | | This is just whitespace changes in the output.
* lib: Add new C API calls: guestfs_push_error_handler,Richard W.M. Jones2012-11-091-0/+6
| | | | | | | | | | | | | | | | | guestfs_pop_error_handler. The addition of these calls makes it much simpler to temporarily disable or ignore errors: guestfs_push_error_handler (g, NULL, NULL); guestfs_mkdir (g, "/foo"); /* We don't care if this fails. */ guestfs_pop_error_handler (g); Note these calls are used by the C API only. They are not necessary in other languages, because those map errors to exceptions. The subsequent commits change existing code to use push/pop instead of laboriously saving and restoring the error handler.
* header: Define LIBGUESTFS_HAVE_CREATE_FLAGS=1.Richard W.M. Jones2012-11-091-0/+1
| | | | This fixes commit 9466060201600db47016133d80af22eb38091a49.
* lib: Rework temporary and cache directory code.Richard W.M. Jones2012-11-092-2/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir. The current code has evolved over time and has a number of problems: (a) A single environment variable ($TMPDIR) controls the location of several directories. (b) It's hard for the library user to predict which directory libguestfs will use, unless the user simulates the same internal steps that libguestfs performs. This commit fixes these issues. (a) Now three environment variables control the location of all small temporary files, and the appliance cache: For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp. For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp. The user can also set these directories explicitly through API calls (guestfs_set_tmpdir and guestfs_set_cachedir). (b) The user can also retrieve the actual directories that libguestfs will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir. These functions are also used internally. This commit also: - reworks the internal tmpdir code - removes the internal (undocumented) guestfs_tmpdir call (replacing it with calls to the documented guestfs_get_tmpdir API instead) - changes the ./run script to set LIBGUESTFS_TMPDIR and LIBGUESTFS_CACHEDIR - adds a test - fixes a few places like libguestfs-make-fixed-appliance which depended on $TMPDIR
* tests: wipefs: Don't try to wipe mounted filesystem.Richard W.M. Jones2012-11-031-1/+2
| | | | | | | Previously wipefs (the utility) allowed this, but it's obviously a bad thing to do and the new wipefs gives an error if you try it: wipefs: error: /dev/VG/LV: probing initialization failed: Device or resource busy
* generator: Split up huge src/actions.c into separate files.Richard W.M. Jones2012-11-022-4/+20
| | | | | | | | Split the functions according to a simple hash across C.nr_actions_files files (this number can be increased later if necessary). This is just code motion.
* generator: actions: Move variant functions to a separate file.Richard W.M. Jones2012-11-022-6/+26
| | | | This is just code motion.
* generator: actions: Move 3 helper functions to a separate file.Richard W.M. Jones2012-11-021-89/+6
| | | | This is just code motion.
* New API: mklost_and_foundRichard W.M. Jones2012-11-021-0/+15
|
* lib: Add inspect_list_applications2 method (RHBZ#859949)John Eckersberg2012-11-012-0/+128
| | | | | | RWMJ: - Fix memory leak in guestfs__inspect_list_applications wrapper. - Don't document app2_spare* fields.
* generator: Use an OCaml struct to store the structs.Richard W.M. Jones2012-10-3012-92/+137
| | | | | | This just makes it simpler to add extra fields to each struct. This is code motion.
* lib: Force visibility default on public actions.Richard W.M. Jones2012-10-301-4/+10
| | | | | | This is currently done implicitly because of the linker script. However in order to do symbol versioning, we will have to do this explicitly at each definition instead.
* generator: Move struct-freeing functions to a separate source file.Richard W.M. Jones2012-10-302-27/+43
| | | | This is just code motion.
* NEW API: mktempWanlong Gao2012-10-171-0/+34
| | | | | | | | | | | | | | | | Used to create temporary directory or file with an optional suffix. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Split this out into a new file (daemon/mktemp.c). - I don't see a reason to deprecate the mkdtemp function which works fine. Instead remove complex dir-making code from the new function. - Test and fix the patch (missing close(fd)).
* generator: Add 'blocking' flag to marking blocking (long-running) functions.Richard W.M. Jones2012-10-155-15/+100
| | | | | | | | | | | | | In languages like Python where we release a global lock around long-running libguestfs functions, it is also useful to *not* release this lock for small, non-blocking functions. Therefore mark all functions with a 'blocking' boolean flag. It defaults to true, and is true by definition for all daemon functions. For non-daemon functions, I have classified them manually. Only when the blocking flag is set do we generate the code to release and reacquire the lock around libguestfs calls.
* ocaml: Get rid of CAMLprim.Richard W.M. Jones2012-10-151-8/+8
| | | | It's wrong to use it, and in any case it doesn't do anything on Linux.
* New APIs: guestfs_create_flags, guestfs_parse_environment,Richard W.M. Jones2012-10-157-24/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | guestfs_parse_environment_list. Add a new function for creating a handle: guestfs_h *guestfs_create_flags (unsigned flags [, ...]); This variant lets you supply flags and extra arguments, although extra arguments are not used at the moment. Of particular interest is the ability to separate the creation of the handle from the parsing of environment variables like LIBGUESTFS_DEBUG. guestfs_create does both together, which prevents us from propagating errors from parsing environment variables back to the caller (guestfs_create has always printed any errors on stderr and then just ignored them). If you are interested in these errors, you can now write: g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT); if (!g) exit (EXIT_FAILURE); r = guestfs_parse_environment (g); if (!r) exit (EXIT_FAILURE); Also you can *omit* the call to guestfs_parse_environment, which creates a handle unaffected by the environment (which was not possible before). This commit also includes new (backwards compatible) changes to the OCaml, Perl, Python, Ruby and Java constructors that let you use the flags.
* New APIs: Model libvirt authentication events through the API.Richard W.M. Jones2012-10-132-0/+103
| | | | | | | | | | | | | | | | | | | | | This commit models libvirt authentication events through the API, adding one new event (GUESTFS_EVENT_LIBVIRT_AUTH) and several new APIs: guestfs_set_libvirt_supported_credentials guestfs_get_libvirt_requested_credentials guestfs_get_libvirt_requested_credential_prompt guestfs_get_libvirt_requested_credential_challenge guestfs_get_libvirt_requested_credential_defresult guestfs_set_libvirt_requested_credential See the documentation and example which shows how to use the new API. This commit also changes existing calls to virConnectOpen* within the library so that the new API is used. Also included is an example (but not a test, because it's hard to see how to automatically test the libvirt API).
* lib: Pointer arg to safe_memdup function should be const.Richard W.M. Jones2012-10-131-1/+1
|
* launch: Add warning not to avoid calling launch twice on the same handle.Richard W.M. Jones2012-10-101-1/+6
| | | | | For more information on this topic, see: https://www.redhat.com/archives/libguestfs/2012-October/msg00045.html
* Add support for hotplugging (removing disks).Richard W.M. Jones2012-10-091-0/+39
| | | | | | | | New API: remove-drive. Note because of a bug in fuser, this only works with psmisc >= 22.20. This also updates the hotplugging tests.
* Add support for hotplugging (adding disks) to the libvirt attach-method.Richard W.M. Jones2012-10-081-3/+21
| | | | | | | | | | | | | When libvirt is used, we can allow disks to be hotplugged. guestfs_add_drive can be called after launch to hot-add a disk. When a disk is hot-added, we first ask libvirt to add the disk to the appliance, then we make an internal call into the appliance to get it to wait for the disk to appear (ie. udev_settle ()). Hot-added disks are tracked in the g->drives array. This also adds a test.
* launch: Add add_drive 'label' option.Richard W.M. Jones2012-10-081-1/+27
| | | | | | | | | | | | | | | | | | | | | New API: list-disk-labels Allow the user to pass an optional disk label when adding a drive. This is passed through to qemu / libvirt using the disk serial field, and from there to the appliance which exposes it through udev, creating a special alias of the device /dev/disk/guestfs/<label>. Partitions are named /dev/disk/guestfs/<label><partnum>. virtio-blk and virtio-scsi limit the serial field to 20 bytes. We further limit the name to maximum 20 ASCII characters in [a-zA-Z]. list-devices and list-partitions are not changed: these calls still return raw block device names. However a new call, list-disk-labels, returns a hash table allowing callers to map between disk labels, and block device and partition names. This commit also includes a test.
* docs: add_drive: Clean up documentation of the 'filename' parameter.Richard W.M. Jones2012-10-061-9/+6
| | | | | Also, remove duplicate documentation of using '/dev/null' as the filename.