1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-25 13:49:28 +03:00

o Allow fractional parts for size args. eg, lvcreate -L 34.4M

o  Fix a couple of bugs related to the earlier lv_list change
This commit is contained in:
Joe Thornber
2002-01-21 17:43:10 +00:00
parent f868d63582
commit 75e4d06ade
2 changed files with 35 additions and 6 deletions

View File

@ -406,13 +406,12 @@ struct logical_volume *lv_create(const char *name,
log_verbose("Creating logical volume %s", name);
if (!(ll = pool_zalloc(cmd->mem, sizeof(*ll)))) {
if (!(ll = pool_zalloc(cmd->mem, sizeof(*ll))) ||
!(ll->lv = pool_zalloc(cmd->mem, sizeof(*ll->lv)))) {
stack;
return NULL;
}
list_init(&ll->list);
lv = ll->lv;
strcpy(lv->id.uuid, "");
@ -509,6 +508,13 @@ int lv_extend(struct logical_volume *lv,
int lv_remove(struct volume_group *vg, struct logical_volume *lv)
{
struct list *segh;
struct lv_list *lvl;
/* find the lv list */
if (!(lvl = find_lv_in_vg(vg, lv->name))) {
stack;
return 0;
}
/* iterate through the lv's segments freeing off the pe's */
list_iterate (segh, &lv->segments)
@ -517,7 +523,7 @@ int lv_remove(struct volume_group *vg, struct logical_volume *lv)
vg->lv_count--;
vg->free_count += lv->le_count;
list_del(&list_head(lv, struct lv_list, lv));
list_del(&lvl->list);
return 1;
}

View File

@ -21,6 +21,7 @@
#include <sys/stat.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#ifdef READLINE_SUPPORT
#include <readline/readline.h>
@ -229,8 +230,29 @@ int size_arg(struct arg *a)
char *ptr;
int i;
static char *suffixes = "kmgt";
char *val;
double v;
if (!_get_int_arg(a, &ptr))
val = a->value;
switch (*val) {
case '+':
a->sign = SIGN_PLUS;
val++;
break;
case '-':
a->sign = SIGN_MINUS;
val++;
break;
default:
a->sign = SIGN_NONE;
}
if (!isdigit(*val))
return 0;
v = strtod(val, &ptr);
if (ptr == val)
return 0;
if (*ptr) {
@ -242,8 +264,9 @@ int size_arg(struct arg *a)
return 0;
while (i-- > 0)
a->i_value *= 1024;
v *= 1024;
}
a->i_value = (uint32_t) v;
return 1;