diff options
author | David Sterba <dsterba@suse.com> | 2017-01-03 18:03:44 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-01-25 09:47:32 +0100 |
commit | 72ae343f772120ec52533e071e8bea58fd76ad3a (patch) | |
tree | 3abf68685d98b841eec5a5651b1f1d4f43b4cd1f /utils.h | |
parent | 2f682fb89b0b69647a4d27f1de9b4f608b0c7895 (diff) |
btrfs-progs: make negative number pretty printing optional
Add a unit mode that will interpret the input number as a signed 64bit,
optionally and not by default for all numbers.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -95,6 +95,8 @@ void set_argv0(char **argv); #define UNITS_RAW (1U << UNITS_MODE_SHIFT) #define UNITS_BINARY (2U << UNITS_MODE_SHIFT) #define UNITS_DECIMAL (3U << UNITS_MODE_SHIFT) +/* Interpret the u64 value as s64 */ +#define UNITS_NEGATIVE (4U << UNITS_MODE_SHIFT) #define UNITS_MODE_MASK ((1U << UNITS_MODE_SHIFT) - 1) #define UNITS_MODE_SHIFT (8) #define UNITS_HUMAN_BINARY (UNITS_BINARY) @@ -174,9 +176,9 @@ int check_mounted_where(int fd, const char *file, char *where, int size, int btrfs_device_already_in_root(struct btrfs_root *root, int fd, int super_offset); -int pretty_size_snprintf(s64 size, char *str, size_t str_bytes, unsigned unit_mode); +int pretty_size_snprintf(u64 size, char *str, size_t str_bytes, unsigned unit_mode); #define pretty_size(size) pretty_size_mode(size, UNITS_DEFAULT) -const char *pretty_size_mode(s64 size, unsigned mode); +const char *pretty_size_mode(u64 size, unsigned mode); u64 parse_size(char *s); u64 parse_qgroupid(const char *p); |