Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/kernfs switch KERNFS_ALLOCENTRY() to use kmem_zal...
details: https://anonhg.NetBSD.org/src/rev/38b7cb2c7540
branches: trunk
changeset: 1008963:38b7cb2c7540
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Apr 07 08:14:42 2020 +0000
description:
switch KERNFS_ALLOCENTRY() to use kmem_zalloc() instead of malloc()
diffstat:
sys/arch/xen/xen/hypervisor.c | 9 ++++-----
sys/arch/xen/xen/pciback.c | 8 ++++----
sys/arch/xen/xen/privcmd.c | 7 +++----
sys/arch/xen/xenbus/xenbus_dev.c | 8 ++++----
sys/miscfs/kernfs/kernfs.h | 8 ++++----
5 files changed, 19 insertions(+), 21 deletions(-)
diffs (166 lines):
diff -r d89af25238f1 -r 38b7cb2c7540 sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c Tue Apr 07 08:07:58 2020 +0000
+++ b/sys/arch/xen/xen/hypervisor.c Tue Apr 07 08:14:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -53,12 +53,11 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/sysctl.h>
#include "xenbus.h"
@@ -416,7 +415,7 @@
bi.common.len = sizeof(struct btinfo_rootdevice);
/* From i386/multiboot.c */
- /* $NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $ */
+ /* $NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $ */
int i, len;
vaddr_t data;
extern struct bootinfo bootinfo;
@@ -671,7 +670,7 @@
{
kernfs_entry_t *dkt;
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_DIR, "xen", NULL, KFSsubdir, VDIR, DIR_MODE);
kernfs_addentry(NULL, dkt);
kernxen_pkt = KERNFS_ENTOPARENTDIR(dkt);
diff -r d89af25238f1 -r 38b7cb2c7540 sys/arch/xen/xen/pciback.c
--- a/sys/arch/xen/xen/pciback.c Tue Apr 07 08:07:58 2020 +0000
+++ b/sys/arch/xen/xen/pciback.c Tue Apr 07 08:14:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciback.c,v 1.19 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: pciback.c,v 1.20 2020/04/07 08:14:42 jdolecek Exp $ */
/*
* Copyright (c) 2009 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.19 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.20 2020/04/07 08:14:42 jdolecek Exp $");
#include "opt_xen.h"
@@ -290,7 +290,7 @@
snprintf(sc->sc_kernfsname, sizeof(sc->sc_kernfsname),
"0000:%02x:%02x.%x", pa->pa_bus, pa->pa_device, pa->pa_function);
kfst = KERNFS_ALLOCTYPE(pciback_dev_fileops);
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_REG, sc->sc_kernfsname, sc,
kfst, VREG, FILE_MODE);
kernfs_addentry(pciback_kern_pkt, dkt);
@@ -405,7 +405,7 @@
xenbus_backend_register(&pci_backend_driver);
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_DIR, "pci", NULL, KFSsubdir, VDIR, DIR_MODE);
kernfs_addentry(kernxen_pkt, dkt);
pciback_kern_pkt = KERNFS_ENTOPARENTDIR(dkt);
diff -r d89af25238f1 -r 38b7cb2c7540 sys/arch/xen/xen/privcmd.c
--- a/sys/arch/xen/xen/privcmd.c Tue Apr 07 08:07:58 2020 +0000
+++ b/sys/arch/xen/xen/privcmd.c Tue Apr 07 08:14:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.53 2020/02/23 15:46:39 ad Exp $ */
+/* $NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $ */
/*-
* Copyright (c) 2004 Christian Limpach.
@@ -27,12 +27,11 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.53 2020/02/23 15:46:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/vnode.h>
-#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/stat.h>
#include <sys/proc.h>
@@ -572,7 +571,7 @@
kfst = KERNFS_ALLOCTYPE(privcmd_fileops);
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_REG, "privcmd", NULL, kfst, VREG,
PRIVCMD_MODE);
kernfs_addentry(kernxen_pkt, dkt);
diff -r d89af25238f1 -r 38b7cb2c7540 sys/arch/xen/xenbus/xenbus_dev.c
--- a/sys/arch/xen/xenbus/xenbus_dev.c Tue Apr 07 08:07:58 2020 +0000
+++ b/sys/arch/xen/xenbus/xenbus_dev.c Tue Apr 07 08:14:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.14 2017/03/27 18:39:55 bouyer Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.15 2020/04/07 08:14:43 jdolecek Exp $ */
/*
* xenbus_dev.c
*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.14 2017/03/27 18:39:55 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.15 2020/04/07 08:14:43 jdolecek Exp $");
#include "opt_xen.h"
@@ -84,14 +84,14 @@
kfstype kfst;
kfst = KERNFS_ALLOCTYPE(xenbus_fileops);
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_REG, "xenbus", NULL, kfst, VREG,
PRIVCMD_MODE);
kernfs_addentry(kernxen_pkt, dkt);
if (xendomain_is_dom0()) {
kfst = KERNFS_ALLOCTYPE(xsd_port_fileops);
- KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+ KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
KERNFS_INITENTRY(dkt, DT_REG, "xsd_port", NULL,
kfst, VREG, XSD_MODE);
kernfs_addentry(kernxen_pkt, dkt);
diff -r d89af25238f1 -r 38b7cb2c7540 sys/miscfs/kernfs/kernfs.h
--- a/sys/miscfs/kernfs/kernfs.h Tue Apr 07 08:07:58 2020 +0000
+++ b/sys/miscfs/kernfs/kernfs.h Tue Apr 07 08:14:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kernfs.h,v 1.43 2020/02/04 04:19:24 riastradh Exp $ */
+/* $NetBSD: kernfs.h,v 1.44 2020/04/07 08:14:42 jdolecek Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -169,9 +169,9 @@
kfstype kernfs_alloctype(int, const struct kernfs_fileop *);
#define KERNFS_ALLOCTYPE(kf) kernfs_alloctype(sizeof((kf)) / \
sizeof((kf)[0]), (kf))
-#define KERNFS_ALLOCENTRY(dkt, m_type, m_flags) \
- dkt = (struct dyn_kern_target *)malloc( \
- sizeof(struct dyn_kern_target), (m_type), (m_flags))
+#define KERNFS_ALLOCENTRY(dkt, km_flags) \
+ dkt = (kernfs_entry_t *)kmem_zalloc( \
+ sizeof(struct dyn_kern_target), (km_flags))
#define KERNFS_INITENTRY(dkt, type, name, data, tag, vtype, mode) do { \
(dkt)->dkt_kt.kt_type = (type); \
(dkt)->dkt_kt.kt_namlen = strlen((name)); \
Home |
Main Index |
Thread Index |
Old Index