10000 Move header files in the same folder than Go files by lebauce · Pull Request #206 · iovisor/gobpf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Move header files in the same folder than Go files #206

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/pinning.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ where objects are shared via Unix domain sockets.
## Different pinning options

`C.bpf_map_def.pinning` (defined in
[bpf.h](https://github.com/iovisor/gobpf/blob/446e57e0e24e/elf/include/bpf.h#L616))
[bpf.h](https://github.com/iovisor/gobpf/blob/81109c30cbe2/elf/bpf.h#L616))
can be set to one the following pinning options.

* `PIN_NONE` : object is not pinned
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-bpf.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The file at /elf/include/bpf.h is a copy of the Linux kernel file
The file at /elf/bpf.h is a copy of the Linux kernel file
/include/uapi/linux/bpf.h, retrieved from version 4.17, Git commit
36f9814, available at
https://raw.githubusercontent.com/torvalds/linux/36f9814a494a874d5a0f44843544b4b2539022db/include/uapi/linux/bpf.h.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ sections (`SEC("...")`). The following are currently supported:
* `uretprobe/...`
* `xdp/...`

Map definitions must correspond to `bpf_map_def` from [the elf package](https://github.com/iovisor/gobpf/blob/master/elf/include/bpf_map.h).
Map definitions must correspond to `bpf_map_def` from [the elf package](https://github.com/iovisor/gobpf/blob/master/elf/bpf_map.h).
Otherwise, you will encounter an error like `only one map with size 280 bytes allowed per section (check bpf_map_def)`.

The [Cilium](https://github.com/cilium/cilium) BPF docs contain helpful info
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions elf/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ import (
#include <assert.h>
#include <sys/socket.h>
#include <linux/unistd.h>
#include "include/bpf.h"
#include "include/bpf_map.h"
#include "bpf.h"
#include "bpf_map.h"
#include <poll.h>
#include <linux/perf_event.h>
#include <sys/resource.h>
Expand Down Expand Up @@ -265,7 +265,7 @@ const (

// Object pin settings should correspond to those of other projects, e.g.:
// https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git/tree/include/bpf_elf.h#n25
// Also it should be self-consistent with `elf/include/bpf.h` in the same repository.
// Also it should be self-consistent with `elf/bpf.h` in the same repository.
PIN_NONE = 0
PIN_OBJECT_NS = 1
PIN_GLOBAL_NS = 2
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions elf/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "include/bpf.h"
#include "include/libbpf.h"
#include "bpf.h"
#include "libbpf.h"
#include <linux/perf_event.h>
#include <linux/unistd.h>
#include <sys/socket.h>
Expand All @@ -51,8 +51,8 @@ import (
#include <linux/if_link.h>
#include <linux/rtnetlink.h>

#include "lib/nlattr.c"
#include "lib/netlink.c"
#include "netlink.h"
#include "nlattr.h"

static int perf_event_open_tracepoint(int tracepoint_id, int pid, int cpu,
int group_fd, unsigned long flags)
Expand Down
7 changes: 4 additions & 3 deletions elf/lib/netlink.c → elf/netlink.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
/* Copyright (c) 2018 Facebook */

#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <unistd.h>
#include <linux/rtnetlink.h>
#include <sys/socket.h>
#include <errno.h>
#include <time.h>

#include "include/bpf.h"
#include "include/libbpf.h"
#include "include/nlattr.h"
#include "libbpf.h"
#include "nlattr.h"

#ifndef SOL_NETLINK
#define SOL_NETLINK 270
Expand Down
9 changes: 9 additions & 0 deletions elf/netlink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef __NETLINK_H
#define __NETLINK_H

#include "bpf.h"

int libbpf_netlink_open(__u32 *nl_pid);
int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags);

#endif
3 changes: 2 additions & 1 deletion elf/lib/nlattr.c → elf/nlattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

#include <errno.h>
#include "include/nlattr.h"
#include "nlattr.h"
#include "libbpf.h"
#include <linux/rtnetlink.h>
#include <string.h>
#include <stdio.h>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion elf/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

/*
#include "include/bpf.h"
#include "bpf.h"
#include <linux/unistd.h>

extern __u64 ptr_to_u64(void *);
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Compiled with './build'
*/

#include "../elf/include/bpf.h"
#include "../elf/include/bpf_map.h"
#include "../elf/bpf.h"
#include "../elf/bpf_map.h"

#define SEC(NAME) __attribute__((section(NAME), used))

Expand Down
0