forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf: Add libbpf_set_strict_mode() API to turn on libbpf 1.0 behaviors
Add libbpf_set_strict_mode() API that allows application to simulate libbpf 1.0 breaking changes before libbpf 1.0 is released. This will help users migrate gradually and with confidence. For now only ALL or NONE options are available, subsequent patches will add more flags. This patch is preliminary for selftests/bpf changes. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: John Fastabend <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
- Loading branch information
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ | ||
|
||
/* | ||
* Libbpf legacy APIs (either discouraged or deprecated, as mentioned in [0]) | ||
* | ||
* [0] https://docs.google.com/document/d/1UyjTZuPFWiPFyKk1tV5an11_iaRuec6U-ZESZ54nNTY | ||
* | ||
* Copyright (C) 2021 Facebook | ||
*/ | ||
#ifndef __LIBBPF_LEGACY_BPF_H | ||
#define __LIBBPF_LEGACY_BPF_H | ||
|
||
#include <linux/bpf.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include "libbpf_common.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
enum libbpf_strict_mode { | ||
/* Turn on all supported strict features of libbpf to simulate libbpf | ||
* v1.0 behavior. | ||
* This will be the default behavior in libbpf v1.0. | ||
*/ | ||
LIBBPF_STRICT_ALL = 0xffffffff, | ||
|
||
/* | ||
* Disable any libbpf 1.0 behaviors. This is the default before libbpf | ||
* v1.0. It won't be supported anymore in v1.0, please update your | ||
* code so that it handles LIBBPF_STRICT_ALL mode before libbpf v1.0. | ||
*/ | ||
LIBBPF_STRICT_NONE = 0x00, | ||
|
||
__LIBBPF_STRICT_LAST, | ||
}; | ||
|
||
LIBBPF_API int libbpf_set_strict_mode(enum libbpf_strict_mode mode); | ||
|
||
|
||
#ifdef __cplusplus | ||
} /* extern "C" */ | ||
#endif | ||
|
||
#endif /* __LIBBPF_LEGACY_BPF_H */ |