]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages,mon,osd: silence gcc-8 warnings related to memset()
authorKefu Chai <kchai@redhat.com>
Sun, 6 May 2018 06:39:38 +0000 (14:39 +0800)
committerCasey Bodley <cbodley@redhat.com>
Mon, 7 May 2018 19:34:57 +0000 (15:34 -0400)
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 7c25f8d5ffc191c27156b6b05d009018dcf61a04..ce7b1a6eb611867e108f610bad8a41adf445c6d9 100644 (file)
@@ -279,7 +279,6 @@ struct Inode {
       _ref(0), ll_ref(0)
   {
     memset(&dir_layout, 0, sizeof(dir_layout));
-    memset(&quota, 0, sizeof(quota));
   }
   ~Inode();
 
index 3e979b3fe1cda9baef6291047db12ccb87228944..1562c58385b0faf661f9d76d956383a2521925fb 100644 (file)
@@ -187,7 +187,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 6c36626a1f63d9126b4deb44a116194b686c437d..3174517cde24633a06cf6075c77dfeca2ba86fa3 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 473b532266266b23d97e3492c0d4353750728a4d..881b3102e585f283b11402a29b8751074093a295 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 ffd2e8f88d894c0a67f253bf1a6ee0d3a664fe4b..5c50cee8bcba4d63fad185bad5c338b0c238a955 100644 (file)
@@ -118,7 +118,6 @@ public:
 
   MonMap()
     : epoch(0) {
-    memset(&fsid, 0, sizeof(fsid));
   }
 
   uuid_d& get_fsid() { return fsid; }
index 5452dcf4b7e200f1e20930c70c7c953187c6c947..9faf955621762575fb262c6234dd90eca67caee8 100644 (file)
@@ -427,7 +427,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();
@@ -607,7 +606,6 @@ private:
             cached_up_osd_features(0),
             crc_defined(false), crc(0),
             crush(std::make_shared<CrushWrapper>()) {
-    memset(&fsid, 0, sizeof(fsid));
   }
 
 private: