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/sfdisk.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/sfdisk.c')
-rw-r--r-- | daemon/sfdisk.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c index 8221ffa8..1ce69629 100644 --- a/daemon/sfdisk.c +++ b/daemon/sfdisk.c @@ -29,6 +29,9 @@ #include "daemon.h" #include "actions.h" +GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); +GUESTFSD_EXT_CMD(str_blockdev, blockdev); + static int sfdisk (const char *device, int n, int cyls, int heads, int sectors, const char *extra_flag, @@ -38,7 +41,7 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, char buf[256]; int i; - strcpy (buf, "sfdisk"); + strcpy (buf, str_sfdisk); if (n > 0) sprintf (buf + strlen (buf), " -N %d", n); @@ -101,7 +104,7 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, * other component. In any case, reread the partition table * unconditionally here. */ - (void) command (NULL, NULL, "blockdev", "--rereadpt", device, NULL); + (void) command (NULL, NULL, str_blockdev, "--rereadpt", device, NULL); udev_settle (); @@ -136,7 +139,7 @@ sfdisk_flag (const char *device, const char *flag) char *out, *err; int r; - r = command (&out, &err, "sfdisk", flag, device, NULL); + r = command (&out, &err, str_sfdisk, flag, device, NULL); if (r == -1) { reply_with_error ("%s: %s", device, err); free (out); |