diff options
author | Olaf Hering <olaf@aepfle.de> | 2012-08-30 20:51:27 +0200 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-08-30 20:57:07 +0100 |
commit | 0306c98d319d189281af3c15101c8d343e400f13 (patch) | |
tree | 7781024c541a56152405582ece9c3c0ee2edc49d /daemon/command.c | |
parent | 4aa1464d42c62e8cbff4669f01f53f0425c287e3 (diff) | |
download | libguestfs-0306c98d319d189281af3c15101c8d343e400f13.tar.gz libguestfs-0306c98d319d189281af3c15101c8d343e400f13.tar.xz libguestfs-0306c98d319d189281af3c15101c8d343e400f13.zip |
daemon: collect list of called external commands
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
Diffstat (limited to 'daemon/command.c')
-rw-r--r-- | daemon/command.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/daemon/command.c b/daemon/command.c index 7c67d830..58390333 100644 --- a/daemon/command.c +++ b/daemon/command.c @@ -28,10 +28,13 @@ #include "ignore-value.h" +GUESTFSD_EXT_CMD(str_mount, mount); +GUESTFSD_EXT_CMD(str_umount, umount); + static inline void umount_ignore_fail (const char *path) { - ignore_value (command (NULL, NULL, "umount", path, NULL)); + ignore_value (command (NULL, NULL, str_umount, path, NULL)); } char * @@ -81,15 +84,15 @@ do_command (char *const *argv) return NULL; } - r = command (NULL, NULL, "mount", "--bind", "/dev", sysroot_dev, NULL); + r = command (NULL, NULL, str_mount, "--bind", "/dev", sysroot_dev, NULL); dev_ok = r != -1; - r = command (NULL, NULL, "mount", "--bind", "/dev/pts", sysroot_dev_pts, NULL); + r = command (NULL, NULL, str_mount, "--bind", "/dev/pts", sysroot_dev_pts, NULL); dev_pts_ok = r != -1; - r = command (NULL, NULL, "mount", "--bind", "/proc", sysroot_proc, NULL); + r = command (NULL, NULL, str_mount, "--bind", "/proc", sysroot_proc, NULL); proc_ok = r != -1; - r = command (NULL, NULL, "mount", "--bind", "/selinux", sysroot_selinux, NULL); + r = command (NULL, NULL, str_mount, "--bind", "/selinux", sysroot_selinux, NULL); selinux_ok = r != -1; - r = command (NULL, NULL, "mount", "--bind", "/sys", sysroot_sys, NULL); + r = command (NULL, NULL, str_mount, "--bind", "/sys", sysroot_sys, NULL); sys_ok = r != -1; CHROOT_IN; |