From: Yaxiong Tian iambestgod@outlook.com
To save some running memory,Add __init and __exit to the module load/unload functions.
Signed-off-by: Yaxiong Tian tianyaxiong@kylinos.cn --- tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c index 948eb3962732..aa571ab3c6c6 100644 --- a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c +++ b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c @@ -56,7 +56,7 @@ static struct bpf_struct_ops test_no_cif_ops = { .owner = THIS_MODULE, };
-static int bpf_test_no_cfi_init(void) +static int __init bpf_test_no_cfi_init(void) { int ret;
@@ -71,7 +71,7 @@ static int bpf_test_no_cfi_init(void) return ret; }
-static void bpf_test_no_cfi_exit(void) +static void __exit bpf_test_no_cfi_exit(void) { }
On 9/30/24 3:33 AM, Yaxiong Tian wrote:
From: Yaxiong Tian iambestgod@outlook.com
To save some running memory,Add __init and __exit to the module load/unload functions.
Signed-off-by: Yaxiong Tian tianyaxiong@kylinos.cn
tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c index 948eb3962732..aa571ab3c6c6 100644 --- a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c +++ b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c @@ -56,7 +56,7 @@ static struct bpf_struct_ops test_no_cif_ops = { .owner = THIS_MODULE, }; -static int bpf_test_no_cfi_init(void) +static int __init bpf_test_no_cfi_init(void) { int ret; @@ -71,7 +71,7 @@ static int bpf_test_no_cfi_init(void) return ret; } -static void bpf_test_no_cfi_exit(void) +static void __exit bpf_test_no_cfi_exit(void) { }
Not that the memory saving matters too much in this context, but lets also annotate bpf_testmod_init and bpf_testmod_exit while at it?
Thanks, Daniel
在 2024/10/2 20:15, Daniel Borkmann 写道:
On 9/30/24 3:33 AM, Yaxiong Tian wrote:
From: Yaxiong Tian iambestgod@outlook.com
To save some running memory,Add __init and __exit to the module load/unload functions.
Signed-off-by: Yaxiong Tian tianyaxiong@kylinos.cn
tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c index 948eb3962732..aa571ab3c6c6 100644 --- a/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c +++ b/tools/testing/selftests/bpf/bpf_test_no_cfi/bpf_test_no_cfi.c @@ -56,7 +56,7 @@ static struct bpf_struct_ops test_no_cif_ops = { .owner = THIS_MODULE, }; -static int bpf_test_no_cfi_init(void) +static int __init bpf_test_no_cfi_init(void) { int ret; @@ -71,7 +71,7 @@ static int bpf_test_no_cfi_init(void) return ret; } -static void bpf_test_no_cfi_exit(void) +static void __exit bpf_test_no_cfi_exit(void) { }
Not that the memory saving matters too much in this context, but lets also annotate bpf_testmod_init and bpf_testmod_exit while at it?
Of course, it will provide a reference for those who are not familiar with this part of the code.
Thanks, Daniel
linux-kselftest-mirror@lists.linaro.org