X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Flvm.c;h=143c5a810447fe5e468ee655b6a1f5c76137ef30;hb=e395d7db8fd3fe3d1b121258fe2f401d6b3e64c8;hp=40377f10de2d34ba9983a8b30c80e248311fbc3d;hpb=0695593702b8612b500ff0b3bf800e5934f9b56e;p=libguestfs.git diff --git a/daemon/lvm.c b/daemon/lvm.c index 40377f1..143c5a8 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -171,11 +171,13 @@ do_lvs_full (void) } int -do_pvcreate (const char *device) +do_pvcreate (char *device) { char *err; int r; + IS_DEVICE (device, -1); + r = command (NULL, &err, "/sbin/lvm", "pvcreate", device, NULL); if (r == -1) { @@ -189,12 +191,16 @@ 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; + /* 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) { @@ -219,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; @@ -241,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; @@ -330,11 +336,13 @@ do_lvm_remove_all (void) } int -do_lvremove (const char *device) +do_lvremove (char *device) { char *err; int r; + IS_DEVICE (device, -1); + r = command (NULL, &err, "/sbin/lvm", "lvremove", "-f", device, NULL); if (r == -1) { @@ -348,7 +356,7 @@ do_lvremove (const char *device) } int -do_vgremove (const char *device) +do_vgremove (char *device) { char *err; int r; @@ -366,11 +374,13 @@ do_vgremove (const char *device) } int -do_pvremove (const char *device) +do_pvremove (char *device) { char *err; int r; + IS_DEVICE (device, -1); + r = command (NULL, &err, "/sbin/lvm", "pvremove", "-ff", device, NULL); if (r == -1) { @@ -384,11 +394,13 @@ do_pvremove (const char *device) } int -do_pvresize (const char *device) +do_pvresize (char *device) { char *err; int r; + IS_DEVICE (device, -1); + r = command (NULL, &err, "/sbin/lvm", "pvresize", device, NULL); if (r == -1) { @@ -402,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;