From d822ffe1fa3e45716bedd3153b9d89b75409df45 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 22 May 2020 17:53:33 +0800 Subject: include/ceph_fs: do not use anonymous aggregate with member having ctor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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::::::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::::::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::::::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::::::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 --- src/include/ceph_fs.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/include/ceph_fs.h') diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index f7bf65c0662..b01b09adda5 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -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 */ -- cgit v1.2.3