A-Tune-BPF-Collection/Drop-using-legacy-BPF-map-declaration.patch

38 lines
1.2 KiB
Diff
Raw Normal View History

From 870d20f15defab4e3ff6f1cee721b8373ce2eb6d Mon Sep 17 00:00:00 2001
From: Lv Ying <lvying6@huawei.com>
Date: Wed, 3 Aug 2022 08:14:25 +0800
Subject: [PATCH] Drop using legacy BPF map declaration
https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0#drop-support-for-legacy-bpf-map-declaration-syntax
Signed-off-by: Lv Ying <lvying6@huawei.com>
---
readahead_tune.bpf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/readahead_tune.bpf.c b/readahead_tune.bpf.c
index 24a6ff9..cb29f3d 100644
--- a/readahead_tune.bpf.c
+++ b/readahead_tune.bpf.c
@@ -43,12 +43,12 @@ struct {
__uint(max_entries, MAP_ARRAY_SIZE);
} arraymap SEC(".maps");
-struct bpf_map_def SEC("maps") htab = {
- .type = BPF_MAP_TYPE_HASH,
- .key_size = sizeof(long),
- .value_size = sizeof(struct file_rd_hnode),
- .max_entries = MAX_HASH_TABLE_ENTRY,
-};
+struct {
+ __uint(type, BPF_MAP_TYPE_HASH);
+ __type(key, u64);
+ __type(value, struct file_rd_hnode);
+ __uint(max_entries, MAX_HASH_TABLE_ENTRY);
+} htab SEC(".maps");
/*
* This first paramater should be the exact position of variable, otherwise the start
--
2.33.0