summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* syntax: xfs: Rewrite split_strdup function to avoid use of strncpy.Richard W.M. Jones2012-09-151-6/+8
| | | | Found by 'make syntax-check'.
* syntax: Remove gnulib "ignore-value.h" in files that don't use it.Richard W.M. Jones2012-09-151-1/+0
| | | | Found by 'make syntax-check'.
* syntax: Remove include <dirent.h> in files that don't use it.Richard W.M. Jones2012-09-152-2/+0
| | | | Found by 'make syntax-check'.
* syntax: xfs: Remove useless if before free.Richard W.M. Jones2012-09-151-4/+4
| | | | Found by running 'make syntax-check'.
* daemon: provide list of checksum commandsOlaf Hering2012-09-031-7/+14
| | | | | | | While adding the list of external commands I missed the various checksum tools. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* daemon: remove call to obsolete udevsettleOlaf Hering2012-09-031-8/+0
| | | | | | | udevadm is included in all reasonable recent distributions. This avoids 'command not found' errors in verbose mode. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* daemon: collect list of called external commandsOlaf Hering2012-08-3050-202/+350
| | | | | | | | | | | | | | | | | | | | | | | | guestfsd calls many different tools. Keeping track of all of them is error prone. This patch introduces a new helper macro to put the command string into its own ELF section: GUESTFSD_EXT_CMD(C_variable, command_name); This syntax makes it still possible to grep for used command names. The actual usage of the collected list could be like this: objcopy -j .guestfsd_ext_cmds -O binary daemon/guestfsd /dev/stdout | tr '\0' '\n' | sort -u The resulting output will be used to tell mkinitrd which programs to copy into the initrd. Signed-off-by: Olaf Hering <olaf@aepfle.de> RWMJ: - Move str_vgchange at request of author. - Fix snprintf call in daemon/debug.c
* daemon: Remove e2prog hack (only needed for RHEL 5).Richard W.M. Jones2012-08-304-110/+18
| | | | Instead this patch will be carried out of tree in the oldlinux branch.
* NEW API:xfs:xfs_repairWanlong Gao2012-08-301-0/+122
| | | | | | | | | | Add a new api xfs_repair for repairing an XFS filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Fix non-error return path so it doesn't send two replies. - Document return code.
* New APIs: hivex_*Richard W.M. Jones2012-08-292-1/+515
| | | | | | | | | | | Transscribe many hivex(3) APIs into the libguestfs API. There is one hive handle per libguestfs handle, as with Augeas. Note that hivex uses iconv_open for some APIs (eg. hivex_value_string). But since we delete all the i18n files from the appliance, this doesn't work -- iconv_open returns EINVAL. Therefore hivex APIs which require iconv cannot be bound in the daemon.
* Modified API: mkswap now takes optional arguments.Richard W.M. Jones2012-08-281-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add optional label and uuid arguments, and deprecate mkswap-L and mkswap-U. This also adds a call to udev_settle after creating the swap device. This is an attempt to workaround the following problem seen in Koji and Rawhide: libguestfs: trace: mkswap_L "swapit" "/dev/sda1" libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 83 | 00 00 00 00 | ... guestfsd: main_loop: proc 210 (part_disk) took 2.28 seconds guestfsd: main_loop: new request, len 0x44 mkswap -f -L swapit /dev/sda1 libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 83 | 00 00 00 01 | 00 12 37 cf | ... libguestfs: trace: mkswap_L = 0 libguestfs: trace: swapon_label "swapit" libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 ae | 00 00 00 00 | ... guestfsd: main_loop: proc 131 (mkswap_L) took 0.77 seconds guestfsd: main_loop: new request, len 0x34 swapon -L swapit swapon: cannot find the device for swapit guestfsd: error: swapit: swapon: cannot find the device for swapit libguestfs: recv_from_daemon: 100 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 ae | 00 00 00 01 | 00 12 37 d0 | ... libguestfs: trace: swapon_label = -1 (error) swapon_label: swapit: swapon: cannot find the device for swapit test_swapon_label_0 FAILED
* xfs_growfs: drop the unstructed outputWanlong Gao2012-08-211-7/+6
| | | | | | | Just drop the unstructed output since we can get the structed info from xfs_info instead. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* New API: xfs: xfs_adminWanlong Gao2012-08-211-0/+69
| | | | | | | | | | | Add new api xfs_admin to change parameters of an XFS filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Remove printuuid, printlabel, since they don't change any settings. - Adjusted the documentation. - Fix the tests.
* New API: fill-dir: Fill a directory with files (for testing).Richard W.M. Jones2012-08-171-0/+28
|
* guestfs_ls: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-43/+0
|
* New API: ls0 - List files, separated by \0 characters.Richard W.M. Jones2012-08-171-0/+64
| | | | | This API is not especially useful on its own. It will be used to reimplement guestfs_ls to work without protocol limits.
* guestfs_readlinklist: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-1/+1
|
* guestfs_lstatlist, guestfs_lxattrlist: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-172-3/+3
| | | | | Note that the code to do this was already in virt-ls, so this is change is mostly just moving the code into the core library.
* guestfs_write, guestfs_write_append: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-2/+2
| | | | | | | | Note that we keep the old daemon calls, but rename them as "internal_write" and "internal_write_append". This lets us implement the new library-side calls more efficiently in the common case when the uploaded content is smaller than the message buffer. In most cases the new calls won't end up using a temporary file.
* guestfs_read_lines: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-48/+0
| | | | This also makes a larger test suite for this command.
* guestfs_read_file: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-59/+0
|
* guestfs_find: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-83/+0
| | | | | This also reimplements the virt-ls -R option to use the replacement guestfs_find API, which is simpler (though actually less efficient).
* guestfs_cat: Reimplement to avoid protocol limits.Richard W.M. Jones2012-08-171-69/+0
|
* tar-out: Add list of excluded patterns (--exclude=...) (RHBZ#847881).Richard W.M. Jones2012-08-141-5/+59
|
* daemon: New utility functions 'join_strings', 'concat_strings'.Richard W.M. Jones2012-08-142-0/+48
| | | | Useful functions for concatenating strings together.
* tar-out: Add optional numericowner flag (RHBZ#847880).Richard W.M. Jones2012-08-141-5/+9
| | | | This is equivalent to the tar option --numeric-owner.
* Add optional compress flag to tar-in, tar-out APIs.Richard W.M. Jones2012-08-141-25/+56
| | | | | | | | | | The compress flag can be used to control compression, one of: (none), "compress", "gzip", "bzip2", "xz", "lzop". Thus these calls can now be used instead of tgz-in/tgz-out/txz-in/txz-out, and also support more compression types. Mark these APIs as once_had_no_optargs so that compatibility code is generated.
* xfs: fix a possible memory leakWanlong Gao2012-08-111-0/+1
| | | | | | free out when failure. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* New APIs: rsync, rsync-in, rsync-outRichard W.M. Jones2012-08-112-0/+152
| | | | Implement rsync.
* grep: Add optargs to grep API and deprecate fgrep etc.Richard W.M. Jones2012-08-021-17/+54
| | | | | | | | This commit makes grep into an optargs API, with flags for extended, fixed, [case-]insensitive and compressed. At the same time it deprecates: egrep, fgrep, grepi, egrepi, fgrepi, zgrep, zegrep, zfgrep, zgrepi, zegrepi and zfgrepi.
* xfs: add new api xfs-growfsWanlong Gao2012-08-021-0/+111
| | | | | | New api xfs_growfs for expanding a XFS filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* New API: utsnameRichard W.M. Jones2012-07-302-0/+64
| | | | | | | | | | Typical output: ><fs> utsname uts_sysname: Linux uts_release: 3.5.0-1.fc18.x86_64 uts_version: #1 SMP Mon Jul 23 17:43:39 UTC 2012 uts_machine: x86_64
* New APIs: pvchange-uuid, pvchange-uuid-all, vgchange-uuid, vgchange-uuid-all.Richard W.M. Jones2012-07-251-0/+84
| | | | | | | | These APIs will allow sysprep to change the UUIDs of all PVs and VGs in the system. LVs don't have UUIDs AFAICT, or at least there seems to be no way to change them if they do have them.
* umount: use Dev_or_Path for the argument typeWanlong Gao2012-07-241-3/+0
| | | | | | | | | | | | | | Use Dev_or_Path instead of String. Remove the RESOLVE_DEVICE since Dev_or_Path will generate REQUIRE_ROOT_OR_RESOLVE_DEVICE instead. RWMJ: Note a change in semantics: this now requires root. However this is OK and still works with mkmountpoint and friends because 'is_root_mounted' works even if something is mounted below the root. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* xfs_info: resolve device when doing xfs_info on a deviceWanlong Gao2012-07-241-13/+8
| | | | | | | Resolve device first, like do_umount. Use Dev_or_Path. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* umount: add force umount and lazy umountWanlong Gao2012-07-241-5/+26
| | | | | | Add the option force and lazy for force and lazy umount. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* build: Rename most C files that contain underscore with dash.Richard W.M. Jones2012-07-192-6/+6
| | | | | | | This is just code motion. Some files cannot be renamed. Notably rpcgen input and output files must not contain dash characters, else rpcgen breaks.
* tar-in: Add --no-same-owner flag to tar command when target filesystem ↵Richard W.M. Jones2012-07-181-3/+54
| | | | | | | | | | | | | | | | doesn't support chown (RHBZ#840572). When using tar-in or tools built around it such as virt-make-fs, if the target filesystem is vfat then unpacking the tarball would fail because tar tries to chown(2) files and fails. You would see errors such as: tar: <file>: Cannot change ownership to uid 500, gid 500: Operation not permitted This change detects whether the target filesystem supports chown(2). If not, it adds the --no-same-owner flag to tar to stop it from trying to change the ownership of newly created files.
* daemon: Make 'random_name' into a utility function.Richard W.M. Jones2012-07-183-30/+51
| | | | | This is mostly code motion, although the precise contract of this function changes slightly to make it more generally useful
* New API: add new api xfs_infoWanlong Gao2012-07-182-0/+356
| | | | | | | | | | | | Add xfs_info to show the geometry of the xfs filesystem. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Updated po/POTFILES. - Use xfs_ prefix for all struct fields. - Return uninitialized fields as -1 / empty string. - Copyedit the description.
* augeas: make functions as noreturnWanlong Gao2012-07-181-14/+14
| | | | | | Just make gcc happy. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* case_sensitive_path: Allow trailing path element to be missing (RHBZ#840115).Richard W.M. Jones2012-07-171-15/+21
| | | | | | | | | | | | case_sensitive_path is undefined when the final path element doesn't exist. Currently it returns an error, but this means that creating a new file doesn't work as expected: $ guestfish --rw -i -d windows touch 'win:c:\blah' libguestfs: error: case_sensitive_path: blah no file or directory found with this name We should allow this case (provided there is no trailing slash) so that new files or directories can be created.
* case_sensitive_path: Move variables to top of function.Richard W.M. Jones2012-07-171-6/+8
| | | | This is just code motion.
* generator: Rename 'ntfsresize_opts' API to 'ntfsresize'.Richard W.M. Jones2012-07-141-11/+5
| | | | | By using the once_had_no_optargs flag, this change is backwards compatible for callers.
* generator: Rename 'mkfs_opts' API to 'mkfs'.Richard W.M. Jones2012-07-141-15/+8
| | | | | By using the once_had_no_optargs flag, this change is backwards compatible for callers.
* daemon: Run fsync on block devices after sync (RHBZ#836710).Richard W.M. Jones2012-07-021-0/+78
| | | | | | | | | | | | | | | | | | On Linux, sync(2) does not actually issue a write barrier, thus it doesn't force a flush of the underlying hardware write cache (or qemu's disk cache in the virtual case). This can be a problem, because libguestfs relies on running sync in the appliance, followed by killing qemu (using SIGTERM). In most cases, this is fine, because killing qemu with SIGTERM should cause it to flush out the disk cache before it exits. However we have found various bugs in qemu which cause qemu to crash while doing the flush, leaving the data unwritten (see RHBZ#836913). The solution is to issue fsync(2) to the block devices. This has a write barrier, so it ensures that qemu writes out its cache long before we get around to killing qemu.
* daemon: Code tidy up in devsparts.Richard W.M. Jones2012-07-021-8/+9
| | | | No functional change.
* New API: guestfs_nr_devicesRichard W.M. Jones2012-06-291-0/+17
| | | | | | This returns the number of whole block devices added. It is usually simpler to call this than to list the devices and count them, which is what we do in some places in the current codebase.
* part-get-bootable: Fix when partitions are missing or unordered (RHBZ#602997).Richard W.M. Jones2012-06-221-4/+16
| | | | | | | | The original fix for this in commit 511c82df46f5c6f4a7f984fdb81d4691038ed6da was not complete, in that it did not fix the case of the old (pre '-m' option) parted. This doesn't matter for Fedora, but it matters for RHEL 5 which has this ancient parted.
* New API: device-index.Richard W.M. Jones2012-06-131-0/+23
| | | | | | This returns the index of the device, eg. /dev/sdb => 1. Or you can think of it as the order that the device was added, or the index of the device in guestfs_list_devices.