mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
include/ceph_fs: do not use anonymous aggregate with member having ctor
GCC-10 fails to compile ceph_fs.h, with following error: In file included from ../src/include/types.h:27, from ../src/msg/msg_types.h:23, from ../src/common/ipaddr.cc:16: ../src/include/ceph_fs.h:891:11: error: member ‘ceph_le32 ceph_mds_caps_body_legacy::<unnamed union>::<unnamed struct>::truncate_seq’ with constructor not allowed in anonymous aggregate 891 | __le32 truncate_seq; | ^~~~~~~~~~~~ ../src/include/ceph_fs.h:892:25: error: member ‘ceph_timespec ceph_mds_caps_body_legacy::<unnamed union>::<unnamed struct>::mtime’ with constructor not allowed in anonymous aggregate 892 | struct ceph_timespec mtime, atime, ctime; | ^~~~~ ../src/include/ceph_fs.h:892:32: error: member ‘ceph_timespec ceph_mds_caps_body_legacy::<unnamed union>::<unnamed struct>::atime’ with constructor not allowed in anonymous aggregate 892 | struct ceph_timespec mtime, atime, ctime; | ^~~~~ ../src/include/ceph_fs.h:892:39: error: member ‘ceph_timespec ceph_mds_caps_body_legacy::<unnamed union>::<unnamed struct>::ctime’ with constructor not allowed in anonymous aggregate 892 | struct ceph_timespec mtime, atime, ctime; | ^~~~~ because, for instance, `ceph_timespec` has compiler generated constructor, and it's not allowed by C++17 standard. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
617298c201
commit
d822ffe1fa
@ -882,20 +882,19 @@ struct ceph_mds_caps_head {
|
||||
__le64 xattr_version;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_caps_body_legacy {
|
||||
union {
|
||||
/* all except export */
|
||||
struct {
|
||||
/* filelock */
|
||||
__le64 size, max_size, truncate_size;
|
||||
__le32 truncate_seq;
|
||||
struct ceph_timespec mtime, atime, ctime;
|
||||
struct ceph_file_layout layout;
|
||||
__le32 time_warp_seq;
|
||||
} __attribute__ ((packed));
|
||||
/* export message */
|
||||
struct ceph_mds_cap_peer peer;
|
||||
} __attribute__ ((packed));
|
||||
struct ceph_mds_caps_non_export_body {
|
||||
/* all except export */
|
||||
/* filelock */
|
||||
__le64 size, max_size, truncate_size;
|
||||
__le32 truncate_seq;
|
||||
struct ceph_timespec mtime, atime, ctime;
|
||||
struct ceph_file_layout layout;
|
||||
__le32 time_warp_seq;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_caps_export_body {
|
||||
/* export message */
|
||||
struct ceph_mds_cap_peer peer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* cap release msg head */
|
||||
|
@ -324,7 +324,8 @@ WRITE_RAW_ENCODER(ceph_mds_request_head)
|
||||
WRITE_RAW_ENCODER(ceph_mds_request_release)
|
||||
WRITE_RAW_ENCODER(ceph_filelock)
|
||||
WRITE_RAW_ENCODER(ceph_mds_caps_head)
|
||||
WRITE_RAW_ENCODER(ceph_mds_caps_body_legacy)
|
||||
WRITE_RAW_ENCODER(ceph_mds_caps_export_body)
|
||||
WRITE_RAW_ENCODER(ceph_mds_caps_non_export_body)
|
||||
WRITE_RAW_ENCODER(ceph_mds_cap_peer)
|
||||
WRITE_RAW_ENCODER(ceph_mds_cap_release)
|
||||
WRITE_RAW_ENCODER(ceph_mds_cap_item)
|
||||
|
@ -205,11 +205,15 @@ public:
|
||||
using ceph::decode;
|
||||
auto p = payload.cbegin();
|
||||
decode(head, p);
|
||||
ceph_mds_caps_body_legacy body;
|
||||
decode(body, p);
|
||||
if (head.op == CEPH_CAP_OP_EXPORT) {
|
||||
ceph_mds_caps_export_body body;
|
||||
decode(body, p);
|
||||
peer = body.peer;
|
||||
p += (sizeof(ceph_mds_caps_non_export_body) -
|
||||
sizeof(ceph_mds_caps_export_body));
|
||||
} else {
|
||||
ceph_mds_caps_non_export_body body;
|
||||
decode(body, p);
|
||||
size = body.size;
|
||||
max_size = body.max_size;
|
||||
truncate_size = body.truncate_size;
|
||||
@ -274,11 +278,16 @@ public:
|
||||
head.xattr_len = xattrbl.length();
|
||||
|
||||
encode(head, payload);
|
||||
ceph_mds_caps_body_legacy body;
|
||||
static_assert(sizeof(ceph_mds_caps_non_export_body) >
|
||||
sizeof(ceph_mds_caps_export_body));
|
||||
if (head.op == CEPH_CAP_OP_EXPORT) {
|
||||
memset(&body, 0, sizeof(body));
|
||||
ceph_mds_caps_export_body body;
|
||||
body.peer = peer;
|
||||
encode(body, payload);
|
||||
payload.append_zero(sizeof(ceph_mds_caps_non_export_body) -
|
||||
sizeof(ceph_mds_caps_export_body));
|
||||
} else {
|
||||
ceph_mds_caps_non_export_body body;
|
||||
body.size = size;
|
||||
body.max_size = max_size;
|
||||
body.truncate_size = truncate_size;
|
||||
@ -288,8 +297,8 @@ public:
|
||||
ctime.encode_timeval(&body.ctime);
|
||||
layout.to_legacy(&body.layout);
|
||||
body.time_warp_seq = time_warp_seq;
|
||||
encode(body, payload);
|
||||
}
|
||||
encode(body, payload);
|
||||
ceph::encode_nohead(snapbl, payload);
|
||||
|
||||
middle = xattrbl;
|
||||
|
Loading…
Reference in New Issue
Block a user