fix config.new's hardcoded partition number problems (read maxpartitions
in from a required keyword, and use it everywhere that's necessary), and also (slightly) clean up the MACHINE_ARCH config file's inclusion.
This commit is contained in:
parent
800be68af6
commit
53dde5bc1c
|
@ -40,7 +40,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)config.h 8.1 (Berkeley) 6/6/93
|
||||
* $Id: config.h,v 1.5 1994/06/22 10:44:06 pk Exp $
|
||||
* $Id: config.h,v 1.6 1995/01/25 20:44:39 cgd Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -204,6 +204,7 @@ int minmaxusers; /* minimum "maxusers" parameter */
|
|||
int defmaxusers; /* default "maxusers" parameter */
|
||||
int maxmaxusers; /* default "maxusers" parameter */
|
||||
int maxusers; /* configuration's "maxusers" parameter */
|
||||
int maxpartitions; /* configuration's "maxpartitions" parameter */
|
||||
struct nvlist *options; /* options */
|
||||
struct nvlist *mkoptions; /* makeoptions */
|
||||
struct hashtab *devbasetab; /* devbase lookup */
|
||||
|
|
|
@ -42,11 +42,12 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)gram.y 8.1 (Berkeley) 6/6/93
|
||||
* $Id: gram.y,v 1.5 1994/06/22 10:44:09 pk Exp $
|
||||
* $Id: gram.y,v 1.6 1995/01/25 20:44:41 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <ctype.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -78,6 +79,7 @@ static int adepth;
|
|||
|
||||
static void cleanup __P((void));
|
||||
static void setmachine __P((const char *, const char *));
|
||||
static void setmaxpartitions __P((int));
|
||||
|
||||
%}
|
||||
|
||||
|
@ -90,8 +92,8 @@ static void setmachine __P((const char *, const char *));
|
|||
}
|
||||
|
||||
%token AND AT COMPILE_WITH CONFIG DEFINE DEVICE DUMPS ENDFILE
|
||||
%token XFILE FLAGS INCLUDE XMACHINE MAJOR MAKEOPTIONS MAXUSERS MINOR
|
||||
%token ON OPTIONS PSEUDO_DEVICE ROOT SWAP VECTOR
|
||||
%token XFILE FLAGS INCLUDE XMACHINE MAJOR MAKEOPTIONS MAXUSERS MAXPARTITIONS
|
||||
%token MINOR ON OPTIONS PSEUDO_DEVICE ROOT SWAP VECTOR
|
||||
%token <val> FFLAG NUMBER
|
||||
%token <str> PATHNAME WORD
|
||||
|
||||
|
@ -126,6 +128,7 @@ Configuration:
|
|||
hdrs machine_spec /* "machine foo" from machine descr. */
|
||||
dev_defs dev_eof /* ../../conf/devices */
|
||||
dev_defs dev_eof /* devices.foo */
|
||||
maxpart_spec dev_defs dev_eof /* ../../conf/devices */
|
||||
specs; /* rest of machine description */
|
||||
|
||||
hdrs:
|
||||
|
@ -144,7 +147,13 @@ machine_spec:
|
|||
dev_eof:
|
||||
ENDFILE = { enddefs(lastfile); checkfiles(); };
|
||||
|
||||
maxpart_blanks:
|
||||
maxpart_blanks '\n' |
|
||||
/* empty */;
|
||||
|
||||
maxpart_spec:
|
||||
maxpart_blanks MAXPARTITIONS NUMBER = { setmaxpartitions($3); } |
|
||||
error = { stop("cannot proceed without maxpartitions specifier"); };
|
||||
|
||||
/*
|
||||
* Various nonterminals shared between the grammars.
|
||||
|
@ -393,10 +402,20 @@ setmachine(mch, mcharch)
|
|||
if (machinearch != NULL)
|
||||
(void)sprintf(archbuf, "../../%s/conf/files.%s.newconf",
|
||||
machinearch, machinearch);
|
||||
else
|
||||
strncpy(archbuf, _PATH_DEVNULL, MAXPATHLEN);
|
||||
(void)sprintf(buf, "files.%s.newconf", machine);
|
||||
|
||||
if (include(buf, ENDFILE) ||
|
||||
(machinearch != NULL && include(archbuf, '\n')) ||
|
||||
include(archbuf, ENDFILE) ||
|
||||
include("../../../conf/files.newconf", ENDFILE))
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
setmaxpartitions(n)
|
||||
int n;
|
||||
{
|
||||
|
||||
maxpartitions = n;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)main.c 8.1 (Berkeley) 6/6/93
|
||||
* $Id: main.c,v 1.6 1995/01/25 03:58:57 cgd Exp $
|
||||
* $Id: main.c,v 1.7 1995/01/25 20:44:42 cgd Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
@ -391,12 +391,12 @@ cfcrosscheck(cf, what, nv)
|
|||
if (dev == NULL)
|
||||
panic("cfcrosscheck(%s)", nv->nv_name);
|
||||
if (has_instances(dev, STAR) ||
|
||||
has_instances(dev, minor(nv->nv_int) >> 3))
|
||||
has_instances(dev, minor(nv->nv_int) / maxpartitions))
|
||||
continue;
|
||||
for (pd = allpseudo; pd != NULL; pd = pd->i_next)
|
||||
if (pd->i_base == dev &&
|
||||
minor(nv->nv_int) >> 3 < dev->d_umax &&
|
||||
minor(nv->nv_int) >> 3 >= 0)
|
||||
(minor(nv->nv_int) / maxpartitions) < dev->d_umax &&
|
||||
(minor(nv->nv_int) / maxpartitions) >= 0)
|
||||
goto loop;
|
||||
(void)fprintf(stderr,
|
||||
"%s%d: %s says %s on %s, but there's no %s\n",
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)scan.l 8.1 (Berkeley) 6/6/93
|
||||
* $Id: scan.l,v 1.5 1994/08/08 19:24:54 deraadt Exp $
|
||||
* $Id: scan.l,v 1.6 1995/01/25 20:44:43 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -97,6 +97,7 @@ machine { return XMACHINE; }
|
|||
major { return MAJOR; }
|
||||
makeoptions { return MAKEOPTIONS; }
|
||||
maxusers { return MAXUSERS; }
|
||||
maxpartitions { return MAXPARTITIONS; }
|
||||
minor { return MINOR; }
|
||||
on { return ON; }
|
||||
options { return OPTIONS; }
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sem.c 8.1 (Berkeley) 6/6/93
|
||||
* $Id: sem.c,v 1.6 1994/07/01 09:15:53 pk Exp $
|
||||
* $Id: sem.c,v 1.7 1995/01/25 20:44:44 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -420,7 +420,7 @@ exclude(nv, name, what)
|
|||
}
|
||||
|
||||
/*
|
||||
* Map things like "ra0b" => makedev(major("ra"), 0*8 + 'b'-'a').
|
||||
* Map things like "ra0b" => makedev(major("ra"), 0*maxpartitions + 'b'-'a').
|
||||
* Handle the case where the device number is given but there is no
|
||||
* corresponding name, and map NULL to the default.
|
||||
*/
|
||||
|
@ -438,7 +438,7 @@ resolve(nvp, name, what, dflt, part)
|
|||
int unit;
|
||||
char buf[NAMESIZE];
|
||||
|
||||
if ((u_int)(part -= 'a') >= 7)
|
||||
if ((u_int)(part -= 'a') >= maxpartitions)
|
||||
panic("resolve");
|
||||
if ((nv = *nvp) == NULL) {
|
||||
dev_t d = NODEV;
|
||||
|
@ -448,7 +448,7 @@ resolve(nvp, name, what, dflt, part)
|
|||
*/
|
||||
if (dflt->nv_int != NODEV) {
|
||||
maj = major(dflt->nv_int);
|
||||
min = (minor(dflt->nv_int) & ~7) | part;
|
||||
min = (minor(dflt->nv_int) / maxpartitions) + part;
|
||||
d = makedev(maj, min);
|
||||
}
|
||||
*nvp = nv = newnv(NULL, NULL, NULL, d);
|
||||
|
@ -467,7 +467,7 @@ resolve(nvp, name, what, dflt, part)
|
|||
(void)sprintf(buf, "<%d/%d>", maj, min);
|
||||
else
|
||||
(void)sprintf(buf, "%s%d%c", dev->d_name,
|
||||
min >> 3, (min & 7) + 'a');
|
||||
min / maxpartitions, (min % maxpartitions) + 'a');
|
||||
nv->nv_str = intern(buf);
|
||||
return (0);
|
||||
}
|
||||
|
@ -485,7 +485,8 @@ resolve(nvp, name, what, dflt, part)
|
|||
*/
|
||||
l = strlen(nv->nv_str);
|
||||
cp = &nv->nv_str[l];
|
||||
if (l > 1 && *--cp >= 'a' && *cp <= 'h' && isdigit(cp[-1])) {
|
||||
if (l > 1 && *--cp >= 'a' && *cp <= 'a'+maxpartitions &&
|
||||
isdigit(cp[-1])) {
|
||||
l--;
|
||||
part = *cp - 'a';
|
||||
}
|
||||
|
@ -501,7 +502,7 @@ resolve(nvp, name, what, dflt, part)
|
|||
return (1);
|
||||
}
|
||||
nv->nv_name = dev->d_name;
|
||||
nv->nv_int = makedev(dev->d_major, unit * 8 + part);
|
||||
nv->nv_int = makedev(dev->d_major, unit * maxpartitions + part);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue