X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Flvm.c;h=742b40ba7606cc86b018ea926d8be656e34d5eae;hb=62b322872543c2ec069ac4fb0103ab758f587cef;hp=624dcf34ab54ab9159f98dc9554b26ce3dd2093a;hpb=2f1a50d81671810256dce0852e6b1e0810ac44af;p=libguestfs.git diff --git a/daemon/lvm.c b/daemon/lvm.c index 624dcf3..742b40b 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; @@ -171,13 +171,11 @@ do_lvs_full (void) } 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); if (r == -1) { @@ -194,16 +192,12 @@ do_pvcreate (char *device) } int -do_vgcreate (char *volgroup, char **physvols) +do_vgcreate (const char *volgroup, char *const *physvols) { char *err; int r, argc, i; const char **argv; - /* 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)); if (argv == NULL) { @@ -216,7 +210,7 @@ do_vgcreate (char *volgroup, char **physvols) for (i = 3; i <= argc; ++i) argv[i] = physvols[i-3]; - r = commandv (NULL, &err, argv); + r = commandv (NULL, &err, (char **) argv); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -231,7 +225,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; @@ -256,14 +250,12 @@ 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, @@ -347,13 +339,11 @@ 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); if (r == -1) { @@ -370,7 +360,7 @@ do_lvremove (char *device) } int -do_vgremove (char *device) +do_vgremove (const char *device) { char *err; int r; @@ -391,13 +381,11 @@ 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); if (r == -1) { @@ -414,13 +402,11 @@ 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); if (r == -1) { @@ -434,7 +420,7 @@ do_pvresize (char *device) } int -do_vg_activate (int activate, char **volgroups) +do_vg_activate (int activate, char *const *volgroups) { char *err; int r, i, argc; @@ -454,7 +440,7 @@ do_vg_activate (int activate, char **volgroups) for (i = 4; i <= argc; ++i) argv[i] = volgroups[i-4]; - r = commandv (NULL, &err, argv); + r = commandv (NULL, &err, (char **) argv); if (r == -1) { reply_with_error ("vgchange: %s", err); free (err);