Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev malloc(9) -> kmem(9)
details: https://anonhg.NetBSD.org/src/rev/d69a415f0060
branches: trunk
changeset: 370706:d69a415f0060
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Sep 24 23:16:37 2022 +0000
description:
malloc(9) -> kmem(9)
diffstat:
sys/dev/fss.c | 14 +++++++-------
sys/dev/md.c | 10 +++++-----
sys/dev/spkr.c | 10 +++++-----
3 files changed, 17 insertions(+), 17 deletions(-)
diffs (152 lines):
diff -r 80015b23803d -r d69a415f0060 sys/dev/fss.c
--- a/sys/dev/fss.c Sat Sep 24 23:16:02 2022 +0000
+++ b/sys/dev/fss.c Sat Sep 24 23:16:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.112 2022/03/31 19:30:15 pgoyette Exp $ */
+/* $NetBSD: fss.c,v 1.113 2022/09/24 23:18:54 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,14 +36,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.112 2022/03/31 19:30:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.113 2022/09/24 23:18:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/errno.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/buf.h>
#include <sys/ioctl.h>
#include <sys/disklabel.h>
@@ -160,7 +160,7 @@
cv_init(&sc->sc_work_cv, "fssbs");
cv_init(&sc->sc_cache_cv, "cowwait");
bufq_alloc(&sc->sc_bufq, "fcfs", 0);
- sc->sc_dkdev = malloc(sizeof(*sc->sc_dkdev), M_DEVBUF, M_WAITOK);
+ sc->sc_dkdev = kmem_zalloc(sizeof(*sc->sc_dkdev), KM_SLEEP);
sc->sc_dkdev->dk_info = NULL;
disk_init(sc->sc_dkdev, device_xname(self), NULL);
if (!pmf_device_register(self, NULL, NULL))
@@ -192,7 +192,7 @@
bufq_drain(sc->sc_bufq);
bufq_free(sc->sc_bufq);
disk_destroy(sc->sc_dkdev);
- free(sc->sc_dkdev, M_DEVBUF);
+ kmem_free(sc->sc_dkdev, sizeof(*sc->sc_dkdev));
return 0;
}
@@ -210,7 +210,7 @@
sc = device_lookup_private(&fss_cd, minor(dev));
if (sc == NULL) {
- cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
+ cf = kmem_zalloc(sizeof(*cf), KM_SLEEP);
cf->cf_name = fss_cd.cd_name;
cf->cf_atname = fss_cd.cd_name;
cf->cf_unit = minor(dev);
@@ -274,7 +274,7 @@
cf = device_cfdata(sc->sc_dev);
error = config_detach(sc->sc_dev, DETACH_QUIET);
if (! error)
- free(cf, M_DEVBUF);
+ kmem_free(cf, sizeof(*cf));
mutex_exit(&fss_device_lock);
return error;
diff -r 80015b23803d -r d69a415f0060 sys/dev/md.c
--- a/sys/dev/md.c Sat Sep 24 23:16:02 2022 +0000
+++ b/sys/dev/md.c Sat Sep 24 23:16:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.85 2020/05/14 08:34:18 msaitoh Exp $ */
+/* $NetBSD: md.c,v 1.86 2022/09/24 23:20:13 thorpej Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.85 2020/05/14 08:34:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.86 2022/09/24 23:20:13 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_md.h"
@@ -50,7 +50,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/bufq.h>
@@ -273,7 +273,7 @@
mutex_exit(&md_device_lock);
return ENXIO;
}
- cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
+ cf = kmem_zalloc(sizeof(*cf), KM_SLEEP);
cf->cf_name = md_cd.cd_name;
cf->cf_atname = md_cd.cd_name;
cf->cf_unit = unit;
@@ -369,7 +369,7 @@
cf = device_cfdata(sc->sc_dev);
error = config_detach(sc->sc_dev, DETACH_QUIET);
if (! error)
- free(cf, M_DEVBUF);
+ kmem_free(cf, sizeof(*cf));
mutex_exit(&md_device_lock);
return error;
}
diff -r 80015b23803d -r d69a415f0060 sys/dev/spkr.c
--- a/sys/dev/spkr.c Sat Sep 24 23:16:02 2022 +0000
+++ b/sys/dev/spkr.c Sat Sep 24 23:16:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.23 2022/03/31 19:30:15 pgoyette Exp $ */
+/* $NetBSD: spkr.c,v 1.24 2022/09/24 23:16:37 thorpej Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr%snark.thyrsus.com@localhost)
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.23 2022/03/31 19:30:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.24 2022/09/24 23:16:37 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "wsmux.h"
@@ -54,7 +54,7 @@
#include <sys/kernel.h>
#include <sys/errno.h>
#include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/module.h>
#include <sys/uio.h>
#include <sys/proc.h>
@@ -492,7 +492,7 @@
if (sc->sc_inbuf != NULL)
return EBUSY;
- sc->sc_inbuf = malloc(DEV_BSIZE, M_DEVBUF, M_WAITOK);
+ sc->sc_inbuf = kmem_alloc(DEV_BSIZE, KM_SLEEP);
playinit(sc);
return 0;
}
@@ -533,7 +533,7 @@
return EINVAL;
sc->sc_tone(sc->sc_dev, 0, 0);
- free(sc->sc_inbuf, M_DEVBUF);
+ kmem_free(sc->sc_inbuf, DEV_BSIZE);
sc->sc_inbuf = NULL;
return 0;
Home |
Main Index |
Thread Index |
Old Index