summaryrefslogtreecommitdiffstats
path: root/generator
Commit message (Collapse)AuthorAgeFilesLines
...
* generator: Allow non-optargs functions to gain optargs.Richard W.M. Jones2012-07-145-112/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a flag (once_had_no_optargs) which can be used to add optargs to functions that currently don't have any. The idea is that if 'func' currently has no optargs, we can safely add optargs provided we are backwards compatible for existing callers. In C that means we leave 'guestfs_func' alone and provide an extra function 'guestfs_func_opts' that takes the optargs ('guestfs_func' becomes a wrapper that calls 'guestfs_func_opts'). In the C generator this means there are two names for each function (although the two names are normally identical). 'c_name' is the name that we export publicly (eg. [guestfs_] 'func_opts'). 'name' is the internal name of the function (eg. 'func') which is used for everything apart from the public interface, and also to generate the no-optargs compat function. In other languages that can add optional arguments safely, we simply add the arguments to the existing 'func', so for example in Perl: $g->func (required_args) $g->func (required_args, optional_args) can be used. Note that this commit does not cause any change to the output of the generator. I verified this by diffing the output before and after.
* generator: Rearrange some C generator code into sub-functions.Richard W.M. Jones2012-07-131-571/+585
| | | | | This is just code motion. I verified this by comparing the generator output before and after this commit.
* java: Generate overloaded non-optargs method for each optargs method.Richard W.M. Jones2012-07-131-0/+23
| | | | | | | | | | | | | | For example the existing method: public void mkfs_opts (String fstype, String device, Map<..> optargs); is now accompanied by this overloaded method which is a simple wrapper: public void mkfs_opts (String fstype, String device) throws LibGuestFSException { mkfs_opts (fstype, device, null); }
* generator: Add c_optarg_prefix for each action.Richard W.M. Jones2012-07-1312-50/+49
| | | | This updates commit 9286f556c6a9e6967fcac8aacdae3660821c4c7a.
* generator: Add c_function (C function name) to each action struct.Richard W.M. Jones2012-07-1214-58/+68
| | | | | | | | | | | | | | | | | | | | | | | | | This field, which is generated internally by the generator, is the name of the C function corresponding to each action. For actions that have NO optional arguments, it's just "guestfs_<name>". For actions that have any optional arguments, it is "guestfs_<name>_argv" (since any binding has to construct the optional argument struct explicitly). In a future commit, this mapping may become more complex. This commit also "fixes" the C# bindings which didn't handle optional arguments properly at all. In fact, it doesn't fix this, it just changes it enough that it probably now compiles. We should either compile and test the bindings routinely with Mono, or drop them, since they are starting to bit-rot. In the GObject bindings, I have added a space between the C function name and the first paren. Apart from the C# and GObject changes, this is just code motion. It was verified by diffing the output of the generator before and after.
* generator: Change the way that camel-case names are generated.Richard W.M. Jones2012-07-124-53/+73
| | | | | | | | Store the camel-case name directly in the struct instead of generating it on the fly in only the GObject bindings. This is just code motion. Tested by verifying that the generator output is identical.
* tests: Rename test0* functions as internal_test*.Richard W.M. Jones2012-07-113-79/+94
| | | | | The internal_* prefix is reserved for internal functions such as these tests.
* generator: Use a struct instead of a tuple to describe each action.Richard W.M. Jones2012-07-1122-4104/+5738
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each action changes from a tuple like this: ("cat", (RString "content", [Pathname "path"], []), 4, [ProtocolLimitWarning], [InitISOFS, Always, TestOutput ( [["cat"; "/known-2"]], "abcdef\n")], "list the contents of a file", "[...]"); to a slightly longer but more readable struct: { defaults with name = "cat"; style = RString "content", [Pathname "path"], []; proc_nr = Some 4; protocol_limit_warning = true; tests = [ InitISOFS, Always, TestOutput ( [["cat"; "/known-2"]], "abcdef\n") ]; shortdesc = "list the contents of a file"; longdesc = "[...]" }; ["defaults" is a struct which contains the defaults for every field, allowing us to use the "{ defaults with ... }" syntax to just update the fields we want to be different from the defaults.] This is a mechanical change and there is no change to the output of the generator. I checked the output before and after with diff to verify this. There are no changes in the output apart from UUIDs which are expected to change with each run.
* generator: Add a note in generator/README about safely extending functions.Richard W.M. Jones2012-07-111-0/+9
|
* generator: Move note in comment to generator/README file.Richard W.M. Jones2012-07-112-8/+7
|
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-031-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | The new API splits orderly close into a two-step process: if (guestfs_shutdown (g) == -1) { /* handle the error, eg. qemu error */ } guestfs_close (g); Note that the explicit shutdown step is only necessary in the case where you have made changes to the disk image and want to handle write errors. Read the documentation for further information. This change also: - deprecates guestfs_kill_subprocess - turns guestfs_kill_subprocess into the same as guestfs_shutdown - changes guestfish and other tools to call shutdown + close where necessary (not for read-only tools) - updates documentation - updates examples
* New API: guestfs_nr_devicesRichard W.M. Jones2012-06-291-0/+12
| | | | | | This returns the number of whole block devices added. It is usually simpler to call this than to list the devices and count them, which is what we do in some places in the current codebase.
* Ensure #include <config.h> occurs in every C file.Richard W.M. Jones2012-06-277-0/+14
|
* src/actions.c: Include <config.h> in this generated file.Richard W.M. Jones2012-06-271-0/+2
| | | | | | | On RHEL 5, because _GNU_SOURCE was not defined, open_memstream was not being declared, resulting in miscompilation and a segfault in the trace code whenever open_memstream returned a pointer >= 0x80000000 (which would be truncated to a 32 bit int and then sign-extended).
* launch: Treat /dev/null specially, for old KVM.Richard W.M. Jones2012-06-251-1/+5
| | | | | | | | | Old KVM can't add /dev/null readonly. Treat /dev/null as a special case. We also fix a few tests where /dev/null was being used with format=qcow2. This was always incorrect behaviour, but qemu appears to tolerate it.
* ruby: Add a replacement rb_hash_lookup function for Ruby 1.8.5.Richard W.M. Jones2012-06-221-0/+16
| | | | This function was first added to Ruby in 1.8.7.
* New API: device-index.Richard W.M. Jones2012-06-131-1/+14
| | | | | | This returns the index of the device, eg. /dev/sdb => 1. Or you can think of it as the order that the device was added, or the index of the device in guestfs_list_devices.
* New API: guestfs_canonical_device_name.Richard W.M. Jones2012-06-131-1/+29
| | | | This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
* New API: guestfs_max_disks.Richard W.M. Jones2012-06-131-0/+13
| | | | Returns the maximum number of disks that may be added to a handle.
* New API: fstrim - allow filesystem trim.Richard W.M. Jones2012-06-121-2/+25
|
* blockdev_getbsz: Remove test.Richard W.M. Jones2012-06-091-2/+1
| | | | | The output of this test depends on page size, so on ppc64 it returns 64K.
* New API: filesystem-available: tests for filesystem availability.Richard W.M. Jones2012-06-091-1/+20
| | | | | This also creates an internal filesystem_available function within the daemon.
* java: Remove unnecessary imports from the generated Java code.Richard W.M. Jones2012-05-221-8/+0
|
* NEW API: add new api btrfs-fsckWanlong Gao2012-05-151-0/+9
| | | | | | | | | Add the new API btrfs-fsck to check the btrfs filesystem. Btrfs is currently under heavy development, and not suitable for any uses other than benchmarking and review. But it'll be useful in the near future. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* New API: add new api btrfs-set-seeding to enable or disable seeding.Wanlong Gao2012-05-141-0/+10
| | | | | | | Add the new API btrfs-set-seeding to support the seeding-device feature for btrfs. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* fish: glob command now expands /dev/ patterns (RHBZ#635971).Richard W.M. Jones2012-05-021-1/+5
| | | | | | | | | | | | | For example: ><fs> glob echo /dev/* /dev/vda /dev/vda1 /dev/vda2 /dev/vda3 ><fs> glob echo /dev/v*/* /dev/vg_f16x64/lv_root /dev/vg_f16x64/lv_swap
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-0/+4
| | | | | | | | | | | | gettextize provides a local file called "gettext.h". Remove this and use <libintl.h> from glibc headers instead. Most of this change is mechanical: #include <libintl.h> in every C file which uses any gettext function. But also we remove the gettext.h file, and adjust the "_" macros. Note that this effectively removes the ./configure --disable-nls option, although we don't know if that ever worked.
* lib: Remove the BUSY state.Richard W.M. Jones2012-04-262-24/+9
| | | | | | | | | | | | | | | Originally this state was intended so that in some way you could find out if the appliance was running a command. However there was never a thread-safe way to access the state of the handle, so in effect you could never do anything useful safely with this information. This commit completely removes the BUSY state. The only visible change is to the guestfs_is_busy API. Previously you could never call this safely from another thread. If you called it from the same thread it would always return false (since the current thread can't be running a libguestfs command at that point by definition). Now it always returns false.
* gobject: Use generator_built macro to ensure generated files are rebuilt ↵Richard W.M. Jones2012-04-261-2/+2
| | | | properly.
* gobject: Move headers into a subdirectoryMatthew Booth2012-04-262-10/+13
| | | | | | | | | The gobject bindings generate a large number of header files, which pollute /usr/include when installed. This patch moves them all into a guestfs-gobject/ subdirectory. guestfs-gobject.h remains in the same place. This change also moves generated source files into src/, because it makes the gobject directory a bit tidier.
* btrfs: Fix docs for btrfs_subvolume_set_default (thanks Matt Booth).Richard W.M. Jones2012-04-261-1/+1
| | | | This fixes commit 87ea7a04094d5ed40f3f047ff2b7a613d4d530d4.
* gobject: Implement libguestfs events as signalsMatthew Booth2012-04-261-1/+187
| | | | | | | | | | Implement libguestfs events as GObject signals. Callback arguments are passed in a boxed object. Note that this patch fixes the length of the uint64_t array in the callback arguments at 16, whereas it is actually arbitrary length. This is to make it introspectable. There is currently no way to pass an arbitrary length array to a callback, and have its type introspected.
* gobject: Wrap literal sections in POD in CDATA sectionsMatthew Booth2012-04-261-0/+5
|
* gobject: NFC generated code formatting fixMatthew Booth2012-04-261-1/+1
|
* New btrfs APIs.Richard W.M. Jones2012-04-252-0/+91
| | | | | | | | | | | | | | | | Bind the easy parts of the 'btrfs' program. The new APIs are: btrfs-device-add: add devices to a btrfs filesystem btrfs-device-delete: remove devices from a btrfs filesystem btrfs-filesystem-sync: sync a btrfs filesystem btrfs-filesystem-balance: balance a btrfs filesystem btrfs-subvolume-create: create a btrfs snapshot btrfs-subvolume-delete: delete a btrfs snapshot btrfs-subvolume-list: list btrfs snapshots and subvolumes btrfs-subvolume-set-default: set default btrfs subvolume btrfs-subvolume-snapshot: create a writable btrfs snapshot
* btrfs: Modify mkfs-btrfs API so it takes a list of devices.Richard W.M. Jones2012-04-251-1/+4
| | | | | | | btrfs filesystems can span multiple filesystems. Note this changes the API, but this API has not yet been released in a stable version of libguestfs.
* generator: Add explicit types to pod memoization code.Richard W.M. Jones2012-04-241-3/+7
| | | | This is just code motion.
* New APIs for reading and writing ext2 file attributes and file generation.Richard W.M. Jones2012-04-131-0/+193
| | | | | | | | | | | | The new APIs are: get-e2attrs: List ext2 file attributes of a file. set-e2attrs: Set or clear ext2 file attributes of a file. get-e2generation: Get ext2 file generation of a file. set-e2generation: Set ext2 file generation of a file. These are implemented using the lsattr and chattr programs from e2fsprogs.
* New API: mkfs-btrfs for creating btrfs filesystems (RHBZ#807905).Richard W.M. Jones2012-04-021-0/+11
| | | | This allows all parameters from btrfs to be accessed.
* New APIs: mount-local, mount-local-run, umount-local (FUSE support in the API).Richard W.M. Jones2012-03-291-0/+59
| | | | | | | | | | Add FUSE support directly to the API. Instead of needing to use the external 'guestmount' command, you can mount the libguestfs filesystem space on a local mountpoint using an API call from any language. Note that although mount-local-run is marked as Cancellable, the current implementation does not support it, but it would be relatively simple to add it.
* Partially revert "generator: Fix unescaped '<' and '>' in api descriptions"Richard Jones2012-03-291-5/+5
| | | | | | Don't escape < and > in verbatim sections. This partially reverts commit 09a4e7664b59789f90b6674f640f9d688e4f8b43.
* gobject: Split sources into 1 file per classMatthew Booth2012-03-282-343/+428
| | | | | | | This greatly improves the usability of the generated gtk-doc. Although there is a lot of churn in generator_gobject.ml, this is almost exclusively code motion.
* gobject: Add gtk-doc for GuestfsSession and GuestfsSessionClassMatthew Booth2012-03-281-2/+13
|
* gobject: Add gtk-doc field descriptions for generated structsMatthew Booth2012-03-281-0/+25
|
* gobject: Add gtk-doc for optarg wrapper classesMatthew Booth2012-03-281-8/+25
|
* gobject: Drop references to Guestfs::<foo> in commentsMatthew Booth2012-03-281-4/+4
|
* gobject: Handle various problem content in gtk-doc API descriptionsMatthew Booth2012-03-281-1/+45
| | | | | | | | | | Produce better gtk-doc for: * URLs * RHBZ# references * CVE references * API cross-references * Parameter references * Escaped characters
* gobject: Add basic gtk-doc for all parametersMatthew Booth2012-03-281-4/+16
|
* gobject: Add basic gtk-doc for propertiesMatthew Booth2012-03-281-19/+28
|
* gobject: gtk-doc SECTION must be named after a source fileMatthew Booth2012-03-281-1/+1
|