Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Remove the unused 'struct malloc_type' args to kern_mall...
details: https://anonhg.NetBSD.org/src/rev/8987225a6fdd
branches: trunk
changeset: 779062:8987225a6fdd
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Apr 29 16:36:53 2012 +0000
description:
Remove the unused 'struct malloc_type' args to kern_malloc/realloc/free
The M_xxx arg is left on the calls to malloc() and free(),
maybe they could be converted to an enumeration and just saved in
the malloc header (for deep diag use).
Remove the malloc_type from mbuf extension.
Fixes rump build as well.
Welcome to 6.99.6
diffstat:
sys/kern/kern_malloc.c | 11 +++++------
sys/kern/uipc_mbuf.c | 5 ++---
sys/rump/librump/rumpkern/memalloc.c | 24 +++++-------------------
sys/sys/malloc.h | 14 +++++++-------
sys/sys/mbuf.h | 23 +----------------------
sys/sys/param.h | 4 ++--
6 files changed, 22 insertions(+), 59 deletions(-)
diffs (239 lines):
diff -r b736142a62e0 -r 8987225a6fdd sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/kern/kern_malloc.c Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_malloc.c,v 1.139 2012/04/28 23:03:40 rmind Exp $ */
+/* $NetBSD: kern_malloc.c,v 1.140 2012/04/29 16:36:53 dsl Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.139 2012/04/28 23:03:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.140 2012/04/29 16:36:53 dsl Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -103,7 +103,7 @@
} __aligned(ALIGNBYTES + 1);
void *
-kern_malloc(unsigned long size, struct malloc_type *ksp, int flags)
+kern_malloc(unsigned long size, int flags)
{
const int kmflags = (flags & M_NOWAIT) ? KM_NOSLEEP : KM_SLEEP;
size_t allocsize, hdroffset;
@@ -132,7 +132,7 @@
}
void
-kern_free(void *addr, struct malloc_type *ksp)
+kern_free(void *addr)
{
struct malloc_header *mh;
@@ -147,8 +147,7 @@
}
void *
-kern_realloc(void *curaddr, unsigned long newsize, struct malloc_type *ksp,
- int flags)
+kern_realloc(void *curaddr, unsigned long newsize, int flags)
{
struct malloc_header *mh;
unsigned long cursize;
diff -r b736142a62e0 -r 8987225a6fdd sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/kern/uipc_mbuf.c Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_mbuf.c,v 1.145 2012/02/10 17:35:47 para Exp $ */
+/* $NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.145 2012/02/10 17:35:47 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $");
#include "opt_mbuftrace.h"
#include "opt_nmbclusters.h"
@@ -73,7 +73,6 @@
#include <sys/atomic.h>
#include <sys/cpu.h>
#include <sys/proc.h>
-#define MBTYPES
#include <sys/mbuf.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
diff -r b736142a62e0 -r 8987225a6fdd sys/rump/librump/rumpkern/memalloc.c
--- a/sys/rump/librump/rumpkern/memalloc.c Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/rump/librump/rumpkern/memalloc.c Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memalloc.c,v 1.13 2012/04/29 14:00:15 rmind Exp $ */
+/* $NetBSD: memalloc.c,v 1.14 2012/04/29 16:36:53 dsl Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.13 2012/04/29 14:00:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.14 2012/04/29 16:36:53 dsl Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -54,20 +54,6 @@
* malloc
*/
-MALLOC_DEFINE(M_DEVBUF, "devbuf", "device driver memory");
-MALLOC_DEFINE(M_DMAMAP, "DMA map", "bus_dma(9) structures");
-MALLOC_DEFINE(M_FREE, "free", "should be on free list");
-MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
-MALLOC_DEFINE(M_TEMP, "temp", "misc. temporary data buffers");
-MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
-MALLOC_DEFINE(M_FTABLE, "fragtbl", "fragment reassembly header");
-MALLOC_DEFINE(M_UFSMNT, "UFS mount", "UFS mount structure");
-MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
-MALLOC_DEFINE(M_IPMOPTS, "ip_moptions", "internet multicast options");
-MALLOC_DEFINE(M_IPMADDR, "in_multi", "internet multicast address");
-MALLOC_DEFINE(M_MRTABLE, "mrt", "multicast routing tables");
-MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast upcall bw meters");
-
void
malloc_type_attach(struct malloc_type *type)
{
@@ -83,7 +69,7 @@
}
void *
-kern_malloc(unsigned long size, struct malloc_type *type, int flags)
+kern_malloc(unsigned long size, int flags)
{
void *rv;
@@ -99,14 +85,14 @@
}
void *
-kern_realloc(void *ptr, unsigned long size, struct malloc_type *type, int flags)
+kern_realloc(void *ptr, unsigned long size, int flags)
{
return rumpuser_realloc(ptr, size);
}
void
-kern_free(void *ptr, struct malloc_type *type)
+kern_free(void *ptr)
{
rumpuser_free(ptr);
diff -r b736142a62e0 -r 8987225a6fdd sys/sys/malloc.h
--- a/sys/sys/malloc.h Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/sys/malloc.h Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: malloc.h,v 1.111 2012/04/28 23:03:40 rmind Exp $ */
+/* $NetBSD: malloc.h,v 1.112 2012/04/29 16:36:54 dsl Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -63,13 +63,13 @@
MALLOC_DECLARE(M_MRTABLE);
MALLOC_DECLARE(M_BWMETER);
-void *kern_malloc(unsigned long, struct malloc_type *, int);
-void *kern_realloc(void *, unsigned long, struct malloc_type *, int);
-void kern_free(void *, struct malloc_type *);
+void *kern_malloc(unsigned long, int);
+void *kern_realloc(void *, unsigned long, int);
+void kern_free(void *);
-#define malloc(size, type, flags) kern_malloc(size, type, flags)
-#define free(addr, type) kern_free(addr, type)
-#define realloc(ptr, size, type, flags) kern_realloc(ptr, size, type, flags)
+#define malloc(size, type, flags) kern_malloc(size, flags)
+#define free(addr, type) kern_free(addr)
+#define realloc(ptr, size, type, flags) kern_realloc(ptr, size, flags)
#endif /* _KERNEL */
diff -r b736142a62e0 -r 8987225a6fdd sys/sys/mbuf.h
--- a/sys/sys/mbuf.h Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/sys/mbuf.h Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbuf.h,v 1.148 2011/11/21 04:36:05 christos Exp $ */
+/* $NetBSD: mbuf.h,v 1.149 2012/04/29 16:36:54 dsl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -241,7 +241,6 @@
(struct mbuf *, void *, size_t, void *);
void *ext_arg; /* argument for ext_free */
size_t ext_size; /* size of buffer, for ext_free */
- struct malloc_type *ext_type; /* malloc type */
union {
paddr_t extun_paddr; /* physical address (M_EXT_CLUSTER) */
/* pages (M_EXT_PAGES) */
@@ -519,7 +518,6 @@
(m)->m_ext.ext_size = (size); \
(m)->m_ext.ext_free = NULL; \
(m)->m_ext.ext_arg = NULL; \
- (m)->m_ext.ext_type = mbtypes[(m)->m_type]; \
mowner_ref((m), M_EXT); \
} \
} while (/* CONSTCOND */ 0)
@@ -533,7 +531,6 @@
(m)->m_ext.ext_size = (size); \
(m)->m_ext.ext_free = (free); \
(m)->m_ext.ext_arg = (arg); \
- (m)->m_ext.ext_type = (type); \
mowner_ref((m), M_EXT); \
} while (/* CONSTCOND */ 0)
@@ -930,21 +927,3 @@
#endif /* _KERNEL */
#endif /* !_SYS_MBUF_H_ */
-
-#ifdef _KERNEL
-#ifdef MBTYPES
-struct malloc_type *mbtypes[] = { /* XXX */
- M_FREE, /* MT_FREE 0 should be on free list */
- M_MBUF, /* MT_DATA 1 dynamic (data) allocation */
- M_MBUF, /* MT_HEADER 2 packet header */
- M_SONAME, /* MT_SONAME 3 socket name */
- M_SOOPTS, /* MT_SOOPTS 4 socket options */
- M_FTABLE, /* MT_FTABLE 5 fragment reassembly header */
- M_MBUF, /* MT_CONTROL 6 extra-data protocol message */
- M_MBUF, /* MT_OOBDATA 7 expedited data */
-};
-#undef MBTYPES
-#else
-extern struct malloc_type *mbtypes[];
-#endif /* MBTYPES */
-#endif /* _KERNEL */
diff -r b736142a62e0 -r 8987225a6fdd sys/sys/param.h
--- a/sys/sys/param.h Sun Apr 29 16:23:56 2012 +0000
+++ b/sys/sys/param.h Sun Apr 29 16:36:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.413 2012/04/20 20:23:21 bouyer Exp $ */
+/* $NetBSD: param.h,v 1.414 2012/04/29 16:36:54 dsl Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 699000500 /* NetBSD 6.99.5 */
+#define __NetBSD_Version__ 699000600 /* NetBSD 6.99.6 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
Home |
Main Index |
Thread Index |
Old Index