From f9496794ff5670818d14b58cb9ffda8f702eaed7 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 9 Feb 2019 03:33:59 +0000 Subject: - Change the allocation macros to be more like function calls - Change sizeof(type) -> sizeof(*variable) - Use macros for the long buffer length allocations - Remove "bit polishing" memsets() -- do them only once - Remove unnecessary casts Thanks to oster@ for finding bugs and testing. --- sys/dev/raidframe/rf_diskqueue.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sys/dev/raidframe/rf_diskqueue.c') diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c index 33e42772f91..f4e39cb8054 100644 --- a/sys/dev/raidframe/rf_diskqueue.c +++ b/sys/dev/raidframe/rf_diskqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.53 2011/05/05 06:04:09 mrg Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.54 2019/02/09 03:34:00 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ ****************************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.53 2011/05/05 06:04:09 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.54 2019/02/09 03:34:00 christos Exp $"); #include @@ -225,10 +225,9 @@ rf_ConfigureDiskQueues(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, } raidPtr->qType = p; - RF_MallocAndAdd(diskQueues, - (raidPtr->numCol + RF_MAXSPARE) * - sizeof(RF_DiskQueue_t), (RF_DiskQueue_t *), - raidPtr->cleanupList); + diskQueues = RF_MallocAndAdd( + (raidPtr->numCol + RF_MAXSPARE) * sizeof(*diskQueues), + raidPtr->cleanupList); if (diskQueues == NULL) return (ENOMEM); raidPtr->Queues = diskQueues; @@ -372,7 +371,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect, if (p == NULL) return (NULL); - memset(p, 0, sizeof(RF_DiskQueueData_t)); + memset(p, 0, sizeof(*p)); if (waitflag == PR_WAITOK) { p->bp = getiobuf(NULL, true); } else { -- cgit