- avoid variable shadowing

- add a lot of const
- remove parameters from functin declarations
This commit is contained in:
christos 2005-05-29 22:03:09 +00:00
parent 3acb3fe622
commit ba7574326e
18 changed files with 119 additions and 132 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dag.h,v 1.17 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dag.h,v 1.18 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -125,7 +125,7 @@ struct RF_DagNode_s {
* walks */
/* ANY CODE THAT USES THIS FIELD MUST MAINTAIN THE PROPERTY THAT AFTER
* IT FINISHES, ALL VISITED FLAGS IN THE DAG ARE IDENTICAL */
char *name; /* debug only */
const char *name; /* debug only */
RF_DagNodeFlags_t flags;/* see below */
RF_DagNode_t *big_dag_ptrs; /* used in cases where the cache below isn't big enough */
RF_DagParam_t *big_dag_params; /* used when the cache below isn't big enough */
@ -171,7 +171,7 @@ struct RF_DagHeader_s {
void (*cbFunc) (void *); /* function to call when the dag
* completes */
void *cbArg; /* argument for cbFunc */
char *creator; /* name of function used to create this dag */
const char *creator; /* name of function used to create this dag */
RF_DagNode_t *nodes; /* linked list of nodes used in this DAG */
RF_PhysDiskAddr_t *pda_cleanup_list; /* for PDAs that can't get
cleaned up any other way... */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagffrd.c,v 1.14 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dagffrd.c,v 1.15 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.14 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.15 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -135,7 +135,7 @@ rf_CreateNonredundantDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
RF_PhysDiskAddr_t *pda = asmap->physInfo;
int (*doFunc) (RF_DagNode_t *), (*undoFunc) (RF_DagNode_t *);
int i, n, totalNumNodes;
char *name;
const char *name;
n = asmap->numStripeUnitsAccessed;
dag_h->creator = "NonredundantDAG";

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagffwr.c,v 1.29 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dagffwr.c,v 1.30 2005/05/29 22:03:09 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.29 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.30 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -540,7 +540,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
int numDataNodes, numParityNodes;
RF_StripeNum_t parityStripeID;
RF_PhysDiskAddr_t *pda;
char *name, *qname;
const char *name, *qname;
long nfaults;
nfaults = qfuncs ? 2 : 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagfuncs.c,v 1.23 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dagfuncs.c,v 1.24 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.23 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.24 2005/05/29 22:03:09 christos Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@ -172,7 +172,7 @@ int
rf_ParityLogUpdateFunc(RF_DagNode_t *node)
{
RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p;
caddr_t buf = (caddr_t) node->params[1].p;
caddr_t bf = (caddr_t) node->params[1].p;
RF_ParityLogData_t *logData;
#if RF_ACC_TRACE > 0
RF_AccTraceEntry_t *tracerec = node->dagHdr->tracerec;
@ -183,7 +183,7 @@ rf_ParityLogUpdateFunc(RF_DagNode_t *node)
#if RF_ACC_TRACE > 0
RF_ETIMER_START(timer);
#endif
logData = rf_CreateParityLogData(RF_UPDATE, pda, buf,
logData = rf_CreateParityLogData(RF_UPDATE, pda, bf,
(RF_Raid_t *) (node->dagHdr->raidPtr),
node->wakeFunc, (void *) node,
node->dagHdr->tracerec, timer);
@ -209,7 +209,7 @@ int
rf_ParityLogOverwriteFunc(RF_DagNode_t *node)
{
RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p;
caddr_t buf = (caddr_t) node->params[1].p;
caddr_t bf = (caddr_t) node->params[1].p;
RF_ParityLogData_t *logData;
#if RF_ACC_TRACE > 0
RF_AccTraceEntry_t *tracerec = node->dagHdr->tracerec;
@ -220,7 +220,7 @@ rf_ParityLogOverwriteFunc(RF_DagNode_t *node)
#if RF_ACC_TRACE > 0
RF_ETIMER_START(timer);
#endif
logData = rf_CreateParityLogData(RF_OVERWRITE, pda, buf,
logData = rf_CreateParityLogData(RF_OVERWRITE, pda, bf,
(RF_Raid_t *) (node->dagHdr->raidPtr),
node->wakeFunc, (void *) node, node->dagHdr->tracerec, timer);
if (logData)
@ -276,7 +276,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node)
{
RF_DiskQueueData_t *req;
RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p;
caddr_t buf = (caddr_t) node->params[1].p;
caddr_t bf = (caddr_t) node->params[1].p;
RF_StripeNum_t parityStripeID = (RF_StripeNum_t) node->params[2].v;
unsigned priority = RF_EXTRACT_PRIORITY(node->params[3].v);
unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
@ -288,7 +288,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node)
b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc;
req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
buf, parityStripeID, which_ru,
bf, parityStripeID, which_ru,
(int (*) (void *, int)) node->wakeFunc,
node,
#if RF_ACC_TRACE > 0
@ -315,7 +315,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node)
{
RF_DiskQueueData_t *req;
RF_PhysDiskAddr_t *pda = (RF_PhysDiskAddr_t *) node->params[0].p;
caddr_t buf = (caddr_t) node->params[1].p;
caddr_t bf = (caddr_t) node->params[1].p;
RF_StripeNum_t parityStripeID = (RF_StripeNum_t) node->params[2].v;
unsigned priority = RF_EXTRACT_PRIORITY(node->params[3].v);
unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
@ -328,7 +328,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node)
/* normal processing (rollaway or forward recovery) begins here */
req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
buf, parityStripeID, which_ru,
bf, parityStripeID, which_ru,
(int (*) (void *, int)) node->wakeFunc,
(void *) node,
#if RF_ACC_TRACE > 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagutils.c,v 1.45 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dagutils.c,v 1.46 2005/05/29 22:03:09 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.45 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.46 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -95,7 +95,7 @@ rf_InitNode(RF_DagNode_t *node, RF_NodeStatus_t initstatus, int commit,
int (*undoFunc) (RF_DagNode_t *node),
int (*wakeFunc) (RF_DagNode_t *node, int status),
int nSucc, int nAnte, int nParam, int nResult,
RF_DagHeader_t *hdr, char *name, RF_AllocListElem_t *alist)
RF_DagHeader_t *hdr, const char *name, RF_AllocListElem_t *alist)
{
void **ptrs;
int nptrs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagutils.h,v 1.18 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_dagutils.h,v 1.19 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -43,9 +43,9 @@
struct RF_RedFuncs_s {
int (*regular) (RF_DagNode_t *);
char *RegularName;
const char *RegularName;
int (*simple) (RF_DagNode_t *);
char *SimpleName;
const char *SimpleName;
};
typedef struct RF_FuncList_s {
@ -57,11 +57,11 @@ extern const RF_RedFuncs_t rf_xorFuncs;
extern const RF_RedFuncs_t rf_xorRecoveryFuncs;
void rf_InitNode(RF_DagNode_t *, RF_NodeStatus_t, int,
int (*doFunc) (RF_DagNode_t *),
int (*undoFunc) (RF_DagNode_t *),
int (*wakeFunc) (RF_DagNode_t *, int),
int (*) (RF_DagNode_t *),
int (*) (RF_DagNode_t *),
int (*) (RF_DagNode_t *, int),
int, int, int, int, RF_DagHeader_t *,
char *, RF_AllocListElem_t *);
const char *, RF_AllocListElem_t *);
void rf_FreeDAG(RF_DagHeader_t *);
int rf_ConfigureDAGs(RF_ShutdownList_t **);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_diskqueue.c,v 1.40 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_diskqueue.c,v 1.41 2005/05/29 22:03:09 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.40 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.41 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -440,7 +440,7 @@ rf_DiskIOPromote(RF_DiskQueue_t *queue, RF_StripeNum_t parityStripeID,
RF_DiskQueueData_t *
rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
RF_SectorCount_t nsect, caddr_t buf,
RF_SectorCount_t nsect, caddr_t bf,
RF_StripeNum_t parityStripeID,
RF_ReconUnitNum_t which_ru,
int (*wakeF) (void *, int), void *arg,
@ -470,7 +470,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
p->sectorOffset = ssect + rf_protectedSectors;
p->numSector = nsect;
p->type = typ;
p->buf = buf;
p->buf = bf;
p->parityStripeID = parityStripeID;
p->which_ru = which_ru;
p->CompleteFunc = wakeF;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_disks.c,v 1.57 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_disks.c,v 1.58 2005/05/29 22:03:09 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -67,7 +67,7 @@
***************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.57 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.58 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -570,7 +570,7 @@ fail:
/* configure a single disk in the array */
int
rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr,
rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
RF_RowCol_t col)
{
char *p;
@ -580,7 +580,7 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr,
struct proc *proc;
int error;
p = rf_find_non_white(buf);
p = rf_find_non_white(bf);
if (p[strlen(p) - 1] == '\n') {
/* strip off the newline */
p[strlen(p) - 1] = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_disks.h,v 1.12 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_disks.h,v 1.13 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -44,19 +44,14 @@
((_dstat_) == rf_ds_reconstructing) || ((_dstat_) == rf_ds_failed) || \
((_dstat_) == rf_ds_dist_spared))
int rf_ConfigureDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr,
RF_Config_t * cfgPtr);
int rf_ConfigureSpareDisks(RF_ShutdownList_t ** listp, RF_Raid_t * raidPtr,
RF_Config_t * cfgPtr);
int rf_ConfigureDisk(RF_Raid_t * raidPtr, char *buf, RF_RaidDisk_t * diskPtr,
RF_RowCol_t col);
int rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr,
RF_AutoConfig_t *auto_config);
int rf_CheckLabels( RF_Raid_t *, RF_Config_t *);
int rf_add_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr);
int rf_remove_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr);
int rf_delete_component(RF_Raid_t *raidPtr, RF_SingleComponent_t *component);
int rf_incorporate_hot_spare(RF_Raid_t *raidPtr,
RF_SingleComponent_t *component);
int rf_ConfigureDisks(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *);
int rf_ConfigureSpareDisks(RF_ShutdownList_t **, RF_Raid_t *, RF_Config_t *);
int rf_ConfigureDisk(RF_Raid_t *, char *, RF_RaidDisk_t *, RF_RowCol_t);
int rf_AutoConfigureDisks(RF_Raid_t *, RF_Config_t *, RF_AutoConfig_t *);
int rf_CheckLabels(RF_Raid_t *, RF_Config_t *);
int rf_add_hot_spare(RF_Raid_t *, RF_SingleComponent_t *);
int rf_remove_hot_spare(RF_Raid_t *, RF_SingleComponent_t *);
int rf_delete_component(RF_Raid_t *r, RF_SingleComponent_t *);
int rf_incorporate_hot_spare(RF_Raid_t *, RF_SingleComponent_t *);
#endif /* !_RF__RF_DISKS_H_ */
#endif /* !_RF__RF_DISKS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_driver.c,v 1.107 2005/02/27 00:27:44 perry Exp $ */
/* $NetBSD: rf_driver.c,v 1.108 2005/05/29 22:03:09 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -73,7 +73,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.107 2005/02/27 00:27:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.108 2005/05/29 22:03:09 christos Exp $");
#include "opt_raid_diagnostic.h"
@ -865,7 +865,7 @@ rf_ConfigureDebug(RF_Config_t *cfgPtr)
}
void
rf_print_panic_message(int line, char *file)
rf_print_panic_message(int line, const char *file)
{
snprintf(rf_panicbuf, sizeof(rf_panicbuf),
"raidframe error at line %d file %s", line, file);
@ -873,7 +873,7 @@ rf_print_panic_message(int line, char *file)
#ifdef RAID_DIAGNOSTIC
void
rf_print_assert_panic_message(int line, char *file, char *condition)
rf_print_assert_panic_message(int line, const char *file, const char *condition)
{
snprintf(rf_panicbuf, sizeof(rf_panicbuf),
"raidframe error at line %d file %s (failed asserting %s)\n",
@ -882,14 +882,14 @@ rf_print_assert_panic_message(int line, char *file, char *condition)
#endif
void
rf_print_unable_to_init_mutex(char *file, int line, int rc)
rf_print_unable_to_init_mutex(const char *file, int line, int rc)
{
RF_ERRORMSG3("Unable to init mutex file %s line %d rc=%d\n",
file, line, rc);
}
void
rf_print_unable_to_add_shutdown(char *file, int line, int rc)
rf_print_unable_to_add_shutdown(const char *file, int line, int rc)
{
RF_ERRORMSG3("Unable to add to shutdown list file %s line %d rc=%d\n",
file, line, rc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_etimer.h,v 1.8 2001/10/04 17:42:29 oster Exp $ */
/* $NetBSD: rf_etimer.h,v 1.9 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -42,19 +42,19 @@ struct RF_Etimer_s {
#define RF_ETIMER_START(_t_) \
{ \
int s; \
int _s; \
memset(&(_t_), 0, sizeof (_t_)); \
s = splclock(); \
_s = splclock(); \
(_t_).st = mono_time; \
splx(s); \
splx(_s); \
}
#define RF_ETIMER_STOP(_t_) \
{ \
int s; \
s = splclock(); \
int _s; \
_s = splclock(); \
(_t_).et = mono_time; \
splx(s); \
splx(_s); \
}
#define RF_ETIMER_EVAL(_t_) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_general.h,v 1.14 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_general.h,v 1.15 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -49,10 +49,10 @@
#define RF_ERRORMSG2(s,a,b) printf((s),(a),(b))
#define RF_ERRORMSG3(s,a,b,c) printf((s),(a),(b),(c))
void rf_print_panic_message(int, char *);
void rf_print_assert_panic_message(int, char *, char *);
void rf_print_unable_to_init_mutex(char *, int, int);
void rf_print_unable_to_add_shutdown(char *, int, int);
void rf_print_panic_message(int, const char *);
void rf_print_assert_panic_message(int, const char *, const char *);
void rf_print_unable_to_init_mutex(const char *, int, int);
void rf_print_unable_to_add_shutdown(const char *, int, int);
extern char rf_panicbuf[];

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsd.h,v 1.22 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_netbsd.h,v 1.23 2005/05/29 22:03:09 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@ struct RF_Pools_s {
};
extern struct RF_Pools_s rf_pools;
void rf_pool_init(struct pool *, size_t, char *, size_t, size_t);
void rf_pool_init(struct pool *, size_t, const char *, size_t, size_t);
/* XXX probably belongs in a different .h file. */
typedef struct RF_AutoConfig_s {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.186 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.187 2005/05/29 22:03:09 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -146,7 +146,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.186 2005/02/27 00:27:45 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.187 2005/05/29 22:03:09 christos Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -206,12 +206,10 @@ static RF_SparetWait_t *rf_sparet_resp_queue; /* responses from
MALLOC_DEFINE(M_RAIDFRAME, "RAIDframe", "RAIDframe structures");
/* prototypes */
static void KernelWakeupFunc(struct buf * bp);
static void InitBP(struct buf * bp, struct vnode *, unsigned rw_flag,
dev_t dev, RF_SectorNum_t startSect,
RF_SectorCount_t numSect, caddr_t buf,
void (*cbFunc) (struct buf *), void *cbArg,
int logBytesPerSector, struct proc * b_proc);
static void KernelWakeupFunc(struct buf *);
static void InitBP(struct buf *, struct vnode *, unsigned,
dev_t, RF_SectorNum_t, RF_SectorCount_t, caddr_t, void (*) (struct buf *),
void *, int, struct proc *);
static void raidinit(RF_Raid_t *);
void raidattach(int);
@ -1998,7 +1996,7 @@ KernelWakeupFunc(struct buf *vbp)
*/
static void
InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev,
RF_SectorNum_t startSect, RF_SectorCount_t numSect, caddr_t buf,
RF_SectorNum_t startSect, RF_SectorCount_t numSect, caddr_t bf,
void (*cbFunc) (struct buf *), void *cbArg, int logBytesPerSector,
struct proc *b_proc)
{
@ -2008,7 +2006,7 @@ InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev,
bp->b_bufsize = bp->b_bcount;
bp->b_error = 0;
bp->b_dev = dev;
bp->b_data = buf;
bp->b_data = bf;
bp->b_blkno = startSect;
bp->b_resid = bp->b_bcount; /* XXX is this right!??!?!! */
if (bp->b_bcount == 0) {
@ -3323,11 +3321,11 @@ rf_disk_unbusy(RF_RaidAccessDesc_t *desc)
}
void
rf_pool_init(struct pool *p, size_t size, char *w_chan,
size_t min, size_t max)
rf_pool_init(struct pool *p, size_t size, const char *w_chan,
size_t xmin, size_t xmax)
{
pool_init(p, size, 0, 0, 0, w_chan, NULL);
pool_sethiwat(p, max);
pool_prime(p, min);
pool_setlowat(p, min);
pool_sethiwat(p, xmax);
pool_prime(p, xmin);
pool_setlowat(p, xmin);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_options.h,v 1.3 1999/02/05 00:06:13 oster Exp $ */
/* $NetBSD: rf_options.h,v 1.4 2005/05/29 22:03:09 christos Exp $ */
/*
* rf_options.h
*/
@ -35,7 +35,7 @@
#define RF_DEFAULT_LOCK_TABLE_SIZE 256
typedef struct RF_DebugNames_s {
char *name;
const char *name;
long *ptr;
} RF_DebugName_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_parityscan.c,v 1.28 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_parityscan.c,v 1.29 2005/05/29 22:03:09 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.28 2005/02/27 00:27:45 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.29 2005/05/29 22:03:09 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -189,7 +189,7 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
RF_AccessStripeMap_t *asmap;
RF_AllocListElem_t *alloclist;
RF_PhysDiskAddr_t *pda;
char *pbuf, *buf, *end_p, *p;
char *pbuf, *bf, *end_p, *p;
int i, retcode;
RF_ReconUnitNum_t which_ru;
RF_StripeNum_t psID = rf_RaidAddressToParityStripeID(layoutPtr,
@ -205,16 +205,16 @@ rf_VerifyParityBasic(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(bf, numbytes * (layoutPtr->numDataCol + layoutPtr->numParityCol), (char *), alloclist);
RF_MallocAndAdd(pbuf, numbytes, (char *), alloclist);
end_p = buf + bytesPerStripe;
end_p = bf + bytesPerStripe;
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, numbytes, buf, rf_DiskReadFunc, rf_DiskReadUndoFunc,
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, numbytes, bf, rf_DiskReadFunc, rf_DiskReadUndoFunc,
"Rod", alloclist, flags, RF_IO_NORMAL_PRIORITY);
blockNode = rd_dag_h->succedents[0];
/* map the stripe and fill in the PDAs in the dag */
asm_h = rf_MapAccess(raidPtr, startAddr, layoutPtr->dataSectorsPerStripe, buf, RF_DONT_REMAP);
asm_h = rf_MapAccess(raidPtr, startAddr, layoutPtr->dataSectorsPerStripe, bf, RF_DONT_REMAP);
asmap = asm_h->stripeMap;
for (pda = asmap->physInfo, i = 0; i < layoutPtr->numDataCol; i++, pda = pda->next) {
@ -263,14 +263,14 @@ rf_VerifyParityBasic(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
retcode = RF_PARITY_COULD_NOT_VERIFY;
goto out;
}
for (p = buf; p < end_p; p += numbytes) {
for (p = bf; p < end_p; p += numbytes) {
rf_bxor(p, pbuf, numbytes);
}
for (i = 0; i < numbytes; i++) {
if (pbuf[i] != buf[bytesPerStripe + i]) {
if (pbuf[i] != bf[bytesPerStripe + i]) {
if (!correct_it)
RF_ERRORMSG3("Parity verify error: byte %d of parity is 0x%x should be 0x%x\n",
i, (u_char) buf[bytesPerStripe + i], (u_char) pbuf[i]);
i, (u_char) bf[bytesPerStripe + i], (u_char) pbuf[i]);
retcode = RF_PARITY_BAD;
break;
}
@ -402,7 +402,7 @@ RF_DagHeader_t *
rf_MakeSimpleDAG(RF_Raid_t *raidPtr, int nNodes, int bytesPerSU, char *databuf,
int (*doFunc) (RF_DagNode_t * node),
int (*undoFunc) (RF_DagNode_t * node),
char *name, RF_AllocListElem_t *alloclist,
const char *name, RF_AllocListElem_t *alloclist,
RF_RaidAccessFlags_t flags, int priority)
{
RF_DagHeader_t *dag_h;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_parityscan.h,v 1.5 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_parityscan.h,v 1.6 2005/05/29 22:03:09 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -33,22 +33,16 @@
#include "rf_alloclist.h"
int rf_RewriteParity(RF_Raid_t * raidPtr);
int
rf_VerifyParityBasic(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr,
RF_PhysDiskAddr_t * parityPDA, int correct_it, RF_RaidAccessFlags_t flags);
int
rf_VerifyParity(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * stripeMap,
int correct_it, RF_RaidAccessFlags_t flags);
int rf_TryToRedirectPDA(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, int parity);
int rf_VerifyDegrModeWrite(RF_Raid_t * raidPtr, RF_AccessStripeMapHeader_t * asmh);
RF_DagHeader_t *
rf_MakeSimpleDAG(RF_Raid_t * raidPtr, int nNodes,
int bytesPerSU, char *databuf,
int (*doFunc) (RF_DagNode_t *),
int (*undoFunc) (RF_DagNode_t *),
char *name, RF_AllocListElem_t * alloclist,
RF_RaidAccessFlags_t flags, int priority);
int rf_RewriteParity(RF_Raid_t *);
int rf_VerifyParityBasic(RF_Raid_t *, RF_RaidAddr_t, RF_PhysDiskAddr_t *,
int, RF_RaidAccessFlags_t);
int rf_VerifyParity(RF_Raid_t *, RF_AccessStripeMap_t *, int,
RF_RaidAccessFlags_t);
int rf_TryToRedirectPDA(RF_Raid_t *, RF_PhysDiskAddr_t *, int);
int rf_VerifyDegrModeWrite(RF_Raid_t *, RF_AccessStripeMapHeader_t *);
RF_DagHeader_t *rf_MakeSimpleDAG(RF_Raid_t *, int, int, char *,
int (*)(RF_DagNode_t *), int (*) (RF_DagNode_t *), const char *,
RF_AllocListElem_t *, RF_RaidAccessFlags_t, int);
#define RF_DO_CORRECT_PARITY 1
#define RF_DONT_CORRECT_PARITY 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_raid1.c,v 1.25 2005/02/27 00:27:45 perry Exp $ */
/* $NetBSD: rf_raid1.c,v 1.26 2005/05/29 22:03:09 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.25 2005/02/27 00:27:45 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.26 2005/05/29 22:03:09 christos Exp $");
#include "rf_raid.h"
#include "rf_raid1.h"
@ -263,7 +263,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
RF_AccessStripeMap_t *aasm;
RF_SectorCount_t nsector;
RF_RaidAddr_t startAddr;
char *buf, *buf1, *buf2;
char *bf, *buf1, *buf2;
RF_PhysDiskAddr_t *pda;
RF_StripeNum_t psID;
RF_MCPair_t *mcpair;
@ -289,14 +289,14 @@ 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(buf, bcount, (char *), allocList);
if (buf == NULL)
RF_MallocAndAdd(bf, bcount, (char *), allocList);
if (bf == NULL)
goto done;
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify: buf=%lx bcount=%d (%lx - %lx)\n",
raidPtr->raidid, (long) buf, bcount, (long) buf,
(long) buf + bcount);
raidPtr->raidid, (long) bf, bcount, (long) bf,
(long) bf + bcount);
}
#endif
/*
@ -304,7 +304,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
* just compare data chunks versus "parity" chunks.
*/
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, nbytes, buf,
rd_dag_h = rf_MakeSimpleDAG(raidPtr, stripeWidth, nbytes, bf,
rf_DiskReadFunc, rf_DiskReadUndoFunc, "Rod", allocList, flags,
RF_IO_NORMAL_PRIORITY);
if (rd_dag_h == NULL)
@ -317,10 +317,10 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
* (which are really mirror copies).
*/
asm_h = rf_MapAccess(raidPtr, startAddr, layoutPtr->dataSectorsPerStripe,
buf, RF_DONT_REMAP);
bf, RF_DONT_REMAP);
aasm = asm_h->stripeMap;
buf1 = buf;
buf1 = bf;
/*
* Loop through the data blocks, setting up read nodes for each.
*/
@ -397,8 +397,8 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
* buf1 is the beginning of the data blocks chunk
* buf2 is the beginning of the parity blocks chunk
*/
buf1 = buf;
buf2 = buf + (nbytes * layoutPtr->numDataCol);
buf1 = bf;
buf2 = bf + (nbytes * layoutPtr->numDataCol);
ret = RF_PARITY_OKAY;
/*
* bbufs is "bad bufs"- an array whose entries are the data
@ -417,7 +417,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify %d bytes: i=%d buf1=%lx buf2=%lx buf=%lx\n",
raidPtr->raidid, nbytes, i, (long) buf1,
(long) buf2, (long) buf);
(long) buf2, (long) bf);
}
#endif
ret = memcmp(buf1, buf2, nbytes);
@ -466,7 +466,7 @@ rf_VerifyParityRAID1(RF_Raid_t *raidPtr, RF_RaidAddr_t raidAddr,
* copy, and that we're spooging good data by writing bad over it,
* but there's no way we can know that.
*/
wr_dag_h = rf_MakeSimpleDAG(raidPtr, nbad, nbytes, buf,
wr_dag_h = rf_MakeSimpleDAG(raidPtr, nbad, nbytes, bf,
rf_DiskWriteFunc, rf_DiskWriteUndoFunc, "Wnp", allocList, flags,
RF_IO_NORMAL_PRIORITY);
if (wr_dag_h == NULL)