Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/testing/scatterlist: Rejuvenate bit-rotten test

A couple small tweaks are needed to make the test build and run
on current kernels.

Link: https://lore.kernel.org/r/20201004154340.1080481-3-leon@kernel.org
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Tvrtko Ursulin and committed by
Jason Gunthorpe
efc5b2e7 549738f1

+37 -1
+2 -1
tools/testing/scatterlist/Makefile
··· 14 14 main: $(OFILES) 15 15 16 16 clean: 17 - $(RM) $(TARGETS) $(OFILES) scatterlist.c linux/scatterlist.h linux/highmem.h linux/kmemleak.h asm/io.h 17 + $(RM) $(TARGETS) $(OFILES) scatterlist.c linux/scatterlist.h linux/highmem.h linux/kmemleak.h linux/slab.h asm/io.h 18 18 @rmdir asm 19 19 20 20 scatterlist.c: ../../../lib/scatterlist.c ··· 28 28 @touch asm/io.h 29 29 @touch linux/highmem.h 30 30 @touch linux/kmemleak.h 31 + @touch linux/slab.h 31 32 @cp $< linux/scatterlist.h
+35
tools/testing/scatterlist/linux/mm.h
··· 114 114 return malloc(size); 115 115 } 116 116 117 + static inline void * 118 + kmalloc_array(unsigned int n, unsigned int size, unsigned int flags) 119 + { 120 + return malloc(n * size); 121 + } 122 + 117 123 #define kfree(x) free(x) 118 124 119 125 #define kmemleak_alloc(a, b, c, d) ··· 127 121 128 122 #define PageSlab(p) (0) 129 123 #define flush_kernel_dcache_page(p) 124 + 125 + #define MAX_ERRNO 4095 126 + 127 + #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) 128 + 129 + static inline void * __must_check ERR_PTR(long error) 130 + { 131 + return (void *) error; 132 + } 133 + 134 + static inline long __must_check PTR_ERR(__force const void *ptr) 135 + { 136 + return (long) ptr; 137 + } 138 + 139 + static inline bool __must_check IS_ERR(__force const void *ptr) 140 + { 141 + return IS_ERR_VALUE((unsigned long)ptr); 142 + } 143 + 144 + static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) 145 + { 146 + if (IS_ERR(ptr)) 147 + return PTR_ERR(ptr); 148 + else 149 + return 0; 150 + } 151 + 152 + #define IS_ENABLED(x) (0) 130 153 131 154 #endif