SHA256
1
0
forked from pool/openafs
openafs/658942f2791fad5e33ec7542158c16dfc66eed39

67 lines
2.4 KiB
Plaintext
Raw Normal View History

commit 658942f2791fad5e33ec7542158c16dfc66eed39
Author: Cheyenne Wills <cwills@sinenomine.net>
Date: Wed Jun 12 14:16:43 2024 -0600
Linux-6.10: define a wrapper for vmalloc
The Linux 6.10 commit:
"mm: vmalloc: enable memory allocation profiling" (88ae5fb755)
changed vmalloc from a function to a wrapper macro.
This change results in build errors:
"error: implicit declaration of function vmalloc; did you mean
kmalloc? [-Werror=implicit-function-declaration]"
when vmalloc is passed as a parameter to the afs_atomlist_create() and
afs_lhash_create() functions.
Add a little wrapper function around vmalloc() to use for the parameter
to afs_atomlist_create() and afs_lhash_create().
Note: A configure test was not needed for this change since the name
and functionality of Linux's vmalloc did not change.
Change-Id: I69c1da9eea5d1de11c1628bbcef427f81f5c01e1
Reviewed-on: https://gerrit.openafs.org/15765
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c
index 86cd0e571..7c4b4a1ca 100644
--- a/src/afs/LINUX/osi_alloc.c
+++ b/src/afs/LINUX/osi_alloc.c
@@ -196,6 +196,15 @@ local_free(void *p, size_t n)
vfree(p);
}
+/*
+ * wrapper for vmalloc(), since vmalloc() may be a macro
+ */
+static void *
+local_vmalloc(size_t size)
+{
+ return vmalloc(size);
+}
+
/* linux_alloc_init(): Initializes the kernel memory allocator. As part
* of this process, it also initializes a pool of osi_linux_mem
* structures as well as the hash table itself.
@@ -209,14 +218,14 @@ linux_alloc_init(void)
/* initiate our pool of osi_linux_mem structs */
al_mem_pool =
afs_atomlist_create(sizeof(struct osi_linux_mem), sizeof(long) * 1024,
- (void *)vmalloc, local_free);
+ local_vmalloc, local_free);
if (!al_mem_pool) {
printf("afs_osi_Alloc: Error in initialization(atomlist_create)\n");
return 0;
}
/* initialize the hash table to hold references to alloc'ed chunks */
- lh_mem_htab = afs_lhash_create(hash_equal, (void *)vmalloc, local_free);
+ lh_mem_htab = afs_lhash_create(hash_equal, local_vmalloc, local_free);
if (!lh_mem_htab) {
printf("afs_osi_Alloc: Error in initialization(lhash_create)\n");
return 0;