-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the use of custom keys in BPF_HASH_OF_MAPS #3500
Conversation
The implementation of a template class should be in header file. |
Thanks for replying @chenhengqi, like this code? but I have this error.
|
|
src/cc/api/BPF.h
Outdated
BPFMapInMapTable<KeyType> get_map_in_map_table(const std::string& name){ | ||
TableStorage::iterator it; | ||
if (bpf_module_->table_storage().Find(Path({bpf_module_->id(), name}),it)) | ||
return BPFMapInMapTable<KeyType>(it->second); | ||
return BPFMapInMapTable<KeyType>({}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: 2 space for indention, 1 space after comma.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed
Oh, I'm sorry. I made a terrible mistake. 😢 |
[buildbot, test this please] |
Sorry, I made a mistake with the |
[buildbot, test this please] |
test_map_in_map.py failed, probably due to python3 compatibility.
|
[buildbot, ok to test] |
OK, probably fixed. |
LGTM. Thanks! |
- Allow the use of custom keys in BPF_HASH_OF_MAPS - Add both python and C++ tests
- Allow the use of custom keys in BPF_HASH_OF_MAPS - Add both python and C++ tests
close #3496
Hi team. I wrote a macro that can use custom key for
BPF_HASH_OF_MAPS
.But in c++,
get_map_in_map_table
is shared toBPF_ARRAY_OF_MAPS
.So, when using
BPF_ARRAY_OF_MAPS
, we have to declare like this.Is it okay?
-- solved --
Maybe I could wrote about
BPF_HASH_OF_MAPS
macro. But.cc
files have errors. I've never write c++ programs, Can anyone help me?This is probably due to the fact that the definition and implementation are in separate files, but if I write it in the header file, the following error occurs. I don't know which one is closer to the solution, so I pushed the one where the definition and implementation are in separate files.