From dd33c9802f3438391c57e18854debd9d4203f002 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 14 Oct 2013 16:54:07 -0700 Subject: [PATCH] osd/osd_types: generalize pg_pool_t::get_flags_string() This way the method doesn't have to be modified when new flags are added. Signed-off-by: Sage Weil --- src/osd/osd_types.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 8bf8822bffde9..8ceeb539c1afb 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -732,17 +732,20 @@ struct pg_pool_t { default: return "???"; } } - string get_flags_string() const { + static string get_flags_string(uint64_t f) { string s; - if (flags & FLAG_HASHPSPOOL) - s += get_flag_name(FLAG_HASHPSPOOL); - if (flags & FLAG_FULL) { - if (s.length()) - s += ","; - s += get_flag_name(FLAG_FULL); + for (unsigned n=0; f && n<64; ++n) { + if (f & (1ull << n)) { + if (s.length()) + s += ","; + s += get_flag_name(1ull << n); + } } return s; } + string get_flags_string() const { + return get_flags_string(flags); + } typedef enum { CACHEMODE_NONE = 0, ///< no caching -- 2.39.5