bpf: switch map 'pin_subdir' to 'pin_prefix'
which simplifies NetBpfLoad logic Test: TreeHugger Flag: EXEMPT mainline Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I3600cf45ae14a20801b5beca0aa9e79bb3052c57
This commit is contained in:
parent
85415edca0
commit
667dfa97e6
1 changed files with 5 additions and 16 deletions
|
|
@ -880,13 +880,6 @@ static enum bpf_map_type sanitizeMapType(enum bpf_map_type type) {
|
|||
return type;
|
||||
}
|
||||
|
||||
static string buildMapPinLoc(const char pin_subdir[BPF_PIN_SUBDIR_CHAR_ARRAY_SIZE],
|
||||
const string& objName, const string& mapName) {
|
||||
// Format of pin location is /sys/fs/bpf/<pin_subdir>map_<objName>_<mapName>
|
||||
// Note: <objName> refers to the extension-less basename of the .o file (without @ suffix).
|
||||
return string(BPF_FS_PATH) + pin_subdir + "map_" + objName + "_" + mapName;
|
||||
}
|
||||
|
||||
static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>& mapFds,
|
||||
const unsigned int bpfloader_ver) {
|
||||
int ret;
|
||||
|
|
@ -967,7 +960,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
|
|||
if (max_entries < page_size) max_entries = page_size;
|
||||
}
|
||||
|
||||
string mapPinLoc = buildMapPinLoc(md[i].pin_subdir, objName, mapNames[i]);
|
||||
string mapPinLoc = string(md[i].pin_prefix) + mapNames[i];
|
||||
unique_fd fd;
|
||||
int saved_errno;
|
||||
|
||||
|
|
@ -1368,7 +1361,7 @@ static int pinMaps(const char* const elfPath, const struct bpf_object* obj,
|
|||
// This map was skipped
|
||||
if (!bpf_map__autocreate(m)) continue;
|
||||
|
||||
string mapPinLoc = buildMapPinLoc(md[i].pin_subdir, objName, mapNames[i]);
|
||||
string mapPinLoc = string(md[i].pin_prefix) + mapNames[i];
|
||||
if (access(mapPinLoc.c_str(), F_OK) == 0) {
|
||||
ALOGE("Reusing map is not supported: %s", mapNames[i].c_str());
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue