summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_alloclist.c6
-rw-r--r--sys/dev/raidframe/rf_chaindecluster.c6
-rw-r--r--sys/dev/raidframe/rf_compat32.c9
-rw-r--r--sys/dev/raidframe/rf_compat50.c20
-rw-r--r--sys/dev/raidframe/rf_compat80.c40
-rw-r--r--sys/dev/raidframe/rf_copyback.c9
-rw-r--r--sys/dev/raidframe/rf_cvscan.c7
-rw-r--r--sys/dev/raidframe/rf_dagdegrd.c58
-rw-r--r--sys/dev/raidframe/rf_dagdegwr.c36
-rw-r--r--sys/dev/raidframe/rf_dagffwr.c11
-rw-r--r--sys/dev/raidframe/rf_dagutils.c27
-rw-r--r--sys/dev/raidframe/rf_debugMem.c100
-rw-r--r--sys/dev/raidframe/rf_debugMem.h77
-rw-r--r--sys/dev/raidframe/rf_decluster.c23
-rw-r--r--sys/dev/raidframe/rf_declusterPQ.c6
-rw-r--r--sys/dev/raidframe/rf_diskqueue.c13
-rw-r--r--sys/dev/raidframe/rf_disks.c16
-rw-r--r--sys/dev/raidframe/rf_driver.c6
-rw-r--r--sys/dev/raidframe/rf_evenodd.c20
-rw-r--r--sys/dev/raidframe/rf_evenodd_dagfuncs.c39
-rw-r--r--sys/dev/raidframe/rf_fifo.c7
-rw-r--r--sys/dev/raidframe/rf_interdecluster.c7
-rw-r--r--sys/dev/raidframe/rf_map.c30
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c19
-rw-r--r--sys/dev/raidframe/rf_paritylog.c8
-rw-r--r--sys/dev/raidframe/rf_paritylogDiskMgr.c25
-rw-r--r--sys/dev/raidframe/rf_paritylogging.c60
-rw-r--r--sys/dev/raidframe/rf_parityloggingdags.c18
-rw-r--r--sys/dev/raidframe/rf_paritymap.c10
-rw-r--r--sys/dev/raidframe/rf_parityscan.c13
-rw-r--r--sys/dev/raidframe/rf_psstatus.c10
-rw-r--r--sys/dev/raidframe/rf_raid0.c9
-rw-r--r--sys/dev/raidframe/rf_raid1.c14
-rw-r--r--sys/dev/raidframe/rf_raid4.c9
-rw-r--r--sys/dev/raidframe/rf_raid5.c6
-rw-r--r--sys/dev/raidframe/rf_raid5_rotatedspare.c6
-rw-r--r--sys/dev/raidframe/rf_reconmap.c11
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c12
-rw-r--r--sys/dev/raidframe/rf_reconutil.c12
-rw-r--r--sys/dev/raidframe/rf_sstf.c10
-rw-r--r--sys/dev/raidframe/rf_stripelocks.c8
-rw-r--r--sys/dev/raidframe/rf_utils.c12
42 files changed, 416 insertions, 429 deletions
diff --git a/sys/dev/raidframe/rf_alloclist.c b/sys/dev/raidframe/rf_alloclist.c
index 9533973e6c1..1eb7d9c15cc 100644
--- a/sys/dev/raidframe/rf_alloclist.c
+++ b/sys/dev/raidframe/rf_alloclist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_alloclist.c,v 1.26 2009/03/15 17:17:23 cegger Exp $ */
+/* $NetBSD: rf_alloclist.c,v 1.27 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -37,7 +37,7 @@
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.26 2009/03/15 17:17:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.27 2019/02/09 03:33:59 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -125,6 +125,6 @@ rf_real_MakeAllocList(void)
RF_AllocListElem_t *p;
p = pool_get(&rf_pools.alloclist, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_AllocListElem_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
diff --git a/sys/dev/raidframe/rf_chaindecluster.c b/sys/dev/raidframe/rf_chaindecluster.c
index 3ec472e597c..8659b04745e 100644
--- a/sys/dev/raidframe/rf_chaindecluster.c
+++ b/sys/dev/raidframe/rf_chaindecluster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_chaindecluster.c,v 1.15 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_chaindecluster.c,v 1.16 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.15 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_chaindecluster.c,v 1.16 2019/02/09 03:33:59 christos Exp $");
#include "rf_archs.h"
@@ -70,7 +70,7 @@ rf_ConfigureChainDecluster(RF_ShutdownList_t **listp,
RF_RowCol_t i;
/* create a Chained Declustering configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_ChaindeclusterConfigInfo_t), (RF_ChaindeclusterConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
diff --git a/sys/dev/raidframe/rf_compat32.c b/sys/dev/raidframe/rf_compat32.c
index a9c7dcac023..0e24020d83e 100644
--- a/sys/dev/raidframe/rf_compat32.c
+++ b/sys/dev/raidframe/rf_compat32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat32.c,v 1.4 2019/02/06 15:39:41 christos Exp $ */
+/* $NetBSD: rf_compat32.c,v 1.5 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 2017 Matthew R. Green
@@ -88,7 +88,7 @@ rf_config_netbsd32(struct raid_softc *rs, void *data)
RF_Config_t32 *k_cfg32;
int rv;
- RF_Malloc(k_cfg32, sizeof(RF_Config_t32), (RF_Config_t32 *));
+ k_cfg32 = RF_Malloc(sizeof(*k_cfg32));
if (k_cfg32 == NULL)
return ENOMEM;
@@ -98,7 +98,7 @@ rf_config_netbsd32(struct raid_softc *rs, void *data)
return ENOMEM;
}
- RF_Malloc(k_cfg, sizeof(RF_Config_t), (RF_Config_t *));
+ k_cfg = RF_Malloc(sizeof(*k_cfg));
if (k_cfg == NULL) {
RF_Free(k_cfg32, sizeof(RF_Config_t32));
RF_Free(k_cfg, sizeof(RF_Config_t));
@@ -132,8 +132,7 @@ rf_get_info_netbsd32(RF_Raid_t *raidPtr, void *data)
int retcode;
void *ucfgp = NETBSD32PTR64(*(netbsd32_pointer_t *)data);
- RF_DeviceConfig_t *d_cfg;
- RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t), (RF_DeviceConfig_t *));
+ RF_DeviceConfig_t *d_cfg = RF_Malloc(sizeof(*d_cfg));
if (d_cfg == NULL)
return ENOMEM;
diff --git a/sys/dev/raidframe/rf_compat50.c b/sys/dev/raidframe/rf_compat50.c
index c61f2772a06..88bfdf29c34 100644
--- a/sys/dev/raidframe/rf_compat50.c
+++ b/sys/dev/raidframe/rf_compat50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat50.c,v 1.8 2019/02/05 23:28:02 christos Exp $ */
+/* $NetBSD: rf_compat50.c,v 1.9 2019/02/09 03:33:59 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -123,18 +123,18 @@ rf_config50(struct raid_softc *rs, void *data)
/* data points to a pointer to the configuration structure */
u50_cfg = *((RF_Config50_t **) data);
- RF_Malloc(k50_cfg, sizeof(RF_Config50_t), (RF_Config50_t *));
+ k50_cfg = RF_Malloc(sizeof(*k50_cfg));
if (k50_cfg == NULL)
return ENOMEM;
- error = copyin(u50_cfg, k50_cfg, sizeof(RF_Config50_t));
+ error = copyin(u50_cfg, k50_cfg, sizeof(*k50_cfg));
if (error) {
- RF_Free(k50_cfg, sizeof(RF_Config50_t));
+ RF_Free(k50_cfg, sizeof(*k50_cfg));
return error;
}
- RF_Malloc(k_cfg, sizeof(RF_Config_t), (RF_Config_t *));
+ k_cfg = RF_Malloc(sizeof(*k_cfg));
if (k_cfg == NULL) {
- RF_Free(k50_cfg, sizeof(RF_Config50_t));
+ RF_Free(k50_cfg, sizeof(*k50_cfg));
return ENOMEM;
}
@@ -171,7 +171,7 @@ rf_config50(struct raid_softc *rs, void *data)
k_cfg->layoutSpecific = k50_cfg->layoutSpecific;
k_cfg->force = k50_cfg->force;
- RF_Free(k50_cfg, sizeof(RF_Config50_t));
+ RF_Free(k50_cfg, sizeof(*k50_cfg));
return rf_construct(rs, k_cfg);
}
@@ -185,7 +185,7 @@ rf_get_info50(RF_Raid_t *raidPtr, void *data)
if (!raidPtr->valid)
return ENODEV;
- RF_Malloc(d_cfg, sizeof(RF_DeviceConfig50_t), (RF_DeviceConfig50_t *));
+ d_cfg = RF_Malloc(sizeof(*d_cfg));
if (d_cfg == NULL)
return ENOMEM;
@@ -211,10 +211,10 @@ rf_get_info50(RF_Raid_t *raidPtr, void *data)
for (j = d_cfg->cols, i = 0; i < d_cfg->nspares; i++, j++)
rf_disk_to_disk50(&d_cfg->spares[i], &raidPtr->Disks[j]);
- error = copyout(d_cfg, *ucfgp, sizeof(RF_DeviceConfig50_t));
+ error = copyout(d_cfg, *ucfgp, sizeof(**ucfgp));
out:
- RF_Free(d_cfg, sizeof(RF_DeviceConfig50_t));
+ RF_Free(d_cfg, sizeof(*d_cfg));
return error;
}
diff --git a/sys/dev/raidframe/rf_compat80.c b/sys/dev/raidframe/rf_compat80.c
index 44e8337cb2a..627dabf5998 100644
--- a/sys/dev/raidframe/rf_compat80.c
+++ b/sys/dev/raidframe/rf_compat80.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_compat80.c,v 1.11 2019/02/05 23:28:02 christos Exp $ */
+/* $NetBSD: rf_compat80.c,v 1.12 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 2017 Matthew R. Green
@@ -119,7 +119,7 @@ rf_check_recon_status_ext80(RF_Raid_t *raidPtr, void *data)
RF_ProgressInfo_t info, **infoPtr = data;
rf_check_recon_status_ext(raidPtr, &info);
- return copyout(&info, *infoPtr, sizeof info);
+ return copyout(&info, *infoPtr, sizeof(info));
}
static int
@@ -128,7 +128,7 @@ rf_check_parityrewrite_status_ext80(RF_Raid_t *raidPtr, void *data)
RF_ProgressInfo_t info, **infoPtr = data;
rf_check_parityrewrite_status_ext(raidPtr, &info);
- return copyout(&info, *infoPtr, sizeof info);
+ return copyout(&info, *infoPtr, sizeof(info));
}
static int
@@ -137,7 +137,7 @@ rf_check_copyback_status_ext80(RF_Raid_t *raidPtr, void *data)
RF_ProgressInfo_t info, **infoPtr = data;
rf_check_copyback_status_ext(raidPtr, &info);
- return copyout(&info, *infoPtr, sizeof info);
+ return copyout(&info, *infoPtr, sizeof(info));
}
static void
@@ -145,7 +145,7 @@ rf_copy_raiddisk80(RF_RaidDisk_t *disk, RF_RaidDisk_t80 *disk80)
{
/* Be sure the padding areas don't have kernel memory. */
- memset(disk80, 0, sizeof *disk80);
+ memset(disk80, 0, sizeof(*disk80));
memcpy(disk80->devname, disk->devname, sizeof(disk80->devname));
disk80->status = disk->status;
disk80->spareRow = 0;
@@ -164,13 +164,13 @@ rf_get_info80(RF_Raid_t *raidPtr, void *data)
RF_DeviceConfig_t80 *config80, **configPtr80 = data;
int rv;
- RF_Malloc(config, sizeof *config, (RF_DeviceConfig_t *));
+ config = RF_Malloc(sizeof(*config));
if (config == NULL)
- return (ENOMEM);
- RF_Malloc(config80, sizeof *config80, (RF_DeviceConfig_t80 *));
+ return ENOMEM;
+ config80 = RF_Malloc(sizeof(*config80));
if (config80 == NULL) {
- RF_Free(config, sizeof(RF_DeviceConfig_t))
- return (ENOMEM);
+ RF_Free(config, sizeof(*config));
+ return ENOMEM;
}
rv = rf_get_info(raidPtr, config);
if (rv == 0) {
@@ -186,10 +186,10 @@ rf_get_info80(RF_Raid_t *raidPtr, void *data)
rf_copy_raiddisk80(&config->spares[i],
&config80->spares[i]);
}
- rv = copyout(config80, *configPtr80, sizeof *config80);
+ rv = copyout(config80, *configPtr80, sizeof(*config80));
}
- RF_Free(config, sizeof(RF_DeviceConfig_t));
- RF_Free(config80, sizeof(RF_DeviceConfig_t80));
+ RF_Free(config, sizeof(*config));
+ RF_Free(config80, sizeof(*config80));
return rv;
}
@@ -205,7 +205,7 @@ rf_get_component_label80(RF_Raid_t *raidPtr, void *data)
* Perhaps there should be an option to skip the in-core
* copy and hit the disk, as with disklabel(8).
*/
- RF_Malloc(clabel, sizeof(*clabel), (RF_ComponentLabel_t *));
+ clabel = RF_Malloc(sizeof(*clabel));
if (clabel == NULL)
return ENOMEM;
retcode = copyin(*clabel_ptr, clabel, sizeof(*clabel));
@@ -240,18 +240,18 @@ rf_config80(struct raid_softc *rs, void *data)
/* data points to a pointer to the configuration structure */
u80_cfg = *((RF_Config_t80 **) data);
- RF_Malloc(k80_cfg, sizeof(RF_Config_t80), (RF_Config_t80 *));
+ k80_cfg = RF_Malloc(sizeof(*k80_cfg));
if (k80_cfg == NULL)
return ENOMEM;
- error = copyin(u80_cfg, k80_cfg, sizeof(RF_Config_t80));
+ error = copyin(u80_cfg, k80_cfg, sizeof(*k80_cfg));
if (error) {
- RF_Free(k80_cfg, sizeof(RF_Config_t80));
+ RF_Free(k80_cfg, sizeof(*k80_cfg));
return error;
}
- RF_Malloc(k_cfg, sizeof(RF_Config_t), (RF_Config_t *));
+ k_cfg = RF_Malloc(sizeof(*k_cfg));
if (k_cfg == NULL) {
- RF_Free(k80_cfg, sizeof(RF_Config_t80));
+ RF_Free(k80_cfg, sizeof(*k80_cfg));
return ENOMEM;
}
@@ -288,7 +288,7 @@ rf_config80(struct raid_softc *rs, void *data)
k_cfg->layoutSpecific = k80_cfg->layoutSpecific;
k_cfg->force = k80_cfg->force;
- RF_Free(k80_cfg, sizeof(RF_Config_t80));
+ RF_Free(k80_cfg, sizeof(*k80_cfg));
return rf_construct(rs, k_cfg);
}
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c
index 8c5d5175041..bd000cf0940 100644
--- a/sys/dev/raidframe/rf_copyback.c
+++ b/sys/dev/raidframe/rf_copyback.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_copyback.c,v 1.50 2014/06/14 07:39:00 hannken Exp $ */
+/* $NetBSD: rf_copyback.c,v 1.51 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -38,7 +38,7 @@
****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.50 2014/06/14 07:39:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.51 2019/02/09 03:33:59 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -185,10 +185,11 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
return;
}
/* get a buffer to hold one SU */
- RF_Malloc(databuf, rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit), (char *));
+ databuf = RF_Malloc(rf_RaidAddressToByte(raidPtr,
+ raidPtr->Layout.sectorsPerStripeUnit));
/* create a descriptor */
- RF_Malloc(desc, sizeof(*desc), (RF_CopybackDesc_t *));
+ desc = RF_Malloc(sizeof(*desc));
desc->raidPtr = raidPtr;
desc->status = 0;
desc->fcol = fcol;
diff --git a/sys/dev/raidframe/rf_cvscan.c b/sys/dev/raidframe/rf_cvscan.c
index 412bf413872..c50e1228ef6 100644
--- a/sys/dev/raidframe/rf_cvscan.c
+++ b/sys/dev/raidframe/rf_cvscan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_cvscan.c,v 1.16 2011/08/31 18:31:02 plunky Exp $ */
+/* $NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -35,7 +35,7 @@
******************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.16 2011/08/31 18:31:02 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $");
#include <dev/raidframe/raidframevar.h>
#include "rf_alloclist.h"
@@ -326,8 +326,7 @@ rf_CvscanCreate(RF_SectorCount_t sectPerDisk,
long range = 2; /* Currently no mechanism to change these */
long penalty = sectPerDisk / 5;
- RF_MallocAndAdd(hdr, sizeof(RF_CvscanHeader_t), (RF_CvscanHeader_t *), clList);
- memset((char *) hdr, 0, sizeof(RF_CvscanHeader_t));
+ hdr = RF_MallocAndAdd(sizeof(*hdr), clList);
hdr->range_for_avg = RF_MAX(range, 1);
hdr->change_penalty = RF_MAX(penalty, 0);
hdr->direction = rf_cvscan_RIGHT;
diff --git a/sys/dev/raidframe/rf_dagdegrd.c b/sys/dev/raidframe/rf_dagdegrd.c
index 3b658279c0d..15dd32328f9 100644
--- a/sys/dev/raidframe/rf_dagdegrd.c
+++ b/sys/dev/raidframe/rf_dagdegrd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagdegrd.c,v 1.29 2013/09/15 12:13:56 martin Exp $ */
+/* $NetBSD: rf_dagdegrd.c,v 1.30 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_dagdegrd.c,v 1.29 2013/09/15 12:13:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagdegrd.c,v 1.30 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -605,7 +605,7 @@ rf_CreateRaidCDegradedReadDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
useMirror = RF_TRUE;
/* total number of nodes = 1 + (block + commit + terminator) */
- RF_MallocAndAdd(nodes, 4 * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList);
+ nodes = RF_MallocAndAdd(4 * sizeof(*nodes), allocList);
i = 0;
rdNode = &nodes[i];
i++;
@@ -724,17 +724,19 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
fone_start = rf_StripeUnitOffset(layoutPtr, fone->startSector);
fone_end = fone_start + fone->numSector;
+#define BUF_ALLOC(num) \
+ RF_MallocAndAdd(rf_RaidAddressToByte(raidPtr, num), allocList)
#define CONS_PDA(if,start,num) \
pda_p->col = asmap->if->col; \
pda_p->startSector = ((asmap->if->startSector / secPerSU) * secPerSU) + start; \
pda_p->numSector = num; \
pda_p->next = NULL; \
- RF_MallocAndAdd(pda_p->bufPtr,rf_RaidAddressToByte(raidPtr,num),(char *), allocList)
+ pda_p->bufPtr = BUF_ALLOC(num)
if (asmap->numDataFailed == 1) {
PDAPerDisk = 1;
state = 1;
- RF_MallocAndAdd(*pqpdap, 2 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(2 * sizeof(**pqpdap), allocList);
pda_p = *pqpdap;
/* build p */
CONS_PDA(parityInfo, fone_start, fone->numSector);
@@ -749,7 +751,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
if (fone->numSector + ftwo->numSector > secPerSU) {
PDAPerDisk = 1;
state = 2;
- RF_MallocAndAdd(*pqpdap, 2 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(2 * sizeof(**pqpdap), allocList);
pda_p = *pqpdap;
CONS_PDA(parityInfo, 0, secPerSU);
pda_p->type = RF_PDA_TYPE_PARITY;
@@ -760,7 +762,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
PDAPerDisk = 2;
state = 3;
/* four of them, fone, then ftwo */
- RF_MallocAndAdd(*pqpdap, 4 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(4 * sizeof(**pqpdap), allocList);
pda_p = *pqpdap;
CONS_PDA(parityInfo, fone_start, fone->numSector);
pda_p->type = RF_PDA_TYPE_PARITY;
@@ -819,8 +821,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
/* allocate up our list of pda's */
- RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t),
- (RF_PhysDiskAddr_t *), allocList);
+ pda_p = RF_MallocAndAdd(napdas * sizeof(*pdap), allocList);
*pdap = pda_p;
/* linkem together */
@@ -844,17 +845,17 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
case 2: /* full stripe */
pda_p->numSector = secPerSU;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, secPerSU), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(secPerSU);
break;
case 3: /* two slabs */
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
pda_p->type = RF_PDA_TYPE_DATA;
pda_p->raidAddress = sosAddr + (i * secPerSU);
@@ -862,7 +863,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = ftwo->numSector;
pda_p->raidAddress += ftwo_start;
pda_p->startSector += ftwo_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
default:
RF_PANIC();
@@ -885,7 +886,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = suoff - fone_start;
pda_p->raidAddress = sosAddr + (i * secPerSU) + fone_start;
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
}
if (suend < fone_end) {
@@ -895,7 +896,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = fone_end - suend;
pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
}
break;
@@ -906,14 +907,15 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = secPerSU - suend;
pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
} else
if (suoff > 0) { /* short at front */
pda_p->numSector = suoff;
pda_p->raidAddress = sosAddr + (i * secPerSU);
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr =
+ BUF_ALLOC(pda_p->numSector);
pda_p++;
}
break;
@@ -927,7 +929,8 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = suoff - fone_start;
pda_p->raidAddress = sosAddr + (i * secPerSU) + fone_start;
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr =
+ BUF_ALLOC(pda_p->numSector);
pda_p++;
}
if (suend < fone_end) {
@@ -937,7 +940,8 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = fone_end - suend;
pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr =
+ BUF_ALLOC(pda_p->numSector);
pda_p++;
}
}
@@ -950,7 +954,8 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = suoff - ftwo_start;
pda_p->raidAddress = sosAddr + (i * secPerSU) + ftwo_start;
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr =
+ BUF_ALLOC(pda_p->numSector);
pda_p++;
}
if (suend < ftwo_end) {
@@ -960,7 +965,8 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = ftwo_end - suend;
pda_p->raidAddress = sosAddr + (i * secPerSU) + suend; /* off by one? */
(raidPtr->Layout.map->MapSector) (raidPtr, pda_p->raidAddress, &(pda_p->col), &(pda_p->startSector), 0);
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr =
+ BUF_ALLOC(pda_p->numSector);
pda_p++;
}
}
@@ -985,17 +991,17 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
case 2: /* full stripe */
pda_p->numSector = secPerSU;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, secPerSU), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(secPerSU);
break;
case 3: /* two slabs */
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
pda_p->type = RF_PDA_TYPE_DATA;
pda_p->raidAddress = sosAddr + (i * secPerSU);
@@ -1003,7 +1009,7 @@ rf_DD_GenerateFailedAccessASMs(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
pda_p->numSector = ftwo->numSector;
pda_p->raidAddress += ftwo_start;
pda_p->startSector += ftwo_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
default:
RF_PANIC();
@@ -1058,7 +1064,7 @@ rf_DoubleDegRead(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
nReadNodes = nRrdNodes + nRudNodes + 2 * nPQNodes;
nNodes = 4 /* block, unblock, recovery, term */ + nReadNodes;
- RF_MallocAndAdd(nodes, nNodes * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList);
+ nodes = RF_MallocAndAdd(nNodes * sizeof(*nodes), allocList);
i = 0;
blockNode = &nodes[i];
i += 1;
diff --git a/sys/dev/raidframe/rf_dagdegwr.c b/sys/dev/raidframe/rf_dagdegwr.c
index e68ff899204..c7467cbb12d 100644
--- a/sys/dev/raidframe/rf_dagdegwr.c
+++ b/sys/dev/raidframe/rf_dagdegwr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagdegwr.c,v 1.33 2014/03/23 03:42:39 christos Exp $ */
+/* $NetBSD: rf_dagdegwr.c,v 1.34 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.33 2014/03/23 03:42:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.34 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -116,6 +116,8 @@ rf_CreateDegradedWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
*
* DAG creation code begins here
*/
+#define BUF_ALLOC(num) \
+ RF_MallocAndAdd(rf_RaidAddressToByte(raidPtr, num), allocList)
@@ -380,8 +382,8 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr,
/* fill in the Wnq Node */
if (nfaults == 2) {
{
- RF_MallocAndAdd(parityPDA, sizeof(RF_PhysDiskAddr_t),
- (RF_PhysDiskAddr_t *), allocList);
+ parityPA = RF_MallocAndAdd(sizeof(*parityPA),
+ allocList);
parityPDA->col = asmap->qInfo->col;
parityPDA->startSector = ((asmap->qInfo->startSector / sectorsPerSU)
* sectorsPerSU) + (failedPDA->startSector % sectorsPerSU);
@@ -390,8 +392,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr,
rf_InitNode(wnqNode, rf_wait, RF_FALSE, rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
rf_GenericWakeupFunc, 1, 1, 4, 0, dag_h, "Wnq", allocList);
wnqNode->params[0].p = parityPDA;
- RF_MallocAndAdd(xorNode->results[1],
- rf_RaidAddressToByte(raidPtr, failedPDA->numSector), (char *), allocList);
+ xorNode->results[1] = BUF_ALLOC(failedPDA->numSector);
wnqNode->params[1].p = xorNode->results[1];
wnqNode->params[2].v = parityStripeID;
wnqNode->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
@@ -564,7 +565,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF_Raid_t *raidPtr,
pda_p->startSector = ((asmap->if->startSector / secPerSU) * secPerSU) + start; \
pda_p->numSector = num; \
pda_p->next = NULL; \
- RF_MallocAndAdd(pda_p->bufPtr,rf_RaidAddressToByte(raidPtr,num),(char *), allocList)
+ pda_p->bufPtr = BUF_ALLOC(num)
#if (RF_INCLUDE_PQ > 0) || (RF_INCLUDE_EVENODD > 0)
void
rf_WriteGenerateFailedAccessASMs(
@@ -596,7 +597,7 @@ rf_WriteGenerateFailedAccessASMs(
if (asmap->numDataFailed == 1) {
PDAPerDisk = 1;
state = 1;
- RF_MallocAndAdd(*pqpdap, 2 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(2 * sizeof(**pqpdap), allocList);
pda_p = *pqpdap;
/* build p */
CONS_PDA(parityInfo, fone_start, fone->numSector);
@@ -610,7 +611,8 @@ rf_WriteGenerateFailedAccessASMs(
if (fone->numSector + ftwo->numSector > secPerSU) {
PDAPerDisk = 1;
state = 2;
- RF_MallocAndAdd(*pqpdap, 2 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(2 * sizeof(**pqpdap),
+ allocList);
pda_p = *pqpdap;
CONS_PDA(parityInfo, 0, secPerSU);
pda_p->type = RF_PDA_TYPE_PARITY;
@@ -621,7 +623,8 @@ rf_WriteGenerateFailedAccessASMs(
PDAPerDisk = 2;
state = 3;
/* four of them, fone, then ftwo */
- RF_MallocAndAdd(*pqpdap, 4 * sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t *), allocList);
+ *pqpdap = RF_MallocAndAdd(4 * sizeof(*pqpdap),
+ allocList);
pda_p = *pqpdap;
CONS_PDA(parityInfo, fone_start, fone->numSector);
pda_p->type = RF_PDA_TYPE_PARITY;
@@ -646,8 +649,7 @@ rf_WriteGenerateFailedAccessASMs(
/* allocate up our list of pda's */
- RF_MallocAndAdd(pda_p, napdas * sizeof(RF_PhysDiskAddr_t),
- (RF_PhysDiskAddr_t *), allocList);
+ pda_p = RF_MallocAndAdd(napdas * sizeof(*pda_p), allocList);
*pdap = pda_p;
/* linkem together */
@@ -669,17 +671,17 @@ rf_WriteGenerateFailedAccessASMs(
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
case 2: /* full stripe */
pda_p->numSector = secPerSU;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, secPerSU), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(secPerSU);
break;
case 3: /* two slabs */
pda_p->numSector = fone->numSector;
pda_p->raidAddress += fone_start;
pda_p->startSector += fone_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
pda_p++;
pda_p->type = RF_PDA_TYPE_DATA;
pda_p->raidAddress = sosAddr + (i * secPerSU);
@@ -687,7 +689,7 @@ rf_WriteGenerateFailedAccessASMs(
pda_p->numSector = ftwo->numSector;
pda_p->raidAddress += ftwo_start;
pda_p->startSector += ftwo_start;
- RF_MallocAndAdd(pda_p->bufPtr, rf_RaidAddressToByte(raidPtr, pda_p->numSector), (char *), allocList);
+ pda_p->bufPtr = BUF_ALLOC(pda_p->numSector);
break;
default:
RF_PANIC();
@@ -750,7 +752,7 @@ rf_DoubleDegSmallWrite(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
nWriteNodes = nWudNodes + 2 * nPQNodes;
nNodes = 4 + nReadNodes + nWriteNodes;
- RF_MallocAndAdd(nodes, nNodes * sizeof(RF_DagNode_t), (RF_DagNode_t *), allocList);
+ nodes = RF_MallocAndAdd(nNodes * sizeof(*nodes), allocList);
blockNode = nodes;
unblockNode = blockNode + 1;
termNode = unblockNode + 1;
diff --git a/sys/dev/raidframe/rf_dagffwr.c b/sys/dev/raidframe/rf_dagffwr.c
index 10a4bc54480..0cbed30fb03 100644
--- a/sys/dev/raidframe/rf_dagffwr.c
+++ b/sys/dev/raidframe/rf_dagffwr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagffwr.c,v 1.34 2013/09/15 12:41:17 martin Exp $ */
+/* $NetBSD: rf_dagffwr.c,v 1.35 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.34 2013/09/15 12:41:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.35 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -125,6 +125,8 @@ rf_CreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
*
* DAG creation code begins here
*/
+#define BUF_ALLOC(num) \
+ RF_MallocAndAdd(rf_RaidAddressToByte(raidPtr, num), allocList)
/******************************************************************************
@@ -382,9 +384,8 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
* to get smashed during the P and Q calculation, guaranteeing
* one would be wrong.
*/
- RF_MallocAndAdd(xorNode->results[1],
- rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit),
- (void *), allocList);
+ xorNode->results[1] =
+ BUF_ALLOC(raidPtr->Layout.sectorsPerStripeUnit);
rf_InitNode(wnqNode, rf_wait, RF_FALSE, rf_DiskWriteFunc,
rf_DiskWriteUndoFunc, rf_GenericWakeupFunc,
1, 1, 4, 0, dag_h, "Wnq", allocList);
diff --git a/sys/dev/raidframe/rf_dagutils.c b/sys/dev/raidframe/rf_dagutils.c
index fa90e09b2cd..4d037a4cdcc 100644
--- a/sys/dev/raidframe/rf_dagutils.c
+++ b/sys/dev/raidframe/rf_dagutils.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagutils.c,v 1.54 2016/01/07 21:57:00 joerg Exp $ */
+/* $NetBSD: rf_dagutils.c,v 1.55 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_dagutils.c,v 1.54 2016/01/07 21:57:00 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.55 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -142,8 +142,7 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit,
node->big_dag_ptrs = rf_AllocDAGPCache();
ptrs = (void **) node->big_dag_ptrs;
} else {
- RF_MallocAndAdd(ptrs, nptrs * sizeof(void *),
- (void **), alist);
+ ptrs = RF_MallocAndAdd(nptrs * sizeof(*ptrs), alist);
}
node->succedents = (nSucc) ? (RF_DagNode_t **) ptrs : NULL;
node->antecedents = (nAnte) ? (RF_DagNode_t **) (ptrs + nSucc) : NULL;
@@ -157,9 +156,8 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit,
node->big_dag_params = rf_AllocDAGPCache();
node->params = node->big_dag_params;
} else {
- RF_MallocAndAdd(node->params,
- nParam * sizeof(RF_DagParam_t),
- (RF_DagParam_t *), alist);
+ node->params = RF_MallocAndAdd(
+ nParam * sizeof(*node->params), alist);
}
} else {
node->params = NULL;
@@ -259,7 +257,7 @@ rf_AllocDAGHeader(void)
RF_DagHeader_t *dh;
dh = pool_get(&rf_pools.dagh, PR_WAITOK);
- memset((char *) dh, 0, sizeof(RF_DagHeader_t));
+ memset(dh, 0, sizeof(*dh));
return (dh);
}
@@ -275,7 +273,7 @@ rf_AllocDAGNode(void)
RF_DagNode_t *node;
node = pool_get(&rf_pools.dagnode, PR_WAITOK);
- memset(node, 0, sizeof(RF_DagNode_t));
+ memset(node, 0, sizeof(*node));
return (node);
}
@@ -297,7 +295,7 @@ rf_AllocDAGList(void)
RF_DagList_t *dagList;
dagList = pool_get(&rf_pools.daglist, PR_WAITOK);
- memset(dagList, 0, sizeof(RF_DagList_t));
+ memset(dagList, 0, sizeof(*dagList));
return (dagList);
}
@@ -330,7 +328,7 @@ rf_AllocFuncList(void)
RF_FuncList_t *funcList;
funcList = pool_get(&rf_pools.funclist, PR_WAITOK);
- memset(funcList, 0, sizeof(RF_FuncList_t));
+ memset(funcList, 0, sizeof(*funcList));
return (funcList);
}
@@ -853,10 +851,9 @@ rf_ValidateDAG(RF_DagHeader_t *dag_h)
unvisited = dag_h->succedents[0]->visited;
- RF_Malloc(scount, nodecount * sizeof(int), (int *));
- RF_Malloc(acount, nodecount * sizeof(int), (int *));
- RF_Malloc(nodes, nodecount * sizeof(RF_DagNode_t *),
- (RF_DagNode_t **));
+ scount = RF_Malloc(nodecount * sizeof(*scount));
+ acount = RF_Malloc(nodecount * sizeof(*acount));
+ nodes = RF_Malloc(nodecount * sizeof(*nodes));
for (i = 0; i < dag_h->numSuccedents; i++) {
if ((dag_h->succedents[i]->visited == unvisited)
&& rf_ValidateBranch(dag_h->succedents[i], scount,
diff --git a/sys/dev/raidframe/rf_debugMem.c b/sys/dev/raidframe/rf_debugMem.c
index d3c943ef146..6b58de0963b 100644
--- a/sys/dev/raidframe/rf_debugMem.c
+++ b/sys/dev/raidframe/rf_debugMem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_debugMem.c,v 1.21 2011/05/01 06:49:43 mrg Exp $ */
+/* $NetBSD: rf_debugMem.c,v 1.22 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.21 2011/05/01 06:49:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.22 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -44,16 +44,16 @@ __KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.21 2011/05/01 06:49:43 mrg Exp $")
#if RF_DEBUG_MEM
-static long tot_mem_in_use = 0;
+static size_t tot_mem_in_use = 0;
/* Hash table of information about memory allocations */
#define RF_MH_TABLESIZE 1000
struct mh_struct {
void *address;
- int size;
- int line;
- const char *filen;
+ size_t size;
+ const char *file;
+ uint32_t line;
char allocated;
struct mh_struct *next;
};
@@ -61,56 +61,63 @@ static struct mh_struct *mh_table[RF_MH_TABLESIZE];
static rf_declare_mutex2(rf_debug_mem_mutex);
static int mh_table_initialized = 0;
-static void memory_hash_insert(void *addr, int size, int line, const char *filen);
-static int memory_hash_remove(void *addr, int sz);
+static void memory_hash_insert(void *, size_t, const char *, uint32_t);
+static int memory_hash_remove(void *, size_t);
void
-rf_record_malloc(void *p, int size, int line, const char *filen)
+rf_record_malloc(void *p, size_t size, const char *file, uint32_t line)
{
RF_ASSERT(size != 0);
/* rf_lock_mutex2(rf_debug_mem_mutex); */
- memory_hash_insert(p, size, line, filen);
+ memory_hash_insert(p, size, file, line);
tot_mem_in_use += size;
/* rf_unlock_mutex2(rf_debug_mem_mutex); */
- if ((long) p == rf_memDebugAddress) {
- printf("Allocate: debug address allocated from line %d file %s\n", line, filen);
+ if ((intptr_t)p == rf_memDebugAddress) {
+ printf("%s,%d: %s: Debug address allocated\n", file, line,
+ __func__);
}
}
void
-rf_unrecord_malloc(void *p, int sz)
+rf_unrecord_malloc(void *p, size_t sz)
{
- int size;
+ size_t size;
/* rf_lock_mutex2(rf_debug_mem_mutex); */
size = memory_hash_remove(p, sz);
tot_mem_in_use -= size;
/* rf_unlock_mutex2(rf_debug_mem_mutex); */
- if ((long) p == rf_memDebugAddress) {
- printf("Free: Found debug address\n"); /* this is really only a
- * flag line for gdb */
+ if ((intptr_t) p == rf_memDebugAddress) {
+ /* this is really only a flag line for gdb */
+ printf("%s: Found debug address\n", __func__);
}
}
void
rf_print_unfreed(void)
{
- int i, foundone = 0;
+ size_t i;
+ int foundone = 0;
struct mh_struct *p;
for (i = 0; i < RF_MH_TABLESIZE; i++) {
- for (p = mh_table[i]; p; p = p->next)
- if (p->allocated) {
- if (!foundone)
- printf("\n\nThere are unfreed memory locations at program shutdown:\n");
- foundone = 1;
- printf("Addr 0x%lx Size %d line %d file %s\n",
- (long) p->address, p->size, p->line, p->filen);
+ for (p = mh_table[i]; p; p = p->next) {
+ if (!p->allocated)
+ continue;
+ if (foundone) {
+ printf("\n\n:%s: There are unfreed memory"
+ " locations at program shutdown:\n",
+ __func__);
}
+ foundone = 1;
+ printf("%s: @%s,%d: addr %p size %zu\n", __func__,
+ p->file, p->line, p->address, p->size);
+ }
}
if (tot_mem_in_use) {
- printf("%ld total bytes in use\n", tot_mem_in_use);
+ printf("%s: %zu total bytes in use\n",
+ __func__, tot_mem_in_use);
}
}
#endif /* RF_DEBUG_MEM */
@@ -127,7 +134,7 @@ int
rf_ConfigureDebugMem(RF_ShutdownList_t **listp)
{
#if RF_DEBUG_MEM
- int i;
+ size_t i;
rf_init_mutex2(rf_debug_mem_mutex, IPL_VM);
if (rf_memDebug) {
@@ -142,20 +149,21 @@ rf_ConfigureDebugMem(RF_ShutdownList_t **listp)
#if RF_DEBUG_MEM
-#define HASHADDR(_a_) ( (((unsigned long) _a_)>>3) % RF_MH_TABLESIZE )
+#define HASHADDR(a) ((size_t)((((uintptr_t)a) >> 3) % RF_MH_TABLESIZE))
static void
-memory_hash_insert(void *addr, int size, int line, const char *filen)
+memory_hash_insert(void *addr, size_t size, const char *file, uint32_t line)
{
- unsigned long bucket = HASHADDR(addr);
+ size_t bucket = (size_t)HASHADDR(addr);
struct mh_struct *p;
RF_ASSERT(mh_table_initialized);
/* search for this address in the hash table */
- for (p = mh_table[bucket]; p && (p->address != addr); p = p->next);
+ for (p = mh_table[bucket]; p && (p->address != addr); p = p->next)
+ continue;
if (!p) {
- RF_Malloc(p, sizeof(struct mh_struct), (struct mh_struct *));
+ p = RF_Malloc(sizeof(*p));
RF_ASSERT(p);
p->next = mh_table[bucket];
mh_table[bucket] = p;
@@ -163,40 +171,48 @@ memory_hash_insert(void *addr, int size, int line, const char *filen)
p->allocated = 0;
}
if (p->allocated) {
- printf("ERROR: reallocated address 0x%lx from line %d, file %s without intervening free\n", (long) addr, line, filen);
- printf(" last allocated from line %d file %s\n", p->line, p->filen);
+ printf("%s: @%s,%u: ERROR: Reallocated addr %p without free\n",
+ __func__, file, line, addr);
+ printf("%s: last allocated @%s,%u\n",
+ __func__, p->file, p->line);
RF_ASSERT(0);
}
p->size = size;
p->line = line;
- p->filen = filen;
+ p->file = file;
p->allocated = 1;
}
static int
-memory_hash_remove(void *addr, int sz)
+memory_hash_remove(void *addr, size_t sz)
{
- unsigned long bucket = HASHADDR(addr);
+ size_t bucket = HASHADDR(addr);
struct mh_struct *p;
RF_ASSERT(mh_table_initialized);
- for (p = mh_table[bucket]; p && (p->address != addr); p = p->next);
+ for (p = mh_table[bucket]; p && (p->address != addr); p = p->next)
+ continue;
if (!p) {
- printf("ERROR: freeing never-allocated address 0x%lx\n", (long) addr);
+ printf("%s: ERROR: Freeing never-allocated address %p\n",
+ __func__, addr);
RF_PANIC();
}
if (!p->allocated) {
- printf("ERROR: freeing unallocated address 0x%lx. Last allocation line %d file %s\n", (long) addr, p->line, p->filen);
+ printf("%s: ERROR: Freeing unallocated address %p."
+ " Last allocation @%s,%u\n",
+ __func__, addr, p->file, p->line);
RF_PANIC();
}
if (sz > 0 && p->size != sz) { /* you can suppress this error by
* using a negative value as the size
* to free */
- printf("ERROR: incorrect size at free for address 0x%lx: is %d should be %d. Alloc at line %d of file %s\n", (unsigned long) addr, sz, p->size, p->line, p->filen);
+ printf("%s: ERROR: Incorrect size (%zu should be %zu) at"
+ " free for address %p. Allocated @%s,%u\n", __func__,
+ sz, p->size, addr, p->file, p->line);
RF_PANIC();
}
p->allocated = 0;
- return (p->size);
+ return p->size;
}
#endif /* RF_DEBUG_MEM */
diff --git a/sys/dev/raidframe/rf_debugMem.h b/sys/dev/raidframe/rf_debugMem.h
index 0ab17cae6c6..62875c223d8 100644
--- a/sys/dev/raidframe/rf_debugMem.h
+++ b/sys/dev/raidframe/rf_debugMem.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_debugMem.h,v 1.13 2011/05/01 06:49:43 mrg Exp $ */
+/* $NetBSD: rf_debugMem.h,v 1.14 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -42,47 +42,54 @@
#include <sys/types.h>
#include <sys/malloc.h>
-#ifndef RF_DEBUG_MEM
-#define RF_DEBUG_MEM 0
-#endif
+int rf_ConfigureDebugMem(RF_ShutdownList_t **);
-#if RF_DEBUG_MEM
-#define RF_Malloc(_p_, _size_, _cast_) \
- { \
- _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK); \
- memset((char *)_p_, 0, _size_); \
- if (rf_memDebug) rf_record_malloc(_p_, _size_, __LINE__, __FILE__); \
- }
+#ifndef RF_DEBUG_MEM
+# define RF_DEBUG_MEM 0
+# define RF_Malloc(s) malloc(s, M_RAIDFRAME, M_WAITOK | M_ZERO)
+# define RF_Free(p, s) free(p, M_RAIDFRAME)
+# define RF_MallocAndAdd(s, l) _RF_MallocAndAdd(s, l)
#else
-#define RF_Malloc(_p_, _size_, _cast_) \
- { \
- _p_ = _cast_ malloc((u_long)_size_, M_RAIDFRAME, M_WAITOK); \
- memset((char *)_p_, 0, _size_); \
- }
-#endif
+extern long rf_memDebug;
+
+void rf_record_malloc(void *, size_t, const char *, uint32_t);
+void rf_unrecord_malloc(void *, size_t);
+void rf_print_unfreed(void);
-#define RF_MallocAndAdd(__p_, __size_, __cast_, __alist_) \
- { \
- RF_Malloc(__p_, __size_, __cast_); \
- if (__alist_) rf_AddToAllocList(__alist_, __p_, __size_); \
+# define RF_Malloc(s) _RF_Malloc(s, __FILE__, __LINE__)
+# define RF_MallocAndAdd(s, l) \
+ _RF_MallocAndAdd(s, l, __FILE__, __LINE__)
+
+static __inline void *
+_RF_Malloc(size_t size, const char *file, uint32_t line)
+{
+ void *p = malloc(size, M_RAIDFRAME, M_WAITOK | M_ZERO);
+ if (rf_memDebug) rf_record_malloc(p, size, file, line);
+ return p;
+}
+
+static __inline void
+RF_Free(void *p, size_t size)
+{
+ free(p, M_RAIDFRAME);
+ if (rf_memDebug) rf_unrecord_malloc(p, size);
}
+#endif
+static __inline void *
+_RF_MallocAndAdd(size_t size, RF_AllocListElem_t *l
#if RF_DEBUG_MEM
-#define RF_Free(_p_, _sz_) \
- { \
- free((void *)(_p_), M_RAIDFRAME); \
- if (rf_memDebug) rf_unrecord_malloc(_p_, (u_int32_t) (_sz_)); \
- }
-#else
-#define RF_Free(_p_, _sz_) \
- { \
- free((void *)(_p_), M_RAIDFRAME); \
- }
+ , const char *file, uint32_t line
+#endif
+)
+{
+ void *p = malloc(size, M_RAIDFRAME, M_WAITOK | M_ZERO);
+#if RF_DEBUG_MEM
+ if (rf_memDebug) rf_record_malloc(p, size, file, line);
#endif
+ if (l) rf_AddToAllocList(l, p, size);
+ return p;
+}
-void rf_record_malloc(void *p, int size, int line, const char *filen);
-void rf_unrecord_malloc(void *p, int sz);
-void rf_print_unfreed(void);
-int rf_ConfigureDebugMem(RF_ShutdownList_t ** listp);
#endif /* !_RF__RF_DEBUGMEM_H_ */
diff --git a/sys/dev/raidframe/rf_decluster.c b/sys/dev/raidframe/rf_decluster.c
index ce1740e353d..98beed07797 100644
--- a/sys/dev/raidframe/rf_decluster.c
+++ b/sys/dev/raidframe/rf_decluster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_decluster.c,v 1.25 2018/01/18 00:32:49 mrg Exp $ */
+/* $NetBSD: rf_decluster.c,v 1.26 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -48,7 +48,7 @@
*--------------------------------------------------------------------*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.25 2018/01/18 00:32:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.26 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -89,7 +89,7 @@ rf_ConfigureDeclustered(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
numCompleteSpareRegionsPerDisk = 0;
/* 1. create layout specific structure */
- RF_MallocAndAdd(info, sizeof(RF_DeclusteredConfigInfo_t), (RF_DeclusteredConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
@@ -614,7 +614,7 @@ rf_InstallSpareTable(RF_Raid_t *raidPtr, RF_RowCol_t fcol)
RF_SparetWait_t *req;
int retcode;
- RF_Malloc(req, sizeof(*req), (RF_SparetWait_t *));
+ req = RF_Malloc(sizeof(*req));
req->C = raidPtr->numCol;
req->G = raidPtr->Layout.numDataCol + raidPtr->Layout.numParityCol;
req->fcol = fcol;
@@ -643,20 +643,23 @@ rf_SetSpareTable(RF_Raid_t *raidPtr, void *data)
/* what we need to copyin is a 2-d array, so first copyin the user
* pointers to the rows in the table */
- RF_Malloc(ptrs, info->TablesPerSpareRegion * sizeof(RF_SpareTableEntry_t *), (RF_SpareTableEntry_t **));
- retcode = copyin((void *) data, (void *) ptrs, info->TablesPerSpareRegion * sizeof(RF_SpareTableEntry_t *));
+ size_t ptrslen = info->TablesPerSpareRegion * sizeof(*ptrs);
+ ptrs = RF_Malloc(ptrslen);
+ retcode = copyin(data, ptrs, ptrslen);
if (retcode)
return (retcode);
/* now allocate kernel space for the row pointers */
- RF_Malloc(info->SpareTable, info->TablesPerSpareRegion * sizeof(RF_SpareTableEntry_t *), (RF_SpareTableEntry_t **));
+ info->SpareTable = RF_Malloc(info->TablesPerSpareRegion *
+ sizeof(*info->SpareTable));
/* now allocate kernel space for each row in the table, and copy it in
* from user space */
+ size_t len = info->BlocksPerTable * sizeof(**info->SpareTable);
for (i = 0; i < info->TablesPerSpareRegion; i++) {
- RF_Malloc(info->SpareTable[i], info->BlocksPerTable * sizeof(RF_SpareTableEntry_t), (RF_SpareTableEntry_t *));
- retcode = copyin(ptrs[i], info->SpareTable[i], info->BlocksPerTable * sizeof(RF_SpareTableEntry_t));
+ info->SpareTable[i] = RF_Malloc(len);
+ retcode = copyin(ptrs[i], info->SpareTable[i], len);
if (retcode) {
info->SpareTable = NULL; /* blow off the memory
* we've allocated */
@@ -665,7 +668,7 @@ rf_SetSpareTable(RF_Raid_t *raidPtr, void *data)
}
/* free up the temporary array we used */
- RF_Free(ptrs, info->TablesPerSpareRegion * sizeof(RF_SpareTableEntry_t *));
+ RF_Free(ptrs, ptrslen);
return (0);
}
diff --git a/sys/dev/raidframe/rf_declusterPQ.c b/sys/dev/raidframe/rf_declusterPQ.c
index 316b805932b..b55033dbcf1 100644
--- a/sys/dev/raidframe/rf_declusterPQ.c
+++ b/sys/dev/raidframe/rf_declusterPQ.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_declusterPQ.c,v 1.16 2014/03/23 09:30:59 christos Exp $ */
+/* $NetBSD: rf_declusterPQ.c,v 1.17 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -35,7 +35,7 @@
*--------------------------------------------------*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.16 2014/03/23 09:30:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.17 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -87,7 +87,7 @@ rf_ConfigureDeclusteredPQ(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
return (EINVAL);
}
/* 1. create layout specific structure */
- RF_MallocAndAdd(info, sizeof(RF_DeclusteredConfigInfo_t), (RF_DeclusteredConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
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 <sys/cdefs.h>
-__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 <dev/raidframe/raidframevar.h>
@@ -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 {
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index cbd4ba3ab71..25ce9b805ac 100644
--- a/sys/dev/raidframe/rf_disks.c
+++ b/sys/dev/raidframe/rf_disks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_disks.c,v 1.90 2019/02/08 13:37:46 christos Exp $ */
+/* $NetBSD: rf_disks.c,v 1.91 2019/02/09 03:34:00 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -60,7 +60,7 @@
***************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.90 2019/02/08 13:37:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.91 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -321,19 +321,17 @@ rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr)
/* We allocate RF_MAXSPARE on the first row so that we
have room to do hot-swapping of spares */
- RF_MallocAndAdd(raidPtr->Disks, (raidPtr->numCol + RF_MAXSPARE) *
- sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *),
- raidPtr->cleanupList);
+ raidPtr->Disks = RF_MallocAndAdd((raidPtr->numCol + RF_MAXSPARE) *
+ sizeof(*raidPtr->Disks), raidPtr->cleanupList);
if (raidPtr->Disks == NULL) {
ret = ENOMEM;
goto fail;
}
/* get space for device specific stuff.. */
- RF_MallocAndAdd(raidPtr->raid_cinfo,
- (raidPtr->numCol + RF_MAXSPARE) *
- sizeof(struct raidcinfo), (struct raidcinfo *),
- raidPtr->cleanupList);
+ raidPtr->raid_cinfo = RF_MallocAndAdd(
+ (raidPtr->numCol + RF_MAXSPARE) * sizeof(*raidPtr->raid_cinfo),
+ raidPtr->cleanupList);
if (raidPtr->raid_cinfo == NULL) {
ret = ENOMEM;
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c
index e6958687d2b..9230930b02a 100644
--- a/sys/dev/raidframe/rf_driver.c
+++ b/sys/dev/raidframe/rf_driver.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_driver.c,v 1.134 2019/01/08 07:18:18 mrg Exp $ */
+/* $NetBSD: rf_driver.c,v 1.135 2019/02/09 03:34:00 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -66,7 +66,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.134 2019/01/08 07:18:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.135 2019/02/09 03:34:00 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_diagnostic.h"
@@ -587,7 +587,7 @@ rf_AllocRaidAccDesc(RF_Raid_t *raidPtr, RF_IoType_t type,
desc->status = 0;
desc->numRetries = 0;
#if RF_ACC_TRACE > 0
- memset((char *) &desc->tracerec, 0, sizeof(RF_AccTraceEntry_t));
+ memset(&desc->tracerec, 0, sizeof(desc->tracerec));
#endif
desc->callbackFunc = NULL;
desc->callbackArg = NULL;
diff --git a/sys/dev/raidframe/rf_evenodd.c b/sys/dev/raidframe/rf_evenodd.c
index 3780ecd4048..2c5a796fed5 100644
--- a/sys/dev/raidframe/rf_evenodd.c
+++ b/sys/dev/raidframe/rf_evenodd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_evenodd.c,v 1.21 2014/03/23 09:30:59 christos Exp $ */
+/* $NetBSD: rf_evenodd.c,v 1.22 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_evenodd.c,v 1.21 2014/03/23 09:30:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_evenodd.c,v 1.22 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -74,7 +74,7 @@ rf_ConfigureEvenOdd(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
RF_EvenOddConfigInfo_t *info;
RF_RowCol_t i, j, startdisk;
- RF_MallocAndAdd(info, sizeof(RF_EvenOddConfigInfo_t), (RF_EvenOddConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
layoutPtr->layoutSpecificInfo = (void *) info;
info->stripeIdentifier = rf_make_2d_array(raidPtr->numCol, raidPtr->numCol, raidPtr->cleanupList);
@@ -358,10 +358,12 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
mcpair = rf_AllocMCPair();
rf_MakeAllocList(alloclist);
- RF_MallocAndAdd(buf, numbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol), (char *), alloclist);
- RF_MallocAndAdd(pbuf, numbytes, (char *), alloclist);
+ buf = RF_MallocAndAdd(
+ numbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol),
+ alloclist);
+ pbuf = RF_MallocAndAdd(numbytes, alloclist);
end_p = buf + bytesPerStripe;
- RF_MallocAndAdd(redundantbuf2, numbytes, (char *), alloclist);
+ redundantbuf2 = RF_MallocAndAdd(numbytes, alloclist);
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, numbytes, buf, rf_DiskReadFunc, rf_DiskReadUndoFunc,
"Rod", alloclist, flags, RF_IO_NORMAL_PRIORITY);
@@ -401,7 +403,7 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
blockNode->succedents[layoutPtr->numDataCol + 1]->params[0].p = asmap->qInfo;
/* fire off the DAG */
- memset((char *) &tracerec, 0, sizeof(tracerec));
+ memset(&tracerec, 0, sizeof(tracerec));
rd_dag_h->tracerec = &tracerec;
#if RF_DEBUG_VALIDATE_DAG
@@ -463,7 +465,7 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
wrBlock->succedents[0]->params[0].p = asmap->parityInfo;
wrBlock->succedents[0]->params[2].v = psID;
wrBlock->succedents[0]->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
- memset((char *) &tracerec, 0, sizeof(tracerec));
+ memset(&tracerec, 0, sizeof(tracerec));
wr_dag_h->tracerec = &tracerec;
#if RF_DEBUG_VALIDATE_DAG
if (rf_verifyParityDebug) {
@@ -493,7 +495,7 @@ rf_VerifyParityEvenOdd(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
wrBlock->succedents[0]->params[0].p = asmap->qInfo;
wrBlock->succedents[0]->params[2].v = psID;
wrBlock->succedents[0]->params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
- memset((char *) &tracerec, 0, sizeof(tracerec));
+ memset(&tracerec, 0, sizeof(tracerec));
wr_dag_h->tracerec = &tracerec;
#if RF_DEBUG_VALIDATE_DAG
if (rf_verifyParityDebug) {
diff --git a/sys/dev/raidframe/rf_evenodd_dagfuncs.c b/sys/dev/raidframe/rf_evenodd_dagfuncs.c
index 1a041061a4d..cc3af4189d1 100644
--- a/sys/dev/raidframe/rf_evenodd_dagfuncs.c
+++ b/sys/dev/raidframe/rf_evenodd_dagfuncs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.22 2014/03/23 09:30:59 christos Exp $ */
+/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.23 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.22 2014/03/23 09:30:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.23 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -411,7 +411,7 @@ rf_RecoveryEFunc(RF_DagNode_t *node)
RF_AccTraceEntry_t *tracerec = node->dagHdr->tracerec;
RF_Etimer_t timer;
- memset((char *) node->results[0], 0,
+ memset(node->results[0], 0,
rf_RaidAddressToByte(raidPtr, failedPDA->numSector));
if (node->dagHdr->status == rf_enable) {
RF_ETIMER_START(timer);
@@ -482,8 +482,6 @@ rf_doubleEOdecode(
short *P;
RF_ASSERT(bytesPerEU % sizeof(short) == 0);
- RF_Malloc(P, bytesPerEU, (short *));
- RF_Malloc(temp, bytesPerEU, (short *));
#elif RF_EO_MATRIX_DIM == 17
int longsPerEU = bytesPerEU / sizeof(long);
long *rrdbuf_current, *pbuf_current, *ebuf_current;
@@ -492,13 +490,11 @@ rf_doubleEOdecode(
long *P;
RF_ASSERT(bytesPerEU % sizeof(long) == 0);
- RF_Malloc(P, bytesPerEU, (long *));
- RF_Malloc(temp, bytesPerEU, (long *));
#endif
+ P = RF_Malloc(bytesPerEU);
+ temp = RF_Malloc(bytesPerEU);
RF_ASSERT(*((long *) dest[0]) == 0);
RF_ASSERT(*((long *) dest[1]) == 0);
- memset((char *) P, 0, bytesPerEU);
- memset((char *) temp, 0, bytesPerEU);
RF_ASSERT(*P == 0);
/* calculate the 'P' parameter, which, not parity, is the Xor of all
* elements in the last two column, ie. 'E' and 'parity' colume, see
@@ -680,11 +676,11 @@ rf_EvenOddDoubleRecoveryFunc(RF_DagNode_t *node)
ndataParam = i;
break;
}
- RF_Malloc(buf, numDataCol * sizeof(char *), (char **));
+ buf = RF_Malloc(numDataCol * sizeof(*buf));
if (ndataParam != 0) {
- RF_Malloc(suoff, ndataParam * sizeof(long), (long *));
- RF_Malloc(suend, ndataParam * sizeof(long), (long *));
- RF_Malloc(prmToCol, ndataParam * sizeof(long), (long *));
+ suoff = RF_Malloc(ndataParam * sizeof(*suoff));
+ suend = RF_Malloc(ndataParam * sizeof(*suend));
+ prmToCol = RF_Malloc(ndataParam * sizeof(*prmToCol));
}
if (asmap->failedPDAs[1] &&
(asmap->failedPDAs[1]->numSector + asmap->failedPDAs[0]->numSector < secPerSU)) {
@@ -788,22 +784,19 @@ rf_EvenOddDoubleRecoveryFunc(RF_DagNode_t *node)
if (nresults == 1) {
dest[0] = (char *)((RF_PhysDiskAddr_t *) node->results[0])->bufPtr + rf_RaidAddressToByte(raidPtr, sector - fsuoff[0]);
/* Always malloc temp buffer to dest[1] */
- RF_Malloc(dest[1], bytesPerSector, (char *));
- memset(dest[1], 0, bytesPerSector);
+ dest[1] = RF_Malloc(bytesPerSector);
mallc_two = 1;
} else {
if (fsuoff[0] <= sector && sector < fsuend[0])
dest[0] = (char *)((RF_PhysDiskAddr_t *) node->results[0])->bufPtr + rf_RaidAddressToByte(raidPtr, sector - fsuoff[0]);
else {
- RF_Malloc(dest[0], bytesPerSector, (char *));
- memset(dest[0], 0, bytesPerSector);
+ dest[0] = RF_Malloc(bytesPerSector);
mallc_one = 1;
}
if (fsuoff[1] <= sector && sector < fsuend[1])
dest[1] = (char *)((RF_PhysDiskAddr_t *) node->results[1])->bufPtr + rf_RaidAddressToByte(raidPtr, sector - fsuoff[1]);
else {
- RF_Malloc(dest[1], bytesPerSector, (char *));
- memset(dest[1], 0, bytesPerSector);
+ dest[1] = RF_Malloc(bytesPerSector);
mallc_two = 1;
}
RF_ASSERT(mallc_one == 0 || mallc_two == 0);
@@ -874,7 +867,7 @@ rf_EOWriteDoubleRecoveryFunc(RF_DagNode_t *node)
* case, the other failed SU
* is not being accessed */
RF_ETIMER_START(timer);
- RF_Malloc(buf, numDataCol * sizeof(char *), (char **));
+ buf = RF_Malloc(numDataCol * sizeof(*buf));
ppda = node->results[0];/* Instead of being buffers, node->results[0]
* and [1] are Ppda and Epda */
@@ -915,12 +908,10 @@ rf_EOWriteDoubleRecoveryFunc(RF_DagNode_t *node)
fcol[1] = i;
/* assign temporary space to put recovered failed SU */
numbytes = fpda->numSector * bytesPerSector;
- RF_Malloc(olddata[0], numbytes, (char *));
- RF_Malloc(olddata[1], numbytes, (char *));
+ olddata[0] = RF_Malloc(numbytes);
+ olddata[1] = RF_Malloc(numbytes);
dest[0] = olddata[0];
dest[1] = olddata[1];
- memset(olddata[0], 0, numbytes);
- memset(olddata[1], 0, numbytes);
/* Begin the recovery decoding, initially buf[j], ebuf, pbuf, dest[j]
* have already pointed at the beginning of each source buffers and
* destination buffers */
diff --git a/sys/dev/raidframe/rf_fifo.c b/sys/dev/raidframe/rf_fifo.c
index 5968100ca38..0409c0ddd0f 100644
--- a/sys/dev/raidframe/rf_fifo.c
+++ b/sys/dev/raidframe/rf_fifo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_fifo.c,v 1.15 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -36,7 +36,7 @@
***************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.15 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -58,8 +58,7 @@ rf_FifoCreate(RF_SectorCount_t sectPerDisk, RF_AllocListElem_t *clList,
{
RF_FifoHeader_t *q;
- RF_MallocAndAdd(q, sizeof(RF_FifoHeader_t),
- (RF_FifoHeader_t *), clList);
+ q = RF_MallocAndAdd(sizeof(*q), clList);
q->hq_count = q->lq_count = 0;
return ((void *) q);
}
diff --git a/sys/dev/raidframe/rf_interdecluster.c b/sys/dev/raidframe/rf_interdecluster.c
index fc6604a4d25..73e6a140d00 100644
--- a/sys/dev/raidframe/rf_interdecluster.c
+++ b/sys/dev/raidframe/rf_interdecluster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_interdecluster.c,v 1.14 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_interdecluster.c,v 1.15 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_interdecluster.c,v 1.14 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_interdecluster.c,v 1.15 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -73,8 +73,7 @@ rf_ConfigureInterDecluster(
RF_RowCol_t i, tmp, SUs_per_region;
/* create an Interleaved Declustering configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_InterdeclusterConfigInfo_t), (RF_InterdeclusterConfigInfo_t *),
- raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
diff --git a/sys/dev/raidframe/rf_map.c b/sys/dev/raidframe/rf_map.c
index 2927bcc44e8..79932701a84 100644
--- a/sys/dev/raidframe/rf_map.c
+++ b/sys/dev/raidframe/rf_map.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_map.c,v 1.47 2016/10/15 20:31:15 oster Exp $ */
+/* $NetBSD: rf_map.c,v 1.48 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_map.c,v 1.47 2016/10/15 20:31:15 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.48 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -129,7 +129,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress,
RF_ASSERT(asmList);
t_asm = asmList;
asmList = asmList->next;
- memset((char *) t_asm, 0, sizeof(RF_AccessStripeMap_t));
+ memset(t_asm, 0, sizeof(*t_asm));
if (!asm_p)
asm_list = asm_p = t_asm;
else {
@@ -157,7 +157,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress,
RF_ASSERT(pdaList);
t_pda = pdaList;
pdaList = pdaList->next;
- memset((char *) t_pda, 0, sizeof(RF_PhysDiskAddr_t));
+ memset(t_pda, 0, sizeof(*t_pda));
if (!pda_p)
asm_p->physInfo = pda_p = t_pda;
else {
@@ -200,7 +200,7 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress,
RF_ASSERT(pdaList);
t_pda = pdaList;
pdaList = pdaList->next;
- memset((char *) t_pda, 0, sizeof(RF_PhysDiskAddr_t));
+ memset(t_pda, 0, sizeof(*t_pda));
pda_p = asm_p->parityInfo = t_pda;
pda_p->type = RF_PDA_TYPE_PARITY;
(layoutPtr->map->MapParity) (raidPtr, rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe),
@@ -217,12 +217,12 @@ rf_MapAccess(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddress,
RF_ASSERT(pdaList && pdaList->next);
t_pda = pdaList;
pdaList = pdaList->next;
- memset((char *) t_pda, 0, sizeof(RF_PhysDiskAddr_t));
+ memset(t_pda, 0, sizeof(*t_pda));
pda_p = asm_p->parityInfo = t_pda;
pda_p->type = RF_PDA_TYPE_PARITY;
t_pda = pdaList;
pdaList = pdaList->next;
- memset((char *) t_pda, 0, sizeof(RF_PhysDiskAddr_t));
+ memset(t_pda, 0, sizeof(*t_pda));
pda_q = asm_p->qInfo = t_pda;
pda_q->type = RF_PDA_TYPE_Q;
(layoutPtr->map->MapParity) (raidPtr, rf_RaidAddressOfPrevStripeUnitBoundary(layoutPtr, startAddrWithinStripe),
@@ -278,8 +278,8 @@ rf_MarkFailuresInASMList(RF_Raid_t *raidPtr,
asmap->numParityFailed = 0;
asmap->numQFailed = 0;
asmap->numFailedPDAs = 0;
- memset((char *) asmap->failedPDAs, 0,
- RF_MAX_FAILED_PDA * sizeof(RF_PhysDiskAddr_t *));
+ memset(asmap->failedPDAs, 0,
+ RF_MAX_FAILED_PDA * sizeof(*asmap->failedPDAs));
for (pda = asmap->physInfo; pda; pda = pda->next) {
if (RF_DEAD_DISK(disks[pda->col].status)) {
asmap->numDataFailed++;
@@ -379,7 +379,7 @@ rf_AllocAccessStripeMapHeader(void)
RF_AccessStripeMapHeader_t *p;
p = pool_get(&rf_pools.asm_hdr, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_AccessStripeMapHeader_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
@@ -397,7 +397,7 @@ rf_AllocVFPListElem(void)
RF_VoidFunctionPointerListElem_t *p;
p = pool_get(&rf_pools.vfple, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_VoidFunctionPointerListElem_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
@@ -416,7 +416,7 @@ rf_AllocVPListElem(void)
RF_VoidPointerListElem_t *p;
p = pool_get(&rf_pools.vple, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_VoidPointerListElem_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
@@ -434,7 +434,7 @@ rf_AllocASMHeaderListElem(void)
RF_ASMHeaderListElem_t *p;
p = pool_get(&rf_pools.asmhle, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_ASMHeaderListElem_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
@@ -452,7 +452,7 @@ rf_AllocFailedStripeStruct(void)
RF_FailedStripe_t *p;
p = pool_get(&rf_pools.fss, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_FailedStripe_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
@@ -473,7 +473,7 @@ rf_AllocPhysDiskAddr(void)
RF_PhysDiskAddr_t *p;
p = pool_get(&rf_pools.pda, PR_WAITOK);
- memset((char *) p, 0, sizeof(RF_PhysDiskAddr_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 2db2e986b71..18bbb32de2a 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.373 2019/02/07 03:03:00 christos Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.373 2019/02/07 03:03:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_autoconfig.h"
@@ -1107,7 +1107,7 @@ rf_fail_disk(RF_Raid_t *raidPtr, struct rf_recon_req *rr)
/* make a copy of the recon request so that we don't rely on
* the user's buffer */
- RF_Malloc(rrint, sizeof(*rrint), (struct rf_recon_req_internal *));
+ rrint = RF_Malloc(sizeof(*rrint));
if (rrint == NULL)
return(ENOMEM);
rrint->col = rr->col;
@@ -1134,7 +1134,7 @@ rf_copyinspecificbuf(RF_Config_t *k_cfg)
}
u_char *specific_buf;
- RF_Malloc(specific_buf, k_cfg->layoutSpecificSize, (u_char *));
+ specific_buf = RF_Malloc(k_cfg->layoutSpecificSize);
if (specific_buf == NULL)
return ENOMEM;
@@ -1163,7 +1163,7 @@ rf_getConfiguration(struct raid_softc *rs, void *data, RF_Config_t **k_cfg)
/* copy-in the configuration information */
/* data points to a pointer to the configuration structure */
- RF_Malloc(*k_cfg, sizeof(RF_Config_t), (RF_Config_t *));
+ *k_cfg = RF_Malloc(sizeof(**k_cfg));
if (*k_cfg == NULL) {
return ENOMEM;
}
@@ -1358,7 +1358,7 @@ rf_rebuild_in_place(RF_Raid_t *raidPtr, RF_SingleComponent_t *componentPtr)
rf_unlock_mutex2(raidPtr->mutex);
struct rf_recon_req_internal *rrint;
- RF_Malloc(rrint, sizeof(*rrint), (struct rf_recon_req_internal *));
+ rrint = RF_Malloc(sizeof(*rrint));
if (rrint == NULL)
return ENOMEM;
@@ -1516,8 +1516,7 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
case RAIDFRAME_GET_INFO:
ucfgp = *(RF_DeviceConfig_t **)data;
- RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t),
- (RF_DeviceConfig_t *));
+ d_cfg = RF_Malloc(sizeof(*d_cfg));
if (d_cfg == NULL)
return ENOMEM;
retcode = rf_get_info(raidPtr, d_cfg);
@@ -1680,7 +1679,7 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
/* wakes up a process waiting on SPARET_WAIT and puts an error
* code in it that will cause the dameon to exit */
case RAIDFRAME_ABORT_SPARET_WAIT:
- RF_Malloc(waitreq, sizeof(*waitreq), (RF_SparetWait_t *));
+ waitreq = RF_Malloc(sizeof(*waitreq));
waitreq->fcol = -1;
rf_lock_mutex2(rf_sparet_wait_mutex);
waitreq->next = rf_sparet_wait_queue;
@@ -1698,7 +1697,7 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
/* respond to the requestor. the return status of the spare
* table installation is passed in the "fcol" field */
- RF_Malloc(waitreq, sizeof(*waitreq), (RF_SparetWait_t *));
+ waitred = RF_Malloc(sizeof(*waitreq));
waitreq->fcol = retcode;
rf_lock_mutex2(rf_sparet_wait_mutex);
waitreq->next = rf_sparet_resp_queue;
diff --git a/sys/dev/raidframe/rf_paritylog.c b/sys/dev/raidframe/rf_paritylog.c
index 415e0f922cc..5667c86f88d 100644
--- a/sys/dev/raidframe/rf_paritylog.c
+++ b/sys/dev/raidframe/rf_paritylog.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylog.c,v 1.18 2011/05/11 06:03:06 mrg Exp $ */
+/* $NetBSD: rf_paritylog.c,v 1.19 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.18 2011/05/11 06:03:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.19 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -74,7 +74,7 @@ AllocParityLogCommonData(RF_Raid_t * raidPtr)
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
} else {
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
- RF_Malloc(common, sizeof(RF_CommonLogData_t), (RF_CommonLogData_t *));
+ common = RF_Malloc(sizeof(*common));
/* destroy is in rf_paritylogging.c */
rf_init_mutex2(common->mutex, IPL_VM);
}
@@ -114,7 +114,7 @@ AllocParityLogData(RF_Raid_t * raidPtr)
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
} else {
rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
- RF_Malloc(data, sizeof(RF_ParityLogData_t), (RF_ParityLogData_t *));
+ data = RF_Malloc(sizeof(*data));
}
data->next = NULL;
data->prev = NULL;
diff --git a/sys/dev/raidframe/rf_paritylogDiskMgr.c b/sys/dev/raidframe/rf_paritylogDiskMgr.c
index efa13c6e966..25e7cdad253 100644
--- a/sys/dev/raidframe/rf_paritylogDiskMgr.c
+++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 mrg Exp $ */
+/* $NetBSD: rf_paritylogDiskMgr.c,v 1.29 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.29 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -134,8 +134,6 @@ ReadRegionLog(
RF_IO_NORMAL_PRIORITY);
/* create and initialize PDA for the core log */
- /* RF_Malloc(*rrd_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t
- * *)); */
*rrd_pda = rf_AllocPDAList(1);
rf_MapLogParityLogging(raidPtr, regionID, 0,
&((*rrd_pda)->col), &((*rrd_pda)->startSector));
@@ -146,8 +144,7 @@ ReadRegionLog(
printf("set rrd_pda->next to NULL\n");
}
/* initialize DAG parameters */
- RF_Malloc(tracerec,sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *));
- memset((char *) tracerec, 0, sizeof(RF_AccTraceEntry_t));
+ tracerec = RF_Malloc(sizeof(*tracerec));
(*rrd_dag_h)->tracerec = tracerec;
rrd_rdNode = (*rrd_dag_h)->succedents[0]->succedents[0];
rrd_rdNode->params[0].p = *rrd_pda;
@@ -187,9 +184,6 @@ WriteCoreLog(
rf_DiskWriteFunc, rf_DiskWriteUndoFunc,
"Wcl", *fwr_alloclist, RF_DAG_FLAGS_NONE, RF_IO_NORMAL_PRIORITY);
- /* create and initialize PDA for the region log */
- /* RF_Malloc(*fwr_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t
- * *)); */
*fwr_pda = rf_AllocPDAList(1);
regionOffset = log->diskOffset;
rf_MapLogParityLogging(raidPtr, regionID, regionOffset,
@@ -198,8 +192,7 @@ WriteCoreLog(
(*fwr_pda)->numSector = raidPtr->numSectorsPerLog;
/* initialize DAG parameters */
- RF_Malloc(tracerec,sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *));
- memset((char *) tracerec, 0, sizeof(RF_AccTraceEntry_t));
+ tracerec = RF_Malloc(sizeof(*tracerec));
(*fwr_dag_h)->tracerec = tracerec;
fwr_wrNode = (*fwr_dag_h)->succedents[0]->succedents[0];
fwr_wrNode->params[0].p = *fwr_pda;
@@ -239,8 +232,6 @@ ReadRegionParity(
RF_IO_NORMAL_PRIORITY);
/* create and initialize PDA for region parity */
- /* RF_Malloc(*prd_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t
- * *)); */
*prd_pda = rf_AllocPDAList(1);
rf_MapRegionParity(raidPtr, regionID,
&((*prd_pda)->col), &((*prd_pda)->startSector),
@@ -253,8 +244,7 @@ ReadRegionParity(
printf("set prd_pda->next to NULL\n");
}
/* initialize DAG parameters */
- RF_Malloc(tracerec,sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *));
- memset((char *) tracerec, 0, sizeof(RF_AccTraceEntry_t));
+ tracerec = RF_Malloc(sizeof(*tracerec));
(*prd_dag_h)->tracerec = tracerec;
prd_rdNode = (*prd_dag_h)->succedents[0]->succedents[0];
prd_rdNode->params[0].p = *prd_pda;
@@ -297,16 +287,13 @@ WriteRegionParity(
RF_IO_NORMAL_PRIORITY);
/* create and initialize PDA for region parity */
- /* RF_Malloc(*pwr_pda, sizeof(RF_PhysDiskAddr_t), (RF_PhysDiskAddr_t
- * *)); */
*pwr_pda = rf_AllocPDAList(1);
rf_MapRegionParity(raidPtr, regionID,
&((*pwr_pda)->col), &((*pwr_pda)->startSector),
&((*pwr_pda)->numSector));
/* initialize DAG parameters */
- RF_Malloc(tracerec,sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *));
- memset((char *) tracerec, 0, sizeof(RF_AccTraceEntry_t));
+ tracerec = RF_Malloc(sizeof(*tracerec));
(*pwr_dag_h)->tracerec = tracerec;
pwr_wrNode = (*pwr_dag_h)->succedents[0]->succedents[0];
pwr_wrNode->params[0].p = *pwr_pda;
diff --git a/sys/dev/raidframe/rf_paritylogging.c b/sys/dev/raidframe/rf_paritylogging.c
index 6fc6663fa38..5d2e4e47d54 100644
--- a/sys/dev/raidframe/rf_paritylogging.c
+++ b/sys/dev/raidframe/rf_paritylogging.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 mrg Exp $ */
+/* $NetBSD: rf_paritylogging.c,v 1.35 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.35 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -97,9 +97,7 @@ rf_ConfigureParityLogging(
raidPtr->numSectorsPerLog = RF_DEFAULT_NUM_SECTORS_PER_LOG;
/* create a parity logging configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_ParityLoggingConfigInfo_t),
- (RF_ParityLoggingConfigInfo_t *),
- raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
@@ -202,9 +200,8 @@ rf_ConfigureParityLogging(
/* create region information structs */
printf("Allocating %d bytes for in-core parity region info\n",
(int) (rf_numParityRegions * sizeof(RF_RegionInfo_t)));
- RF_Malloc(raidPtr->regionInfo,
- (rf_numParityRegions * sizeof(RF_RegionInfo_t)),
- (RF_RegionInfo_t *));
+ raidPtr->regionInfo = RF_Malloc(
+ rf_numParityRegions * sizeof(*raidPtr->regionInfo));
if (raidPtr->regionInfo == NULL)
return (ENOMEM);
@@ -228,17 +225,17 @@ rf_ConfigureParityLogging(
raidPtr->numParityLogs * raidPtr->numSectorsPerLog *
raidPtr->bytesPerSector,
raidPtr->numParityLogs);
- RF_Malloc(raidPtr->parityLogBufferHeap, raidPtr->numParityLogs *
- raidPtr->numSectorsPerLog * raidPtr->bytesPerSector,
- (void *));
+ raidPtr->parityLogBufferHeap = RF_Malloc(raidPtr->numParityLogs
+ * raidPtr->numSectorsPerLog * raidPtr->bytesPerSector);
if (raidPtr->parityLogBufferHeap == NULL)
return (ENOMEM);
lHeapPtr = raidPtr->parityLogBufferHeap;
rf_init_mutex2(raidPtr->parityLogPool.mutex, IPL_VM);
for (i = 0; i < raidPtr->numParityLogs; i++) {
if (i == 0) {
- RF_Malloc(raidPtr->parityLogPool.parityLogs,
- sizeof(RF_ParityLog_t), (RF_ParityLog_t *));
+ raidPtr->parityLogPool.parityLogs =
+ RF_Malloc(
+ sizeof(*raidPtr->parityLogPool.parityLogs));
if (raidPtr->parityLogPool.parityLogs == NULL) {
RF_Free(raidPtr->parityLogBufferHeap,
raidPtr->numParityLogs *
@@ -248,8 +245,7 @@ rf_ConfigureParityLogging(
}
l = raidPtr->parityLogPool.parityLogs;
} else {
- RF_Malloc(l->next, sizeof(RF_ParityLog_t),
- (RF_ParityLog_t *));
+ l->next = RF_Malloc(sizeof(*l->next));
if (l->next == NULL) {
RF_Free(raidPtr->parityLogBufferHeap,
raidPtr->numParityLogs *
@@ -270,9 +266,8 @@ rf_ConfigureParityLogging(
l->bufPtr = lHeapPtr;
lHeapPtr = (char *)lHeapPtr + raidPtr->numSectorsPerLog *
raidPtr->bytesPerSector;
- RF_Malloc(l->records, (raidPtr->numSectorsPerLog *
- sizeof(RF_ParityLogRecord_t)),
- (RF_ParityLogRecord_t *));
+ l->records = RF_Malloc(raidPtr->numSectorsPerLog *
+ sizeof(*l->records));
if (l->records == NULL) {
RF_Free(raidPtr->parityLogBufferHeap,
raidPtr->numParityLogs *
@@ -310,9 +305,9 @@ rf_ConfigureParityLogging(
printf("Allocating %d bytes for regionBufferPool\n",
(int) (raidPtr->regionBufferPool.totalBuffers *
sizeof(void *)));
- RF_Malloc(raidPtr->regionBufferPool.buffers,
- raidPtr->regionBufferPool.totalBuffers * sizeof(void *),
- (void **));
+ raidPtr->regionBufferPool.buffers = RF_Malloc(
+ raidPtr->regionBufferPool.totalBuffers *
+ sizeof(*raidPtr->regionBufferPool.buffers));
if (raidPtr->regionBufferPool.buffers == NULL) {
return (ENOMEM);
}
@@ -320,9 +315,8 @@ rf_ConfigureParityLogging(
printf("Allocating %d bytes for regionBufferPool#%d\n",
(int) (raidPtr->regionBufferPool.bufferSize *
sizeof(char)), i);
- RF_Malloc(raidPtr->regionBufferPool.buffers[i],
- raidPtr->regionBufferPool.bufferSize * sizeof(char),
- (void *));
+ raidPtr->regionBufferPool.buffers[i] =
+ RF_Malloc(raidPtr->regionBufferPool.bufferSize);
if (raidPtr->regionBufferPool.buffers[i] == NULL) {
for (j = 0; j < i; j++) {
RF_Free(raidPtr->regionBufferPool.buffers[i],
@@ -360,9 +354,9 @@ rf_ConfigureParityLogging(
(int) (raidPtr->parityBufferPool.totalBuffers *
sizeof(void *)),
raidPtr->parityBufferPool.totalBuffers );
- RF_Malloc(raidPtr->parityBufferPool.buffers,
- raidPtr->parityBufferPool.totalBuffers * sizeof(void *),
- (void **));
+ raidPtr->parityBufferPool.buffers = RF_Malloc(
+ raidPtr->parityBufferPool.totalBuffers *
+ sizeof(*raidPtr->parityBufferPool.buffers));
if (raidPtr->parityBufferPool.buffers == NULL) {
return (ENOMEM);
}
@@ -370,9 +364,8 @@ rf_ConfigureParityLogging(
printf("Allocating %d bytes for parityBufferPool#%d\n",
(int) (raidPtr->parityBufferPool.bufferSize *
sizeof(char)),i);
- RF_Malloc(raidPtr->parityBufferPool.buffers[i],
- raidPtr->parityBufferPool.bufferSize * sizeof(char),
- (void *));
+ raidPtr->parityBufferPool.buffers[i] = RF_Malloc(
+ raidPtr->parityBufferPool.bufferSize);
if (raidPtr->parityBufferPool.buffers == NULL) {
for (j = 0; j < i; j++) {
RF_Free(raidPtr->parityBufferPool.buffers[i],
@@ -443,10 +436,9 @@ rf_ConfigureParityLogging(
printf("Allocating %d bytes for region %d\n",
(int) (raidPtr->regionInfo[i].capacity *
sizeof(RF_DiskMap_t)), i);
- RF_Malloc(raidPtr->regionInfo[i].diskMap,
- (raidPtr->regionInfo[i].capacity *
- sizeof(RF_DiskMap_t)),
- (RF_DiskMap_t *));
+ raidPtr->regionInfo[i].diskMap = RF_Malloc(
+ raidPtr->regionInfo[i].capacity *
+ sizeof(*raidPtr->regionInfo[i].diskMap));
if (raidPtr->regionInfo[i].diskMap == NULL) {
for (j = 0; j < i; j++)
FreeRegionInfo(raidPtr, j);
diff --git a/sys/dev/raidframe/rf_parityloggingdags.c b/sys/dev/raidframe/rf_parityloggingdags.c
index 3e2c2dcfde6..f7acdb82770 100644
--- a/sys/dev/raidframe/rf_parityloggingdags.c
+++ b/sys/dev/raidframe/rf_parityloggingdags.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_parityloggingdags.c,v 1.21 2014/03/23 09:30:59 christos Exp $ */
+/* $NetBSD: rf_parityloggingdags.c,v 1.22 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.21 2014/03/23 09:30:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.22 2019/02/09 03:34:00 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_diagnostic.h"
@@ -102,8 +102,7 @@ rf_CommonCreateParityLoggingLargeWriteDAG(
/* alloc the Wnd nodes, the xor node, and the Lpo node */
nWndNodes = asmap->numStripeUnitsAccessed;
- RF_MallocAndAdd(nodes, (nWndNodes + 6) * sizeof(RF_DagNode_t),
- (RF_DagNode_t *), allocList);
+ nodes = RF_MallocAndAdd((nWndNodes + 6) * sizeof(*nodes), allocList);
i = 0;
wndNodes = &nodes[i];
i += nWndNodes;
@@ -126,8 +125,8 @@ rf_CommonCreateParityLoggingLargeWriteDAG(
rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, new_asm_h, &nRodNodes, &sosBuffer, &eosBuffer, allocList);
if (nRodNodes > 0)
- RF_MallocAndAdd(rodNodes, nRodNodes * sizeof(RF_DagNode_t),
- (RF_DagNode_t *), allocList);
+ rodNodes = RF_MallocAndAdd(nRodNodes * sizeof(*rodNodes),
+ allocList);
/* begin node initialization */
rf_InitNode(blockNode, rf_wait, RF_FALSE, rf_NullNodeFunc, rf_NullNodeUndoFunc, NULL, nRodNodes + 1, 0, 0, 0, dag_h, "Nil", allocList);
@@ -186,8 +185,8 @@ rf_CommonCreateParityLoggingLargeWriteDAG(
if (((RF_PhysDiskAddr_t *) rodNodes[i].params[0].p)->numSector == raidPtr->Layout.sectorsPerStripeUnit)
break;
if (i == nRodNodes) {
- RF_MallocAndAdd(xorNode->results[0],
- rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit), (void *), allocList);
+ xorNode->results[0] = RF_MallocAndAdd(rf_RaidAddressToByte(
+ raidPtr, raidPtr->Layout.sectorsPerStripeUnit), allocList);
} else {
xorNode->results[0] = rodNodes[i].params[1].p;
}
@@ -368,8 +367,7 @@ rf_CommonCreateParityLoggingSmallWriteDAG(
dag_h->numSuccedents = 1;
/* Step 2. create the nodes */
- RF_MallocAndAdd(nodes, totalNumNodes * sizeof(RF_DagNode_t),
- (RF_DagNode_t *), allocList);
+ nodes = RF_MallocAndAdd(totalNumNodes * sizeof(*nodes), allocList);
i = 0;
blockNode = &nodes[i];
i += 1;
diff --git a/sys/dev/raidframe/rf_paritymap.c b/sys/dev/raidframe/rf_paritymap.c
index dc7173d22e3..af63515bdb2 100644
--- a/sys/dev/raidframe/rf_paritymap.c
+++ b/sys/dev/raidframe/rf_paritymap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritymap.c,v 1.8 2011/04/27 07:55:15 mrg Exp $ */
+/* $NetBSD: rf_paritymap.c,v 1.9 2019/02/09 03:34:00 christos Exp $ */
/*-
* Copyright (c) 2009 Jed Davis.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.8 2011/04/27 07:55:15 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.9 2019/02/09 03:34:00 christos Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -231,8 +231,7 @@ void
rf_paritymap_invalidate(struct rf_paritymap *pm)
{
mutex_enter(&pm->lock);
- memset(pm->disk_boot, ~(unsigned char)0,
- sizeof(struct rf_paritymap_ondisk));
+ memset(pm->disk_boot, (unsigned char)~0, sizeof(*pm->disk_boot));
mutex_exit(&pm->lock);
}
@@ -241,8 +240,7 @@ void
rf_paritymap_forceclean(struct rf_paritymap *pm)
{
mutex_enter(&pm->lock);
- memset(pm->disk_boot, (unsigned char)0,
- sizeof(struct rf_paritymap_ondisk));
+ memset(pm->disk_boot, 0, sizeof(*pm->disk_boot));
mutex_exit(&pm->lock);
}
diff --git a/sys/dev/raidframe/rf_parityscan.c b/sys/dev/raidframe/rf_parityscan.c
index 4c61afcddc8..caea152820e 100644
--- a/sys/dev/raidframe/rf_parityscan.c
+++ b/sys/dev/raidframe/rf_parityscan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_parityscan.c,v 1.34 2011/05/01 01:09:05 mrg Exp $ */
+/* $NetBSD: rf_parityscan.c,v 1.35 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_parityscan.c,v 1.34 2011/05/01 01:09:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.35 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -220,8 +220,9 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
mcpair = rf_AllocMCPair();
rf_MakeAllocList(alloclist);
- RF_MallocAndAdd(bf, numbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol), (char *), alloclist);
- RF_MallocAndAdd(pbuf, numbytes, (char *), alloclist);
+ bf = RF_MallocAndAdd(numbytes
+ * (layoutPtr->numDataCol + layoutPtr->numParityCol), alloclist);
+ pbuf = RF_MallocAndAdd(numbytes, alloclist);
end_p = bf + bytesPerStripe;
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, numbytes, bf, rf_DiskReadFunc, rf_DiskReadUndoFunc,
@@ -253,7 +254,7 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
/* fire off the DAG */
#if RF_ACC_TRACE > 0
- memset((char *) &tracerec, 0, sizeof(tracerec));
+ memset(&tracerec, 0, sizeof(tracerec));
rd_dag_h->tracerec = &tracerec;
#endif
#if 0
@@ -299,7 +300,7 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
wrBlock->succedents[0]->params[2].v = psID;
wrBlock->succedents[0]->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
diff --git a/sys/dev/raidframe/rf_psstatus.c b/sys/dev/raidframe/rf_psstatus.c
index b3bc5380e89..61e1e925a00 100644
--- a/sys/dev/raidframe/rf_psstatus.c
+++ b/sys/dev/raidframe/rf_psstatus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_psstatus.c,v 1.34 2011/05/03 08:18:43 mrg Exp $ */
+/* $NetBSD: rf_psstatus.c,v 1.35 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -37,7 +37,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.34 2011/05/03 08:18:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.35 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -102,9 +102,7 @@ rf_MakeParityStripeStatusTable(RF_Raid_t *raidPtr)
RF_PSStatusHeader_t *pssTable;
int i;
- RF_Malloc(pssTable,
- raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t),
- (RF_PSStatusHeader_t *));
+ pssTable = RF_Malloc(raidPtr->pssTableSize * sizeof(*pssTable));
for (i = 0; i < raidPtr->pssTableSize; i++) {
rf_init_mutex2(pssTable[i].mutex, IPL_VM);
rf_init_cond2(pssTable[i].cond, "rfpsslk");
@@ -272,7 +270,7 @@ rf_AllocPSStatus(RF_Raid_t *raidPtr)
RF_ReconParityStripeStatus_t *p;
p = pool_get(&rf_pools.pss, PR_WAITOK);
- memset(p, 0, sizeof(RF_ReconParityStripeStatus_t));
+ memset(p, 0, sizeof(*p));
return (p);
}
diff --git a/sys/dev/raidframe/rf_raid0.c b/sys/dev/raidframe/rf_raid0.c
index 8259b6bd94f..2543ac8a59f 100644
--- a/sys/dev/raidframe/rf_raid0.c
+++ b/sys/dev/raidframe/rf_raid0.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_raid0.c,v 1.15 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_raid0.c,v 1.16 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_raid0.c,v 1.15 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid0.c,v 1.16 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -60,12 +60,13 @@ rf_ConfigureRAID0(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
RF_RowCol_t i;
/* create a RAID level 0 configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_Raid0ConfigInfo_t), (RF_Raid0ConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
- RF_MallocAndAdd(info->stripeIdentifier, raidPtr->numCol * sizeof(RF_RowCol_t), (RF_RowCol_t *), raidPtr->cleanupList);
+ info->stripeIdentifier = RF_MallocAndAdd(raidPtr->numCol
+ * sizeof(*info->stripeIdentifier), raidPtr->cleanupList);
if (info->stripeIdentifier == NULL)
return (ENOMEM);
for (i = 0; i < raidPtr->numCol; i++)
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
diff --git a/sys/dev/raidframe/rf_raid4.c b/sys/dev/raidframe/rf_raid4.c
index 5d66cc8fe85..db24418deeb 100644
--- a/sys/dev/raidframe/rf_raid4.c
+++ b/sys/dev/raidframe/rf_raid4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_raid4.c,v 1.12 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_raid4.c,v 1.13 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_raid4.c,v 1.12 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid4.c,v 1.13 2019/02/09 03:34:00 christos Exp $");
#include "rf_raid.h"
#include "rf_dag.h"
@@ -62,13 +62,14 @@ rf_ConfigureRAID4(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
int i;
/* create a RAID level 4 configuration structure ... */
- RF_MallocAndAdd(info, sizeof(RF_Raid4ConfigInfo_t), (RF_Raid4ConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
/* ... and fill it in. */
- RF_MallocAndAdd(info->stripeIdentifier, raidPtr->numCol * sizeof(RF_RowCol_t), (RF_RowCol_t *), raidPtr->cleanupList);
+ info->stripeIdentifier = RF_MallocAndAdd(raidPtr->numCol *
+ sizeof(*info->stripeIdentifier), raidPtr->cleanupList);
if (info->stripeIdentifier == NULL)
return (ENOMEM);
for (i = 0; i < raidPtr->numCol; i++)
diff --git a/sys/dev/raidframe/rf_raid5.c b/sys/dev/raidframe/rf_raid5.c
index 5e5c984f4b7..220492c940a 100644
--- a/sys/dev/raidframe/rf_raid5.c
+++ b/sys/dev/raidframe/rf_raid5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_raid5.c,v 1.19 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_raid5.c,v 1.20 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_raid5.c,v 1.19 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid5.c,v 1.20 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -63,7 +63,7 @@ rf_ConfigureRAID5(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
RF_RowCol_t i, j, startdisk;
/* create a RAID level 5 configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_Raid5ConfigInfo_t), (RF_Raid5ConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
diff --git a/sys/dev/raidframe/rf_raid5_rotatedspare.c b/sys/dev/raidframe/rf_raid5_rotatedspare.c
index fd029873645..726758536ff 100644
--- a/sys/dev/raidframe/rf_raid5_rotatedspare.c
+++ b/sys/dev/raidframe/rf_raid5_rotatedspare.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_raid5_rotatedspare.c,v 1.13 2009/03/14 15:36:20 dsl Exp $ */
+/* $NetBSD: rf_raid5_rotatedspare.c,v 1.14 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_raid5_rotatedspare.c,v 1.13 2009/03/14 15:36:20 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid5_rotatedspare.c,v 1.14 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
@@ -64,7 +64,7 @@ rf_ConfigureRAID5_RS(
RF_RowCol_t i, j, startdisk;
/* create a RAID level 5 configuration structure */
- RF_MallocAndAdd(info, sizeof(RF_Raid5RSConfigInfo_t), (RF_Raid5RSConfigInfo_t *), raidPtr->cleanupList);
+ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
if (info == NULL)
return (ENOMEM);
layoutPtr->layoutSpecificInfo = (void *) info;
diff --git a/sys/dev/raidframe/rf_reconmap.c b/sys/dev/raidframe/rf_reconmap.c
index bd004340347..46e48d448d4 100644
--- a/sys/dev/raidframe/rf_reconmap.c
+++ b/sys/dev/raidframe/rf_reconmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $ */
+/* $NetBSD: rf_reconmap.c,v 1.37 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.37 2019/02/09 03:34:00 christos Exp $");
#include "rf_raid.h"
#include <sys/time.h>
@@ -88,7 +88,7 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors,
RF_ReconMap_t *p;
int error;
- RF_Malloc(p, sizeof(RF_ReconMap_t), (RF_ReconMap_t *));
+ p = RF_Malloc(sizeof(*p));
p->sectorsPerReconUnit = ru_sectors;
p->sectorsInDisk = disk_sectors;
@@ -100,12 +100,9 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_SectorCount_t ru_sectors,
p->high_ru = p->status_size - 1;
p->head = 0;
- RF_Malloc(p->status, p->status_size * sizeof(RF_ReconMapListElem_t *), (RF_ReconMapListElem_t **));
+ p->status = RF_Malloc(p->status_size * sizeof(*p->status));
RF_ASSERT(p->status != NULL);
- (void) memset((char *) p->status, 0,
- p->status_size * sizeof(RF_ReconMapListElem_t *));
-
pool_init(&p->elem_pool, sizeof(RF_ReconMapListElem_t), 0,
0, 0, "raidreconpl", NULL, IPL_BIO);
if ((error = pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM)) != 0)
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c
index 8287840831f..a80f144c10e 100644
--- a/sys/dev/raidframe/rf_reconstruct.c
+++ b/sys/dev/raidframe/rf_reconstruct.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconstruct.c,v 1.121 2014/11/14 14:29:16 oster Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.122 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_reconstruct.c,v 1.121 2014/11/14 14:29:16 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.122 2019/02/09 03:34:00 christos Exp $");
#include <sys/param.h>
#include <sys/time.h>
@@ -169,8 +169,7 @@ AllocRaidReconDesc(RF_Raid_t *raidPtr, RF_RowCol_t col,
RF_RaidReconDesc_t *reconDesc;
- RF_Malloc(reconDesc, sizeof(RF_RaidReconDesc_t),
- (RF_RaidReconDesc_t *));
+ reconDesc = RF_Malloc(sizeof(*reconDesc));
reconDesc->raidPtr = raidPtr;
reconDesc->col = col;
reconDesc->spareDiskPtr = spareDiskPtr;
@@ -579,7 +578,8 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc)
raidPtr->accumXorTimeUs = 0;
#if RF_ACC_TRACE > 0
/* create one trace record per physical disk */
- RF_Malloc(raidPtr->recon_tracerecs, raidPtr->numCol * sizeof(RF_AccTraceEntry_t), (RF_AccTraceEntry_t *));
+ raidPtr->recon_tracerecs =
+ RF_Malloc(raidPtr->numCol * sizeof(*raidPtr->recon_tracerecs));
#endif
/* quiesce the array prior to starting recon. this is needed
@@ -1220,7 +1220,7 @@ IssueNextReadRequest(RF_Raid_t *raidPtr, RF_RowCol_t col)
rbuf->parityStripeID = ctrl->curPSID;
rbuf->which_ru = ctrl->ru_count;
#if RF_ACC_TRACE > 0
- memset((char *) &raidPtr->recon_tracerecs[col], 0,
+ memset(&raidPtr->recon_tracerecs[col], 0,
sizeof(raidPtr->recon_tracerecs[col]));
raidPtr->recon_tracerecs[col].reconacc = 1;
RF_ETIMER_START(raidPtr->recon_tracerecs[col].recon_timer);
diff --git a/sys/dev/raidframe/rf_reconutil.c b/sys/dev/raidframe/rf_reconutil.c
index e06e9b1940d..f736adee78c 100644
--- a/sys/dev/raidframe/rf_reconutil.c
+++ b/sys/dev/raidframe/rf_reconutil.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconutil.c,v 1.36 2018/01/18 00:32:49 mrg Exp $ */
+/* $NetBSD: rf_reconutil.c,v 1.37 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -31,7 +31,7 @@
********************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.36 2018/01/18 00:32:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.37 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -73,11 +73,11 @@ rf_MakeReconControl(RF_RaidReconDesc_t *reconDesc,
/* make and zero the global reconstruction structure and the per-disk
* structure */
- RF_Malloc(reconCtrlPtr, sizeof(RF_ReconCtrl_t), (RF_ReconCtrl_t *));
+ reconCtrlPtr = RF_Malloc(sizeof(*reconCtrlPtr));
/* note: this zeros the perDiskInfo */
- RF_Malloc(reconCtrlPtr->perDiskInfo, raidPtr->numCol *
- sizeof(RF_PerDiskReconCtrl_t), (RF_PerDiskReconCtrl_t *));
+ reconCtrlPtr->perDiskInfo = RF_Malloc(raidPtr->numCol *
+ sizeof(*reconCtrlPtr->perDiskInfo));
reconCtrlPtr->reconDesc = reconDesc;
reconCtrlPtr->fcol = fcol;
reconCtrlPtr->spareCol = scol;
@@ -232,7 +232,7 @@ rf_MakeReconBuffer(RF_Raid_t *raidPtr, RF_RowCol_t col, RF_RbufType_t type)
u_int recon_buffer_size = rf_RaidAddressToByte(raidPtr, layoutPtr->SUsPerRU * layoutPtr->sectorsPerStripeUnit);
t = pool_get(&rf_pools.reconbuffer, PR_WAITOK);
- RF_Malloc(t->buffer, recon_buffer_size, (void *));
+ t->buffer = RF_Malloc(recon_buffer_size);
t->raidPtr = raidPtr;
t->col = col;
t->priority = RF_IO_RECON_PRIORITY;
diff --git a/sys/dev/raidframe/rf_sstf.c b/sys/dev/raidframe/rf_sstf.c
index 8fc89a730c2..44c9885e24c 100644
--- a/sys/dev/raidframe/rf_sstf.c
+++ b/sys/dev/raidframe/rf_sstf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_sstf.c,v 1.16 2009/03/14 15:36:20 dsl Exp $ */
+/* $NetBSD: rf_sstf.c,v 1.17 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_sstf.c,v 1.16 2009/03/14 15:36:20 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_sstf.c,v 1.17 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -246,7 +246,7 @@ rf_SstfCreate(
{
RF_Sstf_t *sstfq;
- RF_MallocAndAdd(sstfq, sizeof(RF_Sstf_t), (RF_Sstf_t *), cl_list);
+ sstfq = RF_MallocAndAdd(sizeof(*sstfq), cl_list);
sstfq->dir = DIR_EITHER;
sstfq->allow_reverse = 1;
return ((void *) sstfq);
@@ -260,7 +260,7 @@ rf_ScanCreate(
{
RF_Sstf_t *scanq;
- RF_MallocAndAdd(scanq, sizeof(RF_Sstf_t), (RF_Sstf_t *), cl_list);
+ scanq = RF_MallocAndAdd(sizeof(*scanq), cl_list);
scanq->dir = DIR_RIGHT;
scanq->allow_reverse = 1;
return ((void *) scanq);
@@ -274,7 +274,7 @@ rf_CscanCreate(
{
RF_Sstf_t *cscanq;
- RF_MallocAndAdd(cscanq, sizeof(RF_Sstf_t), (RF_Sstf_t *), cl_list);
+ cscanq = RF_MallocAndAdd(sizeof(*cscanq), cl_list);
cscanq->dir = DIR_RIGHT;
return ((void *) cscanq);
}
diff --git a/sys/dev/raidframe/rf_stripelocks.c b/sys/dev/raidframe/rf_stripelocks.c
index 17976116b0e..8b77de9cba2 100644
--- a/sys/dev/raidframe/rf_stripelocks.c
+++ b/sys/dev/raidframe/rf_stripelocks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_stripelocks.c,v 1.32 2011/05/05 08:21:29 mrg Exp $ */
+/* $NetBSD: rf_stripelocks.c,v 1.33 2019/02/09 03:34:00 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.32 2011/05/05 08:21:29 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.33 2019/02/09 03:34:00 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -199,9 +199,7 @@ rf_MakeLockTable(void)
RF_LockTableEntry_t *lockTable;
int i;
- RF_Malloc(lockTable,
- ((int) rf_lockTableSize) * sizeof(RF_LockTableEntry_t),
- (RF_LockTableEntry_t *));
+ lockTable = RF_Malloc(rf_lockTableSize * sizeof(*lockTable));
if (lockTable == NULL)
return (NULL);
for (i = 0; i < rf_lockTableSize; i++) {
diff --git a/sys/dev/raidframe/rf_utils.c b/sys/dev/raidframe/rf_utils.c
index 015bd8525aa..a75d424e378 100644
--- a/sys/dev/raidframe/rf_utils.c
+++ b/sys/dev/raidframe/rf_utils.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_utils.c,v 1.16 2006/11/16 01:33:23 christos Exp $ */
+/* $NetBSD: rf_utils.c,v 1.17 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_utils.c,v 1.16 2006/11/16 01:33:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_utils.c,v 1.17 2019/02/09 03:34:00 christos Exp $");
#include "rf_archs.h"
#include "rf_utils.h"
@@ -46,10 +46,9 @@ rf_make_2d_array(int b, int k, RF_AllocListElem_t *allocList)
{
RF_RowCol_t **retval, i;
- RF_MallocAndAdd(retval, b * sizeof(RF_RowCol_t *), (RF_RowCol_t **), allocList);
+ retval = RF_MallocAndAdd(b * sizeof(*retval), allocList);
for (i = 0; i < b; i++) {
- RF_MallocAndAdd(retval[i], k * sizeof(RF_RowCol_t), (RF_RowCol_t *), allocList);
- (void) memset((char *) retval[i], 0, k * sizeof(RF_RowCol_t));
+ retval[i] = RF_MallocAndAdd(k * sizeof(*retval[i]), allocList);
}
return (retval);
}
@@ -73,8 +72,7 @@ rf_make_1d_array(int c, RF_AllocListElem_t *allocList)
{
RF_RowCol_t *retval;
- RF_MallocAndAdd(retval, c * sizeof(RF_RowCol_t), (RF_RowCol_t *), allocList);
- (void) memset((char *) retval, 0, c * sizeof(RF_RowCol_t));
+ retval = RF_MallocAndAdd(c * sizeof(*retval), allocList);
return (retval);
}