mkfs: make -l and -n an alias for each other

We don't allow different leaf and node blocksizes, so
this just makes the two options mean the same thing

Signed-off-by: Chris Mason <chris.mason@oracle.com>
master
Chris Mason 2012-03-26 16:17:08 -04:00
parent e22827e9bb
commit 19cf368342
1 changed files with 8 additions and 4 deletions

12
mkfs.c
View File

@ -59,6 +59,9 @@ static u64 parse_size(char *s)
int len = strlen(s); int len = strlen(s);
char c; char c;
u64 mult = 1; u64 mult = 1;
u64 ret;
s = strdup(s);
if (!isdigit(s[len - 1])) { if (!isdigit(s[len - 1])) {
c = tolower(s[len - 1]); c = tolower(s[len - 1]);
@ -77,7 +80,9 @@ static u64 parse_size(char *s)
} }
s[len - 1] = '\0'; s[len - 1] = '\0';
} }
return atol(s) * mult; ret = atol(s) * mult;
free(s);
return ret;
} }
static int make_root_dir(struct btrfs_root *root, int mixed) static int make_root_dir(struct btrfs_root *root, int mixed)
@ -1235,6 +1240,8 @@ int main(int ac, char **av)
data_profile_opt = 1; data_profile_opt = 1;
break; break;
case 'l': case 'l':
case 'n':
nodesize = parse_size(optarg);
leafsize = parse_size(optarg); leafsize = parse_size(optarg);
break; break;
case 'L': case 'L':
@ -1247,9 +1254,6 @@ int main(int ac, char **av)
case 'M': case 'M':
mixed = 1; mixed = 1;
break; break;
case 'n':
nodesize = parse_size(optarg);
break;
case 's': case 's':
sectorsize = parse_size(optarg); sectorsize = parse_size(optarg);
break; break;