Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/include/linux/slab.h

    r442 r679  
    55 */
    66
     7#include <linux/gfp.h>
     8#include <linux/overflow.h>
    79#include <linux/types.h>
     10#include <linux/list.h>
     11#include <linux/workqueue.h>
    812
    913#if     !defined(_LINUX_SLAB_H)
     
    4650#endif  /* __KERNEL__ */
    4751
     52/*
     53 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
     54 *
     55 * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
     56 *
     57 * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
     58 * Both make kfree a no-op.
     59 */
     60#define ZERO_SIZE_PTR ((void *)16)
     61
    4862//NOTE: enabling this in the non-KEE driver causes problems (file name strings
    4963//      put in seperate private segments)
     
    5266extern void  __kfree(const void near *, const char *filename, int lineno);
    5367
    54 #define kmalloc(a,b)            __kmalloc(a,b, __FILE__, __LINE__)
     68static inline void *kmalloc(size_t size, gfp_t flags)
     69{
     70        return __kmalloc(size, flags, __FILE__, __LINE__);
     71}
     72
     73
    5574#define kfree(a)                __kfree(a, __FILE__, __LINE__)
    5675#define kfree_s(a,b)            __kfree(a, __FILE__, __LINE__)
     
    7089void *kzalloc(size_t n, gfp_t gfp_flags);
    7190void *kcalloc(size_t n, size_t size, unsigned int __nocast gfp_flags);
     91void *krealloc(const void *, size_t, gfp_t);
     92
     93#define SIZE_MAX        (~(size_t)0)
     94
     95/**
     96 * kmalloc_array - allocate memory for an array.
     97 * @n: number of elements.
     98 * @size: element size.
     99 * @flags: the type of memory to allocate (see kmalloc).
     100 */
     101static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
     102{
     103        if (size != 0 && n > SIZE_MAX / size)
     104                return NULL;
     105        return __kmalloc(n * size, flags);
     106}
     107
     108#define kmalloc_node_track_caller(size, flags, node) \
     109        kmalloc_track_caller(size, flags)
     110#define         kmalloc_track_caller(size, flags)   __kmalloc(size, flags)
     111#define kvfree(arg)                     kfree(arg)
     112
     113struct kmem_cache {
     114        unsigned int object_size;/* The original size of the object */
     115        unsigned int size;      /* The aligned/padded/added on size  */
     116        unsigned int align;     /* Alignment as calculated */
     117        unsigned long flags;    /* Active flags on the slab */
     118        const char *name;       /* Slab name for sysfs */
     119        int refcount;           /* Use counter */
     120        void (*ctor)(void *);   /* Called on object slot creation */
     121        struct list_head list;  /* List of all slab caches on the system */
     122};
     123
     124#define kvzalloc kzalloc
     125size_t ksize(const void *);
     126
     127static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
     128{
     129        return __kmalloc(size, flags);
     130}
     131
     132static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
     133{
     134        return __kmalloc_node(size, flags, node);
     135}
    72136
    73137#endif  /* _LINUX_SLAB_H */
Note: See TracChangeset for help on using the changeset viewer.