Accept the block-device-only devices.
Reported by ragge.
This commit is contained in:
parent
d0c0162e9c
commit
c8d83dee30
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: files.c,v 1.20 2003/01/23 15:03:44 gehenna Exp $ */
|
||||
/* $NetBSD: files.c,v 1.21 2003/01/23 15:05:45 gehenna Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -361,35 +361,35 @@ fixdevsw(void)
|
||||
dm->dm_cmajor);
|
||||
return (1);
|
||||
}
|
||||
} else {
|
||||
if (ht_insert(fixdevmtab, intern(dm->dm_name), dm)) {
|
||||
panic("fixdevsw: %s char %d block %d",
|
||||
dm->dm_name, dm->dm_cmajor,
|
||||
dm->dm_bmajor);
|
||||
}
|
||||
}
|
||||
if (ht_insert(fixdevmtab, intern(dm->dm_name), dm)) {
|
||||
panic("fixdevsw: %s char %d block %d",
|
||||
dm->dm_name, dm->dm_cmajor, dm->dm_bmajor);
|
||||
}
|
||||
|
||||
if (dm->dm_opts != NULL &&
|
||||
!expr_eval(dm->dm_opts, fixsel, NULL))
|
||||
continue;
|
||||
|
||||
if (ht_lookup(cdevmtab, intern(dm->dm_name)) != NULL) {
|
||||
xerror(dm->dm_srcfile, dm->dm_srcline,
|
||||
"device-major of character device '%s' is "
|
||||
"already defined", dm->dm_name);
|
||||
return (1);
|
||||
}
|
||||
(void)snprintf(mstr, sizeof(mstr), "%d", dm->dm_cmajor);
|
||||
if (ht_lookup(cdevmtab, intern(mstr)) != NULL) {
|
||||
xerror(dm->dm_srcfile, dm->dm_srcline,
|
||||
"device-major of character major '%d' "
|
||||
"is already defined", dm->dm_cmajor);
|
||||
return (1);
|
||||
}
|
||||
if (ht_insert(cdevmtab, intern(dm->dm_name), dm) ||
|
||||
ht_insert(cdevmtab, intern(mstr), dm)) {
|
||||
panic("fixdevsw: %s character major %d",
|
||||
dm->dm_name, dm->dm_cmajor);
|
||||
if (dm->dm_cmajor != -1) {
|
||||
if (ht_lookup(cdevmtab, intern(dm->dm_name)) != NULL) {
|
||||
xerror(dm->dm_srcfile, dm->dm_srcline,
|
||||
"device-major of character device '%s' "
|
||||
"is already defined", dm->dm_name);
|
||||
return (1);
|
||||
}
|
||||
(void)snprintf(mstr, sizeof(mstr), "%d", dm->dm_cmajor);
|
||||
if (ht_lookup(cdevmtab, intern(mstr)) != NULL) {
|
||||
xerror(dm->dm_srcfile, dm->dm_srcline,
|
||||
"device-major of character major '%d' "
|
||||
"is already defined", dm->dm_cmajor);
|
||||
return (1);
|
||||
}
|
||||
if (ht_insert(cdevmtab, intern(dm->dm_name), dm) ||
|
||||
ht_insert(cdevmtab, intern(mstr), dm)) {
|
||||
panic("fixdevsw: %s character major %d",
|
||||
dm->dm_name, dm->dm_cmajor);
|
||||
}
|
||||
}
|
||||
if (dm->dm_bmajor != -1) {
|
||||
if (ht_lookup(bdevmtab, intern(dm->dm_name)) != NULL) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
%{
|
||||
/* $NetBSD: gram.y,v 1.39 2002/11/17 23:36:19 thorpej Exp $ */
|
||||
/* $NetBSD: gram.y,v 1.40 2003/01/23 15:05:45 gehenna Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -205,7 +205,8 @@ device_major_block:
|
||||
/* empty */ { $$ = -1; };
|
||||
|
||||
device_major_char:
|
||||
CHAR NUMBER { $$ = $2; };
|
||||
CHAR NUMBER { $$ = $2; } |
|
||||
/* empty */ { $$ = -1; };
|
||||
|
||||
/* order of options is important, must use right recursion */
|
||||
fopts:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sem.c,v 1.35 2002/10/11 01:48:27 thorpej Exp $ */
|
||||
/* $NetBSD: sem.c,v 1.36 2003/01/23 15:05:46 gehenna Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -1116,7 +1116,7 @@ adddevm(const char *name, int cmajor, int bmajor, struct nvlist *options)
|
||||
{
|
||||
struct devm *dm;
|
||||
|
||||
if (cmajor < 0 || cmajor >= 4096) {
|
||||
if (cmajor < -1 || cmajor >= 4096) {
|
||||
error("character major %d is invalid", cmajor);
|
||||
nvfreel(options);
|
||||
return;
|
||||
@ -1127,6 +1127,11 @@ adddevm(const char *name, int cmajor, int bmajor, struct nvlist *options)
|
||||
nvfreel(options);
|
||||
return;
|
||||
}
|
||||
if (cmajor == -1 && bmajor == -1) {
|
||||
error("both character/block majors are not specified");
|
||||
nvfreel(options);
|
||||
return;
|
||||
}
|
||||
|
||||
dm = emalloc(sizeof(*dm));
|
||||
dm->dm_srcfile = yyfile;
|
||||
|
Loading…
Reference in New Issue
Block a user