convert from malloc(9) to kmem(9)
This commit is contained in:
parent
0f35cc0276
commit
7b49b34a66
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid.c,v 1.40 2018/06/22 09:06:04 pgoyette Exp $ */
|
||||
/* $NetBSD: ata_raid.c,v 1.41 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -40,7 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.40 2018/06/22 09:06:04 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.41 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.40 2018/06/22 09:06:04 pgoyette Exp $
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/module.h>
|
||||
@ -274,7 +273,7 @@ ata_raid_get_array_info(u_int type, u_int arrayno)
|
||||
}
|
||||
|
||||
/* Need to allocate a new one. */
|
||||
aai = malloc(sizeof(*aai), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
aai = kmem_zalloc(sizeof(*aai), KM_SLEEP);
|
||||
aai->aai_type = type;
|
||||
aai->aai_arrayno = arrayno;
|
||||
aai->aai_curdisk = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_adaptec.c,v 1.10 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_adaptec.c,v 1.11 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.10 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.11 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.10 2017/11/01 19:34:46 mlelst
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -77,7 +76,7 @@ ata_raid_read_config_adaptec(struct wd_softc *sc)
|
||||
struct ataraid_array_info *aai;
|
||||
struct ataraid_disk_info *adi;
|
||||
|
||||
info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK);
|
||||
info = kmem_zalloc(sizeof(*info), KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -189,6 +188,6 @@ ata_raid_read_config_adaptec(struct wd_softc *sc)
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, sizeof(*info));
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_intel.c,v 1.8 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_intel.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000-2008 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.8 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.8 2017/11/01 19:34:46 mlelstv E
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -138,6 +137,7 @@ ata_raid_read_config_intel(struct wd_softc *sc)
|
||||
{
|
||||
struct dk_softc *dksc = &sc->sc_dksc;
|
||||
struct intel_raid_conf *info;
|
||||
const size_t infosz = 1536;
|
||||
struct intel_raid_mapping *map;
|
||||
struct ataraid_array_info *aai;
|
||||
struct ataraid_disk_info *adi;
|
||||
@ -148,7 +148,7 @@ ata_raid_read_config_intel(struct wd_softc *sc)
|
||||
dev_t dev;
|
||||
int volumeid, diskidx;
|
||||
|
||||
info = malloc(1536, M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
info = kmem_zalloc(infosz, KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -298,7 +298,7 @@ findvol:
|
||||
}
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, infosz);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_jmicron.c,v 1.6 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_jmicron.c,v 1.7 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000-2008 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.6 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.7 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.6 2017/11/01 19:34:46 mlelstv
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -130,7 +129,7 @@ ata_raid_read_config_jmicron(struct wd_softc *sc)
|
||||
int bmajor, error, count, disk, total_disks;
|
||||
dev_t dev;
|
||||
|
||||
info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
info = kmem_zalloc(sizeof(*info), KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -265,6 +264,6 @@ ata_raid_read_config_jmicron(struct wd_softc *sc)
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, sizeof(*info));
|
||||
return error;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_nvidia.c,v 1.3 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_nvidia.c,v 1.4 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.3 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.4 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.3 2017/11/01 19:34:46 mlelstv
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -136,7 +135,7 @@ ata_raid_read_config_nvidia(struct wd_softc *sc)
|
||||
struct _arrayno *next;
|
||||
} arrayno = { 0, 0, NULL}, *anptr;
|
||||
|
||||
info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK);
|
||||
info = kmem_zalloc(sizeof(*info), KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -200,7 +199,7 @@ ata_raid_read_config_nvidia(struct wd_softc *sc)
|
||||
/* new array */
|
||||
anptr->magic1 = info->magic_1;
|
||||
anptr->magic2 = info->magic_2;
|
||||
anptr->next = malloc(sizeof(arrayno), M_DEVBUF, M_WAITOK);
|
||||
anptr->next = kmem_zalloc(sizeof(arrayno), KM_SLEEP);
|
||||
}
|
||||
aai = ata_raid_get_array_info(ATA_RAID_TYPE_NVIDIA, count);
|
||||
|
||||
@ -257,6 +256,6 @@ ata_raid_read_config_nvidia(struct wd_softc *sc)
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, sizeof(*info));
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_promise.c,v 1.12 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_promise.c,v 1.13 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_promise.c,v 1.12 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_promise.c,v 1.13 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_promise.c,v 1.12 2017/11/01 19:34:46 mlelst
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -77,7 +76,7 @@ ata_raid_read_config_promise(struct wd_softc *sc)
|
||||
struct ataraid_array_info *aai;
|
||||
struct ataraid_disk_info *adi;
|
||||
|
||||
info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK);
|
||||
info = kmem_zalloc(sizeof(*info), KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -208,6 +207,6 @@ ata_raid_read_config_promise(struct wd_softc *sc)
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, sizeof(*info));
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ata_raid_via.c,v 1.8 2017/11/01 19:34:46 mlelstv Exp $ */
|
||||
/* $NetBSD: ata_raid_via.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.8 2017/11/01 19:34:46 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.8 2017/11/01 19:34:46 mlelstv Exp
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
@ -126,7 +125,7 @@ ata_raid_read_config_via(struct wd_softc *sc)
|
||||
struct ataraid_array_info *aai;
|
||||
struct ataraid_disk_info *adi;
|
||||
|
||||
info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK);
|
||||
info = kmem_zalloc(sizeof(*info), KM_SLEEP);
|
||||
|
||||
bmajor = devsw_name2blk(dksc->sc_xname, NULL, 0);
|
||||
|
||||
@ -258,6 +257,6 @@ ata_raid_read_config_via(struct wd_softc *sc)
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
free(info, M_DEVBUF);
|
||||
kmem_free(info, sizeof(*info));
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user