summaryrefslogtreecommitdiffstats
path: root/src/guestfs-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* inspect: Abstract out db_dump code for listing RPM applications.Richard W.M. Jones2011-04-181-0/+2
| | | | | | | | | | | | There are two changes here: (1) The code for listing RPM applications ran db_dump and parsed the output. We abstract out that parsing code into a separate reusable module (src/dbdump.c). (2) The old db_dump parsing code used db_dump -p (printable) format. Instead use db_dump -k (hex) format so we can read binary fields. (cherry picked from commit a986e8dadb0c70634f6d1d89dd3e7bb5d9af3078)
* inspect: Split code into separate files.Richard W.M. Jones2011-04-181-0/+40
| | | | | | | | | | | | | | | | | | The src/inspect.c file had grown rather large -- 3,500 lines. Split it across several files according to function. This is just moving code. After the split the files are more evenly divided: 536 src/inspect_apps.c 766 src/inspect.c 537 src/inspect_fs.c 404 src/inspect_fs_cd.c 785 src/inspect_fs_unix.c 535 src/inspect_fs_windows.c 3563 total (cherry picked from commit 3336b5448f12c9eb25bf7a0cecda1315c4cf07ea)
* New API: inspect-get-drive-mappingsRichard W.M. Jones2011-04-051-0/+1
| | | | | | | | | | | | This returns the drive mappings from the Windows Registry. virt-inspector displays the drive mappings, giving output similar to this: <drive_mappings> <drive_mapping name="C">/dev/sda2</drive_mapping> <drive_mapping name="E">/dev/sdb1</drive_mapping> </drive_mappings>
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-051-0/+1
| | | | | | | | | | | | | | This returns the actual registry key corresponding to CurrentControlSet (eg. it might be "ControlSet001"). Previously the inspection code was hard-coding ControlSet001. Now we use the correct control set, and also make it available to callers through the API. This commit also updates the virt-dhcp-address example so it uses this new API. virt-inspector displays the current control set when available.
* Generate progress messages during launch.Richard W.M. Jones2011-04-011-0/+1
| | | | | | | | | | | | | | | | | | | This commit generates approximate progress messages during the guestfs_launch call. Currently this code generates: 0 / 12: launch clock starts 3 / 12: appliance created 6 / 12: detected that guest kernel started 9 / 12: detected that /init script is running 12 / 12: launch completed successfully (Note this is not an ABI and may be changed or removed in a future version). Progress messages are only generated at all if 5 seconds have elapsed since the launch, and they are only generated for the ordinary appliance (not if using attach-method to attach to an existing virtio serial port).
* Shared function to send progress messages.Richard W.M. Jones2011-04-011-1/+3
| | | | This is just code motion.
* inspector: Add detection of Slackware.Richard W.M. Jones2011-03-251-0/+1
| | | | Notes: Labels: feature
* New API: guestfs_inspect_get_product_variantRichard W.M. Jones2011-03-231-0/+1
| | | | | | | | | | This returns a product variant for inspected operating systems. In practice this is a useful way to distinguish between consumer and enterprise/server versions of Windows that otherwise have the same version number. Notes: Labels: feature
* inspect: Don't fail for Windows guests with multiple disks (RHBZ#674130).Richard W.M. Jones2011-03-221-0/+2
| | | | | Notes: Labels: bugfix, RHBZ#674130 Depends: 5776c145d411e5ae00072ecf422055f3d0bd29e2
* proto: Fix both-ends-cancel case.Richard W.M. Jones2011-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where both ends cancel at the same time (eg. both ends realize there are errors before or during the transfer), previously we skipped sending back an error from the daemon, on the spurious basis that the library would not need it (the library is cancelling because of its own error). However this is wrong: we should always send back an error message from the daemon in order to preserve synchronization of the protocol. A simple test case is: $ guestfish -N fs -m /dev/sda1 upload nosuchfile / libguestfs: error: open: nosuchfile: No such file or directory libguestfs: error: unexpected procedure number (66/282) (Notice two things: there are errors at both ends, and the loss of synchronization). After applying this commit, the loss of synchronization does not occur and we just see the library error: $ guestfish -N fs -m /dev/sda1 upload nosuchfile / libguestfs: error: open: nosuchfile: No such file or directory The choice of displaying the library or the daemon error is fairly arbitrary in this case -- it would be valid to display either or even to combine them into one error. Displaying the library error only makes the code considerably simpler. This commit also (re-)enables a test for this case.
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-10/+33
| | | | | | | | | | | | | 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/+1
| | | | | | | | 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).
* New APIs: set-attach-method, get-attach-method.Richard W.M. Jones2011-02-031-0/+6
| | | | | | | | | | 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.
* Use /var/tmp for the cached appliance (for FHS compliance).Richard W.M. Jones2011-01-191-0/+1
| | | | | | | | | | | | | | | | The FHS advises large files not to be stored in the root filesystem[1], and that /var/tmp is persistent across reboots[2] (whereas /tmp is possibly not[3]). Therefore we should store the large cached supermin appliance in /var/tmp instead of /tmp. /tmp is still used for all other temporary files and directories. In either case you can override this by setting $TMPDIR. [1] http://www.pathname.com/fhs/pub/fhs-2.3.html#THEROOTFILESYSTEM [2] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE [3] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
* Add ability to inspect install disks and live CDs.Richard W.M. Jones2011-01-151-0/+12
| | | | | For examples of the virt-inspector output, see the additional inspector/example-*.xml files in this commit.
* generator: Code to handle optional arguments in daemon functions.Richard W.M. Jones2010-12-021-1/+1
| | | | | | | | Previously we only supported optional arguments for library functions (commit 14490c3e1aac61c6ac90f28828896683f64f0dc9). This extends that work so that optional arguments can also be passed through to the daemon.
* protocol: Send progress_hint in header.Richard W.M. Jones2010-12-011-1/+1
| | | | | | For actions that have FileIn arguments, count the size of all the input files and send that in the progress_hint field of the request header.
* generator: trace mode prints return values.Richard W.M. Jones2010-11-171-0/+1
|
* New API: inspect-get-hostname to return the hostname of the guest.Richard W.M. Jones2010-11-161-0/+1
| | | | | This returns the hostname of the guest. Tested on RHEL, Fedora, Debian 5, Ubuntu 10.10, FreeBSD 8, Windows 7.
* inspect: Add support for Linux Mint and Mandriva.Richard Jones2010-11-151-0/+3
| | | | | | | | Linux Mint is derived from Ubuntu. Mandriva has a release file, but it also has /etc/lsb-release and the same parsing code can be reused. Mandriva has a package manager called urpmi.
* inspect: Inspection support for FreeBSD.Richard W.M. Jones2010-11-131-0/+2
| | | | | | | | | | This adds inspection support for FreeBSD. However this is not quite enough to allow guestfish -i freebsd.img to work, because guestfish will try to mount the filesystems, which cannot be done because Linux requires special mount options for the Universal Filesystem (UFS) used by *BSD. Nevertheless you can manually run the same commands.
* lib: Add match3 function.Richard W.M. Jones2010-11-131-0/+2
|
* lib: Add safe_asprintf function.Richard W.M. Jones2010-11-131-0/+3
|
* New APIs: inspect-get-package-format, inspect-get-package-management.Richard Jones2010-11-121-0/+21
| | | | This APIs reimplement some parts of virt-inspector in C.
* Don't need to include XDR headers in <guestfs.h>.Richard W.M. Jones2010-11-111-0/+3
| | | | | | | Include the XDR headers in the internal guestfs-internal.h instead. This is knock-on effects to several other source files which were implicitly relying on indirectly loaded headers.
* Add internal facility to checkpoint and roll back the command line.Richard Jones2010-11-101-0/+2
| | | | | This internal interface can be used to ensure that certain operations are atomic.
* lib: Make pcre, libmagic and hivex libraries optional.Richard Jones2010-11-101-0/+16
| | | | | | | | | | | | | | | 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-1/+4
| | | | | | | 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.
* Define internal safe_calloc shorthand.Richard W.M. Jones2010-11-031-0/+1
|
* inspect: Add support for MeeGo.stable-1.6Richard W.M. Jones2010-11-021-0/+1
|
* inspect: Add support for Ubuntu.Richard Jones2010-10-291-0/+1
|
* inspect: Add detection of Gentoo.Richard Jones2010-10-291-0/+1
|
* inspect: Add detection of Arch Linux.Richard Jones2010-10-291-0/+1
|
* inspect: Add detection of Pardus.Richard Jones2010-10-291-0/+1
|
* New internal function guestfs___print_timestamped_argvMatthew Booth2010-10-281-0/+1
| | | | | | | This function generalises the existing print_cmdline used to output the qemu command line to output any given command line, and exports it to other modules. It also adds a timestamp to the old print_cmdline output for consistency with guestfs___print_timestamped_message.
* New API: inspect-get-windows-systemroot to get systemroot.Richard W.M. Jones2010-10-281-0/+1
| | | | | | We are already using heuristics in the C inspection code to determine the Windows %SYSTEMROOT% directory. This change just exposes this information through the API.
* Don't include control characters in BufferIn trace output (RHBZ#646822).Matthew Booth2010-10-261-0/+1
| | | | | | | | | | | | 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 [...]
* Allow $TMPDIR to override most temporary directory uses.Richard W.M. Jones2010-09-241-1/+5
| | | | | | | Be more consistent in allowing the user to override use of the temporary directory by specifying $TMPDIR. Also prefer P_tmpdir macro (defined in <stdio.h>) if that is defined, rather than hard-coding "/tmp" for the fallback location.
* Implement private data area.Richard Jones2010-09-011-0/+3
| | | | | | | | | 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/+2
| | | | | | | | | | | | 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/+1
| | | | guestfs_set_network (g, true) enables network support in the appliance.
* Use virtio-serial, remove other vmchannel methods.Richard Jones2010-08-241-8/+0
| | | | | | | | | | | | | This adds support for virtio-serial, and removes all other vmchannel methods. Virtio-serial is faster than other methods, and is now widely available. I tested this by using the guestfs_upload API on an 83 MB file: before: 6.12 seconds (14.1 MB/sec) after: 4.20 seconds (20.6 MB/sec) (note this is with the current 8K chunk size)
* Change to using ext2-based, cached supermin appliance.Richard Jones2010-08-231-0/+1
| | | | | | | | | | | | 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.
* Make print_timestamped_message into a cross-module function.Richard Jones2010-08-231-0/+1
| | | | This is just code movement.
* Factor out code for locating the temporary directory.Richard Jones2010-08-231-0/+1
| | | | This is just code movement.
* Whitespace change: Add blank line between structures and functions.Richard Jones2010-08-211-0/+1
|
* New APIs for guest inspection.Richard Jones2010-08-171-0/+54
| | | | | | | | | | | | | | | | | | | | | 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/+2
|
* Rename internal functions.Richard Jones2010-07-281-3/+3
| | | | | | | This is an update to commit 41f25ab3df5f306ac717fa7a6efd58328d30c1ae. Internal functions should be named guestfs___* (3 underscores) to avoid clashing with the implementation of actions (2 underscores).
* Rearrange library code into separate files.Richard Jones2010-07-271-1/+115
| | | | | | | | | | | | 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.