librbd: fix false-positive compiler warning

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2018-01-11 10:52:26 -05:00
parent 072004ad06
commit 854b2bbffb
3 changed files with 12 additions and 13 deletions

View File

@ -226,12 +226,12 @@ WRITE_CLASS_ENCODER(GroupSpec);
enum SnapshotNamespaceType {
SNAPSHOT_NAMESPACE_TYPE_USER = 0,
SNAPSHOT_NAMESPACE_TYPE_GROUP = 1,
SNAPSHOT_NAMESPACE_TYPE_UNKNOWN = -1,
SNAPSHOT_NAMESPACE_TYPE_GROUP = 1
};
struct UserSnapshotNamespace {
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE = SNAPSHOT_NAMESPACE_TYPE_USER;
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE =
SNAPSHOT_NAMESPACE_TYPE_USER;
UserSnapshotNamespace() {}
@ -253,18 +253,19 @@ struct UserSnapshotNamespace {
std::ostream& operator<<(std::ostream& os, const UserSnapshotNamespace& ns);
struct GroupSnapshotNamespace {
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE = SNAPSHOT_NAMESPACE_TYPE_GROUP;
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE =
SNAPSHOT_NAMESPACE_TYPE_GROUP;
GroupSnapshotNamespace() {}
GroupSnapshotNamespace(int64_t _group_pool,
const string &_group_id,
const string &_group_snapshot_id) :group_pool(_group_pool),
group_id(_group_id),
group_snapshot_id(_group_snapshot_id) {}
const string &_group_snapshot_id)
: group_id(_group_id), group_pool(_group_pool),
group_snapshot_id(_group_snapshot_id) {}
int64_t group_pool = 0;
string group_id;
int64_t group_pool = 0;
string group_snapshot_id;
void encode(bufferlist& bl) const;
@ -294,7 +295,8 @@ struct GroupSnapshotNamespace {
std::ostream& operator<<(std::ostream& os, const GroupSnapshotNamespace& ns);
struct UnknownSnapshotNamespace {
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE = SNAPSHOT_NAMESPACE_TYPE_UNKNOWN;
static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE =
static_cast<SnapshotNamespaceType>(-1);
UnknownSnapshotNamespace() {}

View File

@ -181,8 +181,7 @@ typedef struct {
typedef enum {
SNAP_NAMESPACE_TYPE_USER = 0,
SNAP_NAMESPACE_TYPE_GROUP = 1,
SNAP_NAMESPACE_TYPE_UNKNOWN = -1,
SNAP_NAMESPACE_TYPE_GROUP = 1
} rbd_snap_namespace_type_t;
typedef struct {

View File

@ -147,7 +147,6 @@ cdef extern from "rbd/librbd.h" nogil:
ctypedef enum rbd_snap_namespace_type_t:
_SNAP_NAMESPACE_TYPE_USER "SNAP_NAMESPACE_TYPE_USER"
_SNAP_NAMESPACE_TYPE_GROUP "SNAP_NAMESPACE_TYPE_GROUP"
_SNAP_NAMESPACE_TYPE_UNKNOWN "SNAP_NAMESPACE_TYPE_UNKNOWN"
ctypedef enum rbd_lock_mode_t:
_RBD_LOCK_MODE_EXCLUSIVE "RBD_LOCK_MODE_EXCLUSIVE"
@ -477,7 +476,6 @@ RBD_IMAGE_OPTION_DATA_POOL = _RBD_IMAGE_OPTION_DATA_POOL
SNAP_NAMESPACE_TYPE_USER = _SNAP_NAMESPACE_TYPE_USER
SNAP_NAMESPACE_TYPE_GROUP = _SNAP_NAMESPACE_TYPE_GROUP
SNAP_NAMESPACE_TYPE_UNKNOWN = _SNAP_NAMESPACE_TYPE_UNKNOWN
class Error(Exception):
pass