fstrim: Pretty-print the trimmed size in addition to showing raw byte counts.
Also do not bother printing sizes if we are exiting without success and nothing was reported as trimmed.
This commit is contained in:
+5
-1
@@ -35,7 +35,6 @@ StdBinCommands
|
||||
error.c
|
||||
fortune.c
|
||||
finddir.c
|
||||
fstrim.cpp
|
||||
get_driver_settings.cpp
|
||||
hd.c
|
||||
listarea.c
|
||||
@@ -113,6 +112,11 @@ if $(TARGET_PLATFORM) = libbe_test {
|
||||
: tests!apps ;
|
||||
}
|
||||
|
||||
# standard commands that need libbe.so, libshared.a
|
||||
StdBinCommands
|
||||
fstrim.cpp
|
||||
: shared be : $(haiku-utils_rsrc) ;
|
||||
|
||||
# standard commands that need libbe.so and libsupc++.so
|
||||
StdBinCommands
|
||||
alert.cpp
|
||||
|
||||
+9
-3
@@ -19,6 +19,7 @@
|
||||
#include <Drivers.h>
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <StringForSize.h>
|
||||
|
||||
|
||||
static struct option const kLongOptions[] = {
|
||||
@@ -262,9 +263,14 @@ main(int argc, char** argv)
|
||||
retval = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("Trimmed %" B_PRIu64 " bytes from device%s.\n",
|
||||
trimData.trimmed_size,
|
||||
retval == EXIT_SUCCESS ? "" : " (number may be inaccurate)");
|
||||
if (retval == EXIT_SUCCESS || trimData.trimmed_size > 0) {
|
||||
char trimmedSize[128];
|
||||
string_for_size(trimData.trimmed_size, trimmedSize, 128);
|
||||
|
||||
printf("Trimmed %" B_PRIu64 " bytes (%s) from device%s.\n",
|
||||
trimData.trimmed_size, trimmedSize,
|
||||
retval == EXIT_SUCCESS ? "" : " (number may be inaccurate)");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user