]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: add check of ceph_osd_op for compatibility
authorRyne Li <lizhenqiangsnake@gmail.com>
Mon, 10 Oct 2016 20:00:12 +0000 (16:00 -0400)
committerRyne Li <lizhenqiangsnake@gmail.com>
Tue, 11 Oct 2016 20:22:50 +0000 (16:22 -0400)
Signed-off-by: Ryne Li <lizhenqiangsnake@gmail.com>
src/include/rados.h

index 66520ba5b22f6c4e9694a6b0d1f44aa294e6e5c2..7525339b1b09254a1d95d97dc73f19a29fe30a70 100644 (file)
@@ -562,6 +562,18 @@ struct ceph_osd_op {
        __le32 payload_len;
 } __attribute__ ((packed));
 
+/*
+ * Check the compatibility of struct ceph_osd_op
+ *  (2+4+(2*8+8+4)+4) = (sizeof(ceph_osd_op::op) +
+ *                     sizeof(ceph_osd_op::flags) +
+ *                     sizeof(ceph_osd_op::extent) +
+ *                     sizeof(ceph_osd_op::payload_len))
+ */
+#ifdef __cplusplus
+static_assert(sizeof(ceph_osd_op) == (2+4+(2*8+8+4)+4),
+              "sizeof(ceph_osd_op) breaks the compatibility");
+#endif
+
 struct ceph_osd_reply_head {
        __le32 client_inc;                /* client incarnation */
        __le32 flags;