Changeset 615 for GPL/branches/uniaud32-next/include/linux/slab.h
- Timestamp:
- Jan 1, 2021, 5:31:48 AM (5 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/include/linux/slab.h
r442 r615 6 6 7 7 #include <linux/types.h> 8 #include <linux/list.h> 8 9 9 10 #if !defined(_LINUX_SLAB_H) … … 46 47 #endif /* __KERNEL__ */ 47 48 49 /* 50 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. 51 * 52 * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault. 53 * 54 * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can. 55 * Both make kfree a no-op. 56 */ 57 #define ZERO_SIZE_PTR ((void *)16) 58 48 59 //NOTE: enabling this in the non-KEE driver causes problems (file name strings 49 60 // put in seperate private segments) … … 52 63 extern void __kfree(const void near *, const char *filename, int lineno); 53 64 54 #define kmalloc(a,b) __kmalloc(a,b, __FILE__, __LINE__) 65 static inline void *kmalloc(size_t size, gfp_t flags) 66 { 67 return __kmalloc(size, flags, __FILE__, __LINE__); 68 } 69 70 55 71 #define kfree(a) __kfree(a, __FILE__, __LINE__) 56 72 #define kfree_s(a,b) __kfree(a, __FILE__, __LINE__) … … 70 86 void *kzalloc(size_t n, gfp_t gfp_flags); 71 87 void *kcalloc(size_t n, size_t size, unsigned int __nocast gfp_flags); 88 void *krealloc(const void *, size_t, gfp_t); 72 89 90 #define SIZE_MAX (~(size_t)0) 91 92 /** 93 * kmalloc_array - allocate memory for an array. 94 * @n: number of elements. 95 * @size: element size. 96 * @flags: the type of memory to allocate (see kmalloc). 97 */ 98 static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 99 { 100 if (size != 0 && n > SIZE_MAX / size) 101 return NULL; 102 return __kmalloc(n * size, flags); 103 } 104 105 #define kmalloc_node_track_caller(size, flags, node) \ 106 kmalloc_track_caller(size, flags) 107 #define kmalloc_track_caller(size, flags) __kmalloc(size, flags) 108 #define kvfree(arg) kfree(arg) 109 110 struct kmem_cache { 111 unsigned int object_size;/* The original size of the object */ 112 unsigned int size; /* The aligned/padded/added on size */ 113 unsigned int align; /* Alignment as calculated */ 114 unsigned long flags; /* Active flags on the slab */ 115 const char *name; /* Slab name for sysfs */ 116 int refcount; /* Use counter */ 117 void (*ctor)(void *); /* Called on object slot creation */ 118 struct list_head list; /* List of all slab caches on the system */ 119 }; 120 121 #define kvzalloc kzalloc 73 122 #endif /* _LINUX_SLAB_H */
Note:
See TracChangeset
for help on using the changeset viewer.