1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

util: support formatting eta and peta bytes with format_bytes()

This commit is contained in:
Lennart Poettering 2012-01-14 03:07:29 +01:00
parent a7bc2c2ac8
commit 32895bb390

View File

@ -3077,6 +3077,8 @@ int parse_bytes(const char *t, off_t *bytes) {
{ "M", 1024ULL*1024ULL }, { "M", 1024ULL*1024ULL },
{ "G", 1024ULL*1024ULL*1024ULL }, { "G", 1024ULL*1024ULL*1024ULL },
{ "T", 1024ULL*1024ULL*1024ULL*1024ULL }, { "T", 1024ULL*1024ULL*1024ULL*1024ULL },
{ "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "", 1 }, { "", 1 },
}; };
@ -6082,6 +6084,8 @@ char *format_bytes(char *buf, size_t l, off_t t) {
const char *suffix; const char *suffix;
off_t factor; off_t factor;
} table[] = { } table[] = {
{ "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "T", 1024ULL*1024ULL*1024ULL*1024ULL }, { "T", 1024ULL*1024ULL*1024ULL*1024ULL },
{ "G", 1024ULL*1024ULL*1024ULL }, { "G", 1024ULL*1024ULL*1024ULL },
{ "M", 1024ULL*1024ULL }, { "M", 1024ULL*1024ULL },