DirectoryState does not have an "invalid" enum so far, since it's
defined using `enum class`, init a value of this type with a known value
could be a better choice even it is always initialized before being read.
this silences the GCC warning of:
src/cls/rbd/cls_rbd.cc:3147:3: warning: ‘on_disk_directory_state’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
if (directory_state != on_disk_directory_state) {
^~
Signed-off-by: Kefu Chai <kchai@redhat.com>
*/
int dir_state_assert(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
- cls::rbd::DirectoryState directory_state;
+ cls::rbd::DirectoryState directory_state = cls::rbd::DIRECTORY_STATE_READY;
try {
auto iter = in->cbegin();
decode(directory_state, iter);