Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux Implement kvfree by free...
details: https://anonhg.NetBSD.org/src/rev/9b31d72c6788
branches: trunk
changeset: 366191:9b31d72c6788
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 13:44:54 2018 +0000
description:
Implement kvfree by free(9); assume kmalloc/vmalloc use malloc(9).
diffstat:
sys/external/bsd/drm2/include/linux/mm.h | 15 ++++++++++++---
sys/external/bsd/drm2/include/linux/slab.h | 8 +++++++-
sys/external/bsd/drm2/include/linux/vmalloc.h | 8 ++++++--
3 files changed, 25 insertions(+), 6 deletions(-)
diffs (85 lines):
diff -r c40b5377230c -r 9b31d72c6788 sys/external/bsd/drm2/include/linux/mm.h
--- a/sys/external/bsd/drm2/include/linux/mm.h Mon Aug 27 13:44:41 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/mm.h Mon Aug 27 13:44:54 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mm.h,v 1.8 2018/08/27 07:23:22 riastradh Exp $ */
+/* $NetBSD: mm.h,v 1.9 2018/08/27 13:44:54 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
#ifndef _LINUX_MM_H_
#define _LINUX_MM_H_
+#include <sys/malloc.h>
+
#include <uvm/uvm_extern.h>
#include <asm/page.h>
@@ -77,10 +79,17 @@
return uvmexp.npages;
}
+/*
+ * XXX Requires that kmalloc in <linux/slab.h> and vmalloc in
+ * <linux/vmalloc.h> both use malloc(9). If you change either of
+ * those, be sure to update this.
+ */
static inline void
-kvfree(void * ptr)
+kvfree(void *ptr)
{
- panic("Unimplemented");
+
+ if (ptr != NULL)
+ free(ptr, M_TEMP);
}
static inline void
diff -r c40b5377230c -r 9b31d72c6788 sys/external/bsd/drm2/include/linux/slab.h
--- a/sys/external/bsd/drm2/include/linux/slab.h Mon Aug 27 13:44:41 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/slab.h Mon Aug 27 13:44:54 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slab.h,v 1.5 2015/03/02 02:26:37 riastradh Exp $ */
+/* $NetBSD: slab.h,v 1.6 2018/08/27 13:44:54 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -81,6 +81,12 @@
return flags;
}
+/*
+ * XXX vmalloc and kmalloc both use malloc(9). If you change this, be
+ * sure to update vmalloc in <linux/vmalloc.h> and kvfree in
+ * <linux/mm.h>.
+ */
+
static inline void *
kmalloc(size_t size, gfp_t gfp)
{
diff -r c40b5377230c -r 9b31d72c6788 sys/external/bsd/drm2/include/linux/vmalloc.h
--- a/sys/external/bsd/drm2/include/linux/vmalloc.h Mon Aug 27 13:44:41 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/vmalloc.h Mon Aug 27 13:44:54 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmalloc.h,v 1.5 2018/08/06 00:30:07 riastradh Exp $ */
+/* $NetBSD: vmalloc.h,v 1.6 2018/08/27 13:44:54 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -40,10 +40,14 @@
#include <asm/page.h>
+/*
+ * XXX vmalloc and kmalloc both use malloc(9). If you change this, be
+ * sure to update kmalloc in <linux/slab.h> and kvfree in <linux/mm.h>.
+ */
+
static inline bool
is_vmalloc_addr(void *addr)
{
- /* XXX Assumes vmalloc and kmalloc both use malloc(9). */
return true;
}
Home |
Main Index |
Thread Index |
Old Index