mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-29 19:37:06 -05:00
Add new locate command with --tail option.
Co-authored-by: Andrea Mazzoleni <amadvance@gmail.com>
This commit is contained in:
parent
1c4f9870fb
commit
c09bdc572e
8 changed files with 291 additions and 21 deletions
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "elem.h"
|
||||
#include "support.h"
|
||||
#include "state.h"
|
||||
#include "util.h"
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -1461,3 +1462,19 @@ const char* fmt_term(const struct snapraid_disk* disk, const char* str, char* bu
|
|||
}
|
||||
}
|
||||
|
||||
const char* fmt_size(uint64_t size, char* buffer, size_t buffer_size)
|
||||
{
|
||||
if (size >= 10UL * TERA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " T", size / TERA);
|
||||
else if (size >= 10UL * GIGA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " G", size / GIGA);
|
||||
else if (size >= 10UL * MEGA)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " M", size / MEGA);
|
||||
else if (size >= 10UL * KILO)
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " k", size / KILO);
|
||||
else
|
||||
snprintf(buffer, buffer_size, "%" PRIu64 " ", size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue