mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add zfs_nicebytes() to print human-readable sizes
* Add zfs_nicebytes() to print human-readable sizes Some 'zfs', 'zpool' and 'zdb' output strings can be confusing to the user when no units are specified. This add a new zfs_nicenum_format "ZFS_NICENUM_BYTES" used to print bytes in their human-readable form. Additionally, update some test cases to use machine-parsable 'zfs get'. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #2414 Closes #3185 Closes #3594 Closes #6032
This commit is contained in:
+4
-2
@@ -773,8 +773,9 @@ extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *,
|
||||
|
||||
enum zfs_nicenum_format {
|
||||
ZFS_NICENUM_1024 = 0,
|
||||
ZFS_NICENUM_TIME = 1,
|
||||
ZFS_NICENUM_RAW = 2
|
||||
ZFS_NICENUM_BYTES = 1,
|
||||
ZFS_NICENUM_TIME = 2,
|
||||
ZFS_NICENUM_RAW = 3
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -786,6 +787,7 @@ extern void zfs_nicenum_format(uint64_t num, char *buf, size_t buflen,
|
||||
|
||||
|
||||
extern void zfs_nicetime(uint64_t, char *, size_t);
|
||||
extern void zfs_nicebytes(uint64_t, char *, size_t);
|
||||
extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user