Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata convert from malloc(9) to kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/64fe1383b82b
branches:  trunk
changeset: 836533:64fe1383b82b
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Oct 22 19:38:06 2018 +0000

description:
convert from malloc(9) to kmem(9)

diffstat:

 sys/dev/ata/ata_raid.c         |   7 +++----
 sys/dev/ata/ata_raid_adaptec.c |   9 ++++-----
 sys/dev/ata/ata_raid_intel.c   |  10 +++++-----
 sys/dev/ata/ata_raid_jmicron.c |   9 ++++-----
 sys/dev/ata/ata_raid_nvidia.c  |  11 +++++------
 sys/dev/ata/ata_raid_promise.c |   9 ++++-----
 sys/dev/ata/ata_raid_via.c     |   9 ++++-----
 7 files changed, 29 insertions(+), 35 deletions(-)

diffs (truncated from 311 to 300 lines):

diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid.c
--- a/sys/dev/ata/ata_raid.c    Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid.c    Mon Oct 22 19:38:06 2018 +0000
@@ -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 @@
 #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 @@
        }
 
        /* 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;
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_adaptec.c
--- a/sys/dev/ata/ata_raid_adaptec.c    Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_adaptec.c    Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
        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 @@
        error = 0;
 
  out:
-       free(info, M_DEVBUF);
+       kmem_free(info, sizeof(*info));
        return (error);
 }
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_intel.c
--- a/sys/dev/ata/ata_raid_intel.c      Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_intel.c      Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
 {
        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 @@
        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 @@
        }
 
  out:
-       free(info, M_DEVBUF);
+       kmem_free(info, infosz);
        return error;
 }
 
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_jmicron.c
--- a/sys/dev/ata/ata_raid_jmicron.c    Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_jmicron.c    Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
        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 @@
        error = 0;
 
  out:
-       free(info, M_DEVBUF);
+       kmem_free(info, sizeof(*info));
        return error;
 }
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_nvidia.c
--- a/sys/dev/ata/ata_raid_nvidia.c     Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_nvidia.c     Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
          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 @@
                /* 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 @@
        error = 0;
 
  out:
-       free(info, M_DEVBUF);
+       kmem_free(info, sizeof(*info));
        return (error);
 }
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_promise.c
--- a/sys/dev/ata/ata_raid_promise.c    Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_promise.c    Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
        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 @@
        error = 0;
 
  out:
-       free(info, M_DEVBUF);
+       kmem_free(info, sizeof(*info));
        return (error);
 }
diff -r 9a92be136609 -r 64fe1383b82b sys/dev/ata/ata_raid_via.c
--- a/sys/dev/ata/ata_raid_via.c        Mon Oct 22 19:36:28 2018 +0000
+++ b/sys/dev/ata/ata_raid_via.c        Mon Oct 22 19:38:06 2018 +0000
@@ -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@localhost>
@@ -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 @@
 #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 @@
        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);



Home | Main Index | Thread Index | Old Index