From: Richard Jones Date: Wed, 10 Jun 2009 10:49:42 +0000 (+0100) Subject: In the daemon, change all const char * parameters to char *. X-Git-Tag: 1.0.44~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=56bef498f46ac3dd580f4bde3c8f3ed2fe688826;p=libguestfs.git In the daemon, change all const char * parameters to char *. --- diff --git a/daemon/actions.h b/daemon/actions.h index e8291d5..c8e285c 100644 --- a/daemon/actions.h +++ b/daemon/actions.h @@ -21,12 +21,12 @@ #include "../src/guestfs_protocol.h" -extern int do_mount (const char *device, const char *mountpoint); +extern int do_mount (char *device, char *mountpoint); extern int do_sync (void); -extern int do_touch (const char *path); -extern char *do_cat (const char *path); -extern char *do_ll (const char *directory); -extern char **do_ls (const char *directory); +extern int do_touch (char *path); +extern char *do_cat (char *path); +extern char *do_ll (char *directory); +extern char **do_ls (char *directory); extern char **do_list_devices (void); extern char **do_list_partitions (void); extern char **do_pvs (void); @@ -35,99 +35,99 @@ extern char **do_lvs (void); extern guestfs_lvm_int_pv_list *do_pvs_full (void); extern guestfs_lvm_int_vg_list *do_vgs_full (void); extern guestfs_lvm_int_lv_list *do_lvs_full (void); -extern char **do_read_lines (const char *path); -extern int do_aug_init (const char *root, int flags); +extern char **do_read_lines (char *path); +extern int do_aug_init (char *root, int flags); extern int do_aug_close (void); -extern int do_aug_defvar (const char *name, const char *expr); -extern guestfs_aug_defnode_ret *do_aug_defnode (const char *name, const char *expr, const char *val); -extern char *do_aug_get (const char *path); -extern int do_aug_set (const char *path, const char *val); -extern int do_aug_insert (const char *path, const char *label, int before); -extern int do_aug_rm (const char *path); -extern int do_aug_mv (const char *src, const char *dest); -extern char **do_aug_match (const char *path); +extern int do_aug_defvar (char *name, char *expr); +extern guestfs_aug_defnode_ret *do_aug_defnode (char *name, char *expr, char *val); +extern char *do_aug_get (char *path); +extern int do_aug_set (char *path, char *val); +extern int do_aug_insert (char *path, char *label, int before); +extern int do_aug_rm (char *path); +extern int do_aug_mv (char *src, char *dest); +extern char **do_aug_match (char *path); extern int do_aug_save (void); extern int do_aug_load (void); -extern char **do_aug_ls (const char *path); -extern int do_rm (const char *path); -extern int do_rmdir (const char *path); -extern int do_rm_rf (const char *path); -extern int do_mkdir (const char *path); -extern int do_mkdir_p (const char *path); -extern int do_chmod (int mode, const char *path); -extern int do_chown (int owner, int group, const char *path); -extern int do_exists (const char *path); -extern int do_is_file (const char *path); -extern int do_is_dir (const char *path); -extern int do_pvcreate (const char *device); -extern int do_vgcreate (const char *volgroup, char * const* const physvols); -extern int do_lvcreate (const char *logvol, const char *volgroup, int mbytes); -extern int do_mkfs (const char *fstype, const char *device); -extern int do_sfdisk (const char *device, int cyls, int heads, int sectors, char * const* const lines); -extern int do_write_file (const char *path, const char *content, int size); -extern int do_umount (const char *pathordevice); +extern char **do_aug_ls (char *path); +extern int do_rm (char *path); +extern int do_rmdir (char *path); +extern int do_rm_rf (char *path); +extern int do_mkdir (char *path); +extern int do_mkdir_p (char *path); +extern int do_chmod (int mode, char *path); +extern int do_chown (int owner, int group, char *path); +extern int do_exists (char *path); +extern int do_is_file (char *path); +extern int do_is_dir (char *path); +extern int do_pvcreate (char *device); +extern int do_vgcreate (char *volgroup, char **physvols); +extern int do_lvcreate (char *logvol, char *volgroup, int mbytes); +extern int do_mkfs (char *fstype, char *device); +extern int do_sfdisk (char *device, int cyls, int heads, int sectors, char **lines); +extern int do_write_file (char *path, char *content, int size); +extern int do_umount (char *pathordevice); extern char **do_mounts (void); extern int do_umount_all (void); extern int do_lvm_remove_all (void); -extern char *do_file (const char *path); -extern char *do_command (char * const* const arguments); -extern char **do_command_lines (char * const* const arguments); -extern guestfs_int_stat *do_stat (const char *path); -extern guestfs_int_stat *do_lstat (const char *path); -extern guestfs_int_statvfs *do_statvfs (const char *path); -extern char **do_tune2fs_l (const char *device); -extern int do_blockdev_setro (const char *device); -extern int do_blockdev_setrw (const char *device); -extern int do_blockdev_getro (const char *device); -extern int do_blockdev_getss (const char *device); -extern int do_blockdev_getbsz (const char *device); -extern int do_blockdev_setbsz (const char *device, int blocksize); -extern int64_t do_blockdev_getsz (const char *device); -extern int64_t do_blockdev_getsize64 (const char *device); -extern int do_blockdev_flushbufs (const char *device); -extern int do_blockdev_rereadpt (const char *device); -extern int do_upload (const char *remotefilename); -extern int do_download (const char *remotefilename); -extern char *do_checksum (const char *csumtype, const char *path); -extern int do_tar_in (const char *directory); -extern int do_tar_out (const char *directory); -extern int do_tgz_in (const char *directory); -extern int do_tgz_out (const char *directory); -extern int do_mount_ro (const char *device, const char *mountpoint); -extern int do_mount_options (const char *options, const char *device, const char *mountpoint); -extern int do_mount_vfs (const char *options, const char *vfstype, const char *device, const char *mountpoint); -extern char *do_debug (const char *subcmd, char * const* const extraargs); -extern int do_lvremove (const char *device); -extern int do_vgremove (const char *vgname); -extern int do_pvremove (const char *device); -extern int do_set_e2label (const char *device, const char *label); -extern char *do_get_e2label (const char *device); -extern int do_set_e2uuid (const char *device, const char *uuid); -extern char *do_get_e2uuid (const char *device); -extern int do_fsck (const char *fstype, const char *device); -extern int do_zero (const char *device); -extern int do_grub_install (const char *root, const char *device); -extern int do_cp (const char *src, const char *dest); -extern int do_cp_a (const char *src, const char *dest); -extern int do_mv (const char *src, const char *dest); +extern char *do_file (char *path); +extern char *do_command (char **arguments); +extern char **do_command_lines (char **arguments); +extern guestfs_int_stat *do_stat (char *path); +extern guestfs_int_stat *do_lstat (char *path); +extern guestfs_int_statvfs *do_statvfs (char *path); +extern char **do_tune2fs_l (char *device); +extern int do_blockdev_setro (char *device); +extern int do_blockdev_setrw (char *device); +extern int do_blockdev_getro (char *device); +extern int do_blockdev_getss (char *device); +extern int do_blockdev_getbsz (char *device); +extern int do_blockdev_setbsz (char *device, int blocksize); +extern int64_t do_blockdev_getsz (char *device); +extern int64_t do_blockdev_getsize64 (char *device); +extern int do_blockdev_flushbufs (char *device); +extern int do_blockdev_rereadpt (char *device); +extern int do_upload (char *remotefilename); +extern int do_download (char *remotefilename); +extern char *do_checksum (char *csumtype, char *path); +extern int do_tar_in (char *directory); +extern int do_tar_out (char *directory); +extern int do_tgz_in (char *directory); +extern int do_tgz_out (char *directory); +extern int do_mount_ro (char *device, char *mountpoint); +extern int do_mount_options (char *options, char *device, char *mountpoint); +extern int do_mount_vfs (char *options, char *vfstype, char *device, char *mountpoint); +extern char *do_debug (char *subcmd, char **extraargs); +extern int do_lvremove (char *device); +extern int do_vgremove (char *vgname); +extern int do_pvremove (char *device); +extern int do_set_e2label (char *device, char *label); +extern char *do_get_e2label (char *device); +extern int do_set_e2uuid (char *device, char *uuid); +extern char *do_get_e2uuid (char *device); +extern int do_fsck (char *fstype, char *device); +extern int do_zero (char *device); +extern int do_grub_install (char *root, char *device); +extern int do_cp (char *src, char *dest); +extern int do_cp_a (char *src, char *dest); +extern int do_mv (char *src, char *dest); extern int do_drop_caches (int whattodrop); extern char *do_dmesg (void); extern int do_ping_daemon (void); -extern int do_equal (const char *file1, const char *file2); -extern char **do_strings (const char *path); -extern char **do_strings_e (const char *encoding, const char *path); -extern char *do_hexdump (const char *path); -extern int do_zerofree (const char *device); -extern int do_pvresize (const char *device); -extern int do_sfdisk_N (const char *device, int n, int cyls, int heads, int sectors, const char *line); -extern char *do_sfdisk_l (const char *device); -extern char *do_sfdisk_kernel_geometry (const char *device); -extern char *do_sfdisk_disk_geometry (const char *device); +extern int do_equal (char *file1, char *file2); +extern char **do_strings (char *path); +extern char **do_strings_e (char *encoding, char *path); +extern char *do_hexdump (char *path); +extern int do_zerofree (char *device); +extern int do_pvresize (char *device); +extern int do_sfdisk_N (char *device, int n, int cyls, int heads, int sectors, char *line); +extern char *do_sfdisk_l (char *device); +extern char *do_sfdisk_kernel_geometry (char *device); +extern char *do_sfdisk_disk_geometry (char *device); extern int do_vg_activate_all (int activate); -extern int do_vg_activate (int activate, char * const* const volgroups); -extern int do_lvresize (const char *device, int mbytes); -extern int do_resize2fs (const char *device); -extern char **do_find (const char *directory); -extern int do_e2fsck_f (const char *device); +extern int do_vg_activate (int activate, char **volgroups); +extern int do_lvresize (char *device, int mbytes); +extern int do_resize2fs (char *device); +extern char **do_find (char *directory); +extern int do_e2fsck_f (char *device); extern int do_sleep (int secs); -extern int do_ntfs_3g_probe (int rw, const char *device); +extern int do_ntfs_3g_probe (int rw, char *device); diff --git a/daemon/augeas.c b/daemon/augeas.c index 0dbf0e7..9b45f97 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -49,7 +49,7 @@ static augeas *aug = NULL; /* We need to rewrite the root path so it is based at /sysroot. */ int -do_aug_init (const char *root, int flags) +do_aug_init (char *root, int flags) { #ifdef HAVE_AUGEAS char *buf; @@ -103,7 +103,7 @@ do_aug_close (void) } int -do_aug_defvar (const char *name, const char *expr) +do_aug_defvar (char *name, char *expr) { #ifdef HAVE_AUG_DEFVAR int r; @@ -123,7 +123,7 @@ do_aug_defvar (const char *name, const char *expr) } guestfs_aug_defnode_ret * -do_aug_defnode (const char *name, const char *expr, const char *val) +do_aug_defnode (char *name, char *expr, char *val) { #ifdef HAVE_AUG_DEFNODE static guestfs_aug_defnode_ret r; @@ -145,7 +145,7 @@ do_aug_defnode (const char *name, const char *expr, const char *val) } char * -do_aug_get (const char *path) +do_aug_get (char *path) { #ifdef HAVE_AUGEAS const char *value = NULL; @@ -188,7 +188,7 @@ do_aug_get (const char *path) } int -do_aug_set (const char *path, const char *val) +do_aug_set (char *path, char *val) { #ifdef HAVE_AUGEAS int r; @@ -209,7 +209,7 @@ do_aug_set (const char *path, const char *val) } int -do_aug_insert (const char *path, const char *label, int before) +do_aug_insert (char *path, char *label, int before) { #ifdef HAVE_AUGEAS int r; @@ -230,7 +230,7 @@ do_aug_insert (const char *path, const char *label, int before) } int -do_aug_rm (const char *path) +do_aug_rm (char *path) { #ifdef HAVE_AUGEAS int r; @@ -251,7 +251,7 @@ do_aug_rm (const char *path) } int -do_aug_mv (const char *src, const char *dest) +do_aug_mv (char *src, char *dest) { #ifdef HAVE_AUGEAS int r; @@ -272,7 +272,7 @@ do_aug_mv (const char *src, const char *dest) } char ** -do_aug_match (const char *path) +do_aug_match (char *path) { #ifdef HAVE_AUGEAS char **matches = NULL; @@ -344,7 +344,7 @@ do_aug_load (void) /* Simpler version of aug-match, which also sorts the output. */ char ** -do_aug_ls (const char *path) +do_aug_ls (char *path) { #ifdef HAVE_AUGEAS char **matches; diff --git a/daemon/blockdev.c b/daemon/blockdev.c index 2c075ef..1b0185a 100644 --- a/daemon/blockdev.c +++ b/daemon/blockdev.c @@ -32,7 +32,7 @@ * we centralize it in one call. */ static int64_t -call_blockdev (const char *device, const char *switc, int extraarg, int prints) +call_blockdev (char *device, char *switc, int extraarg, int prints) { int r; int64_t rv; @@ -80,37 +80,37 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints) } int -do_blockdev_setro (const char *device) +do_blockdev_setro (char *device) { return (int) call_blockdev (device, "--setro", 0, 0); } int -do_blockdev_setrw (const char *device) +do_blockdev_setrw (char *device) { return (int) call_blockdev (device, "--setrw", 0, 0); } int -do_blockdev_getro (const char *device) +do_blockdev_getro (char *device) { return (int) call_blockdev (device, "--getro", 0, 1); } int -do_blockdev_getss (const char *device) +do_blockdev_getss (char *device) { return (int) call_blockdev (device, "--getss", 0, 1); } int -do_blockdev_getbsz (const char *device) +do_blockdev_getbsz (char *device) { return (int) call_blockdev (device, "--getbsz", 0, 1); } int -do_blockdev_setbsz (const char *device, int blocksize) +do_blockdev_setbsz (char *device, int blocksize) { if (blocksize <= 0 /* || blocksize >= what? */) { reply_with_error ("blockdev_setbsz: blocksize must be > 0"); @@ -120,25 +120,25 @@ do_blockdev_setbsz (const char *device, int blocksize) } int64_t -do_blockdev_getsz (const char *device) +do_blockdev_getsz (char *device) { return call_blockdev (device, "--getsz", 0, 1); } int64_t -do_blockdev_getsize64 (const char *device) +do_blockdev_getsize64 (char *device) { return call_blockdev (device, "--getsize64", 0, 1); } int -do_blockdev_flushbufs (const char *device) +do_blockdev_flushbufs (char *device) { return call_blockdev (device, "--flushbufs", 0, 0); } int -do_blockdev_rereadpt (const char *device) +do_blockdev_rereadpt (char *device) { return call_blockdev (device, "--rereadpt", 0, 0); } diff --git a/daemon/checksum.c b/daemon/checksum.c index bdbef13..3654b65 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -28,7 +28,7 @@ #include "actions.h" char * -do_checksum (const char *csumtype, const char *path) +do_checksum (char *csumtype, char *path) { const char *program; char *buf; diff --git a/daemon/cmp.c b/daemon/cmp.c index 7f92ef0..04feba6 100644 --- a/daemon/cmp.c +++ b/daemon/cmp.c @@ -28,7 +28,7 @@ #include "actions.h" int -do_equal (const char *file1, const char *file2) +do_equal (char *file1, char *file2) { char *file1buf, *file2buf; int file1len, file2len; diff --git a/daemon/command.c b/daemon/command.c index 46a265c..3254de5 100644 --- a/daemon/command.c +++ b/daemon/command.c @@ -27,7 +27,7 @@ #include "actions.h" char * -do_command (char * const * const argv) +do_command (char **argv) { char *out, *err; int r; @@ -84,7 +84,7 @@ do_command (char * const * const argv) } char ** -do_command_lines (char * const * const argv) +do_command_lines (char **argv) { char *out; char **lines; diff --git a/daemon/cpmv.c b/daemon/cpmv.c index 33755c4..b87d7a4 100644 --- a/daemon/cpmv.c +++ b/daemon/cpmv.c @@ -28,19 +28,19 @@ 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) +do_cp (char *src, char *dest) { return cpmv_cmd ("cp", NULL, src, dest); } int -do_cp_a (const char *src, const char *dest) +do_cp_a (char *src, char *dest) { return cpmv_cmd ("cp", "-a", src, dest); } int -do_mv (const char *src, const char *dest) +do_mv (char *src, char *dest) { return cpmv_cmd ("mv", NULL, src, dest); } diff --git a/daemon/debug.c b/daemon/debug.c index 6e9e373..ce760e6 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -61,7 +61,7 @@ static struct cmd cmds[] = { #endif char * -do_debug (const char *subcmd, char *const *const argv) +do_debug (char *subcmd, char **argv) { #if ENABLE_DEBUG_COMMAND int argc, i; diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 21854b5..83e4bb9 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -135,7 +135,7 @@ do_list_partitions (void) } int -do_mkfs (const char *fstype, const char *device) +do_mkfs (char *fstype, char *device) { char *err; int r; diff --git a/daemon/dir.c b/daemon/dir.c index 3df6233..83536ef 100644 --- a/daemon/dir.c +++ b/daemon/dir.c @@ -30,7 +30,7 @@ #include "actions.h" int -do_rmdir (const char *path) +do_rmdir (char *path) { int r; @@ -54,7 +54,7 @@ do_rmdir (const char *path) * do stupid stuff, who are we to try to stop them? */ int -do_rm_rf (const char *path) +do_rm_rf (char *path) { int r, len; char *buf, *err; @@ -92,7 +92,7 @@ do_rm_rf (const char *path) } int -do_mkdir (const char *path) +do_mkdir (char *path) { int r; @@ -158,7 +158,7 @@ recursive_mkdir (const char *path) } int -do_mkdir_p (const char *path) +do_mkdir_p (char *path) { int r; @@ -178,7 +178,7 @@ do_mkdir_p (const char *path) } int -do_is_dir (const char *path) +do_is_dir (char *path) { int r; struct stat buf; diff --git a/daemon/ext2.c b/daemon/ext2.c index 4e1b398..c5e1415 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -28,7 +28,7 @@ #include "actions.h" char ** -do_tune2fs_l (const char *device) +do_tune2fs_l (char *device) { int r; char *out, *err; @@ -117,7 +117,7 @@ do_tune2fs_l (const char *device) } int -do_set_e2label (const char *device, const char *label) +do_set_e2label (char *device, char *label) { int r; char *err; @@ -136,7 +136,7 @@ do_set_e2label (const char *device, const char *label) } char * -do_get_e2label (const char *device) +do_get_e2label (char *device) { int r, len; char *out, *err; @@ -162,7 +162,7 @@ do_get_e2label (const char *device) } int -do_set_e2uuid (const char *device, const char *uuid) +do_set_e2uuid (char *device, char *uuid) { int r; char *err; @@ -181,7 +181,7 @@ do_set_e2uuid (const char *device, const char *uuid) } char * -do_get_e2uuid (const char *device) +do_get_e2uuid (char *device) { int r; char *out, *err, *p, *q; @@ -244,7 +244,7 @@ do_get_e2uuid (const char *device) } int -do_resize2fs (const char *device) +do_resize2fs (char *device) { char *err; int r; @@ -263,7 +263,7 @@ do_resize2fs (const char *device) } int -do_e2fsck_f (const char *device) +do_e2fsck_f (char *device) { char *err; int r; diff --git a/daemon/file.c b/daemon/file.c index 8847d26..0eef0c0 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -30,7 +30,7 @@ #include "actions.h" int -do_touch (const char *path) +do_touch (char *path) { int fd; int r; @@ -63,7 +63,7 @@ do_touch (const char *path) } char * -do_cat (const char *path) +do_cat (char *path) { int fd; int alloc, size, r, max; @@ -134,7 +134,7 @@ do_cat (const char *path) } char ** -do_read_lines (const char *path) +do_read_lines (char *path) { char **r = NULL; int size = 0, alloc = 0; @@ -186,7 +186,7 @@ do_read_lines (const char *path) } int -do_rm (const char *path) +do_rm (char *path) { int r; @@ -206,7 +206,7 @@ do_rm (const char *path) } int -do_chmod (int mode, const char *path) +do_chmod (int mode, char *path) { int r; @@ -226,7 +226,7 @@ do_chmod (int mode, const char *path) } int -do_chown (int owner, int group, const char *path) +do_chown (int owner, int group, char *path) { int r; @@ -246,7 +246,7 @@ do_chown (int owner, int group, const char *path) } int -do_exists (const char *path) +do_exists (char *path) { int r; @@ -261,7 +261,7 @@ do_exists (const char *path) } int -do_is_file (const char *path) +do_is_file (char *path) { int r; struct stat buf; @@ -286,7 +286,7 @@ do_is_file (const char *path) } int -do_write_file (const char *path, const char *content, int size) +do_write_file (char *path, char *content, int size) { int fd; @@ -321,7 +321,7 @@ do_write_file (const char *path, const char *content, int size) /* This runs the 'file' command. */ char * -do_file (const char *path) +do_file (char *path) { char *out, *err; int r, len, freeit = 0; diff --git a/daemon/find.c b/daemon/find.c index 6a7e3e8..a873bca 100644 --- a/daemon/find.c +++ b/daemon/find.c @@ -48,7 +48,7 @@ input_to_nul (FILE *fp, char *buf, int maxlen) } char ** -do_find (const char *dir) +do_find (char *dir) { struct stat statbuf; int r, len, sysrootdirlen; diff --git a/daemon/fsck.c b/daemon/fsck.c index 7f81e96..77e7c66 100644 --- a/daemon/fsck.c +++ b/daemon/fsck.c @@ -27,7 +27,7 @@ #include "actions.h" int -do_fsck (const char *fstype, const char *device) +do_fsck (char *fstype, char *device) { char *err; int r; diff --git a/daemon/grub.c b/daemon/grub.c index 8a38d0b..85a5ab9 100644 --- a/daemon/grub.c +++ b/daemon/grub.c @@ -26,7 +26,7 @@ #include "actions.h" int -do_grub_install (const char *root, const char *device) +do_grub_install (char *root, char *device) { int r, len; char *err; diff --git a/daemon/hexdump.c b/daemon/hexdump.c index 9de602a..ae7df92 100644 --- a/daemon/hexdump.c +++ b/daemon/hexdump.c @@ -26,7 +26,7 @@ #include "actions.h" char * -do_hexdump (const char *path) +do_hexdump (char *path) { int len; char *buf; diff --git a/daemon/ls.c b/daemon/ls.c index 261bc96..61055b6 100644 --- a/daemon/ls.c +++ b/daemon/ls.c @@ -30,7 +30,7 @@ #include "actions.h" char ** -do_ls (const char *path) +do_ls (char *path) { char **r = NULL; int size = 0, alloc = 0; @@ -75,7 +75,7 @@ do_ls (const char *path) } char * -do_ll (const char *path) +do_ll (char *path) { int r, len; char *out, *err; diff --git a/daemon/lvm.c b/daemon/lvm.c index c30d4e7..143c5a8 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -171,7 +171,7 @@ do_lvs_full (void) } int -do_pvcreate (const char *device) +do_pvcreate (char *device) { char *err; int r; @@ -191,13 +191,15 @@ do_pvcreate (const char *device) } int -do_vgcreate (const char *volgroup, char * const* const physvols) +do_vgcreate (char *volgroup, char **physvols) { char *err; int r, argc, i; const char **argv; - Xphysvols; + /* Check they are devices and also do device name translation. */ + for (i = 0; physvols[i] != NULL; ++i) + IS_DEVICE (physvols[i], -1); argc = count_strings (physvols) + 3; argv = malloc (sizeof (char *) * (argc + 1)); @@ -223,7 +225,7 @@ do_vgcreate (const char *volgroup, char * const* const physvols) } int -do_lvcreate (const char *logvol, const char *volgroup, int mbytes) +do_lvcreate (char *logvol, char *volgroup, int mbytes) { char *err; int r; @@ -245,7 +247,7 @@ do_lvcreate (const char *logvol, const char *volgroup, int mbytes) } int -do_lvresize (const char *logvol, int mbytes) +do_lvresize (char *logvol, int mbytes) { char *err; int r; @@ -334,7 +336,7 @@ do_lvm_remove_all (void) } int -do_lvremove (const char *device) +do_lvremove (char *device) { char *err; int r; @@ -354,13 +356,11 @@ do_lvremove (const char *device) } int -do_vgremove (const char *device) +do_vgremove (char *device) { char *err; int r; - IS_DEVICE (device, -1); - r = command (NULL, &err, "/sbin/lvm", "vgremove", "-f", device, NULL); if (r == -1) { @@ -374,7 +374,7 @@ do_vgremove (const char *device) } int -do_pvremove (const char *device) +do_pvremove (char *device) { char *err; int r; @@ -394,7 +394,7 @@ do_pvremove (const char *device) } int -do_pvresize (const char *device) +do_pvresize (char *device) { char *err; int r; @@ -414,7 +414,7 @@ do_pvresize (const char *device) } int -do_vg_activate (int activate, char * const* const volgroups) +do_vg_activate (int activate, char **volgroups) { char *err; int r, i, argc; diff --git a/daemon/mount.c b/daemon/mount.c index 071ca96..4955fcf 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -39,8 +39,8 @@ int root_mounted = 0; */ int -do_mount_vfs (const char *options, const char *vfstype, - const char *device, const char *mountpoint) +do_mount_vfs (char *options, char *vfstype, + char *device, char *mountpoint) { int len, r, is_root; char *mp; @@ -84,20 +84,20 @@ do_mount_vfs (const char *options, const char *vfstype, } int -do_mount (const char *device, const char *mountpoint) +do_mount (char *device, char *mountpoint) { return do_mount_vfs ("sync,noatime", NULL, device, mountpoint); } int -do_mount_ro (const char *device, const char *mountpoint) +do_mount_ro (char *device, char *mountpoint) { return do_mount_vfs ("ro", NULL, device, mountpoint); } int -do_mount_options (const char *options, const char *device, - const char *mountpoint) +do_mount_options (char *options, char *device, + char *mountpoint) { return do_mount_vfs (options, NULL, device, mountpoint); } @@ -106,7 +106,7 @@ do_mount_options (const char *options, const char *device, * is kept updated. */ int -do_umount (const char *pathordevice) +do_umount (char *pathordevice) { int len, freeit = 0, r; char *buf; diff --git a/daemon/ntfs.c b/daemon/ntfs.c index 70826df..87881b1 100644 --- a/daemon/ntfs.c +++ b/daemon/ntfs.c @@ -27,7 +27,7 @@ #include "actions.h" int -do_ntfs_3g_probe (int rw, const char *device) +do_ntfs_3g_probe (int rw, char *device) { char *err; int r; diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c index 2f5206e..95f04af 100644 --- a/daemon/sfdisk.c +++ b/daemon/sfdisk.c @@ -30,7 +30,7 @@ #include "actions.h" static int -sfdisk (const char *device, int n, int cyls, int heads, int sectors, +sfdisk (char *device, int n, int cyls, int heads, int sectors, char * const* const lines) { FILE *fp; @@ -78,15 +78,15 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, } int -do_sfdisk (const char *device, int cyls, int heads, int sectors, - char * const* const lines) +do_sfdisk (char *device, int cyls, int heads, int sectors, + char **lines) { return sfdisk (device, 0, cyls, heads, sectors, lines); } int -do_sfdisk_N (const char *device, int n, int cyls, int heads, int sectors, - const char *line) +do_sfdisk_N (char *device, int n, int cyls, int heads, int sectors, + char *line) { const char *lines[2] = { line, NULL }; @@ -94,7 +94,7 @@ do_sfdisk_N (const char *device, int n, int cyls, int heads, int sectors, } static char * -sfdisk_flag (const char *device, const char *flag) +sfdisk_flag (char *device, const char *flag) { char *out, *err; int r; @@ -115,19 +115,19 @@ sfdisk_flag (const char *device, const char *flag) } char * -do_sfdisk_l (const char *device) +do_sfdisk_l (char *device) { return sfdisk_flag (device, "-l"); } char * -do_sfdisk_kernel_geometry (const char *device) +do_sfdisk_kernel_geometry (char *device) { return sfdisk_flag (device, "-g"); } char * -do_sfdisk_disk_geometry (const char *device) +do_sfdisk_disk_geometry (char *device) { return sfdisk_flag (device, "-G"); } diff --git a/daemon/stat.c b/daemon/stat.c index 743dc6e..6b12f4c 100644 --- a/daemon/stat.c +++ b/daemon/stat.c @@ -31,7 +31,7 @@ #include "actions.h" guestfs_int_stat * -do_stat (const char *path) +do_stat (char *path) { int r; guestfs_int_stat *ret; @@ -73,7 +73,7 @@ do_stat (const char *path) } guestfs_int_stat * -do_lstat (const char *path) +do_lstat (char *path) { int r; guestfs_int_stat *ret; @@ -115,7 +115,7 @@ do_lstat (const char *path) } guestfs_int_statvfs * -do_statvfs (const char *path) +do_statvfs (char *path) { int r; guestfs_int_statvfs *ret; diff --git a/daemon/strings.c b/daemon/strings.c index b26691d..d78f9fd 100644 --- a/daemon/strings.c +++ b/daemon/strings.c @@ -26,7 +26,7 @@ #include "actions.h" char ** -do_strings_e (const char *encoding, const char *path) +do_strings_e (char *encoding, char *path) { int len; char *buf; @@ -68,7 +68,7 @@ do_strings_e (const char *encoding, const char *path) } char ** -do_strings (const char *path) +do_strings (char *path) { return do_strings_e ("s", path); } diff --git a/daemon/stubs.c b/daemon/stubs.c index 2a29644..7842640 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -37,8 +37,8 @@ static void mount_stub (XDR *xdr_in) { int r; struct guestfs_mount_args args; - const char *device; - const char *mountpoint; + char *device; + char *mountpoint; memset (&args, 0, sizeof args); @@ -76,7 +76,7 @@ static void touch_stub (XDR *xdr_in) { int r; struct guestfs_touch_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -100,7 +100,7 @@ static void cat_stub (XDR *xdr_in) { char *r; struct guestfs_cat_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -127,7 +127,7 @@ static void ll_stub (XDR *xdr_in) { char *r; struct guestfs_ll_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -154,7 +154,7 @@ static void ls_stub (XDR *xdr_in) { char **r; struct guestfs_ls_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -315,7 +315,7 @@ static void read_lines_stub (XDR *xdr_in) { char **r; struct guestfs_read_lines_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -343,7 +343,7 @@ static void aug_init_stub (XDR *xdr_in) { int r; struct guestfs_aug_init_args args; - const char *root; + char *root; int flags; memset (&args, 0, sizeof args); @@ -382,8 +382,8 @@ static void aug_defvar_stub (XDR *xdr_in) { int r; struct guestfs_aug_defvar_args args; - const char *name; - const char *expr; + char *name; + char *expr; memset (&args, 0, sizeof args); @@ -410,9 +410,9 @@ static void aug_defnode_stub (XDR *xdr_in) { guestfs_aug_defnode_ret *r; struct guestfs_aug_defnode_args args; - const char *name; - const char *expr; - const char *val; + char *name; + char *expr; + char *val; memset (&args, 0, sizeof args); @@ -439,7 +439,7 @@ static void aug_get_stub (XDR *xdr_in) { char *r; struct guestfs_aug_get_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -466,8 +466,8 @@ static void aug_set_stub (XDR *xdr_in) { int r; struct guestfs_aug_set_args args; - const char *path; - const char *val; + char *path; + char *val; memset (&args, 0, sizeof args); @@ -492,8 +492,8 @@ static void aug_insert_stub (XDR *xdr_in) { int r; struct guestfs_aug_insert_args args; - const char *path; - const char *label; + char *path; + char *label; int before; memset (&args, 0, sizeof args); @@ -520,7 +520,7 @@ static void aug_rm_stub (XDR *xdr_in) { int r; struct guestfs_aug_rm_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -546,8 +546,8 @@ static void aug_mv_stub (XDR *xdr_in) { int r; struct guestfs_aug_mv_args args; - const char *src; - const char *dest; + char *src; + char *dest; memset (&args, 0, sizeof args); @@ -572,7 +572,7 @@ static void aug_match_stub (XDR *xdr_in) { char **r; struct guestfs_aug_match_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -626,7 +626,7 @@ static void aug_ls_stub (XDR *xdr_in) { char **r; struct guestfs_aug_ls_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -654,7 +654,7 @@ static void rm_stub (XDR *xdr_in) { int r; struct guestfs_rm_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -678,7 +678,7 @@ static void rmdir_stub (XDR *xdr_in) { int r; struct guestfs_rmdir_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -702,7 +702,7 @@ static void rm_rf_stub (XDR *xdr_in) { int r; struct guestfs_rm_rf_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -726,7 +726,7 @@ static void mkdir_stub (XDR *xdr_in) { int r; struct guestfs_mkdir_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -750,7 +750,7 @@ static void mkdir_p_stub (XDR *xdr_in) { int r; struct guestfs_mkdir_p_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -775,7 +775,7 @@ static void chmod_stub (XDR *xdr_in) int r; struct guestfs_chmod_args args; int mode; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -802,7 +802,7 @@ static void chown_stub (XDR *xdr_in) struct guestfs_chown_args args; int owner; int group; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -828,7 +828,7 @@ static void exists_stub (XDR *xdr_in) { int r; struct guestfs_exists_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -854,7 +854,7 @@ static void is_file_stub (XDR *xdr_in) { int r; struct guestfs_is_file_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -880,7 +880,7 @@ static void is_dir_stub (XDR *xdr_in) { int r; struct guestfs_is_dir_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -906,7 +906,7 @@ static void pvcreate_stub (XDR *xdr_in) { int r; struct guestfs_pvcreate_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -930,7 +930,7 @@ static void vgcreate_stub (XDR *xdr_in) { int r; struct guestfs_vgcreate_args args; - const char *volgroup; + char *volgroup; char **physvols; memset (&args, 0, sizeof args); @@ -963,8 +963,8 @@ static void lvcreate_stub (XDR *xdr_in) { int r; struct guestfs_lvcreate_args args; - const char *logvol; - const char *volgroup; + char *logvol; + char *volgroup; int mbytes; memset (&args, 0, sizeof args); @@ -991,8 +991,8 @@ static void mkfs_stub (XDR *xdr_in) { int r; struct guestfs_mkfs_args args; - const char *fstype; - const char *device; + char *fstype; + char *device; memset (&args, 0, sizeof args); @@ -1017,7 +1017,7 @@ static void sfdisk_stub (XDR *xdr_in) { int r; struct guestfs_sfdisk_args args; - const char *device; + char *device; int cyls; int heads; int sectors; @@ -1056,8 +1056,8 @@ static void write_file_stub (XDR *xdr_in) { int r; struct guestfs_write_file_args args; - const char *path; - const char *content; + char *path; + char *content; int size; memset (&args, 0, sizeof args); @@ -1084,7 +1084,7 @@ static void umount_stub (XDR *xdr_in) { int r; struct guestfs_umount_args args; - const char *pathordevice; + char *pathordevice; memset (&args, 0, sizeof args); @@ -1151,7 +1151,7 @@ static void file_stub (XDR *xdr_in) { char *r; struct guestfs_file_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -1247,7 +1247,7 @@ static void stat_stub (XDR *xdr_in) { guestfs_int_stat *r; struct guestfs_stat_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -1274,7 +1274,7 @@ static void lstat_stub (XDR *xdr_in) { guestfs_int_stat *r; struct guestfs_lstat_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -1301,7 +1301,7 @@ static void statvfs_stub (XDR *xdr_in) { guestfs_int_statvfs *r; struct guestfs_statvfs_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -1328,7 +1328,7 @@ static void tune2fs_l_stub (XDR *xdr_in) { char **r; struct guestfs_tune2fs_l_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1356,7 +1356,7 @@ static void blockdev_setro_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_setro_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1380,7 +1380,7 @@ static void blockdev_setrw_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_setrw_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1404,7 +1404,7 @@ static void blockdev_getro_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_getro_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1430,7 +1430,7 @@ static void blockdev_getss_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_getss_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1456,7 +1456,7 @@ static void blockdev_getbsz_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_getbsz_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1482,7 +1482,7 @@ static void blockdev_setbsz_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_setbsz_args args; - const char *device; + char *device; int blocksize; memset (&args, 0, sizeof args); @@ -1508,7 +1508,7 @@ static void blockdev_getsz_stub (XDR *xdr_in) { int64_t r; struct guestfs_blockdev_getsz_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1534,7 +1534,7 @@ static void blockdev_getsize64_stub (XDR *xdr_in) { int64_t r; struct guestfs_blockdev_getsize64_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1560,7 +1560,7 @@ static void blockdev_flushbufs_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_flushbufs_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1584,7 +1584,7 @@ static void blockdev_rereadpt_stub (XDR *xdr_in) { int r; struct guestfs_blockdev_rereadpt_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1608,7 +1608,7 @@ static void upload_stub (XDR *xdr_in) { int r; struct guestfs_upload_args args; - const char *remotefilename; + char *remotefilename; memset (&args, 0, sizeof args); @@ -1632,7 +1632,7 @@ static void download_stub (XDR *xdr_in) { int r; struct guestfs_download_args args; - const char *remotefilename; + char *remotefilename; memset (&args, 0, sizeof args); @@ -1656,8 +1656,8 @@ static void checksum_stub (XDR *xdr_in) { char *r; struct guestfs_checksum_args args; - const char *csumtype; - const char *path; + char *csumtype; + char *path; memset (&args, 0, sizeof args); @@ -1685,7 +1685,7 @@ static void tar_in_stub (XDR *xdr_in) { int r; struct guestfs_tar_in_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -1709,7 +1709,7 @@ static void tar_out_stub (XDR *xdr_in) { int r; struct guestfs_tar_out_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -1733,7 +1733,7 @@ static void tgz_in_stub (XDR *xdr_in) { int r; struct guestfs_tgz_in_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -1757,7 +1757,7 @@ static void tgz_out_stub (XDR *xdr_in) { int r; struct guestfs_tgz_out_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -1781,8 +1781,8 @@ static void mount_ro_stub (XDR *xdr_in) { int r; struct guestfs_mount_ro_args args; - const char *device; - const char *mountpoint; + char *device; + char *mountpoint; memset (&args, 0, sizeof args); @@ -1807,9 +1807,9 @@ static void mount_options_stub (XDR *xdr_in) { int r; struct guestfs_mount_options_args args; - const char *options; - const char *device; - const char *mountpoint; + char *options; + char *device; + char *mountpoint; memset (&args, 0, sizeof args); @@ -1835,10 +1835,10 @@ static void mount_vfs_stub (XDR *xdr_in) { int r; struct guestfs_mount_vfs_args args; - const char *options; - const char *vfstype; - const char *device; - const char *mountpoint; + char *options; + char *vfstype; + char *device; + char *mountpoint; memset (&args, 0, sizeof args); @@ -1865,7 +1865,7 @@ static void debug_stub (XDR *xdr_in) { char *r; struct guestfs_debug_args args; - const char *subcmd; + char *subcmd; char **extraargs; memset (&args, 0, sizeof args); @@ -1901,7 +1901,7 @@ static void lvremove_stub (XDR *xdr_in) { int r; struct guestfs_lvremove_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1925,7 +1925,7 @@ static void vgremove_stub (XDR *xdr_in) { int r; struct guestfs_vgremove_args args; - const char *vgname; + char *vgname; memset (&args, 0, sizeof args); @@ -1949,7 +1949,7 @@ static void pvremove_stub (XDR *xdr_in) { int r; struct guestfs_pvremove_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -1973,8 +1973,8 @@ static void set_e2label_stub (XDR *xdr_in) { int r; struct guestfs_set_e2label_args args; - const char *device; - const char *label; + char *device; + char *label; memset (&args, 0, sizeof args); @@ -1999,7 +1999,7 @@ static void get_e2label_stub (XDR *xdr_in) { char *r; struct guestfs_get_e2label_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2026,8 +2026,8 @@ static void set_e2uuid_stub (XDR *xdr_in) { int r; struct guestfs_set_e2uuid_args args; - const char *device; - const char *uuid; + char *device; + char *uuid; memset (&args, 0, sizeof args); @@ -2052,7 +2052,7 @@ static void get_e2uuid_stub (XDR *xdr_in) { char *r; struct guestfs_get_e2uuid_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2079,8 +2079,8 @@ static void fsck_stub (XDR *xdr_in) { int r; struct guestfs_fsck_args args; - const char *fstype; - const char *device; + char *fstype; + char *device; memset (&args, 0, sizeof args); @@ -2107,7 +2107,7 @@ static void zero_stub (XDR *xdr_in) { int r; struct guestfs_zero_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2131,8 +2131,8 @@ static void grub_install_stub (XDR *xdr_in) { int r; struct guestfs_grub_install_args args; - const char *root; - const char *device; + char *root; + char *device; memset (&args, 0, sizeof args); @@ -2157,8 +2157,8 @@ static void cp_stub (XDR *xdr_in) { int r; struct guestfs_cp_args args; - const char *src; - const char *dest; + char *src; + char *dest; memset (&args, 0, sizeof args); @@ -2183,8 +2183,8 @@ static void cp_a_stub (XDR *xdr_in) { int r; struct guestfs_cp_a_args args; - const char *src; - const char *dest; + char *src; + char *dest; memset (&args, 0, sizeof args); @@ -2209,8 +2209,8 @@ static void mv_stub (XDR *xdr_in) { int r; struct guestfs_mv_args args; - const char *src; - const char *dest; + char *src; + char *dest; memset (&args, 0, sizeof args); @@ -2288,8 +2288,8 @@ static void equal_stub (XDR *xdr_in) { int r; struct guestfs_equal_args args; - const char *file1; - const char *file2; + char *file1; + char *file2; memset (&args, 0, sizeof args); @@ -2316,7 +2316,7 @@ static void strings_stub (XDR *xdr_in) { char **r; struct guestfs_strings_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -2344,8 +2344,8 @@ static void strings_e_stub (XDR *xdr_in) { char **r; struct guestfs_strings_e_args args; - const char *encoding; - const char *path; + char *encoding; + char *path; memset (&args, 0, sizeof args); @@ -2374,7 +2374,7 @@ static void hexdump_stub (XDR *xdr_in) { char *r; struct guestfs_hexdump_args args; - const char *path; + char *path; memset (&args, 0, sizeof args); @@ -2401,7 +2401,7 @@ static void zerofree_stub (XDR *xdr_in) { int r; struct guestfs_zerofree_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2425,7 +2425,7 @@ static void pvresize_stub (XDR *xdr_in) { int r; struct guestfs_pvresize_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2449,12 +2449,12 @@ static void sfdisk_N_stub (XDR *xdr_in) { int r; struct guestfs_sfdisk_N_args args; - const char *device; + char *device; int n; int cyls; int heads; int sectors; - const char *line; + char *line; memset (&args, 0, sizeof args); @@ -2483,7 +2483,7 @@ static void sfdisk_l_stub (XDR *xdr_in) { char *r; struct guestfs_sfdisk_l_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2510,7 +2510,7 @@ static void sfdisk_kernel_geometry_stub (XDR *xdr_in) { char *r; struct guestfs_sfdisk_kernel_geometry_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2537,7 +2537,7 @@ static void sfdisk_disk_geometry_stub (XDR *xdr_in) { char *r; struct guestfs_sfdisk_disk_geometry_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2621,7 +2621,7 @@ static void lvresize_stub (XDR *xdr_in) { int r; struct guestfs_lvresize_args args; - const char *device; + char *device; int mbytes; memset (&args, 0, sizeof args); @@ -2647,7 +2647,7 @@ static void resize2fs_stub (XDR *xdr_in) { int r; struct guestfs_resize2fs_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2671,7 +2671,7 @@ static void find_stub (XDR *xdr_in) { char **r; struct guestfs_find_args args; - const char *directory; + char *directory; memset (&args, 0, sizeof args); @@ -2699,7 +2699,7 @@ static void e2fsck_f_stub (XDR *xdr_in) { int r; struct guestfs_e2fsck_f_args args; - const char *device; + char *device; memset (&args, 0, sizeof args); @@ -2748,7 +2748,7 @@ static void ntfs_3g_probe_stub (XDR *xdr_in) int r; struct guestfs_ntfs_3g_probe_args args; int rw; - const char *device; + char *device; memset (&args, 0, sizeof args); diff --git a/daemon/tar.c b/daemon/tar.c index 9f4813c..4d9feaa 100644 --- a/daemon/tar.c +++ b/daemon/tar.c @@ -36,7 +36,7 @@ fwrite_cb (void *fp_ptr, const void *buf, int len) /* Has one FileIn parameter. */ int -do_tar_in (const char *dir) +do_tar_in (char *dir) { int err, r, len; FILE *fp; @@ -101,7 +101,7 @@ do_tar_in (const char *dir) /* Has one FileOut parameter. */ int -do_tar_out (const char *dir) +do_tar_out (char *dir) { int r, len; FILE *fp; @@ -162,7 +162,7 @@ do_tar_out (const char *dir) /* Has one FileIn parameter. */ int -do_tgz_in (const char *dir) +do_tgz_in (char *dir) { int err, r, len; FILE *fp; @@ -227,7 +227,7 @@ do_tgz_in (const char *dir) /* Has one FileOut parameter. */ int -do_tgz_out (const char *dir) +do_tgz_out (char *dir) { int r, len; FILE *fp; diff --git a/daemon/upload.c b/daemon/upload.c index 41b1bf2..0f737af 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -36,7 +36,7 @@ write_cb (void *fd_ptr, const void *buf, int len) /* Has one FileIn parameter. */ int -do_upload (const char *filename) +do_upload (char *filename) { int err, fd, r, is_dev; @@ -88,7 +88,7 @@ do_upload (const char *filename) /* Has one FileOut parameter. */ int -do_download (const char *filename) +do_download (char *filename) { int fd, r, is_dev; char buf[GUESTFS_MAX_CHUNK_SIZE]; diff --git a/daemon/zero.c b/daemon/zero.c index 2c20abc..9d793e1 100644 --- a/daemon/zero.c +++ b/daemon/zero.c @@ -28,7 +28,7 @@ #include "actions.h" int -do_zero (const char *device) +do_zero (char *device) { int fd, i; char buf[4096]; diff --git a/daemon/zerofree.c b/daemon/zerofree.c index b44965a..ed7a3fc 100644 --- a/daemon/zerofree.c +++ b/daemon/zerofree.c @@ -28,7 +28,7 @@ #include "actions.h" int -do_zerofree (const char *device) +do_zerofree (char *device) { char *err; int r; diff --git a/src/generator.ml b/src/generator.ml index 2113bc4..3e4b506 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -3496,8 +3496,12 @@ and generate_daemon_actions () = pr " struct guestfs_%s_args args;\n" name; List.iter ( function + (* Note we allow the string to be writable, in order to + * allow device name translation. This is safe because + * we can modify the string (passed from RPC). + *) | String n - | OptString n -> pr " const char *%s;\n" n + | OptString n -> pr " char *%s;\n" n | StringList n -> pr " char **%s;\n" n | Bool n -> pr " int %s;\n" n | Int n -> pr " int %s;\n" n @@ -4929,8 +4933,14 @@ and generate_prototype ?(extern = true) ?(static = false) ?(semicolon = true) List.iter ( function | String n - | OptString n -> next (); pr "const char *%s" n - | StringList n -> next (); pr "char * const* const %s" n + | OptString n -> + next (); + if not in_daemon then pr "const char *%s" n + else pr "char *%s" n + | StringList n -> + next (); + if not in_daemon then pr "char * const* const %s" n + else pr "char **%s" n | Bool n -> next (); pr "int %s" n | Int n -> next (); pr "int %s" n | FileIn n