| 103 | static GlobalInfo* g_info = NULL; |
| 104 | |
| 105 | static 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 | |
| 125 | uint32_t GetRegionId(const void* buf) { |
| 126 | Region* r = GetRegion(buf); |
no outgoing calls
no test coverage detected