linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][BTRFS-PROGS][V2] Update to parse_size()
@ 2012-10-23 17:51 Goffredo Baroncelli
  2012-10-23 17:51 ` [PATCH 1/5] Move parse_size() to utils.[hc] Goffredo Baroncelli
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Goffredo Baroncelli @ 2012-10-23 17:51 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Stefan Behrens, Wang Sheng-Hui

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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH][BTRFS-PROGS] Update to parse_size()
@ 2012-10-22 20:17 Goffredo Baroncelli
  2012-10-22 20:17 ` [PATCH 1/5] Move parse_size() to utils.[hc] Goffredo Baroncelli
  0 siblings, 1 reply; 11+ messages in thread
From: Goffredo Baroncelli @ 2012-10-22 20:17 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Stefan Behrens, Wang Sheng-Hui

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 <kreijack@inwind.it>



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-25 19:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 17:51 [PATCH][BTRFS-PROGS][V2] Update to parse_size() Goffredo Baroncelli
2012-10-23 17:51 ` [PATCH 1/5] Move parse_size() to utils.[hc] Goffredo Baroncelli
2012-10-23 17:51 ` [PATCH 2/5] parse_size(): replace atoll() with strtoull() Goffredo Baroncelli
2012-10-23 17:51 ` [PATCH 3/5] parse_size(): check for invalid suffix Goffredo Baroncelli
2012-10-23 17:51 ` [PATCH 4/5] parse_size(): add new suffixes Goffredo Baroncelli
2012-10-23 17:51 ` [PATCH 5/5] Update the man page with the new prefixes Goffredo Baroncelli
2012-10-25 16:13   ` David Sterba
2012-10-25 19:22     ` Goffredo Baroncelli
2012-10-23 18:48 ` [PATCH][BTRFS-PROGS][V2] Update to parse_size() Goffredo Baroncelli
2012-10-25 16:33   ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2012-10-22 20:17 [PATCH][BTRFS-PROGS] " Goffredo Baroncelli
2012-10-22 20:17 ` [PATCH 1/5] Move parse_size() to utils.[hc] Goffredo Baroncelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).