summaryrefslogtreecommitdiffstats
path: root/src/guestfs-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* Update inspection and example programs to use new hivex* APIs (RHBZ#852394).Richard W.M. Jones2012-08-291-8/+0
| | | | | | | | | | | | | | | | | | | | | | | I tested this by comparing the output of virt-inspector over Windows guests before and after the change, which was identical: $ md5sum `ls -1 /tmp/*.before /tmp/*.after` c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.after c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.before eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.after eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.before d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.after d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.before 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.after 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.before a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.after a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.before 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.after 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.before fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.after fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.before 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.after 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.before
* launch: Add utility function guestfs___lazy_make_tmpdir.Richard W.M. Jones2012-08-151-0/+1
| | | | | | This lets us create g->tmpdir lazily earlier if needed. This commit is just code motion.
* lib: Add 'g->unique' to handle, for making unique IDs.Richard W.M. Jones2012-08-151-0/+6
|
* New internal APIs: internal-test-set-output, internal-test-close-output.Richard W.M. Jones2012-08-151-0/+3
| | | | | | | | These internal (testing) APIs allow the bindtests output to be sent to some other place than stdout. This is necessary for Erlang, since stdout is used to communicate with the Erlang interpreter.
* Mac OS X: #define UNIX_PATH_MAX 104Masami HIRATA2012-07-241-0/+4
| | | | | | See http://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man4/unix.4.html Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
* launch: Make get-pid and max-disks APIs into virtual methods of the current ↵Richard W.M. Jones2012-07-231-0/+3
| | | | attach-method.
* launch: Add libvirt backend.Richard W.M. Jones2012-07-221-0/+6
| | | | | | | | | | | | Complete the attach-method libvirt backend. This backend uses libvirt to create a transient KVM domain to run the appliance. Note that this still will only work with local libvirt URIs since the <kernel>, <initrd> and appliance links in the libvirt XML refer to local files, and virtio serial only works locally (limitation of libvirt). Remote support will be added later.
* Add attach-method "libvirt" or "libvirt:<URI>".Richard W.M. Jones2012-07-211-1/+5
| | | | | With this commit, you can set the attach method to libvirt, but calling launch will give an error.
* launch: Make 'drive_name' into a common function.Richard W.M. Jones2012-07-211-0/+1
| | | | This is just code motion.
* launch: Abstract attach method operations.Richard W.M. Jones2012-07-201-9/+27
| | | | | | g->attach_ops points to a structure which contains the operations supported by each attach method backend (ie. appliance, unix, etc.).
* launch: Move the command line building code entirely into launch-appliance.c.Richard W.M. Jones2012-07-201-1/+1
| | | | | Although we still use the handle as convenient temporary storage.
* launch: Move guestfs_config API and build list of qemu parameters in handle.Richard W.M. Jones2012-07-201-0/+10
| | | | | | Move and rewrite guestfs_config so it accumulates a list of qemu parameters in the handle. These are added to the appliance at launch time (with attach method == unix:... you'll now get an error).
* launch: Move launch timing / messages code into launch.c.Richard W.M. Jones2012-07-201-2/+3
|
* lib: Use bool (from <stdbool.h>) for a few fields in the handle.Richard W.M. Jones2012-07-201-10/+12
|
* lib: Rearrange fields in guestfs handle.Richard W.M. Jones2012-07-201-39/+38
| | | | Arrange the fields more logically. This is just code motion.
* lib: Split launch.c into separate files.Richard W.M. Jones2012-07-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | launch-appliance.c contains the code associated with the 'appliance' attach-method. Mostly. In fact there are a few APIs which don't fit so nicely: - config: deprecated API which fiddles with the qemu command line directly - max-disks: depends on the qemu implementation (virtio-scsi or not) - debug-drives: used for testing only launch-unix.c contains the code associated with 'unix:<path>'. launch.c is the common code for launching, along with a few other APIs such as guestfs_add_drive_opts. This commit also reduces the number of headers to just those which are required.
* Rename qemu option cache=off to cache=none.Richard W.M. Jones2012-07-021-1/+1
| | | | | Note that qemu treats these identically, so this change has no functional effect.
* lib: Remove obsolete NETWORK, ROUTER definitions in header file.Richard W.M. Jones2012-06-251-21/+0
| | | | These haven't been used since we switched over to virtio-serial.
* appliance: Add support for virtio-scsi.Richard W.M. Jones2012-06-121-0/+3
| | | | This requires febootstrap >= 3.15.
* 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.
* configure: Allow systemtap/DTrace userspace probes to be disabled.Richard W.M. Jones2012-05-111-2/+2
| | | | | | | | | './configure --disable-probes' will disable these probes. Otherwise they are autodetected as before. The <sys/sdt.h> produces lots of errors when you try to compile with these probes enabled under clang, so it is necessary to provide a way to disable them for clang users.
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-6/+2
| | | | | | | | | | | | 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-261-3/+1
| | | | | | | | | | | | | | | 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.
* New APIs: mount-local, mount-local-run, umount-local (FUSE support in the API).Richard W.M. Jones2012-03-291-0/+15
| | | | | | | | | | 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.
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* inspect: Use uint64_t for maximum file size in bytes.Richard W.M. Jones2012-03-121-1/+1
|
* lib: Use size_t for allocation size in safe realloc function.Richard W.M. Jones2012-03-121-1/+1
|
* inspection: Add detection of FreeDOS (RHBZ#786215).Richard W.M. Jones2012-03-071-0/+3
| | | | | FreeDOS is returned as type="dos", distro="freedos". No version or application information is returned at present.
* Add support for Buildroot and Cirros distributions.Richard W.M. Jones2012-03-071-0/+2
|
* 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-0/+1
| | | | | | | 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.
* inspection: Add outline support for GNU/Hurd.Richard W.M. Jones2011-11-281-0/+3
|
* Allow compilation without hivex (RHBZ#723474).Richard W.M. Jones2011-10-211-2/+3
|
* 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-2/+17
| | | | | | | | | | | | | | | | | | 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.
* Add basic support for netbsd detection.Michael Scherer2011-10-141-0/+3
|
* Add support for pkgsrc, default NetBSD package manager.Michael Scherer2011-10-141-1/+2
| | | | | | For now, only detect the tool, but support from reading installed package could be added later ( may require either a package of pkgsrc, or a smaller tool to read the db ).
* Add Opensuse and zypper detection supportMichael Scherer2011-10-141-0/+2
| | | | This would also erronously detect SLES as Opensuse.
* Detect Mageia distributionMichael Scherer2011-10-141-0/+1
|
* Add systemtap/DTrace probes.Richard W.M. Jones2011-10-101-0/+20
| | | | | Mainly this is a documentation change. However a sample of DTrace-compatible userspace probes are also added.
* New API: set-smp, get-smpRichard W.M. Jones2011-09-281-0/+2
| | | | | | | These calls allow you to change the number of virtual CPUs assigned to the appliance. This also adds a --smp option to virt-rescue.
* inspection: Add support for ttylinux (a minimal Linux).Richard W.M. Jones2011-09-161-0/+1
|
* Remove guestfs___print_timestamped_argv.Richard W.M. Jones2011-08-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This function was used to print the qemu and febootstrap-supermin-helper command lines. Unfortunately in the qemu case it was used incorrectly: it called the internal debug function (ie. event API callback) from the forked qemu subprocess, which meant that higher level event callbacks might have been invoked from the child process. To fix this, convert the qemu case into a new function called print_qemu_command line which just prints the command line directly to stderr. This is called after stderr has been redirected into the pipe to the main process. Thus the qemu command line will be marshalled into the event API along with other qemu and appliance output. After fixing this, only one use of guestfs___print_timestamped_argv remained, for printing the febootstrap-supermin-helper command line. This is converted to a local function print_febootstrap_command_line. Also print_febootstrap_command_line is now called before we fork febootstrap-supermin-helper, so that messages no longer overlap.
* inspection: Better checking for Windows root disks (RHBZ#729075).Richard W.M. Jones2011-08-081-0/+3
| | | | | | | | | | | | | | | | | Previously any disk that had /autoexec.bat or /boot.ini or /ntldr would be picked up as a candidate for a Windows root disk. If further checking could not find any systemroot (eg. /windows) then this would result in complete failure of inspection. In particular, this got confused by Hp_recovery partitions which have /autoexec.bat, but don't have a systemroot in one of the usual places (they have /MiniNT instead). What we do now is to properly investigate all possible systemroot places before deciding this is a Windows systemroot, so the subsequent failure cannot occur. (Thanks to lorimar for reporting this bug).
* Require PCRE library.Richard W.M. Jones2011-07-251-7/+1
| | | | This library is widely available in distros.
* Add user cancellation to the C API.Richard W.M. Jones2011-07-151-0/+5
| | | | | | | | | 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/+2
| | | | | | | | | | | 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.
* New API: inspect-get-icon returns the guest icon.Richard W.M. Jones2011-06-281-0/+3
| | | | | | | | | | This API returns the guest's favicon if found, else an icon representing the guest operating system. Currently supported by this patch: Fedora, RHEL and derivatives, Debian (but not Ubuntu), Windows XP, Windows 7. This also updates virt-inspector to include an <icon> element containing the icon in base64 encoding.
* Change download_to_tmp so it can work with multi-root operating systems.Richard W.M. Jones2011-06-281-1/+1
| | | | | | | | | | | | | | | | The previous guestfs___download_to_tmp function did not handle multiboot correctly. In particular it used the same cache name for downloaded files from different roots, which could have caused things like applications in each root to be confused. This changes the function so that the cache filename is prefixed with the root / fs number, eg. $tmpdir/0-Name instead of $tmpdir/Name. This change also requires the function to return the new name, so all places in the code which called this function had to be updated. This updates and fixes commit 3c1f762abed92f7a358f3bc93e3396d0606b18ad.
* internal: Use size_t instead of int for command line size.Richard W.M. Jones2011-04-301-3/+3
|