Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Add Linux-style...
details: https://anonhg.NetBSD.org/src/rev/98e29c3dc7c9
branches: riastradh-drm2
changeset: 788045:98e29c3dc7c9
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 01:59:05 2013 +0000
description:
Add Linux-style kmalloc &c. to <linux/slab.h>.
Defined in terms of malloc(9) with M_TEMP for now, since Linux's
kfree doesn't pass the size, so using kmem(9) is inexpedient.
diffstat:
sys/external/bsd/drm2/include/linux/slab.h | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diffs (40 lines):
diff -r 10d096154b80 -r 98e29c3dc7c9 sys/external/bsd/drm2/include/linux/slab.h
--- a/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 01:58:51 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 01:59:05 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slab.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */
+/* $NetBSD: slab.h,v 1.1.2.2 2013/07/24 01:59:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,30 @@
#ifndef _LINUX_SLAB_H_
#define _LINUX_SLAB_H_
+#include <sys/malloc.h>
+
+#include <uvm/uvm_extern.h> /* For PAGE_SIZE. */
+
+/* XXX Should use kmem, but Linux kfree doesn't take the size. */
+
+#define GFP_KERNEL M_WAITOK
+
+static inline void *
+kmalloc(size_t size, int flags)
+{
+ return malloc(size, M_TEMP, flags);
+}
+
+static inline void *
+kzalloc(size_t size, int flags)
+{
+ return malloc(size, M_TEMP, (flags | M_ZERO));
+}
+
+static inline void
+kfree(void *ptr)
+{
+ free(ptr, M_TEMP);
+}
+
#endif /* _LINUX_SLAB_H_ */
Home |
Main Index |
Thread Index |
Old Index