From: Sage Weil Date: Wed, 4 May 2011 20:55:50 +0000 (-0700) Subject: fix some shadowing arguments X-Git-Tag: v0.28~84 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e6dfcfda999b322b1e524520613cf987a3c2583f;p=ceph.git fix some shadowing arguments Small subset of what -Wshadow turns up. Signed-off-by: Sage Weil --- diff --git a/src/auth/RotatingKeyRing.cc b/src/auth/RotatingKeyRing.cc index 2d1a2ff7df04..993474955975 100644 --- a/src/auth/RotatingKeyRing.cc +++ b/src/auth/RotatingKeyRing.cc @@ -47,13 +47,13 @@ bool RotatingKeyRing::get_secret(const EntityName& name, CryptoKey& secret) cons return keyring->get_secret(name, secret); } -bool RotatingKeyRing::get_service_secret(uint32_t service_id, uint64_t secret_id, +bool RotatingKeyRing::get_service_secret(uint32_t service_id_, uint64_t secret_id, CryptoKey& secret) const { Mutex::Locker l(lock); - if (service_id != this->service_id) { - dout(0) << "do not have service " << ceph_entity_type_name(service_id) + if (service_id_ != this->service_id) { + dout(0) << "do not have service " << ceph_entity_type_name(service_id_) << ", i am " << ceph_entity_type_name(this->service_id) << dendl; return false; } diff --git a/src/include/atomic.h b/src/include/atomic.h index e0e70370bc09..fd13588a06bb 100644 --- a/src/include/atomic.h +++ b/src/include/atomic.h @@ -39,8 +39,8 @@ public: AO_fetch_and_add(&val, add_me); } void sub(int sub_me) { - int sub = 0 - sub_me; - AO_fetch_and_add_write(&val, (AO_t)sub); + int negsub = 0 - sub_me; + AO_fetch_and_add_write(&val, (AO_t)negsub); } AO_t read() const { // cast away const on the pointer. this is only needed to build diff --git a/src/include/buffer.h b/src/include/buffer.h index fe428f7ea27b..4bef7ea342d8 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -101,8 +101,8 @@ public: } }; struct malformed_input : public error { - explicit malformed_input(const char *what) { - snprintf(buf, sizeof(buf), "buffer::malformed_input: %s", what); + explicit malformed_input(const char *w) { + snprintf(buf, sizeof(buf), "buffer::malformed_input: %s", w); } const char *what() const throw () { return buf; diff --git a/src/include/dlist.h b/src/include/dlist.h index bf44276c0a7d..e7b938c14d21 100644 --- a/src/include/dlist.h +++ b/src/include/dlist.h @@ -79,15 +79,15 @@ public: remove(front()); } - void push_front(item *item) { - if (!item->empty()) - item->remove_myself(); - _head.insert_after(item); + void push_front(item *i) { + if (!i->empty()) + i->remove_myself(); + _head.insert_after(i); } - void push_back(item *item) { - if (!item->empty()) - item->remove_myself(); - _head.insert_before(item); + void push_back(item *i) { + if (!i->empty()) + i->remove_myself(); + _head.insert_before(i); } T front() { return (T)_head._next->_item; } diff --git a/src/include/elist.h b/src/include/elist.h index 051978169a71..3130fb36af7c 100644 --- a/src/include/elist.h +++ b/src/include/elist.h @@ -97,15 +97,15 @@ public: remove(front()); } - void push_front(item *item) { - if (!item->empty()) - item->remove_myself(); - _head.insert_after(item); + void push_front(item *i) { + if (!i->empty()) + i->remove_myself(); + _head.insert_after(i); } - void push_back(item *item) { - if (!item->empty()) - item->remove_myself(); - _head.insert_before(item); + void push_back(item *i) { + if (!i->empty()) + i->remove_myself(); + _head.insert_before(i); } T front(size_t o=0) { diff --git a/src/include/frag.h b/src/include/frag.h index 16c950f96274..5530363611f8 100644 --- a/src/include/frag.h +++ b/src/include/frag.h @@ -137,10 +137,10 @@ class frag_t { // parse bool parse(const char *s) { - int value, bits; - int r = sscanf(s, "%x/%d", &value, &bits); + int pvalue, pbits; + int r = sscanf(s, "%x/%d", &pvalue, &pbits); if (r == 2) { - *this = frag_t(value, bits); + *this = frag_t(pvalue, pbits); return true; } return false; diff --git a/src/include/interval_set.h b/src/include/interval_set.h index 19e178361e85..ae1c7ff7188d 100644 --- a/src/include/interval_set.h +++ b/src/include/interval_set.h @@ -427,9 +427,9 @@ class interval_set { if (pb->first + pb->second <= pa->first) { pb++; continue; } T start = MAX(pa->first, pb->first); - T end = MIN(pa->first+pa->second, pb->first+pb->second); - assert(end > start); - insert(start, end-start); + T en = MIN(pa->first+pa->second, pb->first+pb->second); + assert(en > start); + insert(start, en-start); if (pa->first+pa->second > pb->first+pb->second) pb++; else diff --git a/src/include/types.h b/src/include/types.h index eb442aa7861e..b9f721aaf0f9 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -342,12 +342,12 @@ struct SnapRealmInfo { SnapRealmInfo() { memset(&h, 0, sizeof(h)); } - SnapRealmInfo(inodeno_t ino, snapid_t created, snapid_t seq, snapid_t current_parent_since) { + SnapRealmInfo(inodeno_t ino_, snapid_t created_, snapid_t seq_, snapid_t current_parent_since_) { memset(&h, 0, sizeof(h)); - h.ino = ino; - h.created = created; - h.seq = seq; - h.parent_since = current_parent_since; + h.ino = ino_; + h.created = created_; + h.seq = seq_; + h.parent_since = current_parent_since_; } inodeno_t ino() { return inodeno_t(h.ino); } diff --git a/src/include/xlist.h b/src/include/xlist.h index 054c8771156e..4a4ffae160d2 100644 --- a/src/include/xlist.h +++ b/src/include/xlist.h @@ -75,49 +75,49 @@ public: while (_front) remove(_front); } - void push_front(item *item) { - if (item->_list) - item->_list->remove(item); + void push_front(item *i) { + if (i->_list) + i->_list->remove(i); - item->_list = this; - item->_next = _front; - item->_prev = 0; + i->_list = this; + i->_next = _front; + i->_prev = 0; if (_front) - _front->_prev = item; + _front->_prev = i; else - _back = item; - _front = item; + _back = i; + _front = i; _size++; } - void push_back(item *item) { - if (item->_list) - item->_list->remove(item); + void push_back(item *i) { + if (i->_list) + i->_list->remove(i); - item->_list = this; - item->_next = 0; - item->_prev = _back; + i->_list = this; + i->_next = 0; + i->_prev = _back; if (_back) - _back->_next = item; + _back->_next = i; else - _front = item; - _back = item; + _front = i; + _back = i; _size++; } - void remove(item *item) { - assert(item->_list == this); + void remove(item *i) { + assert(i->_list == this); - if (item->_prev) - item->_prev->_next = item->_next; + if (i->_prev) + i->_prev->_next = i->_next; else - _front = item->_next; - if (item->_next) - item->_next->_prev = item->_prev; + _front = i->_next; + if (i->_next) + i->_next->_prev = i->_prev; else - _back = item->_prev; + _back = i->_prev; _size--; - item->_list = 0; - item->_next = item->_prev = 0; + i->_list = 0; + i->_next = i->_prev = 0; } T front() { return (T)_front->_item; } diff --git a/src/messages/MMonCommand.h b/src/messages/MMonCommand.h index 5a97d9c83308..dcf2ceb489f1 100644 --- a/src/messages/MMonCommand.h +++ b/src/messages/MMonCommand.h @@ -26,8 +26,8 @@ class MMonCommand : public PaxosServiceMessage { vector cmd; MMonCommand() : PaxosServiceMessage(MSG_MON_COMMAND, 0) {} - MMonCommand(ceph_fsid_t &f, version_t version) : - PaxosServiceMessage(MSG_MON_COMMAND, version), + MMonCommand(ceph_fsid_t &f, version_t v) : + PaxosServiceMessage(MSG_MON_COMMAND, v), fsid(f) { } private: diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index ca1d9db56ddc..3daf005f9b45 100644 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -88,8 +88,8 @@ public: bool may_exec() { assert(rmw_flags); return rmw_flags & (CEPH_OSD_FLAG_EXEC | CEPH_OSD_FLAG_EXEC_PUBLIC); } bool require_exec_caps() { assert(rmw_flags); return rmw_flags & CEPH_OSD_FLAG_EXEC; } - void set_peer_stat(const osd_peer_stat_t& stat) { - peer_stat = stat; + void set_peer_stat(const osd_peer_stat_t& st) { + peer_stat = st; flags |= CEPH_OSD_FLAG_PEERSTAT; } const osd_peer_stat_t& get_peer_stat() { diff --git a/src/msg/msg_types.cc b/src/msg/msg_types.cc index 9b593f9591bb..14865d2fc793 100644 --- a/src/msg/msg_types.cc +++ b/src/msg/msg_types.cc @@ -67,8 +67,8 @@ bool entity_addr_t::parse(const char *s, const char **end) if (*p == '/') { // parse nonce, too p++; - int nonce = atoi(p); - set_nonce(nonce); + int non = atoi(p); + set_nonce(non); while (*p && *p >= '0' && *p <= '9') p++; } diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 03d32d9c6e30..ca3cfd8a55f6 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -99,7 +99,7 @@ void OSDMap::print_summary(ostream& out) const void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid, - int num_osd, int num_dom, int pg_bits, int pgp_bits, int lpg_bits) + int nosd, int ndom, int pg_bits, int pgp_bits, int lpg_bits) { dout(10) << "build_simple on " << num_osd << " osds with " << pg_bits << " pg bits per osd, " @@ -108,7 +108,7 @@ void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid, set_fsid(fsid); created = modified = g_clock.now(); - set_max_osd(num_osd); + set_max_osd(nosd); // pgp_num <= pg_num if (pgp_bits > pg_bits) @@ -126,24 +126,24 @@ void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid, pools[pool].v.size = 2; pools[pool].v.crush_ruleset = p->first; pools[pool].v.object_hash = CEPH_STR_HASH_RJENKINS; - pools[pool].v.pg_num = num_osd << pg_bits; - pools[pool].v.pgp_num = num_osd << pgp_bits; + pools[pool].v.pg_num = nosd << pg_bits; + pools[pool].v.pgp_num = nosd << pgp_bits; pools[pool].v.lpg_num = lpg_bits ? (1 << (lpg_bits-1)) : 0; pools[pool].v.lpgp_num = lpg_bits ? (1 << (lpg_bits-1)) : 0; pools[pool].v.last_change = epoch; pool_name[pool] = p->second; } - build_simple_crush_map(crush, rulesets, num_osd, num_dom); + build_simple_crush_map(crush, rulesets, nosd, ndom); - for (int i=0; i& rulesets, int num_osd, - int num_dom) +void OSDMap::build_simple_crush_map(CrushWrapper& crush, map& rulesets, int nosd, + int ndom) { // new crush.create(); @@ -154,16 +154,15 @@ void OSDMap::build_simple_crush_map(CrushWrapper& crush, map& int minrep = g_conf.osd_min_rep; int maxrep = g_conf.osd_max_rep; assert(maxrep >= minrep); - int ndom = num_dom; if (!ndom) ndom = MAX(maxrep, g_conf.osd_max_raid_width); if (ndom > 1 && - num_osd >= ndom*3 && - num_osd > 8) { + nosd >= ndom*3 && + nosd > 8) { int ritems[ndom]; int rweights[ndom]; - int nper = ((num_osd - 1) / ndom) + 1; + int nper = ((nosd - 1) / ndom) + 1; dout(0) << ndom << " failure domains, " << nper << " osds each" << dendl; int o = 0; @@ -172,7 +171,7 @@ void OSDMap::build_simple_crush_map(CrushWrapper& crush, map& int j; rweights[i] = 0; for (j=0; j& } else { // one bucket - int items[num_osd]; - int weights[num_osd]; - for (int i=0; i struct hash { size_t operator()(const coll_t &c) const { - size_t hash = 0; + size_t h = 0; string str(c.to_str()); std::string::const_iterator end(str.end()); for (std::string::const_iterator s = str.begin(); s != end; ++s) { - hash += *s; - hash += (hash << 10); - hash ^= (hash >> 6); + h += *s; + h += (h << 10); + h ^= (h >> 6); } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; + h += (h << 3); + h ^= (h >> 11); + h += (h << 15); + return h; } }; }