Thread (10 messages) 10 messages, 3 authors, 2012-10-25

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

From: Goffredo Baroncelli <hidden>
Date: 2012-10-23 18:48:10

Sorry the version is V1 and not V2

On Tue, Oct 23, 2012 at 7:51 PM, Goffredo Baroncelli [off-list ref] 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 <redacted>

Changelog:
V1: avoid to change the parse_size argument;
    better check of a wrong suffix;
    force strtoull to use a decimal base
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help