@@ -266,11 +266,50 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
266
266
struct kmem_cache * __kmem_cache_create (const char * name , unsigned int size ,
267
267
unsigned int align , slab_flags_t flags ,
268
268
void (* ctor )(void * ));
269
- struct kmem_cache * kmem_cache_create_usercopy (const char * name ,
270
- unsigned int size , unsigned int align ,
271
- slab_flags_t flags ,
272
- unsigned int useroffset , unsigned int usersize ,
273
- void (* ctor )(void * ));
269
+
270
+ /**
271
+ * kmem_cache_create_usercopy - Create a cache with a region suitable
272
+ * for copying to userspace
273
+ * @name: A string which is used in /proc/slabinfo to identify this cache.
274
+ * @size: The size of objects to be created in this cache.
275
+ * @align: The required alignment for the objects.
276
+ * @flags: SLAB flags
277
+ * @useroffset: Usercopy region offset
278
+ * @usersize: Usercopy region size
279
+ * @ctor: A constructor for the objects.
280
+ *
281
+ * Cannot be called within a interrupt, but can be interrupted.
282
+ * The @ctor is run when new pages are allocated by the cache.
283
+ *
284
+ * The flags are
285
+ *
286
+ * %SLAB_POISON - Poison the slab with a known test pattern (a5a5a5a5)
287
+ * to catch references to uninitialised memory.
288
+ *
289
+ * %SLAB_RED_ZONE - Insert `Red` zones around the allocated memory to check
290
+ * for buffer overruns.
291
+ *
292
+ * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware
293
+ * cacheline. This can be beneficial if you're counting cycles as closely
294
+ * as davem.
295
+ *
296
+ * Return: a pointer to the cache on success, NULL on failure.
297
+ */
298
+ static inline struct kmem_cache *
299
+ kmem_cache_create_usercopy (const char * name , unsigned int size ,
300
+ unsigned int align , slab_flags_t flags ,
301
+ unsigned int useroffset , unsigned int usersize ,
302
+ void (* ctor )(void * ))
303
+ {
304
+ struct kmem_cache_args kmem_args = {
305
+ .align = align ,
306
+ .ctor = ctor ,
307
+ .useroffset = useroffset ,
308
+ .usersize = usersize ,
309
+ };
310
+
311
+ return __kmem_cache_create_args (name , size , & kmem_args , flags );
312
+ }
274
313
275
314
/* If NULL is passed for @args, use this variant with default arguments. */
276
315
static inline struct kmem_cache *
0 commit comments