From: John Spray Date: Fri, 18 Jul 2014 17:39:37 +0000 (+0100) Subject: osdc: refactor JOURNAL_FORMAT_* constants to enum X-Git-Tag: v0.84~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2115%2Fhead;p=ceph.git osdc: refactor JOURNAL_FORMAT_* constants to enum ...so that the upper limit doesn't have to be updated by hand. Signed-off-by: John Spray --- diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index 0a0c868f8239..19e724d38094 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -63,16 +63,22 @@ class PerfCounters; typedef __u8 stream_format_t; // Legacy envelope is leading uint32_t size -#define JOURNAL_FORMAT_LEGACY 0 +enum StreamFormat { + JOURNAL_FORMAT_LEGACY = 0, + JOURNAL_FORMAT_RESILIENT = 1, + // Insert new formats here, before COUNT + JOURNAL_FORMAT_COUNT +}; + +// Highest journal format version that we support +#define JOURNAL_FORMAT_MAX (JOURNAL_FORMAT_COUNT - 1) + +// Legacy envelope is leading uint32_t size #define JOURNAL_ENVELOPE_LEGACY (sizeof(uint32_t)) // Resilient envelope is leading uint64_t sentinel, uint32_t size, trailing uint64_t start_ptr -#define JOURNAL_FORMAT_RESILIENT 1 #define JOURNAL_ENVELOPE_RESILIENT (sizeof(uint32_t) + sizeof(uint64_t) + sizeof(uint64_t)) -// Most recent format which we may try to read -#define JOURNAL_FORMAT_MAX 1 - /** * Represents a collection of entries serialized in a byte stream. *