summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Implement 'vgrename' and 'lvrename' APIs.Richard Jones2010-01-282-1/+21
|
* supermin: Prevent multilib corruption (RHBZ#558593).Richard Jones2010-01-271-2/+4
| | | | | | | | | | | | | | | | | | | On some combination of installing, upgrading and removing the base libguestfs package on x86_64, multilib can corrupt libguestfs by leaving a copy of /usr/bin/libguestfs-supermin-helper around which references the wrong architecture (usually, contains links to the i386-based appliance, when the x86_64 appliance should be constructed). This commit changes libguestfs-supermin-helper so that the script is the same on all architectures. Instead, the library passes the differences to the script (eg. $host_cpu). Because the i386 and x86_64 libraries should be at different locations (/usr/lib vs /usr/lib64) this should prevent multilib from screwing things up. Related links: https://bugzilla.redhat.com/show_bug.cgi?id=558593 http://rwmj.wordpress.com/2009/11/16/please-someone-shoot-multilib/#content https://bugzilla.redhat.com/show_bug.cgi?id=235752
* guestfish: Use xstrtol to parse integers (RHBZ#557655).Richard Jones2010-01-251-4/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code uses atoi to parse the generator Int type and atoll to parse the generator Int64 type. The problem with the ato* functions is that they don't cope with errors very well, and they cannot parse numbers that begin with 0.. or 0x.. for octal and hexadecimal respectively. This replaces the atoi call with a call to Gnulib xstrtol and the atoll call with a call to Gnulib xstrtoll. The generated code looks like this for all Int arguments: { strtol_error xerr; long r; xerr = xstrtol (argv[0], NULL, 0, &r, ""); if (xerr != LONGINT_OK) { fprintf (stderr, _("%s: %s: invalid integer parameter (%s returned %d)\n"), cmd, "memsize", "xstrtol", xerr); return -1; } /* The Int type in the generator is a signed 31 bit int. */ if (r < (-(2LL<<30)) || r > ((2LL<<30)-1)) { fprintf (stderr, _("%s: %s: integer out of range\n"), cmd, "memsize"); return -1; } /* The check above should ensure this assignment does not overflow. */ memsize = r; } and like this for all Int64 arguments (note we don't need the range check for these): { strtol_error xerr; long long r; xerr = xstrtoll (argv[1], NULL, 0, &r, ""); if (xerr != LONGINT_OK) { fprintf (stderr, _("%s: %s: invalid integer parameter (%s returned %d)\n"), cmd, "size", "xstrtoll", xerr); return -1; } size = r; } Note this also fixes an unrelated bug in guestfish handling of RBufferOut. We were using 'fwrite' without checking the return value, and this could have caused silent failures, eg. in the case where there was not enough disk space to store the resulting file, or even if the program was interrupted (but continued) during the write. Replace this with Gnulib 'full-write', and check the return value and report errors.
* Add 'filesize' call.Richard Jones2010-01-252-1/+13
| | | | | Returns the size of a file. You can already do this with 'stat', but this call is good for scripting.
* Add guestfs.pod and guestfish.pod to EXTRA_DIST.1.0.81Richard Jones2010-01-131-1/+2
|
* qemu: Upstream regression of -stdio serial option.Richard Jones2010-01-071-4/+17
| | | | | | | | | | | | | Best explained by the comment in the code: /* Newer versions of qemu (from around 2009/12) changed the * behaviour of monitors so that an implicit '-monitor stdio' is * assumed if we are in -nographic mode and there is no other * -monitor option. Only a single stdio device is allowed, so * this broke the '-serial stdio' option. There is a new flag * called -nodefaults which gets rid of all this default crud, so * let's use that to avoid this and any future surprises. */
* Use linker script to control visibility of symbols.Richard Jones2010-01-042-3/+53
|
* generator: Move all library generation code together.Richard Jones2010-01-041-1/+1
|
* generator: Print total lines of generated code.Richard Jones2010-01-041-2/+18
|
* C#: Add documentation about experimental nature of these bindings.Richard Jones2010-01-042-5/+39
|
* Experimental C# bindings.Richard Jones2010-01-022-5/+218
| | | | Tested in only limited situations, with Mono on Linux.
* Move guestfs(3) and guestfish(1) man pages into subdirectories.Richard Jones2009-12-314-6/+1337
| | | | | | | | These manual pages have for a very long time 'lived' in the top source directory. Clean up this situation by moving those manual pages (plus associated generated files) into the src/ and fish/ subdirectories respectively.
* generator: Move src/guestfs-bindtests.c next to other src/ files.Richard Jones2009-12-311-1/+1
|
* generator: Use Continuation Passing Style (CPS) in output_to function.Richard Jones2009-12-311-175/+56
| | | | This makes the code simpler, shorter and less error-prone.
* generator: Rename GPLv2 to GPLv2plus, LGPLv2 to LGPLv2plus.Richard Jones2009-12-311-38/+38
| | | | | The licenses are "any later version", so reflect this in the naming of the parameter to generate_header.
* generated code: Set copyright years to 2009-xxxx when current year > 2009.Richard Jones2009-12-311-4/+8
|
* Remove separate inspector_generator.ml, combine this with generator.ml.Richard Jones2009-12-311-2/+506
| | | | | | | | | | | 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.
* generator: Comment and whitespace changes only.Richard Jones2009-12-311-17/+24
|
* build: Fix typo in filename.Richard Jones2009-12-161-1/+1
|
* lib: Link with $(LTLIBTHREAD), required by Gnulib lock module.Richard Jones2009-12-071-1/+3
| | | | This fixes commit cada248a53858341c91f70392e8f5b6e47d9b4fe.
* lib: Add thread-safety to global list of handles.Richard Jones2009-12-071-9/+10
| | | | | | | | | | | | | | | | This commit uses the Gnulib 'lock' module to implement a mutex on the global list of handles which is stored by the library. Note that Gnulib nicely avoids explicitly linking with -lpthread unless the application program itself links to -lpthread. Locks are only enabled in multithreaded applications. $ ldd src/.libs/libguestfs.so.0.217.0 linux-vdso.so.1 => (0x00007fffcb7ff000) libc.so.6 => /lib64/libc.so.6 (0x00007f96a4e6c000) /lib64/ld-linux-x86-64.so.2 (0x00007f96a544d000) Please enter the commit message for your changes. Lines starting
* Make realpath call optional, disable it for Windows.Richard Jones2009-11-261-1/+1
|
* availability: Add a test for this call.Richard Jones2009-11-241-1/+1
| | | | | | Because all the tested groups are optional, there's not really a group we can reliably test, therefore test against the empty list (which should not fail).
* availability: Clarify and fix documentation.Richard Jones2009-11-241-11/+12
|
* generator: Passing "" to StringList tests should turn into empty list.Richard Jones2009-11-241-0/+2
| | | | | | | | This is a bug in the generator which wasn't being tickled. If you had a test which expected a StringList or DeviceList parameter, and you passed "" to that test, then you'd (probably) expect to be testing an empty list, but in fact you got a single element list containing an empty string. This fixes it so you get an empty list.
* Implement 'dd' command.Richard Jones2009-11-232-1/+17
|
* generator: second parameter to upload is Dev_or_Path, not String.Richard Jones2009-11-221-1/+1
|
* availability: Skip tests when functions are not available.Richard Jones2009-11-201-3/+23
|
* availability: Add optional groups and implement guestfs_available call.Richard Jones2009-11-201-62/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current groups are defined very conservatively using the following criteria: (a) Would be impossible to implement on Windows because of sheer architectural differences (eg: mknod). (b) Already optional (augeas, inotify). (c) Not currently optional but not implemented on older RHEL and Debian releases (ntfs-3g.probe, scrub, zerofree). The optional groups I've defined according to these criteria are: . augeas . inotify . linuxfsuuid . linuxmodules . linuxxattrs . lvm2 . mknod . ntfs3g . scrub . selinux . zerofree (Note that these choices don't prevent us from adding more optional groups in future. On the other hand to avoid breaking ABIs we would not wish to change the above groups). The rest of this large commit is really just implementation: Each optional function is classified using Optional "group" flag in the generator. The daemon has to implement a function int optgroup_<name>_available (void); for each optional group. Some of these functions are fixed at compile time, and some do simple run-time tests. The do_available implementation in the daemon looks up the correct function in a table and runs it. We document the optional groups in the guestfs(3) man page. Also: I added a NOT_AVAILABLE macro in order to unify all the existing places where we had a message equivalent to "function __func__ is not available".
* availability: Add guestfs_available.Richard Jones2009-11-202-2/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start a new API allowing groups of functions to be tested for availability. There are two reasons for this: (1) If libguestfs is built with missing dependencies (eg. no Augeas lib) then the corresponding functions are disabled in the appliance. Up till now there has been no way to test for this except to speculatively issue commands and check for errors. (2) When we port the daemon to Win32 it is likely that major pieces of functionality won't be available (eg. LVM support). This API gives a way to test for that. There is no change for existing clients: you still have to check for errors from individual API calls. For new clients, you will be able to test for availability of particular APIs. Usage scenario (A): An LVM editing tool which requires both the LVM API and inotify in order to function at all: char *apis[] = { "inotify", "lvm2", NULL }; r = guestfs_available (g, apis); if (r == -1) { /* print an error and exit */ } Usage scenario (B): A general purpose tool which optionally provides configuration file editing, but this can be disabled, the result merely being reduced functionality: char *apis[] = { "augeas", NULL }; r = guestfs_available (g, apis); enable_config_edit_menus = r == 0;
* build: Add missing dependency libguestfs.la->guestfs_protocol.hMatthew Booth2009-11-201-0/+1
|
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-201-20/+20
| | | | | | | | | | | | | | | 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.
* generator: open Unix module by default.Richard Jones2009-11-191-22/+23
| | | | | | | | | | | | | | Add: open Unix at the top of the generator, which means that we don't need to prefix any 'Unix.foo' symbols (we can just use 'foo' instead). Unfortunately the Unix module shadows one symbol in Pervasives (the Pervasives module is opened by default in OCaml code). That symbol is 'stdout'. So we replace this with 'Pervasives.stdout' in two places. Still a net reduction in code size.
* syntax-check: Fix tab-vs-space issue in the generator.Richard Jones2009-11-191-4/+4
|
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* generator: Acquire lock to prevent two parallel runs of the generator.Richard Jones2009-11-191-6/+27
| | | | | | | | | | | | | This commit acquires a lock on a file to prevent two parallel runs of the generator from stomping on each other. The second run will wait for the first to complete before starting. The lock is acquired on the "HACKING" file because it's convenient -- we are already checking this file exists to make sure that we don't start off in the wrong directory. Tested by adding some artificial sleeps in the code to observe locking behaviour between two parallel runs.
* syntax-check: expand TABs in generator.mlJim Meyering2009-11-191-23/+23
| | | | | | | | | | | | | | | | | | | | | | Jim Meyering wrote: >>From 6f128e90afb055f9899011c4a592eb289e678936 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <meyering@redhat.com> > Date: Thu, 19 Nov 2009 11:39:10 +0100 > Subject: [PATCH libguestfs] syntax-check: expand TABs in generator.ml > > * src/generator.ml: Expand leading TABs to spaces. That was incomplete. Please use the following instead. With it, now, "make syntax-check" now passes once again. >From 716a30d0b692972aac8fbea1fb7ad3318ab3a0d8 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 19 Nov 2009 11:39:10 +0100 Subject: [PATCH libguestfs] syntax-check: expand leading TABs * src/generator.ml: Expand leading TABs to spaces. * fuse/test-fuse.sh: Likewise.
* BUILT_SOURCES now depends on running the generator.Richard Jones2009-11-181-1/+1
| | | | This completely reverts commit efad4f53923dcca94613e193d6383bd032e70498.
* generator: Fix API of functions that return RBufferOutRichard Jones2009-11-181-9/+37
| | | | | | | | | | | | | | | | | | | | | (NB: The API / ABI doesn't actually change here - it's just made much simpler to use). The API for RBufferOut functions was unexpectedly hard to use in the case where a zero-length buffer might be returned. For discussion on this see: https://www.redhat.com/archives/libguestfs/2009-November/thread.html#00115 This commit ensures that in the zero-length buffer case, the return value is never NULL. Thus code is now able to just check if the return value == NULL to indicate an error, which is simpler for all concerned. The implementation of this is, however, more complex because we have to be careful about this case inside both the daemon and the library code, which is what this commit does. This has passed a full round of tests.
* fish: Improve output of guestfish -h cmdRichard Jones2009-11-171-3/+5
| | | | | | Display this output like a short manual page. Don't put <..> around the parameters to the command.
* New API call: fill - fill a file with octetsRichard Jones2009-11-172-1/+14
|
* Generate guestfs_protocol.x when stamp-generator updatesMatthew Booth2009-11-111-0/+2
| | | | | This partially reverts efad4f53923dcca94613e193d6383bd032e70498. guestfs_protocol.x wasn't being generated when building from a clean checkout.
* Don't export STREQ and friends in <guestfs.h>Richard Jones2009-11-105-10/+37
| | | | | Move these to private header file(s) and other places as required since these aren't part of the public API.
* Fix problems found by 'make syntax check'Richard Jones2009-11-101-1/+1
|
* Print timestamped messages during appliance launch.Richard Jones2009-11-101-0/+54
| | | | | In verbose mode, print timestamped messages during guestfs_launch so we can see how long each step takes.
* Record time of guest launch.Richard Jones2009-11-101-6/+7
| | | | | | | | | | The guest handle field start_t was previously used (when we had the wait_ready call), but had fallen into disuse. Note that it could never be accessed through the API. Rename this field as launch_t, convert it to a timeval, and use it to measure the time since guestfs_launch was called so that we can start profiling guest launch.
* appliance: Prefix kernel messages with timestamp.Richard Jones2009-11-101-0/+1
|
* Generic partition creation interface.Richard Jones2009-11-102-29/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* change strncasecmp() == 0 to STRCASEEQLEN()Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncasecmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncasecmp( *\(.*?\)) *== *0\b/STRCASEEQLEN$1/g'
* use STREQ, not strcmp: part 2Jim Meyering2009-11-091-8/+8
| | | | | git grep -l 'strcmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *!= *0\b/STRNEQ$1/g'