mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 17:56:51 +00:00
btrfs-progs: use our ASSERT macro everywhere
Switch the remaining use of assert() as it lacks the verbose assert that we have for ASSERT (but otherwise is equivalent). Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2b909aa5db
commit
a3588b1ef6
@ -381,15 +381,15 @@ static void get_raid56_space_info(struct btrfs_ioctl_space_args *sargs,
|
|||||||
size = info_ptr->size / (info_ptr->num_stripes - parities_count);
|
size = info_ptr->size / (info_ptr->num_stripes - parities_count);
|
||||||
|
|
||||||
if (info_ptr->type & BTRFS_BLOCK_GROUP_DATA) {
|
if (info_ptr->type & BTRFS_BLOCK_GROUP_DATA) {
|
||||||
assert(l_data_ratio >= 0);
|
ASSERT(l_data_ratio >= 0);
|
||||||
*r_data_chunks += size;
|
*r_data_chunks += size;
|
||||||
*r_data_used += size * l_data_ratio;
|
*r_data_used += size * l_data_ratio;
|
||||||
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_METADATA) {
|
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_METADATA) {
|
||||||
assert(l_metadata_ratio >= 0);
|
ASSERT(l_metadata_ratio >= 0);
|
||||||
*r_metadata_chunks += size;
|
*r_metadata_chunks += size;
|
||||||
*r_metadata_used += size * l_metadata_ratio;
|
*r_metadata_used += size * l_metadata_ratio;
|
||||||
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_SYSTEM) {
|
} else if (info_ptr->type & BTRFS_BLOCK_GROUP_SYSTEM) {
|
||||||
assert(l_system_ratio >= 0);
|
ASSERT(l_system_ratio >= 0);
|
||||||
*r_system_chunks += size;
|
*r_system_chunks += size;
|
||||||
*r_system_used += size * l_system_ratio;
|
*r_system_used += size * l_system_ratio;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -521,7 +520,7 @@ time2string(char *buf, size_t s, __u64 t)
|
|||||||
time_t t_time_t;
|
time_t t_time_t;
|
||||||
|
|
||||||
t_time_t = (time_t)t;
|
t_time_t = (time_t)t;
|
||||||
assert((__u64)t_time_t == t);
|
ASSERT((__u64)t_time_t == t);
|
||||||
localtime_r(&t_time_t, &t_tm);
|
localtime_r(&t_time_t, &t_tm);
|
||||||
strftime(buf, s, "%e.%b %T", &t_tm);
|
strftime(buf, s, "%e.%b %T", &t_tm);
|
||||||
return buf;
|
return buf;
|
||||||
@ -531,7 +530,7 @@ static char *
|
|||||||
progress2string(char *buf, size_t s, int progress_1000)
|
progress2string(char *buf, size_t s, int progress_1000)
|
||||||
{
|
{
|
||||||
snprintf(buf, s, "%d.%01d%%", progress_1000 / 10, progress_1000 % 10);
|
snprintf(buf, s, "%d.%01d%%", progress_1000 / 10, progress_1000 % 10);
|
||||||
assert(s > 0);
|
ASSERT(s > 0);
|
||||||
buf[s - 1] = '\0';
|
buf[s - 1] = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
|||||||
/* Unknown mode */
|
/* Unknown mode */
|
||||||
if (!base) {
|
if (!base) {
|
||||||
internal_error("unknown unit base, mode %u", unit_mode);
|
internal_error("unknown unit base, mode %u", unit_mode);
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
|||||||
if (num_divs >= ARRAY_SIZE(unit_suffix_binary)) {
|
if (num_divs >= ARRAY_SIZE(unit_suffix_binary)) {
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
internal_error("unsupported unit suffix, index %d", num_divs);
|
internal_error("unsupported unit suffix, index %d", num_divs);
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user