Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove everything to do with 'struct malloc_type' and th...



details:   https://anonhg.NetBSD.org/src/rev/d1ad4873d54a
branches:  trunk
changeset: 779065:d1ad4873d54a
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Apr 29 20:27:31 2012 +0000

description:
Remove everything to do with 'struct malloc_type' and the malloc link_set.
To make code in 'external' (etc) still compile, MALLOC_DECLARE() still
  has to generate something of type 'struct malloc_type *', with
  normal optimisation gcc generates a compile-time 0.
MALLOC_DEFINE() and friends have no effect.
Fix one or two places where the code would no longer compile.

diffstat:

 sys/dev/firmload.c                   |   6 ++--
 sys/dev/ieee1394/sbp.c               |   5 ++-
 sys/fs/efs/efs_ihash.c               |   6 +---
 sys/kern/kern_malloc.c               |  22 +-----------------
 sys/netsmb/smb_conn.c                |   5 ++-
 sys/netsmb/smb_dev.c                 |   6 ++--
 sys/netsmb/smb_iod.c                 |   7 +++--
 sys/rump/librump/rumpkern/memalloc.c |  18 +--------------
 sys/sys/malloc.h                     |   7 +++++-
 sys/sys/mallocvar.h                  |  41 ++++++-----------------------------
 10 files changed, 35 insertions(+), 88 deletions(-)

diffs (truncated from 350 to 300 lines):

diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/dev/firmload.c
--- a/sys/dev/firmload.c        Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/dev/firmload.c        Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firmload.c,v 1.16 2010/11/24 16:31:12 dholland Exp $   */
+/*     $NetBSD: firmload.c,v 1.17 2012/04/29 20:27:31 dsl Exp $        */
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.16 2010/11/24 16:31:12 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.17 2012/04/29 20:27:31 dsl Exp $");
 
 /*
  * The firmload API provides an interface for device drivers to access
@@ -50,7 +50,7 @@
 
 #include <dev/firmload.h>
 
-static MALLOC_DEFINE(M_DEVFIRM, "devfirm", "device firmware buffers");
+MALLOC_DEFINE(M_DEVFIRM, "devfirm", "device firmware buffers");
 
 struct firmware_handle {
        struct vnode    *fh_vp;
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/dev/ieee1394/sbp.c
--- a/sys/dev/ieee1394/sbp.c    Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/dev/ieee1394/sbp.c    Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbp.c,v 1.33 2010/08/14 10:39:33 cegger Exp $  */
+/*     $NetBSD: sbp.c,v 1.34 2012/04/29 20:27:31 dsl Exp $     */
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.33 2010/08/14 10:39:33 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.34 2012/04/29 20:27:31 dsl Exp $");
 
 
 #include <sys/param.h>
@@ -344,6 +344,7 @@
 };
 
 MALLOC_DEFINE(M_SBP, "sbp", "SBP-II/IEEE1394");
+MALLOC_DECLARE(M_SBP);
 
 
 static int sbpmatch(device_t, cfdata_t, void *);
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/fs/efs/efs_ihash.c
--- a/sys/fs/efs/efs_ihash.c    Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/fs/efs/efs_ihash.c    Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efs_ihash.c,v 1.8 2012/01/27 19:48:40 para Exp $       */
+/*     $NetBSD: efs_ihash.c,v 1.9 2012/04/29 20:27:31 dsl Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efs_ihash.c,v 1.8 2012/01/27 19:48:40 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efs_ihash.c,v 1.9 2012/04/29 20:27:31 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -70,8 +70,6 @@
 static kmutex_t        efs_ihash_lock;
 static kmutex_t        efs_hashlock;
 
-MALLOC_DECLARE(M_EFSINO);
-
 /*
  * Initialize inode hash table.
  */
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/kern/kern_malloc.c    Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.140 2012/04/29 16:36:53 dsl Exp $    */
+/*     $NetBSD: kern_malloc.c,v 1.141 2012/04/29 20:27:31 dsl Exp $    */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.140 2012/04/29 16:36:53 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.141 2012/04/29 20:27:31 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -205,28 +205,10 @@
        return newaddr;
 }
 
