/* Do not use when a particular hash function is needed */
explicit hobject_t(const sobject_t &o) :
oid(o.oid), snap(o.snap), max(false), pool(POOL_META) {
- set_hash(CEPH_HASH_NAMESPACE::hash<sobject_t>()(o));
+ set_hash(std::hash<sobject_t>()(o));
}
// maximum sorted value.
};
WRITE_CLASS_ENCODER(hobject_t)
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<hobject_t> {
size_t operator()(const hobject_t &r) const {
static hash<object_t> H;
return H(r.oid) ^ I(r.snap);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
ostream& operator<<(ostream& out, const hobject_t& o);
};
WRITE_CLASS_ENCODER(ghobject_t)
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<ghobject_t> {
size_t operator()(const ghobject_t &r) const {
static hash<object_t> H;
return H(r.hobj.oid) ^ I(r.hobj.snap);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
ostream& operator<<(ostream& out, const ghobject_t& o);
#include "lockdep.h"
#include "include/unordered_map.h"
-#include "include/hash_namespace.h"
#if defined(__FreeBSD__) && defined(__LP64__) // On FreeBSD pthread_t is a pointer.
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<>
struct hash<pthread_t>
{
operator()(pthread_t __x) const
{ return (uintptr_t)__x; }
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
#endif
/******* Constants **********/
include/on_exit.h \
include/memory.h \
include/rados/memory.h \
- include/hash_namespace.h \
include/unordered_set.h \
include/unordered_map.h
+++ /dev/null
-#ifndef CEPH_HASH_NAMESPACE_H
-#define CEPH_HASH_NAMESPACE_H
-
-#include <ciso646>
-
-#include <functional>
-
-#define CEPH_HASH_NAMESPACE_START namespace std {
-#define CEPH_HASH_NAMESPACE_END }
-#define CEPH_HASH_NAMESPACE std
-
-#endif
using namespace std;
#include "include/unordered_map.h"
-#include "include/hash_namespace.h"
#include "hash.h"
#include "encoding.h"
return out << o.name;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<object_t> {
size_t operator()(const object_t& r) const {
//static hash<string> H;
return ceph_str_hash_linux(r.name.c_str(), r.name.length());
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
struct file_object_t {
inline ostream& operator<<(ostream& out, const sobject_t &o) {
return out << o.oid << "/" << o.snap;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<sobject_t> {
size_t operator()(const sobject_t &r) const {
static hash<object_t> H;
return H(r.oid) ^ I(r.snap);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
#endif
using namespace std;
#include "include/unordered_map.h"
-#include "include/hash_namespace.h"
#include "object.h"
#include "intarith.h"
return out << hex << ino.val << dec;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< inodeno_t >
{
size_t operator()( const inodeno_t& x ) const
return H(x.val);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
// file modes
#include <boost/pool/pool.hpp>
#include "include/assert.h"
-#include "include/hash_namespace.h"
#include <boost/serialization/strong_typedef.hpp>
ostream& operator<<(ostream &out, const quota_info_t &n);
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<vinodeno_t> {
size_t operator()(const vinodeno_t &vino) const {
hash<inodeno_t> H;
return H(vino.ino) ^ I(vino.snapid);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
inline bool operator>(const metareqid_t& l, const metareqid_t& r) { return !(l <= r); }
inline bool operator>=(const metareqid_t& l, const metareqid_t& r) { return !(l < r); }
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<metareqid_t> {
size_t operator()(const metareqid_t &r) const {
hash<uint64_t> H;
return H(r.name.num()) ^ H(r.name.type()) ^ H(r.tid);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
// cap info for client reconnect
return l.ino == r.ino && l.frag == r.frag;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<dirfrag_t> {
size_t operator()(const dirfrag_t &df) const {
static rjhash<uint64_t> H;
return H(df.ino) ^ I(df.frag);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
#include "include/types.h"
#include "include/blobhash.h"
#include "include/encoding.h"
-#include "include/hash_namespace.h"
namespace ceph {
class Formatter;
return out << *(const entity_name_t*)&addr;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< entity_name_t >
{
size_t operator()( const entity_name_t &m ) const
return rjhash32(m.type() ^ m.num());
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
inline bool operator>(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) > 0; }
inline bool operator>=(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) >= 0; }
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< entity_addr_t >
{
size_t operator()( const entity_addr_t& x ) const
return H((const char*)&x, sizeof(x));
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
/*
inline bool operator>(const entity_inst_t& a, const entity_inst_t& b) { return b < a; }
inline bool operator>=(const entity_inst_t& a, const entity_inst_t& b) { return b <= a; }
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< entity_inst_t >
{
size_t operator()( const entity_inst_t& x ) const
return H(x.name) ^ I(x.addr);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
inline ostream& operator<<(ostream& out, const entity_inst_t &i)
inline bool operator>(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l <= r); }
inline bool operator>=(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l < r); }
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<osd_reqid_t> {
size_t operator()(const osd_reqid_t &r) const {
static hash<uint64_t> H;
return H(r.name.num() ^ r.tid ^ r.inc);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
// -----
ostream& operator<<(ostream& out, const pg_t &pg);
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< pg_t >
{
size_t operator()( const pg_t& x ) const
return H((x.pool() & 0xffffffff) ^ (x.pool() >> 32) ^ x.ps() ^ x.preferred());
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
struct spg_t {
pg_t pgid;
WRITE_EQ_OPERATORS_2(spg_t, pgid, shard)
WRITE_CMP_OPERATORS_2(spg_t, pgid, shard)
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash< spg_t >
{
size_t operator()( const spg_t& x ) const
return H(hash<pg_t>()(x.pgid) ^ x.shard);
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
ostream& operator<<(ostream& out, const spg_t &pg);
return out;
}
-CEPH_HASH_NAMESPACE_START
+namespace std {
template<> struct hash<coll_t> {
size_t operator()(const coll_t &c) const {
size_t h = 0;
return h;
}
};
-CEPH_HASH_NAMESPACE_END
+} // namespace std
inline ostream& operator<<(ostream& out, const ceph_object_layout &ol)
{