GUESTFSD_EXT_CMD was used by OpenSUSE to track which external commands
are run by the daemon and package those commands into the appliance.
It is no longer used by recent SUSE builds, so remove it.
Thanks: Pino Toscano, Olaf Hering.
---
daemon/9p.c | 3 +-
daemon/available.c | 7 +--
daemon/base64.c | 6 +--
daemon/blkid.c | 10 ++---
daemon/blockdev.c | 4 +-
daemon/btrfs.c | 109 ++++++++++++++++++++++-------------------------
daemon/checksum.c | 26 ++++-------
daemon/cmp.c | 4 +-
daemon/compress.c | 24 ++++-------
daemon/cpio.c | 4 +-
daemon/cpmv.c | 11 ++---
daemon/daemon.h | 3 --
daemon/dd.c | 4 +-
daemon/debug.c | 33 +++++---------
daemon/df.c | 6 +--
daemon/dir.c | 4 +-
daemon/dmesg.c | 4 +-
daemon/du.c | 4 +-
daemon/ext2.c | 48 +++++++++------------
daemon/file.c | 10 ++---
daemon/find.c | 4 +-
daemon/findfs.c | 4 +-
daemon/fsck.c | 4 +-
daemon/fstrim.c | 6 +--
daemon/grub.c | 6 +--
daemon/guestfsd.c | 7 +--
daemon/hotplug.c | 4 +-
daemon/initrd.c | 5 +--
daemon/inotify.c | 3 +-
daemon/isoinfo.c | 4 +-
daemon/labels.c | 4 +-
daemon/ldm.c | 22 +++++-----
daemon/link.c | 4 +-
daemon/ls.c | 6 +--
daemon/luks.c | 14 +++---
daemon/lvm-filter.c | 19 +++------
daemon/lvm.c | 68 ++++++++++++++---------------
daemon/md.c | 10 ++---
daemon/mkfs.c | 7 +--
daemon/modprobe.c | 6 +--
daemon/mount.c | 15 +++----
daemon/ntfs.c | 21 ++++-----
daemon/ntfsclone.c | 7 +--
daemon/parted.c | 66 ++++++++++++++--------------
daemon/rsync.c | 6 +--
daemon/scrub.c | 10 ++---
daemon/selinux-relabel.c | 8 ++--
daemon/sfdisk.c | 9 ++--
daemon/sh.c | 20 ++++-----
daemon/sleuthkit.c | 13 +++---
daemon/squashfs.c | 6 +--
daemon/swap.c | 29 ++++++-------
daemon/syslinux.c | 11 ++---
daemon/tar.c | 6 +--
daemon/xfs.c | 16 +++----
daemon/zero.c | 10 ++---
daemon/zerofree.c | 6 +--
57 files changed, 306 insertions(+), 484 deletions(-)
diff --git a/daemon/9p.c b/daemon/9p.c
index fc5b01736..55644249d 100644
--- a/daemon/9p.c
+++ b/daemon/9p.c
@@ -33,7 +33,6 @@
#include "actions.h"
#define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio"
-GUESTFSD_EXT_CMD(str_mount, mount);
static char *read_whole_file (const char *filename);
@@ -215,7 +214,7 @@ do_mount_9p (const char *mount_tag, const char *mountpoint, const char
*options)
}
r = command (NULL, &err,
- str_mount, "-o", opts, "-t", "9p",
mount_tag, mp, NULL);
+ "mount", "-o", opts, "-t", "9p",
mount_tag, mp, NULL);
if (r == -1) {
reply_with_error ("%s on %s: %s", mount_tag, mountpoint, err);
return -1;
diff --git a/daemon/available.c b/daemon/available.c
index 977c4dead..5ecb3f355 100644
--- a/daemon/available.c
+++ b/daemon/available.c
@@ -30,9 +30,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_grep, grep);
-GUESTFSD_EXT_CMD(str_modprobe, modprobe);
-
int
do_internal_feature_available (const char *group)
{
@@ -79,7 +76,7 @@ test_proc_filesystems (const char *filesystem)
return -1;
}
- r = commandr (NULL, &err, str_grep, regex, "/proc/filesystems", NULL);
+ r = commandr (NULL, &err, "grep", regex, "/proc/filesystems",
NULL);
if (r == -1 || r >= 2) {
fprintf (stderr, "grep /proc/filesystems: %s", err);
return -1;
@@ -92,7 +89,7 @@ test_proc_filesystems (const char *filesystem)
static void
modprobe (const char *module)
{
- ignore_value (command (NULL, NULL, str_modprobe, module, NULL));
+ ignore_value (command (NULL, NULL, "modprobe", module, NULL));
}
/* Internal function for testing if a filesystem is available. Note
diff --git a/daemon/base64.c b/daemon/base64.c
index 3468c3342..badb95efa 100644
--- a/daemon/base64.c
+++ b/daemon/base64.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_base64, base64);
-
static int
write_cb (void *fd_ptr, const void *buf, size_t len)
{
@@ -48,7 +46,7 @@ do_base64_in (const char *file)
CLEANUP_FREE char *cmd = NULL;
int fd;
- if (asprintf_nowarn (&cmd, "%s -d -i > %R", str_base64, file) == -1)
{
+ if (asprintf_nowarn (&cmd, "%s -d -i > %R", "base64", file)
== -1) {
err = errno;
cancel_receive ();
errno = err;
@@ -132,7 +130,7 @@ do_base64_out (const char *file)
}
/* Construct the command. */
- if (asprintf_nowarn (&cmd, "%s %Q", str_base64, buf) == -1) {
+ if (asprintf_nowarn (&cmd, "%s %Q", "base64", buf) == -1) {
reply_with_perror ("asprintf");
return -1;
}
diff --git a/daemon/blkid.c b/daemon/blkid.c
index 1fe5ff93a..d9858d5c8 100644
--- a/daemon/blkid.c
+++ b/daemon/blkid.c
@@ -28,8 +28,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_blkid, blkid);
-
char *
get_blkid_tag (const char *device, const char *tag)
{
@@ -39,7 +37,7 @@ get_blkid_tag (const char *device, const char *tag)
size_t len;
r = commandr (&out, &err,
- str_blkid,
+ "blkid",
/* Adding -c option kills all caching, even on RHEL 5. */
"-c", "/dev/null",
"-o", "value", "-s", tag, device, NULL);
@@ -107,7 +105,7 @@ test_blkid_p_i_opt (void)
int r;
CLEANUP_FREE char *err = NULL, *err2 = NULL;
- r = commandr (NULL, &err, str_blkid, "-p", "/dev/null", NULL);
+ r = commandr (NULL, &err, "blkid", "-p", "/dev/null",
NULL);
if (r == -1) {
/* This means we couldn't run the blkid command at all. */
command_failed:
@@ -119,7 +117,7 @@ test_blkid_p_i_opt (void)
return 0;
}
- r = commandr (NULL, &err2, str_blkid, "-i", NULL);
+ r = commandr (NULL, &err2, "blkid", "-i", NULL);
if (r == -1)
goto command_failed;
@@ -140,7 +138,7 @@ blkid_with_p_i_opt (const char *device)
CLEANUP_FREE_STRING_LIST char **lines = NULL;
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret);
- r = command (&out, &err, str_blkid, "-c", "/dev/null",
+ r = command (&out, &err, "blkid", "-c",
"/dev/null",
"-p", "-i", "-o", "export",
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
diff --git a/daemon/blockdev.c b/daemon/blockdev.c
index 6e8821d92..2083801af 100644
--- a/daemon/blockdev.c
+++ b/daemon/blockdev.c
@@ -28,8 +28,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_blockdev, blockdev);
-
/* These functions are all about using the blockdev command, so
* we centralize it in one call.
*/
@@ -40,7 +38,7 @@ call_blockdev (const char *device, const char *switc, int extraarg, int
prints)
int64_t rv;
CLEANUP_FREE char *out = NULL, *err = NULL;
const char *argv[] = {
- str_blockdev,
+ "blockdev",
switc,
NULL,
NULL,
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 5f1e5d1d0..8fd327c09 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -33,13 +33,6 @@
#include "c-ctype.h"
#include "ignore-value.h"
-GUESTFSD_EXT_CMD(str_btrfs, btrfs);
-GUESTFSD_EXT_CMD(str_btrfstune, btrfstune);
-GUESTFSD_EXT_CMD(str_btrfsck, btrfsck);
-GUESTFSD_EXT_CMD(str_mkfs_btrfs, mkfs.btrfs);
-GUESTFSD_EXT_CMD(str_umount, umount);
-GUESTFSD_EXT_CMD(str_btrfsimage, btrfs-image);
-
COMPILE_REGEXP (re_btrfs_subvolume_list,
"ID\\s+(\\d+).*\\s"
"top level\\s+(\\d+).*\\s"
@@ -51,7 +44,7 @@ int
optgroup_btrfs_available (void)
{
return test_mode ||
- (prog_exists (str_btrfs) && filesystem_available ("btrfs") >
0);
+ (prog_exists ("btrfs") && filesystem_available ("btrfs")
> 0);
}
char *
@@ -62,7 +55,7 @@ btrfs_get_label (const char *device)
char *out = NULL;
size_t len;
- r = command (&out, &err, str_btrfs, "filesystem", "label",
+ r = command (&out, &err, "btrfs", "filesystem",
"label",
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -84,7 +77,7 @@ btrfs_set_label (const char *device, const char *label)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_btrfs, "filesystem", "label",
+ r = command (NULL, &err, "btrfs", "filesystem",
"label",
device, label, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -110,7 +103,7 @@ do_btrfs_filesystem_resize (const char *filesystem, int64_t size)
size_t i = 0;
char size_str[32];
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "filesystem");
ADD_ARG (argv, i, "resize");
@@ -169,7 +162,7 @@ do_mkfs_btrfs (char *const *devices,
return -1;
}
- ADD_ARG (argv, i, str_mkfs_btrfs);
+ ADD_ARG (argv, i, "mkfs.btrfs");
/* Optional arguments. */
if (optargs_bitmask & GUESTFS_MKFS_BTRFS_ALLOCSTART_BITMASK) {
@@ -290,7 +283,7 @@ do_btrfs_subvolume_snapshot (const char *source, const char *dest, int
ro,
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "snapshot");
@@ -333,7 +326,7 @@ do_btrfs_subvolume_delete (const char *subvolume)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "delete");
ADD_ARG (argv, i, subvolume_buf);
@@ -364,7 +357,7 @@ do_btrfs_subvolume_create (const char *dest, const char *qgroupid)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "create");
@@ -426,7 +419,7 @@ umount (char *fs_buf, const mountable_t *fs)
if (fs->type != MOUNTABLE_PATH) {
CLEANUP_FREE char *err = NULL;
- if (command (NULL, &err, str_umount, fs_buf, NULL) == -1) {
+ if (command (NULL, &err, "umount", fs_buf, NULL) == -1) {
reply_with_error ("umount: %s", err);
return -1;
}
@@ -455,7 +448,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
if (!fs_buf)
return NULL;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "list");
ADD_ARG (argv, i, fs_buf);
@@ -590,7 +583,7 @@ do_btrfs_subvolume_set_default (int64_t id, const char *fs)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "set-default");
ADD_ARG (argv, i, buf);
@@ -622,7 +615,7 @@ do_btrfs_subvolume_get_default (const mountable_t *fs)
if (fs_buf == NULL)
goto error;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "get-default");
ADD_ARG (argv, i, fs_buf);
@@ -661,7 +654,7 @@ do_btrfs_filesystem_sync (const char *fs)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "filesystem");
ADD_ARG (argv, i, "sync");
ADD_ARG (argv, i, fs_buf);
@@ -692,7 +685,7 @@ do_btrfs_filesystem_balance (const char *fs)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "balance");
ADD_ARG (argv, i, fs_buf);
ADD_ARG (argv, i, NULL);
@@ -715,7 +708,7 @@ test_btrfs_device_add_needs_force (void)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, str_btrfs, "device", "add",
"--help", NULL);
+ r = command (&out, &err, "btrfs", "device",
"add", "--help", NULL);
if (r == -1) {
reply_with_error ("%s: %s", "btrfs device add --help", err);
return -1;
@@ -756,7 +749,7 @@ do_btrfs_device_add (char *const *devices, const char *fs)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "device");
ADD_ARG (argv, i, "add");
@@ -799,7 +792,7 @@ do_btrfs_device_delete (char *const *devices, const char *fs)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "device");
ADD_ARG (argv, i, "delete");
@@ -840,7 +833,7 @@ test_btrfstune_uuid_opt (void)
CLEANUP_FREE char *err = NULL;
- int r = commandr (NULL, &err, str_btrfstune, "--help", NULL);
+ int r = commandr (NULL, &err, "btrfstune", "--help", NULL);
if (r == -1) {
reply_with_error ("btrfstune: %s", err);
@@ -868,7 +861,7 @@ do_btrfs_set_seeding (const char *device, int svalue)
const char *s_value = svalue ? "1" : "0";
- r = commandr (NULL, &err, str_btrfstune, "-S", s_value, device, NULL);
+ r = commandr (NULL, &err, "btrfstune", "-S", s_value, device,
NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -887,7 +880,7 @@ btrfs_set_uuid (const char *device, const char *uuid)
if (has_uuid_opts <= 0)
NOT_SUPPORTED (-1, "btrfs filesystems' UUID cannot be changed");
- r = commandr (NULL, &err, str_btrfstune, "-f", "-U", uuid,
device, NULL);
+ r = commandr (NULL, &err, "btrfstune", "-f", "-U",
uuid, device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
@@ -907,7 +900,7 @@ btrfs_set_uuid_random (const char *device)
if (has_uuid_opts <= 0)
NOT_SUPPORTED (-1, "btrfs filesystems' UUID cannot be changed");
- r = commandr (NULL, &err, str_btrfstune, "-f", "-u", device,
NULL);
+ r = commandr (NULL, &err, "btrfstune", "-f", "-u",
device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -927,7 +920,7 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair)
const char *argv[MAX_ARGS];
char super_s[64];
- ADD_ARG (argv, i, str_btrfsck);
+ ADD_ARG (argv, i, "btrfsck");
/* Optional arguments. */
if (optargs_bitmask & GUESTFS_BTRFS_FSCK_SUPERBLOCK_BITMASK) {
@@ -1025,7 +1018,7 @@ do_btrfs_subvolume_show (const char *subvolume)
return NULL;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "subvolume");
ADD_ARG (argv, i, "show");
ADD_ARG (argv, i, subvolume_buf);
@@ -1164,7 +1157,7 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable)
if (fs_buf == NULL)
goto error;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "quota");
if (enable)
ADD_ARG (argv, i, "enable");
@@ -1199,7 +1192,7 @@ do_btrfs_quota_rescan (const mountable_t *fs)
if (fs_buf == NULL)
goto error;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "quota");
ADD_ARG (argv, i, "rescan");
ADD_ARG (argv, i, fs_buf);
@@ -1234,7 +1227,7 @@ do_btrfs_qgroup_limit (const char *subvolume, int64_t size)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "limit");
snprintf (size_str, sizeof size_str, "%" PRIi64, size);
@@ -1267,7 +1260,7 @@ do_btrfs_qgroup_create (const char *qgroupid, const char
*subvolume)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "create");
ADD_ARG (argv, i, qgroupid);
@@ -1299,7 +1292,7 @@ do_btrfs_qgroup_destroy (const char *qgroupid, const char
*subvolume)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "destroy");
ADD_ARG (argv, i, qgroupid);
@@ -1332,7 +1325,7 @@ test_btrfs_qgroup_show_raw_opt (void)
CLEANUP_FREE char *err = NULL;
CLEANUP_FREE char *out = NULL;
- int r = commandr (&out, &err, str_btrfs, "qgroup", "show",
"--help", NULL);
+ int r = commandr (&out, &err, "btrfs", "qgroup",
"show", "--help", NULL);
if (r == -1) {
reply_with_error ("btrfs qgroup show --help: %s", err);
@@ -1366,7 +1359,7 @@ do_btrfs_qgroup_show (const char *path)
return NULL;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "show");
if (has_raw_opt > 0)
@@ -1449,7 +1442,7 @@ do_btrfs_qgroup_assign (const char *src, const char *dst, const char
*path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "assign");
ADD_ARG (argv, i, src);
@@ -1482,7 +1475,7 @@ do_btrfs_qgroup_remove (const char *src, const char *dst, const char
*path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "qgroup");
ADD_ARG (argv, i, "remove");
ADD_ARG (argv, i, src);
@@ -1515,7 +1508,7 @@ do_btrfs_scrub_start (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "scrub");
ADD_ARG (argv, i, "start");
ADD_ARG (argv, i, path_buf);
@@ -1546,7 +1539,7 @@ do_btrfs_scrub_cancel (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "scrub");
ADD_ARG (argv, i, "cancel");
ADD_ARG (argv, i, path_buf);
@@ -1577,7 +1570,7 @@ do_btrfs_scrub_resume (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "scrub");
ADD_ARG (argv, i, "resume");
ADD_ARG (argv, i, path_buf);
@@ -1608,7 +1601,7 @@ do_btrfs_balance_pause (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "balance");
ADD_ARG (argv, i, "pause");
ADD_ARG (argv, i, path_buf);
@@ -1639,7 +1632,7 @@ do_btrfs_balance_cancel (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "balance");
ADD_ARG (argv, i, "cancel");
ADD_ARG (argv, i, path_buf);
@@ -1670,7 +1663,7 @@ do_btrfs_balance_resume (const char *path)
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "balance");
ADD_ARG (argv, i, "resume");
ADD_ARG (argv, i, path_buf);
@@ -1702,7 +1695,7 @@ do_btrfs_filesystem_defragment (const char *path, int flush, const
char *compres
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "filesystem");
ADD_ARG (argv, i, "defragment");
ADD_ARG (argv, i, "-r");
@@ -1742,7 +1735,7 @@ do_btrfs_rescue_chunk_recover (const char *device)
CLEANUP_FREE char *err = NULL;
int r;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "rescue");
ADD_ARG (argv, i, "chunk-recover");
ADD_ARG (argv, i, "-y");
@@ -1767,7 +1760,7 @@ do_btrfs_rescue_super_recover (const char *device)
CLEANUP_FREE char *err = NULL;
int r;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "rescue");
ADD_ARG (argv, i, "super-recover");
ADD_ARG (argv, i, "-y");
@@ -1805,7 +1798,7 @@ do_btrfs_balance_status (const char *path)
return NULL;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "balance");
ADD_ARG (argv, i, "status");
ADD_ARG (argv, i, path_buf);
@@ -1918,7 +1911,7 @@ do_btrfs_scrub_status (const char *path)
return NULL;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "scrub");
ADD_ARG (argv, i, "status");
ADD_ARG (argv, i, "-R");
@@ -2052,7 +2045,7 @@ do_btrfstune_seeding (const char *device, int svalue)
int r;
const char *s_value = svalue ? "1" : "0";
- ADD_ARG (argv, i, str_btrfstune);
+ ADD_ARG (argv, i, "btrfstune");
ADD_ARG (argv, i, "-S");
ADD_ARG (argv, i, s_value);
if (svalue == 0)
@@ -2078,7 +2071,7 @@ do_btrfstune_enable_extended_inode_refs (const char *device)
CLEANUP_FREE char *err = NULL;
int r;
- ADD_ARG (argv, i, str_btrfstune);
+ ADD_ARG (argv, i, "btrfstune");
ADD_ARG (argv, i, "-r");
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
@@ -2101,7 +2094,7 @@ do_btrfstune_enable_skinny_metadata_extent_refs (const char
*device)
CLEANUP_FREE char *err = NULL;
int r;
- ADD_ARG (argv, i, str_btrfstune);
+ ADD_ARG (argv, i, "btrfstune");
ADD_ARG (argv, i, "-x");
ADD_ARG (argv, i, device);
ADD_ARG (argv, i, NULL);
@@ -2137,7 +2130,7 @@ do_btrfs_image (char *const *sources, const char *image,
return -1;
}
- ADD_ARG (argv, i, str_btrfsimage);
+ ADD_ARG (argv, i, "btrfs-image");
if ((optargs_bitmask & GUESTFS_BTRFS_IMAGE_COMPRESSLEVEL_BITMASK)
&& compresslevel >= 0) {
@@ -2182,7 +2175,7 @@ do_btrfs_replace (const char *srcdev, const char *targetdev,
return -1;
}
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "replace");
ADD_ARG (argv, i, "start");
ADD_ARG (argv, i, "-B");
@@ -2213,7 +2206,7 @@ do_btrfs_filesystem_show (const char *device)
CLEANUP_FREE_STRING_LIST char **lines = NULL;
int r;
- ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "btrfs");
ADD_ARG (argv, i, "filesystem");
ADD_ARG (argv, i, "show");
ADD_ARG (argv, i, device);
@@ -2305,7 +2298,7 @@ test_btrfs_min_dev_size (void)
if (result != -1)
return result;
- r = commandr (&out, &err, str_btrfs, "--help", NULL);
+ r = commandr (&out, &err, "btrfs", "--help", NULL);
if (r == -1) {
reply_with_error ("btrfs: %s", err);
@@ -2340,7 +2333,7 @@ btrfs_minimum_size (const char *path)
return -1;
}
- r = command (&out, &err, str_btrfs, "inspect-internal",
+ r = command (&out, &err, "btrfs", "inspect-internal",
"min-dev-size", buf, NULL);
if (r == -1) {
diff --git a/daemon/checksum.c b/daemon/checksum.c
index da47a0931..088b04165 100644
--- a/daemon/checksum.c
+++ b/daemon/checksum.c
@@ -29,33 +29,23 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_find, find);
-GUESTFSD_EXT_CMD(str_xargs, xargs);
-GUESTFSD_EXT_CMD(str_cksum, cksum);
-GUESTFSD_EXT_CMD(str_md5sum, md5sum);
-GUESTFSD_EXT_CMD(str_sha1sum, sha1sum);
-GUESTFSD_EXT_CMD(str_sha224sum, sha224sum);
-GUESTFSD_EXT_CMD(str_sha256sum, sha256sum);
-GUESTFSD_EXT_CMD(str_sha384sum, sha384sum);
-GUESTFSD_EXT_CMD(str_sha512sum, sha512sum);
-
static const char *
program_of_csum (const char *csumtype)
{
if (STRCASEEQ (csumtype, "crc"))
- return str_cksum;
+ return "cksum";
else if (STRCASEEQ (csumtype, "md5"))
- return str_md5sum;
+ return "md5sum";
else if (STRCASEEQ (csumtype, "sha1"))
- return str_sha1sum;
+ return "sha1sum";
else if (STRCASEEQ (csumtype, "sha224"))
- return str_sha224sum;
+ return "sha224sum";
else if (STRCASEEQ (csumtype, "sha256"))
- return str_sha256sum;
+ return "sha256sum";
else if (STRCASEEQ (csumtype, "sha384"))
- return str_sha384sum;
+ return "sha384sum";
else if (STRCASEEQ (csumtype, "sha512"))
- return str_sha512sum;
+ return "sha512sum";
else {
reply_with_error ("unknown checksum type, expecting
crc|md5|sha1|sha224|sha256|sha384|sha512");
return NULL;
@@ -166,7 +156,7 @@ do_checksums_out (const char *csumtype, const char *dir)
cmd = NULL;
if (asprintf_nowarn (&cmd, "cd %Q && %s -type f -print0 | %s -0
%s",
- sysrootdir, str_find, str_xargs, program) == -1) {
+ sysrootdir, "find", "xargs", program) == -1)
{
reply_with_perror ("asprintf");
return -1;
}
diff --git a/daemon/cmp.c b/daemon/cmp.c
index 61506b6c1..e3c0e3e1a 100644
--- a/daemon/cmp.c
+++ b/daemon/cmp.c
@@ -27,8 +27,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_cmp, cmp);
-
int
do_equal (const char *file1, const char *file2)
{
@@ -48,7 +46,7 @@ do_equal (const char *file1, const char *file2)
return -1;
}
- r = commandr (NULL, &err, str_cmp, "-s", file1buf, file2buf, NULL);
+ r = commandr (NULL, &err, "cmp", "-s", file1buf, file2buf,
NULL);
if (r == -1 || r > 1) {
reply_with_error ("%s", err);
return -1;
diff --git a/daemon/compress.c b/daemon/compress.c
index 36f4e66f7..75eaae0c7 100644
--- a/daemon/compress.c
+++ b/daemon/compress.c
@@ -27,12 +27,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_compress, compress);
-GUESTFSD_EXT_CMD(str_gzip, gzip);
-GUESTFSD_EXT_CMD(str_bzip2, bzip2);
-GUESTFSD_EXT_CMD(str_xz, xz);
-GUESTFSD_EXT_CMD(str_lzop, lzop);
-
/* Has one FileOut parameter. */
static int
do_compressX_out (const char *file, const char *filter, int is_device)
@@ -126,15 +120,15 @@ get_filter (const char *ctype, int level, char *ret, size_t n)
reply_with_error ("compress: cannot use optional level parameter with this
compression type");
return -1;
}
- snprintf (ret, n, "%s -c", str_compress);
+ snprintf (ret, n, "%s -c", "compress");
return 0;
}
else if (STREQ (ctype, "gzip")) {
CHECK_SUPPORTED ("gzip");
if (level == -1)
- snprintf (ret, n, "%s -c", str_gzip);
+ snprintf (ret, n, "%s -c", "gzip");
else if (level >= 1 && level <= 9)
- snprintf (ret, n, "%s -c -%d", str_gzip, level);
+ snprintf (ret, n, "%s -c -%d", "gzip", level);
else {
reply_with_error ("gzip: incorrect value for level parameter");
return -1;
@@ -144,9 +138,9 @@ get_filter (const char *ctype, int level, char *ret, size_t n)
else if (STREQ (ctype, "bzip2")) {
CHECK_SUPPORTED ("bzip2");
if (level == -1)
- snprintf (ret, n, "%s -c", str_bzip2);
+ snprintf (ret, n, "%s -c", "bzip2");
else if (level >= 1 && level <= 9)
- snprintf (ret, n, "%s -c -%d", str_bzip2, level);
+ snprintf (ret, n, "%s -c -%d", "bzip2", level);
else {
reply_with_error ("bzip2: incorrect value for level parameter");
return -1;
@@ -156,9 +150,9 @@ get_filter (const char *ctype, int level, char *ret, size_t n)
else if (STREQ (ctype, "xz")) {
CHECK_SUPPORTED ("xz");
if (level == -1)
- snprintf (ret, n, "%s -c", str_xz);
+ snprintf (ret, n, "%s -c", "xz");
else if (level >= 0 && level <= 9)
- snprintf (ret, n, "%s -c -%d", str_xz, level);
+ snprintf (ret, n, "%s -c -%d", "xz", level);
else {
reply_with_error ("xz: incorrect value for level parameter");
return -1;
@@ -168,9 +162,9 @@ get_filter (const char *ctype, int level, char *ret, size_t n)
else if (STREQ (ctype, "lzop")) {
CHECK_SUPPORTED ("lzop");
if (level == -1)
- snprintf (ret, n, "%s -c", str_lzop);
+ snprintf (ret, n, "%s -c", "lzop");
else if (level >= 1 && level <= 9)
- snprintf (ret, n, "%s -c -%d", str_lzop, level);
+ snprintf (ret, n, "%s -c -%d", "lzop", level);
else {
reply_with_error ("lzop: incorrect value for level parameter");
return -1;
diff --git a/daemon/cpio.c b/daemon/cpio.c
index d1459b15d..09491ac9c 100644
--- a/daemon/cpio.c
+++ b/daemon/cpio.c
@@ -33,8 +33,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_cpio, cpio);
-
/* Has one FileOut parameter. */
/* Takes optional arguments, consult optargs_bitmask. */
int
@@ -82,7 +80,7 @@ do_cpio_out (const char *dir, const char *format)
if (asprintf_nowarn (&cmd, "cd %Q && find -print0 | %s -0 -o -H %s
--quiet",
buf,
- str_cpio,
+ "cpio",
format) == -1) {
reply_with_perror ("asprintf");
return -1;
diff --git a/daemon/cpmv.c b/daemon/cpmv.c
index 841ac95ce..3eba596b1 100644
--- a/daemon/cpmv.c
+++ b/daemon/cpmv.c
@@ -25,33 +25,30 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_cp, cp);
-GUESTFSD_EXT_CMD(str_mv, mv);
-
static int cpmv_cmd (const char *cmd, const char *flags, const char *src, const char
*dest);
int
do_cp (const char *src, const char *dest)
{
- return cpmv_cmd (str_cp, NULL, src, dest);
+ return cpmv_cmd ("cp", NULL, src, dest);
}
int
do_cp_a (const char *src, const char *dest)
{
- return cpmv_cmd (str_cp, "-a", src, dest);
+ return cpmv_cmd ("cp", "-a", src, dest);
}
int
do_cp_r (const char *src, const char *dest)
{
- return cpmv_cmd (str_cp, "-rP", src, dest);
+ return cpmv_cmd ("cp", "-rP", src, dest);
}
int
do_mv (const char *src, const char *dest)
{
- return cpmv_cmd (str_mv, NULL, src, dest);
+ return cpmv_cmd ("mv", NULL, src, dest);
}
static int
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 50ce41306..18954b03a 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -397,7 +397,4 @@ extern int upload_to_fd (int fd, const char *filename);
} \
} while (0)
-#define __external_command __attribute__((__section__(".guestfsd_ext_cmds")))
-#define GUESTFSD_EXT_CMD(___ext_cmd_var, ___ext_cmd_str) static const char
___ext_cmd_var[] __external_command = #___ext_cmd_str
-
#endif /* GUESTFSD_DAEMON_H */
diff --git a/daemon/dd.c b/daemon/dd.c
index d0390d8b9..15f3f7a6c 100644
--- a/daemon/dd.c
+++ b/daemon/dd.c
@@ -27,8 +27,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_dd, dd);
-
int
do_dd (const char *src, const char *dest)
{
@@ -59,7 +57,7 @@ do_dd (const char *src, const char *dest)
return -1;
}
- r = command (NULL, &err, str_dd, "bs=1024K", if_arg, of_arg, NULL);
+ r = command (NULL, &err, "dd", "bs=1024K", if_arg, of_arg,
NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", src, dest, err);
return -1;
diff --git a/daemon/debug.c b/daemon/debug.c
index e2d43a7ca..9e9100c4f 100644
--- a/daemon/debug.c
+++ b/daemon/debug.c
@@ -33,16 +33,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_printenv, printenv);
-GUESTFSD_EXT_CMD(str_ldd, ldd);
-GUESTFSD_EXT_CMD(str_ls, ls);
-GUESTFSD_EXT_CMD(str_find, find);
-GUESTFSD_EXT_CMD(str_xargs, xargs);
-GUESTFSD_EXT_CMD(str_file, file);
-GUESTFSD_EXT_CMD(str_grep, grep);
-GUESTFSD_EXT_CMD(str_gawk, gawk);
-GUESTFSD_EXT_CMD(str_sh, sh);
-
/* This command exposes debugging information, internals and
* status. There is no comprehensive documentation for this
* command. You have to look at the source code in this file
@@ -301,7 +291,7 @@ debug_env (const char *subcmd, size_t argc, char *const *const argv)
char *out;
CLEANUP_FREE char *err = NULL;
- r = command (&out, &err, str_printenv, NULL);
+ r = command (&out, &err, "printenv", NULL);
if (r == -1) {
reply_with_error ("printenv: %s", err);
free (out);
@@ -380,16 +370,13 @@ debug_binaries (const char *subcmd, size_t argc, char *const *const
argv)
int r;
char *out;
CLEANUP_FREE char *err = NULL;
- char cmd[256];
+ const char *cmd =
+ "find / -xdev -type f -executable "
+ "| xargs file -i "
+ "| grep application/x-executable "
+ "| gawk -F: '{print $1}'";
- snprintf (cmd, sizeof (cmd),
- "%s / -xdev -type f -executable "
- "| %s %s -i "
- "| %s application/x-executable "
- "| %s -F: '{print $1}'",
- str_find, str_xargs, str_file, str_grep, str_gawk);
-
- r = command (&out, &err, str_sh, "-c", cmd, NULL);
+ r = command (&out, &err, "sh", "-c", cmd, NULL);
if (r == -1) {
reply_with_error ("find: %s", err);
free (out);
@@ -420,7 +407,7 @@ debug_ldd (const char *subcmd, size_t argc, char *const *const argv)
* Also 'ldd' randomly sends messages to stderr and errors to stdout
* depending on the phase of the moon.
*/
- r = command (&out, &err, str_ldd, "-r", argv[0], NULL);
+ r = command (&out, &err, "ldd", "-r", argv[0], NULL);
if (r == -1) {
reply_with_error ("ldd: %s: %s", argv[0], err);
free (out);
@@ -457,7 +444,7 @@ debug_ls (const char *subcmd, size_t argc, char *const *const argv)
return NULL;
}
- cargv[0] = str_ls;
+ cargv[0] = "ls";
cargv[1] = "-a";
for (i = 0; i < len; ++i)
cargv[2+i] = argv[i];
@@ -490,7 +477,7 @@ debug_ll (const char *subcmd, size_t argc, char *const *const argv)
return NULL;
}
- cargv[0] = str_ls;
+ cargv[0] = "ls";
cargv[1] = "-la";
for (i = 0; i < len; ++i)
cargv[2+i] = argv[i];
diff --git a/daemon/df.c b/daemon/df.c
index 80b765f30..1b68a7b55 100644
--- a/daemon/df.c
+++ b/daemon/df.c
@@ -27,8 +27,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_df, df);
-
char *
do_df (void)
{
@@ -38,7 +36,7 @@ do_df (void)
NEED_ROOT (0, return NULL);
- r = command (&out, &err, str_df, NULL);
+ r = command (&out, &err, "df", NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
@@ -57,7 +55,7 @@ do_df_h (void)
NEED_ROOT (0, return NULL);
- r = command (&out, &err, str_df, "-h", NULL);
+ r = command (&out, &err, "df", "-h", NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
diff --git a/daemon/dir.c b/daemon/dir.c
index 07dc68f17..b79aca1e5 100644
--- a/daemon/dir.c
+++ b/daemon/dir.c
@@ -29,8 +29,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_rm, rm);
-
int
do_rmdir (const char *path)
{
@@ -69,7 +67,7 @@ do_rm_rf (const char *path)
return -1;
}
- r = command (NULL, &err, str_rm, "-rf", buf, NULL);
+ r = command (NULL, &err, "rm", "-rf", buf, NULL);
/* rm -rf is never supposed to fail. I/O errors perhaps? */
if (r == -1) {
reply_with_error ("%s: %s", path, err);
diff --git a/daemon/dmesg.c b/daemon/dmesg.c
index 5e16861f2..8f2f33ee0 100644
--- a/daemon/dmesg.c
+++ b/daemon/dmesg.c
@@ -27,8 +27,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_dmesg, dmesg);
-
char *
do_dmesg (void)
{
@@ -36,7 +34,7 @@ do_dmesg (void)
CLEANUP_FREE char *err = NULL;
int r;
- r = command (&out, &err, str_dmesg, NULL);
+ r = command (&out, &err, "dmesg", NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
diff --git a/daemon/du.c b/daemon/du.c
index 5bb764075..7e6e329a3 100644
--- a/daemon/du.c
+++ b/daemon/du.c
@@ -28,8 +28,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_du, du);
-
int64_t
do_du (const char *path)
{
@@ -46,7 +44,7 @@ do_du (const char *path)
pulse_mode_start ();
- r = command (&out, &err, str_du, "-s", buf, NULL);
+ r = command (&out, &err, "du", "-s", buf, NULL);
if (r == -1) {
pulse_mode_cancel ();
reply_with_error ("%s: %s", path, err);
diff --git a/daemon/ext2.c b/daemon/ext2.c
index d694b236e..0c776b6d1 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -33,14 +33,6 @@
#define MAX_ARGS 128
-GUESTFSD_EXT_CMD(str_tune2fs, tune2fs);
-GUESTFSD_EXT_CMD(str_e2fsck, e2fsck);
-GUESTFSD_EXT_CMD(str_resize2fs, resize2fs);
-GUESTFSD_EXT_CMD(str_mke2fs, mke2fs);
-GUESTFSD_EXT_CMD(str_lsattr, lsattr);
-GUESTFSD_EXT_CMD(str_chattr, chattr);
-GUESTFSD_EXT_CMD(str_e2label, e2label);
-
/*
https://bugzilla.redhat.com/show_bug.cgi?id=978302#c1 */
int
fstype_is_extfs (const char *fstype)
@@ -57,7 +49,7 @@ do_tune2fs_l (const char *device)
char *p, *pend, *colon;
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret);
- r = command (&out, &err, str_tune2fs, "-l", device, NULL);
+ r = command (&out, &err, "tune2fs", "-l", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -136,7 +128,7 @@ do_set_e2label (const char *device, const char *label)
return -1;
}
- r = command (NULL, &err, str_e2label, device, label, NULL);
+ r = command (NULL, &err, "e2label", device, label, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -162,7 +154,7 @@ do_set_e2uuid (const char *device, const char *uuid)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_tune2fs, "-U", uuid, device, NULL);
+ r = command (NULL, &err, "tune2fs", "-U", uuid, device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -215,7 +207,7 @@ do_resize2fs (const char *device)
if (if_not_mounted_run_e2fsck (device) == -1)
return -1;
- r = command (NULL, &err, str_resize2fs, device, NULL);
+ r = command (NULL, &err, "resize2fs", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -247,7 +239,7 @@ do_resize2fs_size (const char *device, int64_t size)
char buf[32];
snprintf (buf, sizeof buf, "%" PRIi64 "K", size);
- r = command (NULL, &err, str_resize2fs, device, buf, NULL);
+ r = command (NULL, &err, "resize2fs", device, buf, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -265,7 +257,7 @@ do_resize2fs_M (const char *device)
if (if_not_mounted_run_e2fsck (device) == -1)
return -1;
- r = command (NULL, &err, str_resize2fs, "-M", device, NULL);
+ r = command (NULL, &err, "resize2fs", "-M", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -311,7 +303,7 @@ ext_minimum_size (const char *device)
long block_size;
const char *pattern = "Estimated minimum size of the filesystem: ";
- r = command (&out, &err, str_resize2fs, "-P", "-f", device,
NULL);
+ r = command (&out, &err, "resize2fs", "-P", "-f",
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -376,7 +368,7 @@ do_e2fsck (const char *device,
return -1;
}
- ADD_ARG (argv, i, str_e2fsck);
+ ADD_ARG (argv, i, "e2fsck");
ADD_ARG (argv, i, "-f");
if (correct)
@@ -425,7 +417,7 @@ do_mke2journal (int blocksize, const char *device)
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-O", "journal_dev",
"-b", blocksize_s,
+ "mke2fs", "-F", "-O",
"journal_dev", "-b", blocksize_s,
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -453,7 +445,7 @@ do_mke2journal_L (int blocksize, const char *label, const char
*device)
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-O", "journal_dev",
"-b", blocksize_s,
+ "mke2fs", "-F", "-O",
"journal_dev", "-b", blocksize_s,
"-L", label,
device, NULL);
if (r == -1) {
@@ -476,7 +468,7 @@ do_mke2journal_U (int blocksize, const char *uuid, const char
*device)
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-O", "journal_dev",
"-b", blocksize_s,
+ "mke2fs", "-F", "-O",
"journal_dev", "-b", blocksize_s,
"-U", uuid,
device, NULL);
if (r == -1) {
@@ -511,7 +503,7 @@ do_mke2fs_J (const char *fstype, int blocksize, const char *device,
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-t", fstype, "-J", jdev,
"-b", blocksize_s,
+ "mke2fs", "-F", "-t", fstype,
"-J", jdev, "-b", blocksize_s,
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -551,7 +543,7 @@ do_mke2fs_JL (const char *fstype, int blocksize, const char *device,
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-t", fstype, "-J", jdev,
"-b", blocksize_s,
+ "mke2fs", "-F", "-t", fstype,
"-J", jdev, "-b", blocksize_s,
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -585,7 +577,7 @@ do_mke2fs_JU (const char *fstype, int blocksize, const char *device,
wipe_device_before_mkfs (device);
r = command (NULL, &err,
- str_mke2fs, "-F", "-t", fstype, "-J", jdev,
"-b", blocksize_s,
+ "mke2fs", "-F", "-t", fstype,
"-J", jdev, "-b", blocksize_s,
device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -621,7 +613,7 @@ do_tune2fs (const char *device, /* only required parameter */
char reservedblockscount_s[64];
char user_s[64];
- ADD_ARG (argv, i, str_tune2fs);
+ ADD_ARG (argv, i, "tune2fs");
if (optargs_bitmask & GUESTFS_TUNE2FS_FORCE_BITMASK) {
if (force)
@@ -759,7 +751,7 @@ do_get_e2attrs (const char *filename)
return NULL;
}
- r = command (&out, &err, str_lsattr, "-d", "--", buf,
NULL);
+ r = command (&out, &err, "lsattr", "-d", "--",
buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", "lsattr", filename, err);
free (out);
@@ -850,7 +842,7 @@ do_set_e2attrs (const char *filename, const char *attrs, int clear)
return -1;
}
- r = command (NULL, &err, str_chattr, attr_arg, "--", buf, NULL);
+ r = command (NULL, &err, "chattr", attr_arg, "--", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", "chattr", filename, err);
return -1;
@@ -872,7 +864,7 @@ do_get_e2generation (const char *filename)
return -1;
}
- r = command (&out, &err, str_lsattr, "-dv", "--", buf,
NULL);
+ r = command (&out, &err, "lsattr", "-dv", "--",
buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", "lsattr", filename, err);
return -1;
@@ -908,7 +900,7 @@ do_set_e2generation (const char *filename, int64_t generation)
snprintf (generation_str, sizeof generation_str,
"%" PRIu64, (uint64_t) generation);
- r = command (NULL, &err, str_chattr, "-v", generation_str,
"--", buf, NULL);
+ r = command (NULL, &err, "chattr", "-v", generation_str,
"--", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", "chattr", filename, err);
return -1;
@@ -979,7 +971,7 @@ do_mke2fs (const char *device, /* 0 */
char maxonlineresize_s[74];
size_t i = 0;
- ADD_ARG (argv, i, str_mke2fs);
+ ADD_ARG (argv, i, "mke2fs");
if (optargs_bitmask & GUESTFS_MKE2FS_BLOCKSIZE_BITMASK) {
if (blocksize < 0) {
diff --git a/daemon/file.c b/daemon/file.c
index 84874dc6f..da4218c45 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -30,10 +30,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_file, file);
-GUESTFSD_EXT_CMD(str_zcat, zcat);
-GUESTFSD_EXT_CMD(str_bzcat, bzcat);
-
int
do_touch (const char *path)
{
@@ -505,7 +501,7 @@ do_file (const char *path)
char *out;
CLEANUP_FREE char *err = NULL;
- int r = command (&out, &err, str_file, flags, path, NULL);
+ int r = command (&out, &err, "file", flags, path, NULL);
if (r == -1) {
free (out);
@@ -539,9 +535,9 @@ do_zfile (const char *method, const char *path)
char line[256];
if (STREQ (method, "gzip") || STREQ (method, "compress"))
- zcat = str_zcat;
+ zcat = "zcat";
else if (STREQ (method, "bzip2"))
- zcat = str_bzcat;
+ zcat = "bzcat";
else {
reply_with_error ("unknown method");
return NULL;
diff --git a/daemon/find.c b/daemon/find.c
index 3a0cf5d73..4ef2774aa 100644
--- a/daemon/find.c
+++ b/daemon/find.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_find, find);
-
static int
input_to_nul (FILE *fp, char *buf, size_t maxlen)
{
@@ -87,7 +85,7 @@ do_find0 (const char *dir)
sysrootdirlen = strlen (sysrootdir);
- if (asprintf_nowarn (&cmd, "%s %Q -print0", str_find, sysrootdir) == -1)
{
+ if (asprintf_nowarn (&cmd, "find %Q -print0", sysrootdir) == -1) {
reply_with_perror ("asprintf");
return -1;
}
diff --git a/daemon/findfs.c b/daemon/findfs.c
index f44137038..f44a60088 100644
--- a/daemon/findfs.c
+++ b/daemon/findfs.c
@@ -26,8 +26,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_findfs, findfs);
-
static char *
findfs (const char *tag, const char *label_or_uuid)
{
@@ -50,7 +48,7 @@ findfs (const char *tag, const char *label_or_uuid)
return NULL;
}
- r = command (&out, &err, str_findfs, arg, NULL);
+ r = command (&out, &err, "findfs", arg, NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
diff --git a/daemon/fsck.c b/daemon/fsck.c
index 540f779d3..b1b98a31c 100644
--- a/daemon/fsck.c
+++ b/daemon/fsck.c
@@ -26,15 +26,13 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_fsck, fsck);
-
int
do_fsck (const char *fstype, const char *device)
{
CLEANUP_FREE char *err = NULL;
int r;
- r = commandr (NULL, &err, str_fsck, "-a", "-t", fstype, device,
NULL);
+ r = commandr (NULL, &err, "fsck", "-a", "-t", fstype,
device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
diff --git a/daemon/fstrim.c b/daemon/fstrim.c
index 527acfd48..f68690420 100644
--- a/daemon/fstrim.c
+++ b/daemon/fstrim.c
@@ -30,12 +30,10 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_fstrim, fstrim);
-
int
optgroup_fstrim_available (void)
{
- return prog_exists (str_fstrim);
+ return prog_exists ("fstrim");
}
/* Takes optional arguments, consult optargs_bitmask. */
@@ -55,7 +53,7 @@ do_fstrim (const char *path,
*/
sync_disks ();
- ADD_ARG (argv, i, str_fstrim);
+ ADD_ARG (argv, i, "fstrim");
if ((optargs_bitmask & GUESTFS_FSTRIM_OFFSET_BITMASK)) {
if (offset < 0) {
diff --git a/daemon/grub.c b/daemon/grub.c
index 9bcf373bb..a4953d2bc 100644
--- a/daemon/grub.c
+++ b/daemon/grub.c
@@ -26,12 +26,10 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_grub_install, grub-install);
-
int
optgroup_grub_available (void)
{
- return prog_exists (str_grub_install);
+ return prog_exists ("grub-install");
}
int
@@ -46,7 +44,7 @@ do_grub_install (const char *root, const char *device)
}
r = command (verbose ? &out : NULL, &err,
- str_grub_install, buf, device, NULL);
+ "grub-install", buf, device, NULL);
if (r == -1) {
if (verbose)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index b3f40628b..bcded501a 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -63,9 +63,6 @@
#include "daemon.h"
-GUESTFSD_EXT_CMD(str_udevadm, udevadm);
-GUESTFSD_EXT_CMD(str_uuidgen, uuidgen);
-
#ifndef MAX
# define MAX(a,b) ((a)>(b)?(a):(b))
#endif
@@ -1095,7 +1092,7 @@ udev_settle_file (const char *file)
size_t i = 0;
int r;
- ADD_ARG (argv, i, str_udevadm);
+ ADD_ARG (argv, i, "udevadm");
if (verbose)
ADD_ARG (argv, i, "--debug");
@@ -1124,7 +1121,7 @@ get_random_uuid (void)
char *out;
CLEANUP_FREE char *err = NULL;
- r = command (&out, &err, str_uuidgen, NULL);
+ r = command (&out, &err, "uuidgen", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
diff --git a/daemon/hotplug.c b/daemon/hotplug.c
index 234f51ed2..193a5ffb9 100644
--- a/daemon/hotplug.c
+++ b/daemon/hotplug.c
@@ -77,8 +77,6 @@ do_internal_hot_add_drive (const char *label)
return -1;
}
-GUESTFSD_EXT_CMD(str_fuser, fuser);
-
/* This function is called before a drive is hot-unplugged. */
int
do_internal_hot_remove_drive_precheck (const char *label)
@@ -96,7 +94,7 @@ do_internal_hot_remove_drive_precheck (const char *label)
return -1;
}
- r = commandr (&out, &err, str_fuser, "-v", "-m", path,
NULL);
+ r = commandr (&out, &err, "fuser", "-v", "-m",
path, NULL);
if (r == -1) {
reply_with_error ("fuser: %s: %s", path, err);
return -1;
diff --git a/daemon/initrd.c b/daemon/initrd.c
index 21865debf..eb13cb92d 100644
--- a/daemon/initrd.c
+++ b/daemon/initrd.c
@@ -31,9 +31,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_zcat, zcat);
-GUESTFSD_EXT_CMD(str_cpio, cpio);
-
char **
do_initrd_list (const char *path)
{
@@ -46,7 +43,7 @@ do_initrd_list (const char *path)
int ret;
/* "zcat /sysroot/<path> | cpio --quiet -it", but path must be quoted.
*/
- if (asprintf_nowarn (&cmd, "%s %R | %s --quiet -it", str_zcat, path,
str_cpio) == -1) {
+ if (asprintf_nowarn (&cmd, "zcat %R | cpio --quiet -it", path) == -1) {
reply_with_perror ("asprintf");
return NULL;
}
diff --git a/daemon/inotify.c b/daemon/inotify.c
index b9bfed713..aa2350900 100644
--- a/daemon/inotify.c
+++ b/daemon/inotify.c
@@ -38,7 +38,6 @@
#include "optgroups.h"
#ifdef HAVE_SYS_INOTIFY_H
-GUESTFSD_EXT_CMD(str_sort, sort);
/* Currently open inotify handle, or -1 if not opened. */
static int inotify_fd = -1;
@@ -327,7 +326,7 @@ do_inotify_files (void)
return NULL;
}
- snprintf (cmd, sizeof cmd, "%s -u > %s", str_sort, tempfile);
+ snprintf (cmd, sizeof cmd, "sort -u > %s", tempfile);
fp = popen (cmd, "w");
if (fp == NULL) {
diff --git a/daemon/isoinfo.c b/daemon/isoinfo.c
index 3e1acf848..e616df82f 100644
--- a/daemon/isoinfo.c
+++ b/daemon/isoinfo.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_isoinfo, isoinfo);
-
static int
parse_uint32 (uint32_t *ret, const char *str)
{
@@ -246,7 +244,7 @@ isoinfo (const char *path)
/* --debug is necessary to get additional fields, in particular
* the date & time fields.
*/
- r = command (&out, &err, str_isoinfo, "--debug", "-d",
"-i", path, NULL);
+ r = command (&out, &err, "isoinfo", "--debug",
"-d", "-i", path, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
diff --git a/daemon/labels.c b/daemon/labels.c
index aaa3eaf89..aaeb8c905 100644
--- a/daemon/labels.c
+++ b/daemon/labels.c
@@ -27,15 +27,13 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_dosfslabel, dosfslabel);
-
static int
dosfslabel (const char *device, const char *label)
{
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_dosfslabel, device, label, NULL);
+ r = command (NULL, &err, "dosfslabel", device, label, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
diff --git a/daemon/ldm.c b/daemon/ldm.c
index 75418e8d3..609a3e1ec 100644
--- a/daemon/ldm.c
+++ b/daemon/ldm.c
@@ -39,12 +39,10 @@
#pragma GCC diagnostic ignored "-Wnull-dereference"
#endif
-GUESTFSD_EXT_CMD(str_ldmtool, ldmtool);
-
int
optgroup_ldm_available (void)
{
- return prog_exists (str_ldmtool);
+ return prog_exists ("ldmtool");
}
static int
@@ -134,7 +132,7 @@ do_ldmtool_create_all (void)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_ldmtool, "create", "all", NULL);
+ r = command (NULL, &err, "ldmtool", "create", "all",
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -148,7 +146,7 @@ do_ldmtool_remove_all (void)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_ldmtool, "remove", "all", NULL);
+ r = command (NULL, &err, "ldmtool", "remove", "all",
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -327,7 +325,7 @@ do_ldmtool_scan_devices (char * const * devices)
return NULL;
}
- argv[0] = str_ldmtool;
+ argv[0] = "ldmtool";
argv[1] = "scan";
for (i = 0; i < nr_devices; ++i)
argv[2+i] = devices[i];
@@ -349,7 +347,7 @@ do_ldmtool_diskgroup_name (const char *diskgroup)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, str_ldmtool, "show", "diskgroup",
diskgroup, NULL);
+ r = command (&out, &err, "ldmtool", "show",
"diskgroup", diskgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -365,7 +363,7 @@ do_ldmtool_diskgroup_volumes (const char *diskgroup)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, str_ldmtool, "show", "diskgroup",
diskgroup, NULL);
+ r = command (&out, &err, "ldmtool", "show",
"diskgroup", diskgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -382,7 +380,7 @@ do_ldmtool_diskgroup_disks (const char *diskgroup)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, str_ldmtool, "show", "diskgroup",
diskgroup, NULL);
+ r = command (&out, &err, "ldmtool", "show",
"diskgroup", diskgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -399,7 +397,7 @@ do_ldmtool_volume_type (const char *diskgroup, const char *volume)
CLEANUP_FREE char *out = NULL, *err = NULL;
r = command (&out, &err,
- str_ldmtool, "show", "volume", diskgroup, volume,
NULL);
+ "ldmtool", "show", "volume", diskgroup,
volume, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -416,7 +414,7 @@ do_ldmtool_volume_hint (const char *diskgroup, const char *volume)
CLEANUP_FREE char *out = NULL, *err = NULL;
r = command (&out, &err,
- str_ldmtool, "show", "volume", diskgroup, volume,
NULL);
+ "ldmtool", "show", "volume", diskgroup,
volume, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -433,7 +431,7 @@ do_ldmtool_volume_partitions (const char *diskgroup, const char
*volume)
CLEANUP_FREE char *out = NULL, *err = NULL;
r = command (&out, &err,
- str_ldmtool, "show", "volume", diskgroup, volume,
NULL);
+ "ldmtool", "show", "volume", diskgroup,
volume, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
diff --git a/daemon/link.c b/daemon/link.c
index 3ce54fa37..0878fd32b 100644
--- a/daemon/link.c
+++ b/daemon/link.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_ln, ln);
-
char *
do_readlink (const char *path)
{
@@ -140,7 +138,7 @@ _symlink (const char *flag, const char *target, const char *linkname)
}
r = command (NULL, &err,
- str_ln, flag, "--", /* target could begin with '-' */
+ "ln", flag, "--", /* target could begin with
'-' */
target, buf_linkname, NULL);
if (r == -1) {
reply_with_error ("ln %s: %s: %s: %s",
diff --git a/daemon/ls.c b/daemon/ls.c
index 0e2f110f5..23bba5041 100644
--- a/daemon/ls.c
+++ b/daemon/ls.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_ls, ls);
-
/* Has one FileOut parameter. */
int
do_ls0 (const char *path)
@@ -118,7 +116,7 @@ do_ll (const char *path)
return NULL;
}
- r = command (&out, &err, str_ls, "-la", spath, NULL);
+ r = command (&out, &err, "ls", "-la", spath, NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
@@ -151,7 +149,7 @@ do_llz (const char *path)
return NULL;
}
- r = command (&out, &err, str_ls, "-laZ", spath, NULL);
+ r = command (&out, &err, "ls", "-laZ", spath, NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
diff --git a/daemon/luks.c b/daemon/luks.c
index 53bb820d6..5c48a91eb 100644
--- a/daemon/luks.c
+++ b/daemon/luks.c
@@ -28,12 +28,10 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_cryptsetup, cryptsetup);
-
int
optgroup_luks_available (void)
{
- return prog_exists (str_cryptsetup);
+ return prog_exists ("cryptsetup");
}
/* Callers must also call remove_temp (tempfile). */
@@ -108,7 +106,7 @@ luks_open (const char *device, const char *key, const char *mapname,
const char *argv[MAX_ARGS];
size_t i = 0;
- ADD_ARG (argv, i, str_cryptsetup);
+ ADD_ARG (argv, i, "cryptsetup");
ADD_ARG (argv, i, "-d");
ADD_ARG (argv, i, tempfile);
if (readonly) ADD_ARG (argv, i, "--readonly");
@@ -155,7 +153,7 @@ do_luks_close (const char *device)
const char *mapname = &device[12];
CLEANUP_FREE char *err = NULL;
- int r = command (NULL, &err, str_cryptsetup, "luksClose", mapname,
NULL);
+ int r = command (NULL, &err, "cryptsetup", "luksClose",
mapname, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -178,7 +176,7 @@ luks_format (const char *device, const char *key, int keyslot,
char keyslot_s[16];
size_t i = 0;
- ADD_ARG (argv, i, str_cryptsetup);
+ ADD_ARG (argv, i, "cryptsetup");
ADD_ARG (argv, i, "-q");
if (cipher) {
ADD_ARG (argv, i, "--cipher");
@@ -237,7 +235,7 @@ do_luks_add_key (const char *device, const char *key, const char
*newkey,
char keyslot_s[16];
size_t i = 0;
- ADD_ARG (argv, i, str_cryptsetup);
+ ADD_ARG (argv, i, "cryptsetup");
ADD_ARG (argv, i, "-q");
ADD_ARG (argv, i, "-d");
ADD_ARG (argv, i, keyfile);
@@ -273,7 +271,7 @@ do_luks_kill_slot (const char *device, const char *key, int keyslot)
char keyslot_s[16];
size_t i = 0;
- ADD_ARG (argv, i, str_cryptsetup);
+ ADD_ARG (argv, i, "cryptsetup");
ADD_ARG (argv, i, "-q");
ADD_ARG (argv, i, "-d");
ADD_ARG (argv, i, tempfile);
diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
index 5c9ce1866..7f25a5eff 100644
--- a/daemon/lvm-filter.c
+++ b/daemon/lvm-filter.c
@@ -36,11 +36,6 @@
#include "daemon.h"
#include "actions.h"
-GUESTFSD_EXT_CMD(str_lvm, lvm);
-GUESTFSD_EXT_CMD(str_cp, cp);
-GUESTFSD_EXT_CMD(str_rm, rm);
-GUESTFSD_EXT_CMD(str_lvmetad, lvmetad);
-
/* This runs during daemon start up and creates a complete copy of
* /etc/lvm so that we can modify it as we desire. We set
* LVM_SYSTEM_DIR to point to the copy. Note that the final directory
@@ -79,7 +74,7 @@ copy_lvm (void)
error (EXIT_FAILURE, errno, "mkdtemp: %s", lvm_system_dir);
/* Copy the entire directory */
- snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/ %s", str_cp, lvm_system_dir);
+ snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/ %s", "cp",
lvm_system_dir);
r = system (cmd);
if (r == -1) {
perror (cmd);
@@ -106,13 +101,11 @@ copy_lvm (void)
void
start_lvmetad (void)
{
- char cmd[64];
int r;
- snprintf (cmd, sizeof cmd, "%s", str_lvmetad);
if (verbose)
- printf ("%s\n", cmd);
- r = system (cmd);
+ printf ("%s\n", "lvmetad");
+ r = system ("lvmetad");
if (r == -1)
perror ("system/lvmetad");
else if (!WIFEXITED (r) || WEXITSTATUS (r) != 0)
@@ -124,7 +117,7 @@ rm_lvm_system_dir (void)
{
char cmd[64];
- snprintf (cmd, sizeof cmd, "%s -rf %s", str_rm, lvm_system_dir);
+ snprintf (cmd, sizeof cmd, "rm -rf %s", lvm_system_dir);
ignore_value (system (cmd));
}
@@ -232,7 +225,7 @@ static int
vgchange (const char *vgchange_flag)
{
CLEANUP_FREE char *err = NULL;
- int r = command (NULL, &err, str_lvm, "vgchange", vgchange_flag, NULL);
+ int r = command (NULL, &err, "lvm", "vgchange", vgchange_flag,
NULL);
if (r == -1) {
reply_with_error ("vgchange %s: %s", vgchange_flag, err);
return -1;
@@ -265,7 +258,7 @@ rescan (void)
unlink (lvm_cache);
CLEANUP_FREE char *err = NULL;
- int r = command (NULL, &err, str_lvm, "vgscan", NULL);
+ int r = command (NULL, &err, "lvm", "vgscan", NULL);
if (r == -1) {
reply_with_error ("vgscan: %s", err);
return -1;
diff --git a/daemon/lvm.c b/daemon/lvm.c
index 5d12b009f..af2582448 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -32,12 +32,10 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_lvm, lvm);
-
int
optgroup_lvm2_available (void)
{
- return prog_exists (str_lvm);
+ return prog_exists ("lvm");
}
/* LVM actions. Keep an eye on liblvm, although at the time
@@ -194,7 +192,7 @@ do_pvs (void)
int r;
r = command (&out, &err,
- str_lvm, "pvs", "-o", "pv_name",
"--noheadings", NULL);
+ "lvm", "pvs", "-o", "pv_name",
"--noheadings", NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
@@ -212,7 +210,7 @@ do_vgs (void)
int r;
r = command (&out, &err,
- str_lvm, "vgs", "-o", "vg_name",
"--noheadings", NULL);
+ "lvm", "vgs", "-o", "vg_name",
"--noheadings", NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
@@ -235,7 +233,7 @@ test_lvs_has_S_opt (void)
CLEANUP_FREE char *out = NULL;
CLEANUP_FREE char *err = NULL;
- int r = command (&out, &err, str_lvm, "lvs", "--help",
NULL);
+ int r = command (&out, &err, "lvm", "lvs",
"--help", NULL);
if (r == -1) {
reply_with_error ("lvm lvs --help: %s", err);
return -1;
@@ -262,7 +260,7 @@ do_lvs (void)
if (has_S > 0) {
r = command (&out, &err,
- str_lvm, "lvs",
+ "lvm", "lvs",
"-o", "vg_name,lv_name",
"-S", "lv_role=public &&
lv_skip_activation!=yes",
"--noheadings",
@@ -276,7 +274,7 @@ do_lvs (void)
return convert_lvm_output (out, "/dev/");
} else {
r = command (&out, &err,
- str_lvm, "lvs",
+ "lvm", "lvs",
"-o", "lv_attr,vg_name,lv_name",
"--noheadings",
"--separator", ":", NULL);
@@ -319,7 +317,7 @@ do_pvcreate (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "pvcreate", "--force", device, NULL);
+ "lvm", "pvcreate", "--force", device,
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -343,7 +341,7 @@ do_vgcreate (const char *volgroup, char *const *physvols)
reply_with_perror ("malloc");
return -1;
}
- argv[0] = str_lvm;
+ argv[0] = "lvm";
argv[1] = "vgcreate";
argv[2] = volgroup;
for (i = 3; i < argc+1; ++i)
@@ -370,7 +368,7 @@ do_lvcreate (const char *logvol, const char *volgroup, int mbytes)
snprintf (size, sizeof size, "%d", mbytes);
r = command (NULL, &err,
- str_lvm, "lvcreate",
+ "lvm", "lvcreate",
"-L", size, "-n", logvol, volgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -397,7 +395,7 @@ do_lvcreate_free (const char *logvol, const char *volgroup, int
percent)
snprintf (size, sizeof size, "%d%%FREE", percent);
r = command (NULL, &err,
- str_lvm, "lvcreate",
+ "lvm", "lvcreate",
"-l", size, "-n", logvol, volgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);
@@ -430,7 +428,7 @@ do_lvresize (const char *logvol, int mbytes)
snprintf (size, sizeof size, "%d", mbytes);
r = command (NULL, &err,
- str_lvm, "lvresize",
+ "lvm", "lvresize",
"--force", "-L", size, logvol, NULL);
if (r == -1) {
if (!ignore_same_size_error (err)) {
@@ -457,7 +455,7 @@ do_lvresize_free (const char *logvol, int percent)
snprintf (size, sizeof size, "+%d%%FREE", percent);
r = command (NULL, &err,
- str_lvm, "lvresize", "-l", size, logvol, NULL);
+ "lvm", "lvresize", "-l", size, logvol,
NULL);
if (r == -1) {
if (!ignore_same_size_error (err)) {
reply_with_error ("%s", err);
@@ -489,10 +487,10 @@ do_lvm_remove_all (void)
/* Deactivate the LV first. On Ubuntu, lvremove '-f' option
* does not remove active LVs reliably.
*/
- (void) command (NULL, NULL, str_lvm, "lvchange", "-an", xs[i],
NULL);
+ (void) command (NULL, NULL, "lvm", "lvchange", "-an",
xs[i], NULL);
udev_settle ();
- r = command (NULL, &err, str_lvm, "lvremove", "-f", xs[i],
NULL);
+ r = command (NULL, &err, "lvm", "lvremove", "-f",
xs[i], NULL);
if (r == -1) {
reply_with_error ("lvremove: %s: %s", xs[i], err);
return -1;
@@ -510,10 +508,10 @@ do_lvm_remove_all (void)
CLEANUP_FREE char *err = NULL;
/* Deactivate the VG first, see note above. */
- (void) command (NULL, NULL, str_lvm, "vgchange", "-an", xs[i],
NULL);
+ (void) command (NULL, NULL, "lvm", "vgchange", "-an",
xs[i], NULL);
udev_settle ();
- r = command (NULL, &err, str_lvm, "vgremove", "-f", xs[i],
NULL);
+ r = command (NULL, &err, "lvm", "vgremove", "-f",
xs[i], NULL);
if (r == -1) {
reply_with_error ("vgremove: %s: %s", xs[i], err);
return -1;
@@ -530,7 +528,7 @@ do_lvm_remove_all (void)
for (i = 0; xs[i] != NULL; ++i) {
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_lvm, "pvremove", "-f", xs[i],
NULL);
+ r = command (NULL, &err, "lvm", "pvremove", "-f",
xs[i], NULL);
if (r == -1) {
reply_with_error ("pvremove: %s: %s", xs[i], err);
return -1;
@@ -551,7 +549,7 @@ do_lvremove (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "lvremove", "-f", device, NULL);
+ "lvm", "lvremove", "-f", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -569,7 +567,7 @@ do_vgremove (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "vgremove", "-f", device, NULL);
+ "lvm", "vgremove", "-f", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -587,7 +585,7 @@ do_pvremove (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "pvremove", "-ff", device, NULL);
+ "lvm", "pvremove", "-ff", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -605,7 +603,7 @@ do_pvresize (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "pvresize", device, NULL);
+ "lvm", "pvresize", device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -624,7 +622,7 @@ do_pvresize_size (const char *device, int64_t size)
snprintf (buf, sizeof buf, "%" PRIi64 "b", size);
r = command (NULL, &err,
- str_lvm, "pvresize",
+ "lvm", "pvresize",
"--yes",
"--setphysicalvolumesize", buf,
device, NULL);
@@ -650,7 +648,7 @@ do_vg_activate (int activate, char *const *volgroups)
return -1;
}
- argv[0] = str_lvm;
+ argv[0] = "lvm";
argv[1] = "vgchange";
argv[2] = "-a";
argv[3] = activate ? "y" : "n";
@@ -682,7 +680,7 @@ do_lvrename (const char *logvol, const char *newlogvol)
int r;
r = command (NULL, &err,
- str_lvm, "lvrename",
+ "lvm", "lvrename",
logvol, newlogvol, NULL);
if (r == -1) {
reply_with_error ("%s -> %s: %s", logvol, newlogvol, err);
@@ -701,7 +699,7 @@ do_vgrename (const char *volgroup, const char *newvolgroup)
int r;
r = command (NULL, &err,
- str_lvm, "vgrename",
+ "lvm", "vgrename",
volgroup, newvolgroup, NULL);
if (r == -1) {
reply_with_error ("%s -> %s: %s", volgroup, newvolgroup, err);
@@ -719,7 +717,7 @@ get_lvm_field (const char *cmd, const char *field, const char
*device)
char *out;
CLEANUP_FREE char *err = NULL;
int r = command (&out, &err,
- str_lvm, cmd,
+ "lvm", cmd,
"--unbuffered", "--noheadings", "-o",
field,
device, NULL);
if (r == -1) {
@@ -756,7 +754,7 @@ get_lvm_fields (const char *cmd, const char *field, const char
*device)
CLEANUP_FREE char *out = NULL, *err = NULL;
int r = command (&out, &err,
- str_lvm, cmd,
+ "lvm", cmd,
"--unbuffered", "--noheadings", "-o",
field,
device, NULL);
if (r == -1) {
@@ -795,7 +793,7 @@ do_vgscan (void)
int r;
r = command (NULL, &err,
- str_lvm, "vgscan", NULL);
+ "lvm", "vgscan", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -983,7 +981,7 @@ do_vgmeta (const char *vg, size_t *size_r)
close (fd);
- r = command (NULL, &err, str_lvm, "vgcfgbackup", "-f", tmp, vg,
NULL);
+ r = command (NULL, &err, "lvm", "vgcfgbackup", "-f",
tmp, vg, NULL);
if (r == -1) {
reply_with_error ("vgcfgbackup: %s", err);
return NULL;
@@ -1056,7 +1054,7 @@ do_pvchange_uuid (const char *device)
int r;
r = command (NULL, &err,
- str_lvm, "pvchange", "-u", device, NULL);
+ "lvm", "pvchange", "-u", device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -1074,7 +1072,7 @@ do_pvchange_uuid_all (void)
int r;
r = command (NULL, &err,
- str_lvm, "pvchange", "-u", "-a", NULL);
+ "lvm", "pvchange", "-u", "-a",
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -1092,7 +1090,7 @@ do_vgchange_uuid (const char *vg)
int r;
r = command (NULL, &err,
- str_lvm, "vgchange", "-u", vg, NULL);
+ "lvm", "vgchange", "-u", vg, NULL);
if (r == -1) {
reply_with_error ("%s: %s", vg, err);
return -1;
@@ -1110,7 +1108,7 @@ do_vgchange_uuid_all (void)
int r;
r = command (NULL, &err,
- str_lvm, "vgchange", "-u", NULL);
+ "lvm", "vgchange", "-u", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
diff --git a/daemon/md.c b/daemon/md.c
index 64d98fae5..246e38150 100644
--- a/daemon/md.c
+++ b/daemon/md.c
@@ -37,12 +37,10 @@
#include "optgroups.h"
#include "c-ctype.h"
-GUESTFSD_EXT_CMD(str_mdadm, mdadm);
-
int
optgroup_mdadm_available (void)
{
- return prog_exists (str_mdadm);
+ return prog_exists ("mdadm");
}
static size_t
@@ -138,7 +136,7 @@ do_md_create (const char *name, char *const *devices,
const char *argv[MAX_ARGS];
size_t i = 0;
- ADD_ARG (argv, i, str_mdadm);
+ ADD_ARG (argv, i, "mdadm");
ADD_ARG (argv, i, "--create");
/* --run suppresses "Continue creating array" question */
ADD_ARG (argv, i, "--run");
@@ -292,7 +290,7 @@ do_md_detail (const char *md)
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret);
- const char *mdadm[] = { str_mdadm, "-D", "--export", md, NULL };
+ const char *mdadm[] = { "mdadm", "-D", "--export", md,
NULL };
r = commandv (&out, &err, mdadm);
if (r == -1) {
reply_with_error ("%s", err);
@@ -353,7 +351,7 @@ do_md_stop (const char *md)
int r;
CLEANUP_FREE char *err = NULL;
- const char *mdadm[] = { str_mdadm, "--stop", md, NULL};
+ const char *mdadm[] = { "mdadm", "--stop", md, NULL};
r = commandv (NULL, &err, mdadm);
if (r == -1) {
reply_with_error ("%s", err);
diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index a376a1780..2b439a6ce 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c
@@ -30,9 +30,6 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_mke2fs, mke2fs);
-GUESTFSD_EXT_CMD(str_mkfs, mkfs);
-
/* Takes optional arguments, consult optargs_bitmask. */
int
do_mkfs (const char *fstype, const char *device, int blocksize,
@@ -55,9 +52,9 @@ do_mkfs (const char *fstype, const char *device, int blocksize,
* option.
*/
if (extfs)
- ADD_ARG (argv, i, str_mke2fs);
+ ADD_ARG (argv, i, "mke2fs");
else
- ADD_ARG (argv, i, str_mkfs);
+ ADD_ARG (argv, i, "mkfs");
ADD_ARG (argv, i, "-t");
ADD_ARG (argv, i, fstype);
diff --git a/daemon/modprobe.c b/daemon/modprobe.c
index 0b7896ae7..1e095cd00 100644
--- a/daemon/modprobe.c
+++ b/daemon/modprobe.c
@@ -27,8 +27,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_modprobe, modprobe);
-
int
optgroup_linuxmodules_available (void)
{
@@ -39,7 +37,7 @@ optgroup_linuxmodules_available (void)
if (access ("/proc/modules", R_OK) == -1 && errno == ENOENT)
return 0;
- return prog_exists (str_modprobe);
+ return prog_exists ("modprobe");
}
int
@@ -48,7 +46,7 @@ do_modprobe (const char *module)
CLEANUP_FREE char *err = NULL;
int r;
- r = command (NULL, &err, str_modprobe, module, NULL);
+ r = command (NULL, &err, "modprobe", module, NULL);
if (r == -1) {
reply_with_error ("%s", err);
diff --git a/daemon/mount.c b/daemon/mount.c
index 0ad9626a7..f9dfaff70 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -33,9 +33,6 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_mount, mount);
-GUESTFSD_EXT_CMD(str_umount, umount);
-
/* You must mount something on "/" first before many operations.
* Hence we have an internal function which can test if something is
* mounted on *or under* the sysroot directory. (It has to be *or
@@ -176,11 +173,11 @@ mount_vfs_nochroot (const char *options, const char *vfstype,
int r;
if (vfstype)
r = command (NULL, &error,
- str_mount, "-o", options_plus ? options_plus : options,
+ "mount", "-o", options_plus ? options_plus :
options,
"-t", vfstype, device, mp, NULL);
else
r = command (NULL, &error,
- str_mount, "-o", options_plus ? options_plus : options,
+ "mount", "-o", options_plus ? options_plus :
options,
device, mp, NULL);
if (r == -1) {
reply_with_error ("%s on %s (options: '%s'): %s",
@@ -238,7 +235,7 @@ do_umount (const char *pathordevice,
/* Use the external /bin/umount program, so that /etc/mtab is kept
* updated.
*/
- ADD_ARG (argv, i, str_umount);
+ ADD_ARG (argv, i, "umount");
if (force)
ADD_ARG (argv, i, "-f");
@@ -412,7 +409,7 @@ do_umount_all (void)
for (i = 0; i < mounts.size; ++i) {
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_umount, mounts.argv[i], NULL);
+ r = command (NULL, &err, "umount", mounts.argv[i], NULL);
if (r == -1) {
reply_with_error ("umount: %s: %s", mounts.argv[i], err);
return -1;
@@ -445,7 +442,7 @@ do_mount_loop (const char *file, const char *mountpoint)
return -1;
}
- r = command (NULL, &error, str_mount, "-o", "loop", buf, mp,
NULL);
+ r = command (NULL, &error, "mount", "-o", "loop",
buf, mp, NULL);
if (r == -1) {
reply_with_error ("%s on %s: %s", file, mountpoint, error);
return -1;
@@ -480,7 +477,7 @@ do_remount (const char *mountpoint, int rw)
/* XXX Do we need to check the mountpoint exists? */
- r = command (NULL, &err, str_mount, "-o", options, mp, NULL);
+ r = command (NULL, &err, "mount", "-o", options, mp, NULL);
if (r == -1) {
reply_with_error ("%s: %s: %s", mountpoint, options, err);
return -1;
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 3b759fef9..878f6e58a 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -31,21 +31,16 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_ntfs3g_probe, ntfs-3g.probe);
-GUESTFSD_EXT_CMD(str_ntfsresize, ntfsresize);
-GUESTFSD_EXT_CMD(str_ntfsfix, ntfsfix);
-GUESTFSD_EXT_CMD(str_ntfslabel, ntfslabel);
-
int
optgroup_ntfs3g_available (void)
{
- return prog_exists (str_ntfs3g_probe);
+ return prog_exists ("ntfs3g.probe");
}
int
optgroup_ntfsprogs_available (void)
{
- return prog_exists (str_ntfsresize);
+ return prog_exists ("ntfsresize");
}
char *
@@ -56,7 +51,7 @@ ntfs_get_label (const char *device)
char *out = NULL;
size_t len;
- r = command (&out, &err, str_ntfslabel, device, NULL);
+ r = command (&out, &err, "ntfslabel", device, NULL);
if (r == -1) {
reply_with_error ("%s", err);
free (out);
@@ -81,7 +76,7 @@ ntfs_set_label (const char *device, const char *label)
* characters and return an error. This is not so easy since we
* don't have the required libraries.
*/
- r = command (NULL, &err, str_ntfslabel, device, label, NULL);
+ r = command (NULL, &err, "ntfslabel", device, label, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -99,7 +94,7 @@ do_ntfs_3g_probe (int rw, const char *device)
rw_flag = rw ? "-w" : "-r";
- r = commandr (NULL, &err, str_ntfs3g_probe, rw_flag, device, NULL);
+ r = commandr (NULL, &err, "ntfs3g.probe", rw_flag, device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -118,7 +113,7 @@ do_ntfsresize (const char *device, int64_t size, int force)
size_t i = 0;
char size_str[32];
- ADD_ARG (argv, i, str_ntfsresize);
+ ADD_ARG (argv, i, "ntfsresize");
ADD_ARG (argv, i, "-P");
if (optargs_bitmask & GUESTFS_NTFSRESIZE_SIZE_BITMASK) {
@@ -170,7 +165,7 @@ ntfs_minimum_size (const char *device)
int32_t cluster_size = 0;
/* FS may be marked for check, so force ntfsresize */
- r = command (&out, &err, str_ntfsresize, "--info", "-ff",
device, NULL);
+ r = command (&out, &err, "ntfsresize", "--info",
"-ff", device, NULL);
lines = split_lines (out);
if (lines == NULL)
@@ -249,7 +244,7 @@ do_ntfsfix (const char *device, int clearbadsectors)
int r;
CLEANUP_FREE char *err = NULL;
- ADD_ARG (argv, i, str_ntfsfix);
+ ADD_ARG (argv, i, "ntfsfix");
if ((optargs_bitmask & GUESTFS_NTFSFIX_CLEARBADSECTORS_BITMASK) &&
clearbadsectors)
diff --git a/daemon/ntfsclone.c b/daemon/ntfsclone.c
index dc3ac278d..767065648 100644
--- a/daemon/ntfsclone.c
+++ b/daemon/ntfsclone.c
@@ -32,8 +32,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_ntfsclone, ntfsclone);
-
/* Read the error file. Returns a string that the caller must free. */
static char *
read_error_file (char *error_file)
@@ -83,7 +81,7 @@ do_ntfsclone_in (const char *device)
/* Construct the command. */
if (asprintf (&cmd, "%s -O %s --restore-image - 2> %s",
- str_ntfsclone, device, error_file) == -1) {
+ "ntfsclone", device, error_file) == -1) {
err = errno;
r = cancel_receive ();
errno = err;
@@ -161,8 +159,7 @@ do_ntfsclone_out (const char *device,
}
/* Construct the ntfsclone command. */
- if (asprintf (&cmd, "%s -o - --save-image%s%s%s%s%s %s",
- str_ntfsclone,
+ if (asprintf (&cmd, "ntfsclone -o - --save-image%s%s%s%s%s %s",
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_METADATAONLY_BITMASK)
&& metadataonly ? " --metadata" : "",
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_RESCUE_BITMASK) &&
rescue ? " --rescue" : "",
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_IGNOREFSCHECK_BITMASK)
&& ignorefscheck ? " --ignore-fs-check" : "",
diff --git a/daemon/parted.c b/daemon/parted.c
index 03e83cb32..7446bc93e 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -30,10 +30,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_parted, parted);
-GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
-GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
-
/* Notes:
*
* Parted 1.9 sends error messages to stdout, hence use of the
@@ -88,7 +84,7 @@ do_part_init (const char *device, const char *parttype)
udev_settle ();
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--", device, "mklabel",
parttype, NULL);
+ "parted", "-s", "--", device,
"mklabel", parttype, NULL);
if (r == -1) {
reply_with_error ("parted: %s: %s", device, err);
return -1;
@@ -141,7 +137,7 @@ do_part_add (const char *device, const char *prlogex,
* this as a bug in the parted mkpart command.
*/
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--",
+ "parted", "-s", "--",
device, "mkpart", prlogex, startstr, endstr, NULL);
if (r == -1) {
reply_with_error ("parted: %s: %s", device, err);
@@ -170,7 +166,7 @@ do_part_del (const char *device, int partnum)
udev_settle ();
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--", device, "rm",
partnum_str, NULL);
+ "parted", "-s", "--", device,
"rm", partnum_str, NULL);
if (r == -1) {
reply_with_error ("parted: %s: %s", device, err);
return -1;
@@ -209,7 +205,7 @@ do_part_disk (const char *device, const char *parttype)
udev_settle ();
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--",
+ "parted", "-s", "--",
device,
"mklabel", parttype,
/* See comment about about the parted mkpart command. */
@@ -243,7 +239,7 @@ do_part_set_bootable (const char *device, int partnum, int bootable)
udev_settle ();
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--",
+ "parted", "-s", "--",
device, "set", partstr, "boot", bootable ?
"on" : "off", NULL);
if (r == -1) {
reply_with_error ("parted: %s: %s", device, err);
@@ -273,7 +269,7 @@ do_part_set_name (const char *device, int partnum, const char *name)
udev_settle ();
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_parted, "-s", "--", device, "name",
partstr, name, NULL);
+ "parted", "-s", "--", device,
"name", partstr, name, NULL);
if (r == -1) {
reply_with_error ("parted: %s: %s", device, err);
return -1;
@@ -323,11 +319,11 @@ print_partition_table (const char *device, bool add_m_option)
udev_settle ();
if (add_m_option)
- r = command (&out, &err, str_parted, "-m", "-s",
"--", device,
+ r = command (&out, &err, "parted", "-m", "-s",
"--", device,
"unit", "b",
"print", NULL);
else
- r = command (&out, &err, str_parted, "-s", "--", device,
+ r = command (&out, &err, "parted", "-s", "--",
device,
"unit", "b",
"print", NULL);
@@ -511,7 +507,7 @@ test_sfdisk_has_part_type (void)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, str_sfdisk, "--help", NULL);
+ r = command (&out, &err, "sfdisk", "--help", NULL);
if (r == -1) {
reply_with_error ("%s: %s", "sfdisk --help", err);
return -1;
@@ -545,7 +541,7 @@ do_part_get_mbr_id (const char *device, int partnum)
udev_settle ();
- r = command (&out, &err, str_sfdisk, param, device, partnum_str, NULL);
+ r = command (&out, &err, "sfdisk", param, device, partnum_str,
NULL);
if (r == -1) {
reply_with_error ("sfdisk %s: %s", param, err);
return -1;
@@ -585,7 +581,7 @@ do_part_set_mbr_id (const char *device, int partnum, int idbyte)
udev_settle ();
- r = command (NULL, &err, str_sfdisk,
+ r = command (NULL, &err, "sfdisk",
param, device, partnum_str, idbyte_str, NULL);
if (r == -1) {
reply_with_error ("sfdisk %s: %s", param, err);
@@ -600,7 +596,7 @@ do_part_set_mbr_id (const char *device, int partnum, int idbyte)
int
optgroup_gdisk_available (void)
{
- return prog_exists (str_sgdisk);
+ return prog_exists ("sgdisk");
}
int
@@ -619,10 +615,10 @@ do_part_set_gpt_type (const char *device, int partnum, const char
*guid)
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-t", typecode, NULL);
+ "sgdisk", device, "-t", typecode, NULL);
if (r == -1) {
- reply_with_error ("%s %s -t %s: %s", str_sgdisk, device, typecode, err);
+ reply_with_error ("%s %s -t %s: %s", "sgdisk", device, typecode,
err);
return -1;
}
@@ -645,10 +641,10 @@ do_part_set_gpt_guid (const char *device, int partnum, const char
*guid)
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-u", typecode, NULL);
+ "sgdisk", device, "-u", typecode, NULL);
if (r == -1) {
- reply_with_error ("%s %s -u %s: %s", str_sgdisk, device, typecode, err);
+ reply_with_error ("%s %s -u %s: %s", "sgdisk", device, typecode,
err);
return -1;
}
@@ -674,10 +670,10 @@ sgdisk_info_extract_field (const char *device, int partnum, const
char *field,
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-i", partnum_str, NULL);
+ "sgdisk", device, "-i", partnum_str, NULL);
if (r == -1) {
- reply_with_error ("%s %s -i %s: %s", str_sgdisk, device, partnum_str,
err);
+ reply_with_error ("%s %s -i %s: %s", "sgdisk", device,
partnum_str, err);
return NULL;
}
@@ -686,7 +682,7 @@ sgdisk_info_extract_field (const char *device, int partnum, const char
*field,
CLEANUP_FREE_STRING_LIST char **lines = split_lines (err);
if (lines == NULL) {
reply_with_error ("'%s %s -i %i' returned no output",
- str_sgdisk, device, partnum);
+ "sgdisk", device, partnum);
return NULL;
}
@@ -946,16 +942,16 @@ do_part_get_disk_guid (const char *device)
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-p", NULL);
+ "sgdisk", device, "-p", NULL);
if (r == -1) {
- reply_with_error ("%s %s -p: %s", str_sgdisk, device, err);
+ reply_with_error ("%s %s -p: %s", "sgdisk", device, err);
return NULL;
}
CLEANUP_FREE_STRING_LIST char **lines = split_lines (err);
if (lines == NULL) {
reply_with_error ("'%s %s -p' returned no output",
- str_sgdisk, device);
+ "sgdisk", device);
return NULL;
}
@@ -988,10 +984,10 @@ do_part_set_disk_guid (const char *device, const char *guid)
{
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-U", guid, NULL);
+ "sgdisk", device, "-U", guid, NULL);
if (r == -1) {
- reply_with_error ("%s %s -U %s: %s", str_sgdisk, device, guid, err);
+ reply_with_error ("%s %s -U %s: %s", "sgdisk", device, guid,
err);
return -1;
}
@@ -1003,10 +999,10 @@ do_part_set_disk_guid_random (const char *device)
{
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, device, "-U", "R", NULL);
+ "sgdisk", device, "-U", "R", NULL);
if (r == -1) {
- reply_with_error ("%s %s -U R: %s", str_sgdisk, device, err);
+ reply_with_error ("%s %s -U R: %s", "sgdisk", device, err);
return -1;
}
@@ -1022,25 +1018,25 @@ do_part_expand_gpt(const char *device)
* (e.g. recreate partition table and so on).
* We do not want such behavior, so dry-run at first.*/
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, "--pretend", "-e", device, NULL);
+ "sgdisk", "--pretend", "-e", device,
NULL);
if (r == -1) {
- reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err);
+ reply_with_error ("%s --pretend -e %s: %s", "sgdisk", device,
err);
return -1;
}
if (err && strlen(err) != 0) {
/* Unexpected actions. */
- reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err);
+ reply_with_error ("%s --pretend -e %s: %s", "sgdisk", device,
err);
return -1;
}
free(err);
/* Now we can do a real run. */
r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_sgdisk, "-e", device, NULL);
+ "sgdisk", "-e", device, NULL);
if (r == -1) {
- reply_with_error ("%s -e %s: %s", str_sgdisk, device, err);
+ reply_with_error ("%s -e %s: %s", "sgdisk", device, err);
return -1;
}
diff --git a/daemon/rsync.c b/daemon/rsync.c
index d238d6174..8d295e0ec 100644
--- a/daemon/rsync.c
+++ b/daemon/rsync.c
@@ -30,12 +30,10 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_rsync, rsync);
-
int
optgroup_rsync_available (void)
{
- return prog_exists (str_rsync);
+ return prog_exists ("rsync");
}
static int
@@ -48,7 +46,7 @@ rsync (const char *src, const char *src_orig,
int r;
CLEANUP_FREE char *err = NULL;
- ADD_ARG (argv, i, str_rsync);
+ ADD_ARG (argv, i, "rsync");
if (archive)
ADD_ARG (argv, i, "--archive");
diff --git a/daemon/scrub.c b/daemon/scrub.c
index c10b0a0c1..ca330a06c 100644
--- a/daemon/scrub.c
+++ b/daemon/scrub.c
@@ -28,12 +28,10 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_scrub, scrub);
-
int
optgroup_scrub_available (void)
{
- return prog_exists (str_scrub);
+ return prog_exists ("scrub");
}
int
@@ -42,7 +40,7 @@ do_scrub_device (const char *device)
CLEANUP_FREE char *err = NULL;
int r;
- r = command (NULL, &err, str_scrub, device, NULL);
+ r = command (NULL, &err, "scrub", device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
@@ -68,7 +66,7 @@ do_scrub_file (const char *file)
return -1;
}
- r = command (NULL, &err, str_scrub, "-r", buf, NULL);
+ r = command (NULL, &err, "scrub", "-r", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s", file, err);
return -1;
@@ -91,7 +89,7 @@ do_scrub_freespace (const char *dir)
return -1;
}
- r = command (NULL, &err, str_scrub, "-X", buf, NULL);
+ r = command (NULL, &err, "scrub", "-X", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s", dir, err);
return -1;
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index fa80cec7a..5679a29cf 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -29,14 +29,12 @@
#include "ignore-value.h"
-GUESTFSD_EXT_CMD(str_setfiles, setfiles);
-
#define MAX_ARGS 64
int
optgroup_selinuxrelabel_available (void)
{
- return prog_exists (str_setfiles);
+ return prog_exists ("setfiles");
}
static int
@@ -46,7 +44,7 @@ setfiles_has_m_option (void)
CLEANUP_FREE char *err = NULL;
if (flag == -1) {
- ignore_value (command (NULL, &err, str_setfiles, "-m", NULL));
+ ignore_value (command (NULL, &err, "setfiles", "-m", NULL));
flag = err && strstr (err, /* "invalid option -- " */
"'m'") == NULL;
}
@@ -86,7 +84,7 @@ do_selinux_relabel (const char *specfile, const char *path,
* observations to the bug report:
*
https://bugzilla.redhat.com/show_bug.cgi?id=1396297
*/
- ADD_ARG (argv, i, str_setfiles);
+ ADD_ARG (argv, i, "setfiles");
if (force)
ADD_ARG (argv, i, "-F");
diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c
index e32e63707..1ea0d6200 100644
--- a/daemon/sfdisk.c
+++ b/daemon/sfdisk.c
@@ -28,9 +28,6 @@
#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,
@@ -40,7 +37,7 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors,
char buf[256];
int i;
- strcpy (buf, str_sfdisk);
+ strcpy (buf, "sfdisk");
if (n > 0)
sprintf (buf + strlen (buf), " -N %d", n);
@@ -103,7 +100,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, str_blockdev, "--rereadpt", device, NULL);
+ (void) command (NULL, NULL, "blockdev", "--rereadpt", device,
NULL);
udev_settle ();
@@ -139,7 +136,7 @@ sfdisk_flag (const char *device, const char *flag)
CLEANUP_FREE char *err = NULL;
int r;
- r = command (&out, &err, str_sfdisk, flag, device, NULL);
+ r = command (&out, &err, "sfdisk", flag, device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
free (out);
diff --git a/daemon/sh.c b/daemon/sh.c
index baebd3960..92ce08be0 100644
--- a/daemon/sh.c
+++ b/daemon/sh.c
@@ -32,10 +32,6 @@
#include "ignore-value.h"
-GUESTFSD_EXT_CMD(str_cp, cp);
-GUESTFSD_EXT_CMD(str_mount, mount);
-GUESTFSD_EXT_CMD(str_umount, umount);
-
#ifdef HAVE_ATTRIBUTE_CLEANUP
#define CLEANUP_BIND_STATE __attribute__((cleanup(free_bind_state)))
#define CLEANUP_RESOLVER_STATE __attribute__((cleanup(free_resolver_state)))
@@ -100,20 +96,20 @@ bind_mount (struct bind_state *bs)
* However I have not found a reliable way to unmount the same set
* of directories (umount -R does NOT work).
*/
- r = command (NULL, NULL, str_mount, "--bind", "/dev",
bs->sysroot_dev, NULL);
+ r = command (NULL, NULL, "mount", "--bind", "/dev",
bs->sysroot_dev, NULL);
bs->dev_ok = r != -1;
- r = command (NULL, NULL, str_mount, "--bind", "/dev/pts",
bs->sysroot_dev_pts, NULL);
+ r = command (NULL, NULL, "mount", "--bind", "/dev/pts",
bs->sysroot_dev_pts, NULL);
bs->dev_pts_ok = r != -1;
- r = command (NULL, NULL, str_mount, "--bind", "/proc",
bs->sysroot_proc, NULL);
+ r = command (NULL, NULL, "mount", "--bind", "/proc",
bs->sysroot_proc, NULL);
bs->proc_ok = r != -1;
/* Note on the next line we have to bind-mount /sys/fs/selinux (appliance
* kernel) on top of /selinux (where guest is expecting selinux).
*/
- r = command (NULL, NULL, str_mount, "--bind", "/sys/fs/selinux",
bs->sysroot_selinux, NULL);
+ r = command (NULL, NULL, "mount", "--bind",
"/sys/fs/selinux", bs->sysroot_selinux, NULL);
bs->selinux_ok = r != -1;
- r = command (NULL, NULL, str_mount, "--bind", "/sys",
bs->sysroot_sys, NULL);
+ r = command (NULL, NULL, "mount", "--bind", "/sys",
bs->sysroot_sys, NULL);
bs->sys_ok = r != -1;
- r = command (NULL, NULL, str_mount, "--bind", "/sys/fs/selinux",
bs->sysroot_sys_fs_selinux, NULL);
+ r = command (NULL, NULL, "mount", "--bind",
"/sys/fs/selinux", bs->sysroot_sys_fs_selinux, NULL);
bs->sys_fs_selinux_ok = r != -1;
bs->mounted = true;
@@ -124,7 +120,7 @@ bind_mount (struct bind_state *bs)
static inline void
umount_ignore_fail (const char *path)
{
- ignore_value (command (NULL, NULL, str_umount, path, NULL));
+ ignore_value (command (NULL, NULL, "umount", path, NULL));
}
static void
@@ -205,7 +201,7 @@ set_up_etc_resolv_conf (struct resolver_state *rs)
/* Now that the guest's <sysroot>/etc/resolv.conf is out the way, we
* can create our own copy of the appliance /etc/resolv.conf.
*/
- ignore_value (command (NULL, NULL, str_cp, "/etc/resolv.conf",
+ ignore_value (command (NULL, NULL, "cp", "/etc/resolv.conf",
rs->sysroot_etc_resolv_conf, NULL));
rs->mounted = true;
diff --git a/daemon/sleuthkit.c b/daemon/sleuthkit.c
index bdbdb0f89..acda48bc9 100644
--- a/daemon/sleuthkit.c
+++ b/daemon/sleuthkit.c
@@ -31,9 +31,6 @@
static int send_command_output (const char *cmd);
-GUESTFSD_EXT_CMD(str_icat, icat);
-GUESTFSD_EXT_CMD(str_blkls, blkls);
-
int
do_download_inode (const mountable_t *mountable, int64_t inode)
{
@@ -47,8 +44,8 @@ do_download_inode (const mountable_t *mountable, int64_t inode)
}
/* Construct the command. */
- ret = asprintf (&cmd, "%s -r %s %" PRIi64,
- str_icat, mountable->device, inode);
+ ret = asprintf (&cmd, "icat -r %s %" PRIi64,
+ mountable->device, inode);
if (ret < 0) {
reply_with_perror ("asprintf");
return -1;
@@ -84,8 +81,8 @@ do_download_blocks (const mountable_t *mountable, int64_t start, int64_t
stop,
params = "";
/* Construct the command. */
- ret = asprintf (&cmd, "%s %s %s %" PRIi64 "-%" PRIi64,
- str_blkls, mountable->device, params, start, stop);
+ ret = asprintf (&cmd, "blkls %s %s %" PRIi64 "-%" PRIi64,
+ mountable->device, params, start, stop);
if (ret < 0) {
reply_with_perror ("asprintf");
return -1;
@@ -155,5 +152,5 @@ send_command_output (const char *cmd)
int
optgroup_sleuthkit_available (void)
{
- return prog_exists (str_icat);
+ return prog_exists ("icat");
}
diff --git a/daemon/squashfs.c b/daemon/squashfs.c
index c30777661..e0d424350 100644
--- a/daemon/squashfs.c
+++ b/daemon/squashfs.c
@@ -29,12 +29,10 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_mksquashfs, mksquashfs);
-
int
optgroup_squashfs_available (void)
{
- return prog_exists (str_mksquashfs);
+ return prog_exists ("mksquashfs");
}
/* Takes optional arguments, consult optargs_bitmask. */
@@ -80,7 +78,7 @@ do_mksquashfs (const char *path, const char *compress, char *const
*excludes)
return -1;
}
- ADD_ARG (argv, i, str_mksquashfs);
+ ADD_ARG (argv, i, "mksquashfs");
ADD_ARG (argv, i, buf);
ADD_ARG (argv, i, tmpfile);
ADD_ARG (argv, i, "-noappend");
diff --git a/daemon/swap.c b/daemon/swap.c
index fea4a9dcf..a00937292 100644
--- a/daemon/swap.c
+++ b/daemon/swap.c
@@ -31,11 +31,6 @@
#include "ignore-value.h"
-GUESTFSD_EXT_CMD(str_mkswap, mkswap);
-GUESTFSD_EXT_CMD(str_swapon, swapon);
-GUESTFSD_EXT_CMD(str_swapoff, swapoff);
-GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
-
/* Confirmed this is true for Linux swap partitions from the Linux sources. */
#define SWAP_LABEL_MAX 16
@@ -55,7 +50,7 @@ do_mkswap (const char *device, const char *label, const char *uuid)
int r;
CLEANUP_FREE char *err = NULL;
- ADD_ARG (argv, i, str_mkswap);
+ ADD_ARG (argv, i, "mkswap");
ADD_ARG (argv, i, "-f");
if (optargs_bitmask & GUESTFS_MKSWAP_LABEL_BITMASK) {
@@ -117,7 +112,7 @@ do_mkswap_file (const char *path)
return -1;
}
- r = command (NULL, &err, str_mkswap, "-f", buf, NULL);
+ r = command (NULL, &err, "mkswap", "-f", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
@@ -154,13 +149,13 @@ swaponoff (const char *cmd, const char *flag, const char *value)
int
do_swapon_device (const char *device)
{
- return swaponoff (str_swapon, NULL, device);
+ return swaponoff ("swapon", NULL, device);
}
int
do_swapoff_device (const char *device)
{
- return swaponoff (str_swapoff, NULL, device);
+ return swaponoff ("swapoff", NULL, device);
}
int
@@ -174,7 +169,7 @@ do_swapon_file (const char *path)
return -1;
}
- return swaponoff (str_swapon, NULL, buf);
+ return swaponoff ("swapon", NULL, buf);
}
int
@@ -188,7 +183,7 @@ do_swapoff_file (const char *path)
return -1;
}
- return swaponoff (str_swapoff, NULL, buf);
+ return swaponoff ("swapoff", NULL, buf);
}
int
@@ -200,7 +195,7 @@ do_swapon_label (const char *label)
return -1;
}
- return swaponoff (str_swapon, "-L", label);
+ return swaponoff ("swapon", "-L", label);
}
int
@@ -212,19 +207,19 @@ do_swapoff_label (const char *label)
return -1;
}
- return swaponoff (str_swapoff, "-L", label);
+ return swaponoff ("swapoff", "-L", label);
}
int
do_swapon_uuid (const char *uuid)
{
- return swaponoff (str_swapon, "-U", uuid);
+ return swaponoff ("swapon", "-U", uuid);
}
int
do_swapoff_uuid (const char *uuid)
{
- return swaponoff (str_swapoff, "-U", uuid);
+ return swaponoff ("swapoff", "-U", uuid);
}
int
@@ -233,7 +228,7 @@ swap_set_uuid (const char *device, const char *uuid)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, str_swaplabel, "-U", uuid, device, NULL);
+ r = command (NULL, &err, "swaplabel", "-U", uuid, device,
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -254,7 +249,7 @@ swap_set_label (const char *device, const char *label)
return -1;
}
- r = command (NULL, &err, str_swaplabel, "-L", label, device, NULL);
+ r = command (NULL, &err, "swaplabel", "-L", label, device,
NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
diff --git a/daemon/syslinux.c b/daemon/syslinux.c
index 08da170d5..f57734b2d 100644
--- a/daemon/syslinux.c
+++ b/daemon/syslinux.c
@@ -28,19 +28,16 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_syslinux, syslinux);
-GUESTFSD_EXT_CMD(str_extlinux, extlinux);
-
int
optgroup_syslinux_available (void)
{
- return prog_exists (str_syslinux);
+ return prog_exists ("syslinux");
}
int
optgroup_extlinux_available (void)
{
- return prog_exists (str_extlinux);
+ return prog_exists ("extlinux");
}
/* Takes optional arguments, consult optargs_bitmask. */
@@ -53,7 +50,7 @@ do_syslinux (const char *device, const char *directory)
CLEANUP_FREE char *err = NULL;
int r;
- ADD_ARG (argv, i, str_syslinux);
+ ADD_ARG (argv, i, "syslinux");
ADD_ARG (argv, i, "--install");
ADD_ARG (argv, i, "--force");
@@ -86,7 +83,7 @@ do_extlinux (const char *directory)
return -1;
}
- r = command (NULL, &err, str_extlinux, "--install", buf, NULL);
+ r = command (NULL, &err, "extlinux", "--install", buf, NULL);
if (r == -1) {
reply_with_error ("%s: %s", directory, err);
return -1;
diff --git a/daemon/tar.c b/daemon/tar.c
index c23aa0a86..53c5bc138 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -35,8 +35,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_tar, tar);
-
int
optgroup_xz_available (void)
{
@@ -187,7 +185,7 @@ do_tar_in (const char *dir, const char *compress, int xattrs, int
selinux, int a
/* "tar -C /sysroot%s -xf -" but we have to quote the dir. */
if (asprintf_nowarn (&cmd, "%s -C %R%s -xf - %s%s%s%s2> %s",
- str_tar,
+ "tar",
dir, filter,
chown_supported ? "" : "--no-same-owner ",
xattrs ? "--xattrs " : "",
@@ -344,7 +342,7 @@ do_tar_out (const char *dir, const char *compress, int numericowner,
/* "tar -C /sysroot%s -cf - ." but we have to quote the dir. */
if (asprintf_nowarn (&cmd, "%s -C %Q%s%s%s%s%s%s%s -cf - .",
- str_tar,
+ "tar",
buf, filter,
numericowner ? " --numeric-owner" : "",
exclude_from_file ? " -X " : "",
diff --git a/daemon/xfs.c b/daemon/xfs.c
index a0d08b2c9..84e361569 100644
--- a/daemon/xfs.c
+++ b/daemon/xfs.c
@@ -32,16 +32,10 @@
#define MAX_ARGS 64
-GUESTFSD_EXT_CMD(str_mkfs_xfs, mkfs.xfs);
-GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
-GUESTFSD_EXT_CMD(str_xfs_info, xfs_info);
-GUESTFSD_EXT_CMD(str_xfs_growfs, xfs_growfs);
-GUESTFSD_EXT_CMD(str_xfs_repair, xfs_repair);
-
int
optgroup_xfs_available (void)
{
- return prog_exists (str_mkfs_xfs);
+ return prog_exists ("mkfs.xfs");
}
/* Return everything up to the first comma, equals or space in the input
@@ -341,7 +335,7 @@ do_xfs_info (const char *pathordevice)
return NULL;
}
- r = command (&out, &err, str_xfs_info, buf, NULL);
+ r = command (&out, &err, "xfs_info", buf, NULL);
if (r == -1) {
reply_with_error ("%s", err);
return NULL;
@@ -376,7 +370,7 @@ do_xfs_growfs (const char *path,
return -1;
}
- ADD_ARG (argv, i, str_xfs_growfs);
+ ADD_ARG (argv, i, "xfs_growfs");
/* Optional arguments */
if (!(optargs_bitmask & GUESTFS_XFS_GROWFS_DATASEC_BITMASK))
@@ -487,7 +481,7 @@ do_xfs_admin (const char *device,
const char *argv[MAX_ARGS];
size_t i = 0;
- ADD_ARG (argv, i, str_xfs_admin);
+ ADD_ARG (argv, i, "xfs_admin");
/* Optional arguments */
if (!(optargs_bitmask & GUESTFS_XFS_ADMIN_EXTUNWRITTEN_BITMASK))
@@ -564,7 +558,7 @@ do_xfs_repair (const char *device,
size_t i = 0;
int is_device;
- ADD_ARG (argv, i, str_xfs_repair);
+ ADD_ARG (argv, i, "xfs_repair");
/* Optional arguments */
if (optargs_bitmask & GUESTFS_XFS_REPAIR_FORCELOGZERO_BITMASK) {
diff --git a/daemon/zero.c b/daemon/zero.c
index 5166807b5..faeb3bcfd 100644
--- a/daemon/zero.c
+++ b/daemon/zero.c
@@ -32,8 +32,6 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_wipefs, wipefs);
-
static const char zero_buf[4096];
int
@@ -81,7 +79,7 @@ do_zero (const char *device)
int
optgroup_wipefs_available (void)
{
- return prog_exists (str_wipefs);
+ return prog_exists ("wipefs");
}
/* See RHBZ#872831 */
@@ -93,7 +91,7 @@ wipefs_has_force_option (void)
CLEANUP_FREE char *out = NULL, *err = NULL;
if (flag == -1) {
- r = command (&out, &err, str_wipefs, "--help", NULL);
+ r = command (&out, &err, "wipefs", "--help", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -118,7 +116,7 @@ do_wipefs (const char *device)
if (force == -1)
return -1;
- ADD_ARG (argv, i, str_wipefs);
+ ADD_ARG (argv, i, "wipefs");
ADD_ARG (argv, i, "-a");
if (force)
ADD_ARG (argv, i, "--force");
@@ -379,7 +377,7 @@ wipe_device_before_mkfs (const char *device)
if (force == -1)
return;
- ADD_ARG (argv, i, str_wipefs);
+ ADD_ARG (argv, i, "wipefs");
ADD_ARG (argv, i, "-a");
if (force)
ADD_ARG (argv, i, "--force");
diff --git a/daemon/zerofree.c b/daemon/zerofree.c
index 4ba17dd81..3f7d1ca5d 100644
--- a/daemon/zerofree.c
+++ b/daemon/zerofree.c
@@ -28,12 +28,10 @@
#include "actions.h"
#include "optgroups.h"
-GUESTFSD_EXT_CMD(str_zerofree, zerofree);
-
int
optgroup_zerofree_available (void)
{
- return prog_exists (str_zerofree);
+ return prog_exists ("zerofree");
}
int
@@ -42,7 +40,7 @@ do_zerofree (const char *device)
CLEANUP_FREE char *err = NULL;
int r;
- r = command (NULL, &err, str_zerofree, device, NULL);
+ r = command (NULL, &err, "zerofree", device, NULL);
if (r == -1) {
reply_with_error ("%s: %s", device, err);
return -1;
--
2.13.2