Move parts of a RAID type mapping table from rf_layout.c to rf_configure.c.

This means we don't need to compile or link with rf_layout.c here.
This commit is contained in:
oster 2001-01-27 19:32:47 +00:00
parent 532934d5f1
commit 705631a231
2 changed files with 60 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.7 2000/05/23 00:46:53 thorpej Exp $
# $NetBSD: Makefile,v 1.8 2001/01/27 19:32:47 oster Exp $
PROG= raidctl
SRCS= rf_configure.c rf_layout.c raidctl.c
SRCS= rf_configure.c raidctl.c
MAN= raidctl.8
WARNS=2

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_configure.c,v 1.12 2000/12/31 01:58:03 wiz Exp $ */
/* $NetBSD: rf_configure.c,v 1.13 2001/01/27 19:32:47 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@ -77,6 +77,63 @@
bzero((char *)_p_, _size_); \
}
int distSpareYes = 1;
int distSpareNo = 0;
/* The mapsw[] table below contains all the various RAID types that might
be supported by the kernel. The actual supported types are found
in sys/dev/raidframe/rf_layout.c. */
static RF_LayoutSW_t mapsw[] = {
/* parity declustering */
{'T', "Parity declustering",
rf_MakeLayoutSpecificDeclustered, &distSpareNo},
/* parity declustering with distributed sparing */
{'D', "Distributed sparing parity declustering",
rf_MakeLayoutSpecificDeclustered, &distSpareYes},
/* declustered P+Q */
{'Q', "Declustered P+Q",
rf_MakeLayoutSpecificDeclustered, &distSpareNo},
/* RAID 5 with rotated sparing */
{'R', "RAID Level 5 rotated sparing", rf_MakeLayoutSpecificNULL, NULL},
/* Chained Declustering */
{'C', "Chained Declustering", rf_MakeLayoutSpecificNULL, NULL},
/* Interleaved Declustering */
{'I', "Interleaved Declustering", rf_MakeLayoutSpecificNULL, NULL},
/* RAID level 0 */
{'0', "RAID Level 0", rf_MakeLayoutSpecificNULL, NULL},
/* RAID level 1 */
{'1', "RAID Level 1", rf_MakeLayoutSpecificNULL, NULL},
/* RAID level 4 */
{'4', "RAID Level 4", rf_MakeLayoutSpecificNULL, NULL},
/* RAID level 5 */
{'5', "RAID Level 5", rf_MakeLayoutSpecificNULL, NULL},
/* Evenodd */
{'E', "EvenOdd", rf_MakeLayoutSpecificNULL, NULL},
/* Declustered Evenodd */
{'e', "Declustered EvenOdd",
rf_MakeLayoutSpecificDeclustered, &distSpareNo},
/* parity logging */
{'L', "Parity logging", rf_MakeLayoutSpecificNULL, NULL},
/* end-of-list marker */
{'\0', NULL, NULL, NULL}
};
RF_LayoutSW_t *
rf_GetLayout(RF_ParityConfig_t parityConfig)
{
RF_LayoutSW_t *p;
/* look up the specific layout */
for (p = &mapsw[0]; p->parityConfig; p++)
if (p->parityConfig == parityConfig)
break;
if (!p->parityConfig)
return (NULL);
RF_ASSERT(p->parityConfig == parityConfig);
return (p);
}
char *rf_find_non_white(char *p);
char *rf_find_white(char *p);
@ -235,13 +292,7 @@ rf_MakeConfig(configname, cfgPtr)
goto out;
}
/*
* XXX who cares.. it's not going into the kernel, so we should ignore
* this...
*/
#ifndef _KERNEL
retcode = lp->MakeLayoutSpecific(fp, cfgPtr, lp->makeLayoutSpecificArg);
#endif
out:
fclose(fp);
if (retcode < 0)