diff options
| author | christos <christos@NetBSD.org> | 2019-02-09 03:33:59 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2019-02-09 03:33:59 +0000 |
| commit | f9496794ff5670818d14b58cb9ffda8f702eaed7 (patch) | |
| tree | 44b46fe0fb83d0c2f7514745778b296e33474227 /sys/dev/raidframe/rf_raid1.c | |
| parent | 96d63dcbe0bd602859527fcd9c280042831fea01 (diff) | |
- 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.
Diffstat (limited to 'sys/dev/raidframe/rf_raid1.c')
| -rw-r--r-- | sys/dev/raidframe/rf_raid1.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/raidframe/rf_raid1.c b/sys/dev/raidframe/rf_raid1.c index 8b23519884a..17df017d699 100644 --- a/sys/dev/raidframe/rf_raid1.c +++ b/sys/dev/raidframe/rf_raid1.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.35 2013/09/15 12:47:26 martin Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.36 2019/02/09 03:34:00 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ *****************************************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.35 2013/09/15 12:47:26 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.36 2019/02/09 03:34:00 christos Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -66,7 +66,7 @@ rf_ConfigureRAID1(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr, RF_RowCol_t i; /* create a RAID level 1 configuration structure */ - RF_MallocAndAdd(info, sizeof(RF_Raid1ConfigInfo_t), (RF_Raid1ConfigInfo_t *), raidPtr->cleanupList); + info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList); if (info == NULL) return (ENOMEM); layoutPtr->layoutSpecificInfo = (void *) info; @@ -292,7 +292,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_ASSERT(layoutPtr->numDataCol == layoutPtr->numParityCol); stripeWidth = layoutPtr->numDataCol + layoutPtr->numParityCol; bcount = nbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol); - RF_MallocAndAdd(bf, bcount, (char *), allocList); + bf = RF_MallocAndAdd(bcount, allocList); if (bf == NULL) goto done; #if RF_DEBUG_VERIFYPARITY @@ -368,7 +368,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, RF_ASSERT(pda == NULL); #if RF_ACC_TRACE > 0 - memset((char *) &tracerec, 0, sizeof(tracerec)); + memset(&tracerec, 0, sizeof(tracerec)); rd_dag_h->tracerec = &tracerec; #endif #if 0 @@ -409,7 +409,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, * and column 1 of the array are mirror copies, and are considered * "data column 0" for this purpose). */ - RF_MallocAndAdd(bbufs, layoutPtr->numParityCol * sizeof(int), (int *), + bbufs = RF_MallocAndAdd(layoutPtr->numParityCol * sizeof(*bbufs), allocList); nbad = 0; /* @@ -488,7 +488,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr, wrBlock->succedents[i]->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru); } #if RF_ACC_TRACE > 0 - memset((char *) &tracerec, 0, sizeof(tracerec)); + memset(&tracerec, 0, sizeof(tracerec)); wr_dag_h->tracerec = &tracerec; #endif #if 0 |
