Re: [PATCH][BTRFS-PROGS][V2] Update to parse_size()

Goffredo Baroncelli
Tue, 23 Oct 2012 18:48:08 -0000

Sorry the version is V1 and not V2

On Tue, Oct 23, 2012 at 7:51 PM, Goffredo Baroncelli <kreijack@gmail.com>
wrote:
> Hi all,
>
> the following patches attempt to address some issues to the function
> parse_size():
> - this function is defined both in mkfs.c and cmds-filesystem.c; I
> moved it in utils.c (which is already used in both mkfs.btrfs and
> btrfs) in order to avoid code duplication.
> - it used the function atoll(); I replaceed atoll() with strtoull()
> because we are dealing with u64
> - no check on suffixes was performed. If the user put
''MB'' as suffix he got
> bytes instead megabytes. The patches check the suffix is valid
> - add new suffixes (t,p,e for terabytes, petabytes, exabytes)
> - update the man page of the command mkfs.btrfs and
> "btrfs filesystem defragment", both use parse_size()
>
> Several peoples (see cc''s) suggested these improvements with
different
> patches, I collected them togheter.
>
> Please reviewed them, test them. Comments are welcome.
>
> The patches are available also to
>
> You can pull the patch from
>         http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git
> branch
>         parse_size
>
>
> Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it>
>
> Changelog:
> V1: avoid to change the parse_size argument;
>     better check of a wrong suffix;
>     force strtoull to use a decimal base
>