32 return (c1.first < c2.first) && (c1.second < c2.second);
43 if ((uintptr_t)c1.first < (uintptr_t)c2.first)
return true;
44 if ((uintptr_t)c1.first > (uintptr_t)c2.first)
return false;
45 if (c1.second < c2.second)
return true;
49 typedef std::set<AddrSizePairType, CmpAddrSizePair>
SetOfPairs;
54 MapInterval *m, uint64_t e1, uint64_t e2, uint32_t e3)
56 (*m)[std::make_pair(e1,e2)] = e3;
61 const MapInterval & m,
const uint64_t e1,
const uint64_t e2)
63 return m.find(std::make_pair(e1, e2));
68 (*setp).insert(std::make_pair(addr, sz));
72 const SetOfPairs & setp,
void *addr,
size_t sz)
74 return setp.find(std::make_pair(addr, sz));
79 template <
class ElemType>
84 { Addr_ = addr; Elem_ =
new ElemType(elem); Next_ = 0; }
87 std::atomic<ElemType*> Elem_;
91 template <
class ElemType>
98 Tab_ =
new std::atomic<ElemInfo<ElemType>*> [Size_];
101 void Insert(
void*,
const ElemType &);
104 std::atomic<ElemInfo<ElemType>*> *Tab_;
105 static uint32_t Size_;
107 std::atomic<ElemInfo<ElemType>*> *GetTableEntry(
void *addr)
108 {
return (Tab_ + (((uintptr_t(addr)+128) >> 3) & (Size_-1))); }
112 std::atomic<ElemInfo<ElemType>*> *entry = GetTableEntry(addr);
113 return (*entry).load(std::memory_order_acquire);
115 std::atomic<ElemInfo<ElemType>*> *GetPointerToElemInfoHeader(
void *addr)
117 return GetTableEntry(addr);
void InsertToMapInterval(MapInterval *m, uint64_t e1, uint64_t e2, uint32_t e3)
Definition: util.hpp:53
char * NVM_GetFullyQualifiedRegionName(const char *name)
Definition: util.cpp:145
SetOfPairs::const_iterator FindSetOfPairs(const SetOfPairs &setp, void *addr, size_t sz)
Definition: util.hpp:71
char * NVM_GetLogRegionName()
Definition: util.cpp:159
std::map< UInt64Pair, uint32_t, CmpUInt64 > MapInterval
Definition: util.hpp:35
void InsertSetOfPairs(SetOfPairs *setp, void *addr, size_t sz)
Definition: util.hpp:66
void NVM_CreateLogDir()
Definition: util.cpp:97
char * NVM_GetRegionTablePath()
Definition: util.cpp:37
ElemInfo(void *addr, const ElemType &elem)
Definition: util.hpp:83
bool operator()(const UInt64Pair &c1, const UInt64Pair &c2) const
Definition: util.hpp:30
bool operator()(const AddrSizePairType &c1, const AddrSizePairType &c2) const
Definition: util.hpp:41
MapInterval::const_iterator FindInMapInterval(const MapInterval &m, const uint64_t e1, const uint64_t e2)
Definition: util.hpp:60
bool NVM_doesLogExist(const char *log_path_name)
Definition: util.cpp:182
std::set< AddrSizePairType, CmpAddrSizePair > SetOfPairs
Definition: util.hpp:49
int size(COW_AL *cal)
Definition: cow_array_list.c:183
std::set< uint64_t > SetOfInts
Definition: util.hpp:77
SimpleHashTable(uint32_t size=0)
Definition: util.hpp:95
char * NVM_GetUserDir()
Definition: util.cpp:50
void NVM_CreateUserDir()
Definition: util.cpp:80
std::pair< uint64_t, uint64_t > UInt64Pair
Definition: util.hpp:26
std::pair< void *, size_t > AddrSizePairType
Definition: util.hpp:37
void NVM_qualifyPathName(char *s, const char *name)
Definition: util.cpp:193
char * NVM_GetLogDir()
Definition: util.cpp:62