1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _LINUX_SLAB_H 16 #define _LINUX_SLAB_H 17 18 #include "stdlib.h" 19 #include "asm/page.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif /* __cplusplus */ 24 25 #define GFP_KERNEL (0) 26 #define GFP_ATOMIC (0) 27 28 #ifndef __kmalloc 29 #define __kmalloc(x) malloc(x) 30 #endif 31 32 #ifndef kmalloc 33 #define kmalloc(x, y) __kmalloc(x) 34 #endif 35 36 #ifndef __kfree 37 #define __kfree(x) free(x) 38 #endif 39 #ifndef kfree 40 #define kfree(x) __kfree(x) 41 #endif 42 43 #ifndef __vmalloc 44 #define __vmalloc(x) malloc(x) 45 #endif 46 #ifndef vmalloc 47 #define vmalloc(x) __vmalloc(x) 48 #endif 49 #ifndef __vfree 50 #define __vfree(x) free(x) 51 #endif 52 #ifndef vfree 53 #define vfree(x) __vfree(x) 54 #endif 55 #ifndef kzalloc 56 #define kzalloc(s, f) __kzalloc((s), (f)) 57 #endif 58 #ifndef __kzalloc 59 #define __kzalloc(s, f) calloc(1, (s)) 60 #endif 61 62 #ifdef __cplusplus 63 } 64 #endif /* __cplusplus */ 65 66 #endif /* _LINUX_SLAB_H */ 67