diff options
author | grog <grog@FreeBSD.org> | 1998-11-03 06:37:14 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 1998-11-03 06:37:14 +0000 |
commit | 194b462c0ccb16d6302f0a0fb1f5654df3fb3c5d (patch) | |
tree | ca12e7565e4da386ea3ba1baefcbf938cf0f0473 /sys/dev | |
parent | fe1c6b5af2aeec86bb1bd62d7506516ca6e2e9da (diff) | |
download | FreeBSD-src-194b462c0ccb16d6302f0a0fb1f5654df3fb3c5d.zip FreeBSD-src-194b462c0ccb16d6302f0a0fb1f5654df3fb3c5d.tar.gz |
Check for duplicate subdisk names
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vinum/vinumconfig.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c index ccb14e1..24df101 100644 --- a/sys/dev/vinum/vinumconfig.c +++ b/sys/dev/vinum/vinumconfig.c @@ -44,7 +44,7 @@ * otherwise) arising in any way out of the use of this software, even if * advised of the possibility of such damage. * - * $Id: config.c,v 1.20 1998/10/26 02:05:34 grog Exp grog $ + * $Id: config.c,v 1.19 1998/10/05 02:48:15 grog Exp grog $ */ #define STATIC /* nothing while we're testing XXX */ @@ -968,6 +968,7 @@ config_subdisk(void) int sectors; /* sector offset value */ int detached = 0; /* set to 1 if this is a detached subdisk */ int sdindex = -1; /* index in plexes subdisk table */ + int namedsdno; sdno = get_empty_sd(); /* allocate an SD to initialize */ sd = &SD[sdno]; /* and get a pointer */ @@ -994,7 +995,9 @@ config_subdisk(void) break; case kw_name: - ++parameter; + namedsdno = find_subdisk(token[++parameter], 0); /* find an existing sd with this name */ + if (namedsdno >= 0) + throw_rude_remark(EINVAL, "Duplicate subdisk %s", token[parameter]); bcopy(token[parameter], sd->name, min(sizeof(sd->name), strlen(token[parameter]))); @@ -1080,6 +1083,7 @@ config_plex(void) struct plex *plex; /* and pointer to it */ int pindex = MAXPLEX; /* index in volume's plex list */ int detached = 0; /* don't give it to a volume */ + int namedplexno; current_plex = -1; /* forget the previous plex */ plexno = get_empty_plex(); /* allocate a plex */ @@ -1092,13 +1096,9 @@ config_plex(void) break; case kw_name: - { - int namedplexno; - - namedplexno = find_plex(token[++parameter], 0); /* find an existing plex with this name */ - if (namedplexno >= 0) - throw_rude_remark(EINVAL, "Duplicate plex %s", token[parameter]); - } + namedplexno = find_plex(token[++parameter], 0); /* find an existing plex with this name */ + if (namedplexno >= 0) + throw_rude_remark(EINVAL, "Duplicate plex %s", token[parameter]); bcopy(token[parameter], /* put in the name */ plex->name, min(MAXPLEXNAME, strlen(token[parameter]))); |