mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
tools: bpftool: open pinned object without type check
This was needed for opening any file in bpf-fs without knowing its object type Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
329fca60a9
commit
1852719658
2 changed files with 14 additions and 2 deletions
|
@ -122,9 +122,8 @@ static int mnt_bpffs(const char *target, char *buff, size_t bufflen)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type)
|
||||
int open_obj_pinned(char *path)
|
||||
{
|
||||
enum bpf_obj_type type;
|
||||
int fd;
|
||||
|
||||
fd = bpf_obj_get(path);
|
||||
|
@ -136,6 +135,18 @@ int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type)
|
||||
{
|
||||
enum bpf_obj_type type;
|
||||
int fd;
|
||||
|
||||
fd = open_obj_pinned(path);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
type = get_fd_type(fd);
|
||||
if (type < 0) {
|
||||
close(fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue