version 1.22.16.1, 2019/06/10 22:05:33 |
version 1.23, 2018/07/03 03:41:24 |
Line 52 __RCSID("$NetBSD$"); |
|
Line 52 __RCSID("$NetBSD$"); |
|
static int cmd_resize(gpt_t, int, char *[]); |
static int cmd_resize(gpt_t, int, char *[]); |
|
|
static const char *resizehelp[] = { |
static const char *resizehelp[] = { |
"[-i index | -b blocknr] [-a alignment] [-s size]", |
"-i index [-a alignment] [-s size]", |
}; |
}; |
|
|
struct gpt_cmd c_resize = { |
struct gpt_cmd c_resize = { |
|
|
cmd_resize(gpt_t gpt, int argc, char *argv[]) |
cmd_resize(gpt_t gpt, int argc, char *argv[]) |
{ |
{ |
int ch; |
int ch; |
off_t alignment = 0, sectors, start = 0, size = 0; |
off_t alignment = 0, sectors, size = 0; |
unsigned int entry = 0; |
unsigned int entry = 0; |
map_t m; |
|
|
|
while ((ch = getopt(argc, argv, GPT_AIS "b:")) != -1) { |
while ((ch = getopt(argc, argv, GPT_AIS)) != -1) { |
if (ch == 'b') |
if (gpt_add_ais(gpt, &alignment, &entry, &size, ch) == -1) |
gpt_human_get(gpt, &start); |
|
else if (gpt_add_ais(gpt, &alignment, &entry, &size, ch) == -1) |
|
return usage(); |
return usage(); |
} |
} |
|
|
if (argc != optind) |
if (argc != optind) |
return usage(); |
return usage(); |
|
|
if (start > 0) { |
|
for (m = map_first(gpt); m != NULL; m = m->map_next) { |
|
if (m->map_type != MAP_TYPE_GPT_PART || |
|
m->map_index < 1) |
|
continue; |
|
if (start != m->map_start) |
|
continue; |
|
entry = m->map_index; |
|
break; |
|
} |
|
} |
|
|
|
if ((sectors = gpt_check_ais(gpt, alignment, entry, size)) == -1) |
if ((sectors = gpt_check_ais(gpt, alignment, entry, size)) == -1) |
return -1; |
return -1; |
|
|