X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Flvm.c;h=ddc125c93742e90fdf40ee5ddfe6b52de893bdec;hb=1f0810eb3a98cbfd347af59b6b9bc624ddff6028;hp=b81badbcf8de495bf364806e1cd7d4aea02b9173;hpb=a7b73d4a1e09f12b2002083618056f0c823c1dcf;p=libguestfs.git diff --git a/daemon/lvm.c b/daemon/lvm.c index b81badb..ddc125c 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -32,7 +32,7 @@ */ static char ** -convert_lvm_output (char *out, char *prefix) +convert_lvm_output (char *out, const char *prefix) { char *p, *pend; char **r = NULL; @@ -93,7 +93,7 @@ do_pvs (void) int r; r = command (&out, &err, - "/sbin/lvm", "pvs", "-o", "pv_name", "--noheadings", NULL); + "/sbin/lvm", "pvs", "-o", "pv_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -113,7 +113,7 @@ do_vgs (void) int r; r = command (&out, &err, - "/sbin/lvm", "vgs", "-o", "vg_name", "--noheadings", NULL); + "/sbin/lvm", "vgs", "-o", "vg_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -133,9 +133,9 @@ do_lvs (void) int r; r = command (&out, &err, - "/sbin/lvm", "lvs", - "-o", "vg_name,lv_name", "--noheadings", - "--separator", "/", NULL); + "/sbin/lvm", "lvs", + "-o", "vg_name,lv_name", "--noheadings", + "--separator", "/", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -152,34 +152,32 @@ do_lvs (void) * the code. That code is in stubs.c, and it is generated as usual * by generator.ml. */ -guestfs_lvm_int_pv_list * +guestfs_int_lvm_pv_list * do_pvs_full (void) { return parse_command_line_pvs (); } -guestfs_lvm_int_vg_list * +guestfs_int_lvm_vg_list * do_vgs_full (void) { return parse_command_line_vgs (); } -guestfs_lvm_int_lv_list * +guestfs_int_lvm_lv_list * do_lvs_full (void) { return parse_command_line_lvs (); } int -do_pvcreate (char *device) +do_pvcreate (const char *device) { char *err; int r; - IS_DEVICE (device, -1); - r = command (NULL, &err, - "/sbin/lvm", "pvcreate", device, NULL); + "/sbin/lvm", "pvcreate", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -194,7 +192,7 @@ do_pvcreate (char *device) } int -do_vgcreate (char *volgroup, char **physvols) +do_vgcreate (const char *volgroup, char **physvols) { char *err; int r, argc, i; @@ -202,7 +200,7 @@ do_vgcreate (char *volgroup, char **physvols) /* Check they are devices and also do device name translation. */ for (i = 0; physvols[i] != NULL; ++i) - IS_DEVICE (physvols[i], -1); + RESOLVE_DEVICE (physvols[i], return -1); argc = count_strings (physvols) + 3; argv = malloc (sizeof (char *) * (argc + 1)); @@ -231,7 +229,7 @@ do_vgcreate (char *volgroup, char **physvols) } int -do_lvcreate (char *logvol, char *volgroup, int mbytes) +do_lvcreate (const char *logvol, const char *volgroup, int mbytes) { char *err; int r; @@ -240,8 +238,8 @@ do_lvcreate (char *logvol, char *volgroup, int mbytes) snprintf (size, sizeof size, "%d", mbytes); r = command (NULL, &err, - "/sbin/lvm", "lvcreate", - "-L", size, "-n", logvol, volgroup, NULL); + "/sbin/lvm", "lvcreate", + "-L", size, "-n", logvol, volgroup, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -256,19 +254,17 @@ do_lvcreate (char *logvol, char *volgroup, int mbytes) } int -do_lvresize (char *logvol, int mbytes) +do_lvresize (const char *logvol, int mbytes) { char *err; int r; char size[64]; - IS_DEVICE (logvol, -1); - snprintf (size, sizeof size, "%d", mbytes); r = command (NULL, &err, - "/sbin/lvm", "lvresize", - "-L", size, logvol, NULL); + "/sbin/lvm", "lvresize", + "-L", size, logvol, NULL); if (r == -1) { reply_with_error ("lvresize: %s", err); free (err); @@ -347,15 +343,13 @@ do_lvm_remove_all (void) } int -do_lvremove (char *device) +do_lvremove (const char *device) { char *err; int r; - IS_DEVICE (device, -1); - r = command (NULL, &err, - "/sbin/lvm", "lvremove", "-f", device, NULL); + "/sbin/lvm", "lvremove", "-f", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -370,13 +364,13 @@ do_lvremove (char *device) } int -do_vgremove (char *device) +do_vgremove (const char *device) { char *err; int r; r = command (NULL, &err, - "/sbin/lvm", "vgremove", "-f", device, NULL); + "/sbin/lvm", "vgremove", "-f", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -391,15 +385,13 @@ do_vgremove (char *device) } int -do_pvremove (char *device) +do_pvremove (const char *device) { char *err; int r; - IS_DEVICE (device, -1); - r = command (NULL, &err, - "/sbin/lvm", "pvremove", "-ff", device, NULL); + "/sbin/lvm", "pvremove", "-ff", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -414,15 +406,13 @@ do_pvremove (char *device) } int -do_pvresize (char *device) +do_pvresize (const char *device) { char *err; int r; - IS_DEVICE (device, -1); - r = command (NULL, &err, - "/sbin/lvm", "pvresize", device, NULL); + "/sbin/lvm", "pvresize", device, NULL); if (r == -1) { reply_with_error ("pvresize: %s: %s", device, err); free (err);