summaryrefslogtreecommitdiffstats
path: root/fish/fish.h
Commit message (Collapse)AuthorAgeFilesLines
* lib: Rework temporary and cache directory code.Richard W.M. Jones2012-11-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir. The current code has evolved over time and has a number of problems: (a) A single environment variable ($TMPDIR) controls the location of several directories. (b) It's hard for the library user to predict which directory libguestfs will use, unless the user simulates the same internal steps that libguestfs performs. This commit fixes these issues. (a) Now three environment variables control the location of all small temporary files, and the appliance cache: For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp. For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp. The user can also set these directories explicitly through API calls (guestfs_set_tmpdir and guestfs_set_cachedir). (b) The user can also retrieve the actual directories that libguestfs will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir. These functions are also used internally. This commit also: - reworks the internal tmpdir code - removes the internal (undocumented) guestfs_tmpdir call (replacing it with calls to the documented guestfs_get_tmpdir API instead) - changes the ./run script to set LIBGUESTFS_TMPDIR and LIBGUESTFS_CACHEDIR - adds a test - fixes a few places like libguestfs-make-fixed-appliance which depended on $TMPDIR
* syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim ↵Richard W.M. Jones2012-09-171-4/+0
| | | | | | | Meyering). The gnulib <fcntl.h> replacement header will now define this symbol if it's not defined already.
* fish: Move 'feature_available' function to global.Richard W.M. Jones2012-05-021-0/+1
| | | | This is just code motion.
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-13/+0
| | | | | | | | | | | | 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.
* 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'.
* Replace 'int' with 'size_t' passim.Richard W.M. Jones2012-03-131-1/+1
| | | | | Analyze all uses of 'int' in the code, and replace with 'size_t' where appropriate.
* fish: remote: Make sure global cleanups are called for guestfish --listen.Richard W.M. Jones2012-03-121-1/+1
| | | | | Return to the main program ('fish.c') and perform global cleanups when the guestfish remote server exits.
* fish: Allow events to be processed in guestfish.Richard W.M. Jones2011-12-161-0/+9
| | | | | | | | Add 'event', 'list-events' and 'delete-event' commands so that event handlers can be registered, listed and deleted in guestfish. The event handler is a shell script snippet or host command. Cc: Pádraig Brady <P@draigBrady.com>
* fish: Make progress bars into a mini library.Richard W.M. Jones2011-08-261-6/+1
| | | | This library could now be called from other virt tools.
* fish: Declare run_* functions in a generated header file.Richard W.M. Jones2011-08-071-39/+2
| | | | | Calls to these functions are generated, so there is no need to declare the functions by hand.
* fish: Print input file and line number in error messages.Richard W.M. Jones2011-08-051-0/+2
| | | | | eg: *stdin*:37: libguestfs: error: luks_close: Device lukstest is busy.
* fish: Add 'display' command for displaying graphical files.Richard W.M. Jones2011-06-281-0/+3
|
* fish: Enhance guestfish win:... parsing to understand drive letters.Richard W.M. Jones2011-04-051-1/+1
|
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-1/+1
| | | | | | | | | | | | | 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.
* fish: Make exit_on_error into a completely local variable.Richard W.M. Jones2011-01-181-1/+1
| | | | | | Note that 'time' and 'glob' (which both run subcommands) do not correctly pass the exit_on_error flag in the remote case. This is not a regression: the current code doesn't work either.
* fish: Don't use external pod2text program.Richard W.M. Jones2010-11-261-1/+0
| | | | | | | This removes the dependency from guestfish to the external pod2text program (and hence the final dependency on perl for guestfish). This is done by storing the formatted pod2text output in guestfish as the help text.
* fish: Add --listen --csh to for csh, tcsh compatibility.Richard W.M. Jones2010-11-051-0/+1
| | | | (Thanks Eric Blake).
* fish: '-i' option automatically handles whole-disk encryption.Richard W.M. Jones2010-11-051-1/+0
| | | | | | | | | | | This feature is also available in guestmount because of the shared option parsing code. You don't need to do anything to enable it, just using -i will attempt decryption of encrypted partitions. Only works for simple Fedora whole-disk encryption. It's a work-in-progress to make it work for other types of encryption.
* fish: Make the 'help' command more helpful.Richard W.M. Jones2010-11-041-0/+3
|
* Unify guestfish and guestmount options processing (RHBZ#642932).Richard W.M. Jones2010-10-271-8/+1
| | | | | | | | | | | | | | | In guestfish, factor out the processing of the options -a, -c, -d, -i, -m, -n, -r, -v, -V, -x into a separate set of files: options.c, options.h, inspect.c, virt.c. Change guestmount so that it uses these same files (from the ../fish directory) to process the same options. This unifies the handling of these options between the two programs. It also adds the useful inspection feature to guestmount, so you can now do: guestmount -d Guest -i --ro mnt/
* fish: Change 'int argc' to 'size_t argc' throughout.Richard W.M. Jones2010-10-211-16/+16
|
* Allow $TMPDIR to override most temporary directory uses.Richard W.M. Jones2010-09-241-0/+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.
* fish: Implement 'hexedit' command.Richard W.M. Jones2010-09-211-0/+3
|
* leak: Free list of drives and mountpoints in guestfish.Richard W.M. Jones2010-09-211-1/+2
| | | | | | | | | | Previously the list of -a, -d, -m, -N parameters were leaked. This change frees them explicitly. This is not such an important fix since guestfish is a one-shot program, but it aids in finding other leaks in future. (Found by valgrind).
* generator: Generate guestfish-only commands.Richard W.M. Jones2010-09-181-26/+14
| | | | | | The guestfish-only commands such as 'alloc' and 'edit' are now generated from one place in the generator instead of being spread around ad-hoc in the C code.
* fish: Implement copy-in and copy-out commands.Richard Jones2010-09-091-0/+5
|
* fish: Add guestfish -N bootroot and -N bootrootlv for creating boot+root disks.Richard Jones2010-09-081-0/+4
|
* fish: Generate list of prepared disk image types.Richard Jones2010-09-081-0/+6
| | | | This commit shouldn't change the semantics of the code.
* fish: Implement progress bars in guestfish.Richard Jones2010-09-011-0/+5
| | | | | | | | | | | | | | | | | The progress bar is updated 3 times per second, and is not displayed at all for operations which take less than two seconds. You can disable progress bars by using the flag --no-progress-bars, and you can enable progress bars in non-interactive sessions with the flag --progress-bars. A good way to test this is to use the following command: guestfish --progress-bars \ -N disk:10G \ zero-device /dev/sda (adjust "10G" to get different lengths of time).
* fish: Detect UTF-8 output and open termcap/terminfo database.Richard Jones2010-09-011-0/+2
| | | | | | Provide a generic mechanism within guestfish to detect if output if UTF-8 and to open the termcap (or terminfo) database for the current terminal type.
* fish: Reimplement -i option using new C-based inspection.Richard Jones2010-08-171-0/+4
| | | | | | | | | | | | | | Don't shell out to virt-inspector. Instead, use the new C-based inspection APIs. This is much faster. The new syntax is slightly different: guestfish -a disk.img -i guestfish -d guest -i However, the old syntax still works.
* fish: Add -c/--connect and -d/--domain options.Richard Jones2010-08-171-0/+5
| | | | | | | | The -d option lets you specify libvirt domains. The disks from these domains are found and added, as if you'd named them with -a. The -c option lets you specify a libvirt URI, which is needed when we consult libvirt to implement the above.
* generator: Add 'Key' parameter type.Richard Jones2010-07-211-0/+1
| | | | | | | | | | | | | Add a 'Key' parameter type, used for passing sensitive key material into libguestfs. Eventually the plan is to mlock() key material into memory. However this is very difficult to achieve because the encoded XDR strings end up in many places. Therefore users should note that key material passed to libguestfs might end up in swap. The only difference between 'Key' and 'String' currently is that guestfish requests the key from /dev/tty with echoing turned off.
* fish: help command return error for non-existent commands (RHBZ#597145).Richard Jones2010-06-021-2/+2
| | | | | | | | | | | | | | With this change, the exit status indicates error for non-existent commands. $ guestfish -h foo foo: command not known, use -h to list all commands $ echo $? 1 $ guestfish help foo foo: command not known, use -h to list all commands $ echo $? 1
* fish: New command: 'supported'Richard Jones2010-05-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This checks all available optional groups and prints out which ones are supported by the daemon. Note you must launch the appliance first. Example: ><fs> supported augeas yes inotify yes linuxfsuuid yes linuxmodules yes linuxxattrs yes lvm2 yes mknod yes ntfs3g yes ntfsprogs yes realpath yes scrub yes selinux yes xz yes zerofree yes
* fish: Make 'launch' function static.Richard Jones2010-05-081-1/+0
| | | | | | This commit makes the launch function static and private to 'fish.c', and changes the generator so the function is no longer called for the 'run/launch' command.
* fish: Add 'man' command which opens the manual.Richard Jones2010-04-241-0/+4
|
* fish: Add -N option for making prepared disk images.Richard Jones2010-04-221-0/+10
| | | | | | | | | | | | | | | | | Previously you might have typed: $ guestfish ><fs> alloc test1.img 100M ><fs> run ><fs> part-disk /dev/sda mbr ><fs> mkfs ext4 /dev/sda1 now you can do the same with: $ guestfish -N fs:ext4 Some tests have also been updated to use this new functionality.
* fish: Allow -<<END as a syntax for uploading "heredocs".Richard Jones2010-04-191-0/+3
| | | | | | | | | | | | For example: ><fs> upload -<<END /foo some data some more data END ><fs> cat /foo some data some more data
* fish: Autocomplete 'sparse' command (RHBZ#582899).Richard Jones2010-04-171-0/+1
| | | | | I also rechecked the list of built-in commands against the actual commands to make sure no others were omitted.
* fish: Print extended help when the user types an unknown command first.Richard Jones2010-04-071-0/+2
| | | | | | | | $ guestfish /tmp/disk.img /tmp/disk.img: unknown command Did you mean to open a disk image? guestfish -a disk.img For a list of commands: guestfish -h For complete documentation: man guestfish
* Mac OS X: Detect bindtextdomain.Richard Jones2010-03-221-0/+7
| | | | | These are missing on Mac OS X. I think you would need to install a gettext package to get these.
* Don't export STREQ and friends in <guestfs.h>Richard Jones2009-11-101-0/+10
| | | | | Move these to private header file(s) and other places as required since these aren't part of the public API.
* fish: New command 'sparse', like 'alloc' but to generate sparse files.Richard Jones2009-11-041-0/+1
| | | | | | | | | | | | | | | | | With sparse you can make sparse files, which is fun because you can experiment with really large devices: ><fs> sparse /tmp/test.img 100G ><fs> run ><fs> sfdiskM /dev/vda , ><fs> mkfs ext2 /dev/vda1 # very long pause here ... ><fs> mount /dev/vda1 / To see the real (ie. allocated) size of the sparse file, use the du command, eg: ><fs> !du -h /tmp/test.img 1.6G -rw-rw-r-- 1 rjones rjones 100G 2009-11-04 17:40 /tmp/test.img
* guestfish: Add win: prefix to use Windows paths.Richard Jones2009-10-261-0/+1
| | | | | | | Add a win: prefix for path arguments in guestfish: ><fs> file win:c:\windows\system32\config\system.log MS Windows registry file, NT/2000 or above
* fish.c: avoid "assignment discards qualifiers..." warningJim Meyering2009-08-211-0/+6
| | | | | * fish/fish.c (main): Cast-away-const. * fish/fish.h (bad_cast): Define. Safer than using an actual cast.
* fish.c: avoid warningsJim Meyering2009-08-211-1/+1
| | | | | * fish/rc.c (UNIX_PATH_MAX): Remove unused definition. * fish/fish.h (rc_listen): Declare with __attribute__((noreturn)).
* adjust const "**" pointers to avoid warningsJim Meyering2009-08-171-3/+3
| | | | | | Also, ... * src/generator.ml: Add DeviceList type, and propagate that change out to all calling/interface code.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-1/+1
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* guestfish: Make more strings translatable.Richard Jones2009-07-291-1/+1
| | | | | However this doesn't yet attempt to translate the POD command documentation. We need a plan to do that.