]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages,mon,osd: silence gcc-8 warnings related to memset() 23054/head
authorKefu Chai <kchai@redhat.com>
Sun, 6 May 2018 06:39:38 +0000 (14:39 +0800)
committerSage Weil <sage@redhat.com>
Sat, 14 Jul 2018 18:13:17 +0000 (13:13 -0500)
this silences warnings like:

warning: ‘void* memset(void*, int, size_t)’ writing to an object of
non-trivial type ‘struct uuid_d’; use assignment instead [-Wcl\
ass-memaccess]

uuid_d only contains boost::uuids::uuid, which is "nil" initialized in
uuid_d's ctor. so we don't need to bother with memset() it with 0.
the same applies to entity_inst_t.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 557cb0614586880512c9213676f8f6dcd226eb38)

src/client/Inode.h
src/messages/MClientReply.h
src/messages/MMonSubscribeAck.h
src/mon/LogMonitor.cc
src/mon/MonMap.h
src/osd/OSDMap.h

index 614d84a306d05e1249bd7070beedd4e4fb335b0e..63a7f50aa517829e6aad6102945e5de857b3d6b5 100644 (file)
@@ -255,7 +255,6 @@ struct Inode {
       fcntl_locks(NULL), flock_locks(NULL)
   {
     memset(&dir_layout, 0, sizeof(dir_layout));
-    memset(&quota, 0, sizeof(quota));
   }
   ~Inode();
 
index 228db2f9daf687d96983ab225b6d64a5ce14272a..e8c8e7320ccc5ee6384817f21fe7c63e8f4c5371 100644 (file)
@@ -182,7 +182,7 @@ struct InodeStat {
     if (features & CEPH_FEATURE_MDS_QUOTA)
       ::decode(quota, p);
     else
-      memset(&quota, 0, sizeof(quota));
+      quota = quota_info_t{};
 
     if ((features & CEPH_FEATURE_FS_FILE_LAYOUT_V2))
       ::decode(layout.pool_ns, p);
index 148d90db75d70190c63e0193ac6bc55ccb58e97a..0e46bbfb32f564c42aaf613f4bf2536f059ea064 100644 (file)
@@ -23,7 +23,6 @@ struct MMonSubscribeAck : public Message {
   
   MMonSubscribeAck() : Message(CEPH_MSG_MON_SUBSCRIBE_ACK),
                       interval(0) {
-    memset(&fsid, 0, sizeof(fsid));
   }
   MMonSubscribeAck(uuid_d& f, int i) : Message(CEPH_MSG_MON_SUBSCRIBE_ACK),
                                       interval(i), fsid(f) { }
index d4fa0dbe3e5de0cde932ee7899e9bd643c4f5798..2d692840ea1a14420a085e6caea7c4a09a641632 100644 (file)
@@ -62,7 +62,6 @@ void LogMonitor::create_initial()
 {
   dout(10) << "create_initial -- creating initial map" << dendl;
   LogEntry e;
-  memset(&e.who, 0, sizeof(e.who));
   e.name = g_conf->name;
   e.stamp = ceph_clock_now();
   e.prio = CLOG_INFO;
index 63cc2209021a2e701241786a2fc30fa6eb8e13ba..fece39c99dce8874cbab28d7615bbc966eae3463 100644 (file)
@@ -118,7 +118,6 @@ public:
 
   MonMap()
     : epoch(0) {
-    memset(&fsid, 0, sizeof(fsid));
   }
 
   uuid_d& get_fsid() { return fsid; }
index 5d59754cef911a2186de7284d75aa9952af9d8a8..2a5f985c5fc9aa5af57c343bed786389fa093f3d 100644 (file)
@@ -431,7 +431,6 @@ public:
       encode_features(0),
       epoch(e), new_pool_max(-1), new_flags(-1), new_max_osd(-1),
       have_crc(false), full_crc(0), inc_crc(0) {
-      memset(&fsid, 0, sizeof(fsid));
     }
     explicit Incremental(bufferlist &bl) {
       bufferlist::iterator p = bl.begin();
@@ -596,7 +595,6 @@ private:
             cached_up_osd_features(0),
             crc_defined(false), crc(0),
             crush(std::make_shared<CrushWrapper>()) {
-    memset(&fsid, 0, sizeof(fsid));
   }
 
   // no copying