summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
Commit message (Collapse)AuthorAgeFilesLines
* New API: guestfs_canonical_device_name.Richard W.M. Jones2012-06-131-0/+23
| | | | This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
* Record output of qemu -device '?'.Richard W.M. Jones2012-06-121-0/+1
| | | | | This allows us to find out what qemu devices are supported at runtime.
* arm: Set minimum LIBGUESTFS_MEMSIZE at 128.Richard W.M. Jones2012-05-121-1/+1
| | | | | | | | For ARM Versatile ("versatilepb") architecture, memsize must be set to 256 (megabytes) else the appliance is unable to boot. Previously setting LIBGUESTFS_MEMSIZE=256 was not allowed. Versatile Express has larger limits.
* New APIs: mount-local, mount-local-run, umount-local (FUSE support in the API).Richard W.M. Jones2012-03-291-0/+4
| | | | | | | | | | 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.
* lib: Use size_t for allocation size in safe realloc function.Richard W.M. Jones2012-03-121-1/+1
|
* Ignore return values from some functions in guestfs_close (Coverity warning).Richard W.M. Jones2012-03-081-2/+3
| | | | | | | | | | | | | | | | Error: CHECKED_RETURN: /builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9552: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9555: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5584: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5586: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5990: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5991: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13702: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13707: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16000: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16001: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: check_return: Calling function "guestfs_internal_autosync" without checking return value (as is done elsewhere 5 out of 6 times). /builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: unchecked_value: No check of the return value of "guestfs_internal_autosync(g)".
* set-smp: limit the number of cpus below 255Wanlong Gao2012-02-251-1/+4
| | | | | | Limit the number of cpus below 255, since qemu can't support. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* Enable running the daemon under valgrind.Richard W.M. Jones2012-01-241-0/+8
| | | | | | | | | | | | | | | | | This commit allows you to run the daemon under valgrind. You have to enable it at configure time: ./configure --enable-valgrind-daemon This should *not* be done for production builds. When this feature is enabled, valgrind is added to the appliance and the daemon is run under valgrind. Log messages from valgrind are passed back over a virtio-serial channel into a file called 'valgrind.log.$PID' in the top build directory. Running 'make check', 'make extra-tests' etc causes many valgrind.log.* files to be created which must be examined by hand.
* Tempus fugit.Richard W.M. Jones2012-01-181-1/+1
| | | | Update all copyright dates to 2012.
* lib: Add guestfs___remove_tmpdir helper function.Richard W.M. Jones2011-12-231-39/+2
| | | | | | | This function does 'rm -rf <dir>' for temporary directories, safely working if '<dir>' contains shell meta-characters. Replace existing code for removing directories with this.
* lib: Fix memory leak when debugging enabled (found by valgrind).Richard W.M. Jones2011-11-241-0/+2
| | | | | If you enabled debugging (eg. LIBGUESTFS_DEBUG=1) then every debug message printed would be leaked.
* inspect: Add drive naming hintsMatthew Booth2011-10-191-0/+1
| | | | | | | | | | | We currently use a heuristic to guess how drive names we find referenced in the guest map to drive names in the appliance. If this heuristic fails it can cause inspection to fail. This change adds a new 'name' option to add_drive_opts, which allows the user to explicitly pass the name of a drive to libguestfs if it is known. This change also updates the fstab-parsing inspection code to use this information if it is available.
* launch: Store drive information in guestfs_hMatthew Booth2011-10-191-0/+19
| | | | | | | | | | | | | | | | | | This is a NFC on its own, but provides a place-holder for drive metadata which can be used after launch. Fixes by RWMJ: - Fix the tests: this requires a new internal function 'debug-drives' that dumps out the g->drives information so it can be checked in two of the tests. Previously these tests used 'debug-cmdline'. - Test file existence / use_cache_off in the add_drive_opts function, not when launching qemu in the child process. - Call free along error paths. - Add comments.
* New API: set-smp, get-smpRichard W.M. Jones2011-09-281-0/+21
| | | | | | | These calls allow you to change the number of virtual CPUs assigned to the appliance. This also adds a --smp option to virt-rescue.
* daemon: Remove separate configure of daemon subdirectory.Richard W.M. Jones2011-08-051-6/+0
| | | | | | | | | | | | | Combine the two Gnulib instances together. Add checks from old daemon/configure.ac into configure.ac. Fix daemon/Makefile.am so it is like a normal subdirectory Makefile.am. Because we are now using the replacement strerror_r function from Gnulib (instead of the one from glibc directly), this requires a small change to src/guestfs.c.
* Add user cancellation to the C API.Richard W.M. Jones2011-07-151-0/+6
| | | | | | | | | This allows long transfers (FileIn and FileOut operations) to be cancelled by calling the signal and thread safe guestfs_user_cancel function. Most of this commit consists of a multithreaded program that tests user cancellation of uploads and downloads.
* New APIs: set-pgroup, get-pgroupRichard W.M. Jones2011-07-151-0/+13
| | | | | | | | | | | If the pgroup flag is set in the handle, then the qemu and recovery subprocesses are placed in separate process groups. The default is false. The purpose for setting up a process group is that ^C will not be passed from the main process down to these processes (killing them). This allows ^C and other keyboard events to be caught and handled in the main process.
* Add a trace message to guestfs_close.Richard W.M. Jones2011-04-301-0/+7
| | | | | | | | | | Only the "first half" (ie. the call) is traced, because by the time the function returns the handle has gone and there's no way to generate events. You should see: libguestfs: trace: close
* internal: Use size_t instead of int for command line size.Richard W.M. Jones2011-04-301-1/+1
|
* guestfs_close: Move local variables close to code that uses them.Richard W.M. Jones2011-04-301-3/+4
| | | | This is just code motion.
* guestfs_close: Remove unused local variable.Richard W.M. Jones2011-04-301-2/+1
|
* Remove temporary directory containing arbitrary files.Richard W.M. Jones2011-04-131-9/+40
| | | | | | | | In preparation for caching inspection information in the temporary directory (g->tmpdir), allow the temporary directory to contain arbitrary files, and remove all of them when the handle is closed. This just generalizes the previous method of cleaning up the tmpdir.
* Rename $tmpdir/sock to $tmpdir/guestfsd.sock.Richard W.M. Jones2011-03-251-1/+1
| | | | | | | | No functional change; this simply makes the purpose of the socket clearer. Notes: Labels: cleanup
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-57/+90
| | | | | | | | | | | | | This API allows more than one callback to be registered for each event, makes it possible to call the API from other languages, and allows [nearly all] log, debug and trace messages to be rerouted from stderr. An older version of this API was discussed on the mailing list here: https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html This also updates guestfish to use the new API for its progress bars.
* New APIs: guestfs_first_private, guestfs_next_private to walk overRichard W.M. Jones2011-03-151-0/+41
| | | | | | | | the private data area. This commit adds new APIs for walking over the keys and pointers in the private data area associated with each handle (note this is only applicable to the C API).
* check the pid is > 0 before calling waitpid()Angus Salkeld2011-03-151-1/+1
| | | | Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* New APIs: set-attach-method, get-attach-method.Richard W.M. Jones2011-02-031-0/+45
| | | | | | | | | | These allow you to get and set the attach method. The format is one of: * appliance * unix:<path> It's stored broken out into an enum and a string in the handle.
* Add a new internal-autosync API to perform autosync.Richard W.M. Jones2011-01-281-4/+2
| | | | | | | | | Instead of explicitly calling umount-all; sync, we add a daemon function called internal-autosync which does the same. Apart from slightly simplifying the process of closing the handle, the main advantage is we can modify the daemon for the standalone case so that internal-autosync does not do the umount-all operation.
* generator: trace mode prints return values.Richard W.M. Jones2010-11-171-0/+6
|
* lib: Add safe_asprintf function.Richard W.M. Jones2010-11-131-0/+16
|
* lib: Make pcre, libmagic and hivex libraries optional.Richard Jones2010-11-101-0/+9
| | | | | | | | | | | | | | | This change makes these libraries optional. If they are not available at compile time then certain core API features will be disabled (see below). This also changes PCRE detection to use pkg-config instead of the ad hoc autoconf checks. The large inspect.c file has been split out into separate function-specific files. file-architecture: requires pcre & libmagic inspection: requires pcre & hivex
* lib: Expose errno through new API guestfs_last_errno.Richard W.M. Jones2010-11-031-4/+17
| | | | | | | If either the daemon sends back an errno, or a system call fails in the library, save the errno in the handle and then make it available to callers through the guestfs_last_errno function.
* Enable autosync by default.Richard W.M. Jones2010-10-271-0/+1
|
* Don't include control characters in BufferIn trace output (RHBZ#646822).Matthew Booth2010-10-261-0/+29
| | | | | | | | | | | | The example below shows what the output looks like for a large random buffer. $ guestfish -N fs -m /dev/sda1 -x -- \ touch /test : \ pwrite /test "$(dd if=/dev/urandom bs=128k count=1)" 0 [...] pwrite "/test" "\x7f\xa0/\xb3\x80\xd3\xbc\xc3\xc3.\xb1\xe0\x1b\xafC\x06\xd5;\x0ajJ[o\xc1\xdd\xae\x1f\xce\xb2\x8d\xb3\xd0\x11\xcc$%\xe6<\xc7\xc7\xe7BU*\xc4l%\xaa\xea\xe9\x1an\xda]\xc6I\x0eC\xf9;\xec\x12a\x1f\xeaRH\xb2P\xd6+\xc4\xe6\xa5bW\x99\\x9d\xc8\x9bJ\xef\x99-\x16:h5\xe2\x0f\xa2\xa08\x9bU\x0b$\x138\xcf\xd4j\x9b\x83{%\xac0\xdaa1Xx\xbd`\x8e\xdd\x82\x87\x07\x98\xd2\x9ed\x8bq\xd0\x1f5\x8f\xab\xad4z1\xda\xc4b\xc1\xbc\x0f\xaa\xea\xc1\x15(\xfd1\xc2\x0bF\xe6\x9e\xb0+/g\\xab\xb0b\xde_\xca\xf9\xad\xe1?%\x17\xad\x98\xa4e\xc1\xe0f'\x89\xe9>\xff\xadhYi\xe7\x8c]%\xef\xe0\xa1R\xe5\xd5\x03K\xefI\xdf\xad\xd3\x82\xdb\x0f\xdd\xc3\x8f"\xf1G\xea\xf9r\xdd\xff\x88\x81\xb7\xf2\x0e\x0f\x1d;:\xf2F1\xdb\xb5D\xa1^\x928\xf5\x8e)\xab\xc4\xc3H(\xd0ol\xc6\xe4\xd6\xa3L\x1c\x06\xf4"<truncated, original size 130567 bytes> 0 [...]
* syntax: Remove unused ignore-value.h header.Richard Jones2010-09-101-1/+0
|
* syntax: Remove unused signal.h header.Richard Jones2010-09-101-1/+0
|
* syntax: Remove unused c-ctype.h header.Richard Jones2010-09-101-1/+0
|
* Implement private data area.Richard Jones2010-09-011-0/+81
| | | | | | | | | The private data area is a hash table which is associated with libguestfs handles, that C callers may use to store arbitrary data for the lifetime of the handle. Later the OCaml bindings will use this in order to implement callbacks.
* Implement progress messages in the daemon and library.Richard Jones2010-08-311-0/+8
| | | | | | | | | | | | This implements progress notification messages in the daemon, and adds a callback in the library to handle them. No calls are changed so far, so in fact no progress messages can be generated by this commit. For more details, see: https://www.redhat.com/archives/libguestfs/2010-July/msg00003.html https://www.redhat.com/archives/libguestfs/2010-July/msg00024.html
* New APIs: set-network and get-network to enable network support.Richard Jones2010-08-241-0/+13
| | | | guestfs_set_network (g, true) enables network support in the appliance.
* Change to using ext2-based, cached supermin appliance.Richard Jones2010-08-231-6/+0
| | | | | | | | | | | | This changes the method used to build the supermin appliance to use the new ext2-based appliance supported by latest febootstrap. The appliance can also be cached, so we avoid rebuilding it each time it is used. Mailing list discussion goes into the rationale and details: https://www.redhat.com/archives/libguestfs/2010-August/msg00028.html Requires febootstrap >= 2.8.
* New APIs for guest inspection.Richard Jones2010-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | | This commit converts (some of) the Perl inspection code to C and makes it available through core APIs. The new APIs are: inspect-os - Does the inspection, returns list of OSes inspect-get-* - Get results of the inspection where '*' is one of: type - 'windows' or 'linux' distro - Linux distro arch - architecture product-name - long product name string major-version minor-version - major.minor version of OS mountpoints - get a list of the mountpoints filesystems - get all filesystems associated with the OS This works for all existing supported Linux and Windows OSes.
* Add safe_strndup call.Richard Jones2010-08-171-0/+8
|
* Rearrange library code into separate files.Richard Jones2010-07-271-2210/+0
| | | | | | | | | | | | We split the library code into these separate files: - guestfs.c: creating handles, closing handles, handle-related variables - actions.c: generated library-side stubs for each action - bindtests.c: generated code to test bindings - launch.c: launching the appliance - proto.c: the library side of the daemon communications protocol This is just code movement.
* Rename guestfs-{actions,bindtests}.c to {actions,bindtests}.cRichard Jones2010-07-271-1/+1
| | | | | Rename these two generated files, in preparation for splitting up the main src/guestfs.c file.
* Move variable initialization close to variable use.Richard Jones2010-07-221-3/+3
|
* Revert "add_drive_ro adds readonly=on option if available." (RHBZ#617200).Richard Jones2010-07-221-18/+4
| | | | | | | | | | | | | | | | | | Adding the readonly=on option is not so clever. This causes qemu to present the disk as read-only to the guest. (The expected behaviour of snapshots=on,readonly=on was that it would open the disk O_RDONLY but present a writable disk to the guest). Since the guest sees a read-only disk, we are unable to do any recovery if a filesystem on the disk is inconsistent. This basically prevents most accesses to live disk images. What we really want is a qemu option which presents a writable disk to the guest, but only opens the disk on the host side with O_RDONLY, to alleviate the udev bug RHBZ#571714. This reverts commit 676462684e05dd8341dd695762dd99a87d8ec022.
* Make tmp directory world readable (RHBZ#610880).Richard Jones2010-07-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | If you have a restrictive umask (0077 for example) then files in the tmp directory would be created with 0600 permissions. Example: drwx------. 2 rjones rjones 4096 Jul 2 17:52 . drwxrwxrwt. 57 root root 102400 Jul 2 17:52 .. -rw-------. 1 rjones rjones 86328832 Jul 2 17:52 initrd lrwxrwxrwx. 1 rjones rjones 46 Jul 2 17:52 kernel -> /boot/vmlinuz-2.6.33-0.40.rc7.git0.fc13.x86_64 This in itself is not a problem. However in virt-v2v we also change UID:GID and the result is that qemu is unable to read the initrd file: qemu: could not load initial ram disk '/tmp/libguestfs2ssynP/initrd' With this patch we make the tmp directory and the files world readable. After the patch: $ ls -la /tmp/libguestfsJFVzPg/ total 116192 drwxr-xr-x. 2 rjones rjones 4096 Jul 2 18:03 . drwxrwxrwt. 56 root root 102400 Jul 2 18:03 .. -rw-r--r--. 1 rjones rjones 118869504 Jul 2 18:03 initrd lrwxrwxrwx. 1 rjones rjones 46 Jul 2 18:03 kernel -> /boot/vmlinuz-2.6.33-0.40.rc7.git0.fc13.x86_64
* Add error callback (RHBZ#602599).Richard Jones2010-06-101-0/+14
| | | | Read the note in the man page before using this feature.
* Unify supermin appliance building using febootstrap 2.7Richard Jones2010-05-131-12/+10
|