-void
-malloc_type_attach(struct malloc_type *type)
-{
-       KASSERT(type->ks_magic == M_MAGIC);
-}
-
-void
-malloc_type_detach(struct malloc_type *type)
-{
-       KASSERT(type->ks_magic == M_MAGIC);
-}
-
 /*
  * Initialize the kernel memory allocator
  */
 void
 kmeminit(void)
 {
-       __link_set_decl(malloc_types, struct malloc_type);
-       struct malloc_type * const *ksp;
-
-       /* Attach all of the statically-linked malloc types. */
-       __link_set_foreach(ksp, malloc_types)
-               malloc_type_attach(*ksp);
 }
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/netsmb/smb_conn.c
--- a/sys/netsmb/smb_conn.c     Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/netsmb/smb_conn.c     Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smb_conn.c,v 1.28 2012/03/13 18:41:01 elad Exp $       */
+/*     $NetBSD: smb_conn.c,v 1.29 2012/04/29 20:27:31 dsl Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_conn.c,v 1.28 2012/03/13 18:41:01 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_conn.c,v 1.29 2012/04/29 20:27:31 dsl Exp $");
 
 /*
  * Connection engine.
@@ -90,6 +90,7 @@
 static kauth_listener_t smb_listener;
 
 MALLOC_DEFINE(M_SMBCONN, "SMB conn", "SMB connection");
+MALLOC_DECLARE(M_SMBCONN);
 
 static void smb_co_init(struct smb_connobj *cp, int level, const char *objname);
 static void smb_co_done(struct smb_connobj *cp);
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/netsmb/smb_dev.c
--- a/sys/netsmb/smb_dev.c      Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/netsmb/smb_dev.c      Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smb_dev.c,v 1.39 2010/12/17 14:27:34 pooka Exp $       */
+/*     $NetBSD: smb_dev.c,v 1.40 2012/04/29 20:27:31 dsl Exp $ */
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.39 2010/12/17 14:27:34 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.40 2012/04/29 20:27:31 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -73,7 +73,7 @@
 #define NSMB_DEFNUM    4
 
 
-static MALLOC_DEFINE(M_NSMBDEV, "NETSMBDEV", "NET/SMB device");
+MALLOC_DEFINE(M_NSMBDEV, "NETSMBDEV", "NET/SMB device");
 
 
 /*
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/netsmb/smb_iod.c
--- a/sys/netsmb/smb_iod.c      Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/netsmb/smb_iod.c      Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smb_iod.c,v 1.39 2010/12/17 13:05:29 pooka Exp $       */
+/*     $NetBSD: smb_iod.c,v 1.40 2012/04/29 20:27:31 dsl Exp $ */
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.39 2010/12/17 13:05:29 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.40 2012/04/29 20:27:31 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,7 +62,8 @@
 
 #define        smb_iod_wakeup(iod)     wakeup(&(iod)->iod_flags)
 
-static MALLOC_DEFINE(M_SMBIOD, "SMBIOD", "SMB network io daemon");
+MALLOC_DEFINE(M_SMBIOD, "SMBIOD", "SMB network io daemon");
+MALLOC_DECLARE(M_SMBIOD);
 
 static int smb_iod_next;
 
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/rump/librump/rumpkern/memalloc.c
--- a/sys/rump/librump/rumpkern/memalloc.c      Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/rump/librump/rumpkern/memalloc.c      Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memalloc.c,v 1.14 2012/04/29 16:36:53 dsl Exp $        */
+/*     $NetBSD: memalloc.c,v 1.15 2012/04/29 20:27:32 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.14 2012/04/29 16:36:53 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.15 2012/04/29 20:27:32 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -54,20 +54,6 @@
  * malloc
  */
 
-void
-malloc_type_attach(struct malloc_type *type)
-{
-
-       return;
-}
-
-void
-malloc_type_detach(struct malloc_type *type)
-{
-
-       return;
-}
-
 void *
 kern_malloc(unsigned long size, int flags)
 {
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/sys/malloc.h
--- a/sys/sys/malloc.h  Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/sys/malloc.h  Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: malloc.h,v 1.112 2012/04/29 16:36:54 dsl Exp $ */
+/*     $NetBSD: malloc.h,v 1.113 2012/04/29 20:27:32 dsl Exp $ */
 
 /*
  * Copyright (c) 1987, 1993
@@ -45,9 +45,13 @@
 #define        M_CANFAIL       0x0004  /* can fail if requested memory can't ever
                                 * be allocated */
 #include <sys/mallocvar.h>
+#if 0
 /*
  * The following are standard, built-in malloc types that are
  * not specific to any one subsystem.
+ *
+ * They are currently not defined, but are still passed to malloc()
+ * and free(). They may be re-instated as diagnostics at some point.
  */
 MALLOC_DECLARE(M_DEVBUF);
 MALLOC_DECLARE(M_DMAMAP);
@@ -62,6 +66,7 @@
 MALLOC_DECLARE(M_IPMADDR);
 MALLOC_DECLARE(M_MRTABLE);
 MALLOC_DECLARE(M_BWMETER);
+#endif
 
 void   *kern_malloc(unsigned long, int);
 void   *kern_realloc(void *, unsigned long, int);
diff -r 4a55f7c05ff5 -r d1ad4873d54a sys/sys/mallocvar.h
--- a/sys/sys/mallocvar.h       Sun Apr 29 19:19:04 2012 +0000
+++ b/sys/sys/mallocvar.h       Sun Apr 29 20:27:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mallocvar.h,v 1.11 2012/04/28 23:03:40 rmind Exp $     */
+/*     $NetBSD: mallocvar.h,v 1.12 2012/04/29 20:27:32 dsl Exp $       */
 
 /*
  * Copyright (c) 1987, 1993
@@ -36,56 +36,29 @@
 
 #include <sys/types.h>
 
-#define        M_MAGIC         877983977
-
-#define MAXBUCKET      15
 /*
  * This structure describes a type of malloc'd memory and carries
  * allocation statistics for that memory.
  */
-struct malloc_type {
-       struct malloc_type *ks_next;    /* next in list */



Home | Main Index | Thread Index | Old Index