when loaded via LKM, need to malloc_type_{attach|detach} used malloc

types on load/unload appropriately
XXX this should really be automated somehow
This commit is contained in:
jdolecek 2003-04-02 16:26:53 +00:00
parent 5d591b6e06
commit a9bdad15e9
3 changed files with 20 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_node.c,v 1.14 2003/02/27 09:14:26 jdolecek Exp $ */
/* $NetBSD: smbfs_node.c,v 1.15 2003/04/02 16:26:53 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.14 2003/02/27 09:14:26 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.15 2003/04/02 16:26:53 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -65,7 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.14 2003/02/27 09:14:26 jdolecek Exp
#define smbfs_hash_lock(smp) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL)
#define smbfs_hash_unlock(smp) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL)
static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name");
MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name");
extern int (**smbfs_vnodeop_p) __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_subr.h,v 1.7 2003/03/03 21:17:05 jdolecek Exp $ */
/* $NetBSD: smbfs_subr.h,v 1.8 2003/04/02 16:26:53 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -36,9 +36,8 @@
#ifndef _FS_SMBFS_SMBFS_SUBR_H_
#define _FS_SMBFS_SMBFS_SUBR_H_
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_SMBNODENAME);
MALLOC_DECLARE(M_SMBFSDATA);
#endif
#define SMBFSERR(format, args...) printf("%s: "format, __func__ ,## args)

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vfsops.c,v 1.22 2003/02/26 20:21:40 jdolecek Exp $ */
/* $NetBSD: smbfs_vfsops.c,v 1.23 2003/04/02 16:26:53 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.22 2003/02/26 20:21:40 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.23 2003/04/02 16:26:53 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -341,6 +341,12 @@ smbfs_init(void)
pool_init(&smbfs_node_pool, sizeof(struct smbnode), 0, 0, 0,
"smbfsnopl", &pool_allocator_nointr);
#ifdef _LKM
/* Need explicit attach if LKM */
malloc_type_attach(M_SMBNODENAME);
malloc_type_attach(M_SMBFSDATA);
#endif
SMBVDEBUG("init.\n");
}
@ -356,6 +362,13 @@ smbfs_done(void)
{
pool_destroy(&smbfs_node_pool);
#ifdef _LKM
/* Need explicit detach if LKM */
malloc_type_detach(M_SMBNODENAME);
malloc_type_detach(M_SMBFSDATA);
#endif
SMBVDEBUG("done.\n");
}