MCPcopy Create free account
hub / github.com/apache/brpc / GetRegion

Function GetRegion

src/brpc/rdma/block_pool.cpp:105–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103static GlobalInfo* g_info = NULL;
104
105static inline Region* GetRegion(const void* buf) {
106 if (!buf) {
107 errno = EINVAL;
108 return NULL;
109 }
110 Region* r = NULL;
111 uintptr_t addr = (uintptr_t)buf;
112 for (int i = 0; i < FLAGS_rdma_memory_pool_max_regions; ++i) {
113 if (g_regions[i].start == 0) {
114 break;
115 }
116 if (addr >= g_regions[i].start &&
117 addr < g_regions[i].start + g_regions[i].size) {
118 r = &g_regions[i];
119 break;
120 }
121 }
122 return r;
123}
124
125uint32_t GetRegionId(const void* buf) {
126 Region* r = GetRegion(buf);

Callers 4

GetRegionIdFunction · 0.85
RecycleAllFunction · 0.85
DeallocBlockFunction · 0.85
GetBlockTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected