Skip to content
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

Supports map of maps #2

Merged
merged 1 commit into from
Jun 28, 2021
Merged

Supports map of maps #2

merged 1 commit into from
Jun 28, 2021

Conversation

masibw
Copy link
Owner

@masibw masibw commented Jun 24, 2021

Hi team, this PR solve iovisor#297.

We have to use the table's file descriptor when using BPF_HASH_OF_MAPS or BPF_ARRAY_OF_MAPS. But now gobpf doesn't have the method. And also we have to pass the unsafe.Pointer of the file descriptor. So, I made the SetMap method.

This is a example.

parentTable := bpf.NewTable(m.TableId("parent_list"), m)
	innerTable := bpf.NewTable(m.TableId("inner_list"), m)
    fd := innerTable.Fd()
     if err := parentTable.SetMap(unsafe.Pointer(parentKey), fd); err != nil {
 	fmt.Fprintf(os.Stderr, "Failed to add data to parent_list: %s\n", err)
 	os.Exit(1)
 }

Please review this, thanks.

@masibw masibw self-assigned this Jun 27, 2021
@masibw masibw merged commit 7308938 into master Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants