'static inline' -> 'inline'

Per Bernie: "in C++, inline implies internal linkage, you can drop static"

Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I139af1d826d4982a1480fbee433fd9a743509786
This commit is contained in:
Maciej Żenczykowski 2020-02-11 16:42:21 -08:00
parent c3a640db94
commit 06caf87004

View file

@ -57,12 +57,12 @@ constexpr const int MINIMUM_API_REQUIRED = 28;
* all unused portions are zero. It will fail with E2BIG if we don't fully zero bpf_attr.
*/
static inline int bpf(int cmd, const bpf_attr& attr) {
inline int bpf(int cmd, const bpf_attr& attr) {
return syscall(__NR_bpf, cmd, &attr, sizeof(attr));
}
static inline int createMap(bpf_map_type map_type, uint32_t key_size, uint32_t value_size,
uint32_t max_entries, uint32_t map_flags) {
inline int createMap(bpf_map_type map_type, uint32_t key_size, uint32_t value_size,
uint32_t max_entries, uint32_t map_flags) {
return bpf(BPF_MAP_CREATE, {
.map_type = map_type,
.key_size = key_size,
@ -72,8 +72,8 @@ static inline int createMap(bpf_map_type map_type, uint32_t key_size, uint32_t v
});
}
static inline int writeToMapEntry(const base::unique_fd& map_fd, const void* key, const void* value,
uint64_t flags) {
inline int writeToMapEntry(const base::unique_fd& map_fd, const void* key, const void* value,
uint64_t flags) {
return bpf(BPF_MAP_UPDATE_ELEM, {
.map_fd = static_cast<__u32>(map_fd.get()),
.key = ptr_to_u64(key),
@ -82,7 +82,7 @@ static inline int writeToMapEntry(const base::unique_fd& map_fd, const void* key
});
}
static inline int findMapEntry(const base::unique_fd& map_fd, const void* key, void* value) {
inline int findMapEntry(const base::unique_fd& map_fd, const void* key, void* value) {
return bpf(BPF_MAP_LOOKUP_ELEM, {
.map_fd = static_cast<__u32>(map_fd.get()),
.key = ptr_to_u64(key),
@ -90,14 +90,14 @@ static inline int findMapEntry(const base::unique_fd& map_fd, const void* key, v
});
}
static inline int deleteMapEntry(const base::unique_fd& map_fd, const void* key) {
inline int deleteMapEntry(const base::unique_fd& map_fd, const void* key) {
return bpf(BPF_MAP_DELETE_ELEM, {
.map_fd = static_cast<__u32>(map_fd.get()),
.key = ptr_to_u64(key),
});
}
static inline int getNextMapKey(const base::unique_fd& map_fd, const void* key, void* next_key) {
inline int getNextMapKey(const base::unique_fd& map_fd, const void* key, void* next_key) {
return bpf(BPF_MAP_GET_NEXT_KEY, {
.map_fd = static_cast<__u32>(map_fd.get()),
.key = ptr_to_u64(key),
@ -105,30 +105,30 @@ static inline int getNextMapKey(const base::unique_fd& map_fd, const void* key,
});
}
static inline int getFirstMapKey(const base::unique_fd& map_fd, void* firstKey) {
inline int getFirstMapKey(const base::unique_fd& map_fd, void* firstKey) {
return getNextMapKey(map_fd, NULL, firstKey);
}
static inline int bpfFdPin(const base::unique_fd& map_fd, const char* pathname) {
inline int bpfFdPin(const base::unique_fd& map_fd, const char* pathname) {
return bpf(BPF_OBJ_PIN, {
.pathname = ptr_to_u64(pathname),
.bpf_fd = static_cast<__u32>(map_fd.get()),
});
}
static inline int bpfFdGet(const char* pathname, uint32_t flag) {
inline int bpfFdGet(const char* pathname, uint32_t flag) {
return bpf(BPF_OBJ_GET, {
.pathname = ptr_to_u64(pathname),
.file_flags = flag,
});
}
static inline int mapRetrieve(const char* pathname, uint32_t flag) {
inline int mapRetrieve(const char* pathname, uint32_t flag) {
return bpfFdGet(pathname, flag);
}
static inline int attachProgram(bpf_attach_type type, const base::unique_fd& prog_fd,
const base::unique_fd& cg_fd) {
inline int attachProgram(bpf_attach_type type, const base::unique_fd& prog_fd,
const base::unique_fd& cg_fd) {
return bpf(BPF_PROG_ATTACH, {
.target_fd = static_cast<__u32>(cg_fd.get()),
.attach_bpf_fd = static_cast<__u32>(prog_fd.get()),
@ -136,7 +136,7 @@ static inline int attachProgram(bpf_attach_type type, const base::unique_fd& pro
});
}
static inline int detachProgram(bpf_attach_type type, const base::unique_fd& cg_fd) {
inline int detachProgram(bpf_attach_type type, const base::unique_fd& cg_fd) {
return bpf(BPF_PROG_DETACH, {
.target_fd = static_cast<__u32>(cg_fd.get()),
.attach_type = type,
@ -149,7 +149,7 @@ int setrlimitForTest();
std::string BpfLevelToString(BpfLevel BpfLevel);
BpfLevel getBpfSupportLevel();
static inline bool isBpfSupported() {
inline bool isBpfSupported() {
return getBpfSupportLevel() != BpfLevel::NONE;
}