Ignore:
Timestamp:
Jan 1, 2021, 5:31:48 AM (5 years ago)
Author:
Paul Smedley
Message:

Add source for uniaud32 based on code from linux kernel 5.4.86

Location:
GPL/branches/uniaud32-next
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/include/linux/slab.h

    r442 r615  
    66
    77#include <linux/types.h>
     8#include <linux/list.h>
    89
    910#if     !defined(_LINUX_SLAB_H)
     
    4647#endif  /* __KERNEL__ */
    4748
     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
    4859//NOTE: enabling this in the non-KEE driver causes problems (file name strings
    4960//      put in seperate private segments)
     
    5263extern void  __kfree(const void near *, const char *filename, int lineno);
    5364
    54 #define kmalloc(a,b)            __kmalloc(a,b, __FILE__, __LINE__)
     65static inline void *kmalloc(size_t size, gfp_t flags)
     66{
     67        return __kmalloc(size, flags, __FILE__, __LINE__);
     68}
     69
     70
    5571#define kfree(a)                __kfree(a, __FILE__, __LINE__)
    5672#define kfree_s(a,b)            __kfree(a, __FILE__, __LINE__)
     
    7086void *kzalloc(size_t n, gfp_t gfp_flags);
    7187void *kcalloc(size_t n, size_t size, unsigned int __nocast gfp_flags);
     88void *krealloc(const void *, size_t, gfp_t);
    7289
     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 */
     98static 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
     110struct 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
    73122#endif  /* _LINUX_SLAB_H */
Note: See TracChangeset for help on using the changeset viewer.