summaryrefslogtreecommitdiffstats
path: root/generator
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* docs: Minor cleanup of documentation for add_drive 'name' parameter.Richard W.M. Jones2012-10-031-2/+3
|
* NEW API:ext:mke2fsWanlong Gao2012-09-241-0/+90
| | | | | | | | | | | New api mke2fs for full configuration of filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Update description. - Run and fix the tests. - Remove bogus filename from po/POTFILES.
* generator: xdr: Re-code procedure table.Richard W.M. Jones2012-09-241-7/+13
| | | | This is just code motion.
* generator: Tidy up comments in guestfs_protocol.x.Richard W.M. Jones2012-09-241-9/+19
|
* generator: Allow an optional emacs-mode at the top of generated files.Richard W.M. Jones2012-09-241-2/+7
|
* generator: The default input files are 'generator/ *.ml' [sic].Richard W.M. Jones2012-09-241-1/+1
| | | | | | | | Since generator source files were renamed, the comment at the top of each generated file was wrong. Unfortunately we cannot allow /* to appear within a comment, so the space is necessary.
* Update SuSE Linux detection.Olaf Hering2012-09-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update SuSE Linux detection. Up to now everything with a /etc/SuSE-release file was treated as openSuSE. With this change SLES based distributions such as "SUSE Linux Enterprise Server", "SUSE Linux Enterprise Desktop" and "Novell Linux Desktop" will show up as "sles". The 'opensuse' detection was updated to handle older openSuSE releases as well as the well known SuSE Linux releases, starting from 6.0. Everything else with a /etc/SuSE-release file will show up as "suse-based". Here is a collection of release files: ==> Dist/6.0/etc/SuSE-release <== SuSE Linux 6.0 (i386) VERSION = 6.0 ==> Dist/6.1/etc/SuSE-release <== SuSE Linux 6.1 (i386) VERSION = 6.1 ==> Dist/6.2/etc/SuSE-release <== SuSE Linux 6.2 (i386) VERSION = 6.2 ==> Dist/6.3/etc/SuSE-release <== SuSE Linux 6.3 (i386) VERSION = 6.3 ==> Dist/6.4/etc/SuSE-release <== SuSE Linux 6.4 (i386) VERSION = 6.4 ==> Dist/7.0/etc/SuSE-release <== SuSE Linux 7.0 (i386) VERSION = 7.0 ==> Dist/7.1/etc/SuSE-release <== SuSE Linux 7.1 (i386) VERSION = 7.1 ==> Dist/7.2/etc/SuSE-release <== SuSE Linux 7.2 (i386) VERSION = 7.2 ==> Dist/7.3/etc/SuSE-release <== SuSE Linux 7.3 (i386) VERSION = 7.3 ==> Dist/8.0/etc/SuSE-release <== SuSE Linux 8.0 (i386) VERSION = 8.0 ==> Dist/8.1/etc/SuSE-release <== SuSE Linux 8.1 (i386) VERSION = 8.1 ==> Dist/8.2/etc/SuSE-release <== SuSE Linux 8.2 (x86-64) VERSION = 8.2 ==> Dist/9.0/etc/SuSE-release <== SuSE Linux 9.0 (x86-64) VERSION = 9.0 ==> Dist/9.1/etc/SuSE-release <== SuSE Linux 9.1 (x86-64) VERSION = 9.1 ==> Dist/9.2/etc/SuSE-release <== SuSE Linux 9.2 (x86-64) VERSION = 9.2 ==> Dist/9.3/etc/SuSE-release <== SuSE Linux 9.3 (x86-64) VERSION = 9.3 ==> Dist/10.0/etc/SuSE-release <== SUSE LINUX 10.0 (X86-64) OSS VERSION = 10.0 ==> Dist/10.1-remastered/etc/SuSE-release <== SUSE LINUX 10.1 (X86-64) VERSION = 10.1 ==> Dist/10.1/etc/SuSE-release <== SUSE Linux 10.1 (X86-64) Beta8 VERSION = 10.1 ==> Dist/10.2/etc/SuSE-release <== openSUSE 10.2 (X86-64) VERSION = 10.2 ==> Dist/10.3/etc/SuSE-release <== openSUSE 10.3 (X86-64) VERSION = 10.3 ==> Dist/11.0/etc/SuSE-release <== openSUSE 11.0 (X86-64) VERSION = 11.0 ==> Dist/11.1/etc/SuSE-release <== openSUSE 11.1 (x86_64) VERSION = 11.1 ==> Dist/11.2/etc/SuSE-release <== openSUSE 11.2 (x86_64) VERSION = 11.2 ==> Dist/11.3/etc/SuSE-release <== openSUSE 11.3 (x86_64) VERSION = 11.3 ==> Dist/11.4/etc/SuSE-release <== openSUSE 11.4 (x86_64) VERSION = 11.4 CODENAME = Celadon ==> Dist/12.1/etc/SuSE-release <== openSUSE 12.1 (x86_64) VERSION = 12.1 CODENAME = Asparagus ==> Dist/12.2/etc/SuSE-release <== openSUSE 12.2 (x86_64) VERSION = 12.2 CODENAME = Mantis ==> Dist/sles8/etc/SuSE-release <== SuSE SLES-8 (AMD64) VERSION = 8.1 ==> Dist/sles9/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 ==> Dist/sles9sp2/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 2 ==> Dist/sles9sp3/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 3 ==> Dist/sles9sp4/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 4 ==> Dist/sled10/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 ==> Dist/sled10sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sled10sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sled10sp3/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sled10sp4/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sled11/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sled11sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sled11sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 ==> Dist/sles10/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 ==> Dist/sles10sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sles10sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sles10sp3/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sles10sp4/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sles11/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sles11sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sles11sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 Signed-off-by: Olaf Hering <olaf@aepfle.de>
* python: PyInt_* no longer exists in python3, replace with PyLong_*Hilko Bengen2012-09-201-1/+1
|
* New API: rm-f: remove a file, ignoring errors if it doesn't exist.Richard W.M. Jones2012-09-171-0/+27
|
* daemon: stubs: Move all arg decls to top of function.Richard W.M. Jones2012-09-171-2/+2
| | | | | | | | | | | | For some reason, argument declarations were handled inconsistently for strings and non-string arguments. Non-string arguments were all declared at the top of the function stub, where as string arguments were declared in place. Be consistent. This is just code motion.
* syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim ↵Richard W.M. Jones2012-09-171-4/+0
| | | | | | | Meyering). The gnulib <fcntl.h> replacement header will now define this symbol if it's not defined already.
* syntax: Remove trailing whitespace.Richard W.M. Jones2012-09-155-9/+10
| | | | Found by 'make syntax-check'.
* generator: Remove inaccurate comment.Richard W.M. Jones2012-09-151-20/+0
| | | | | The correct way to extend functions is documented in generator/README. This comment was no longer accurate.
* syntax: Use STREQ/STRNEQ in place of strcmp.Richard W.M. Jones2012-09-151-1/+3
| | | | Found by 'make syntax-check'.
* perl: Add <stdio.h> and <stdlib.h> for printf and malloc.Richard W.M. Jones2012-09-151-0/+2
|
* perl: Include <inttypes.h> and assume it always defines PRId64 and PRIu64.Richard W.M. Jones2012-09-151-8/+2
| | | | | | If these are not defined in the header files, it's a problem on the platform which we should fix with gnulib. Our replacement definitions might be wrong here.
* fish: Replace '_' with '-' in deprecation cross-refs (thanks Olaf Hering).Richard W.M. Jones2012-09-132-3/+5
|
* generator: Remove generated and unused files from previous runs of the ↵Richard W.M. Jones2012-09-053-1/+44
| | | | | | | | | | | | generator. If you go back in time in git (eg. git reset, git bisect) then you can end up in a situation where a file that was generated by a later version is left around unused in the earlier version. This isn't a problem for most things, but gobject documentation generation picks up any file in a directory, even unreferenced ones, and breaks. So the correct thing to do is to remove these files.
* generator: gobject: Use a more normal way to output files.Richard W.M. Jones2012-09-052-100/+111
| | | | | The generator output is identical, verified by comparing the output files before and after the change.
* lib: Add tests to the disk-{format,virtual-size,has-backing-file} APIs.Richard W.M. Jones2012-09-041-0/+24
|