mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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
This commit is contained in:
committed by
Richard W.M. Jones
parent
4aa1464d42
commit
0306c98d31
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user