some cleanup. Add back OFIOCGETOPTNODE.
This commit is contained in:
parent
a790bc7690
commit
1936d0565a
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: openfirmio.c,v 1.1 2000/11/14 06:45:54 matt Exp $ */
|
/* $NetBSD: openfirmio.c,v 1.2 2000/11/14 21:10:05 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -120,6 +120,13 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
|
|||||||
int node, len, ok, error, s;
|
int node, len, ok, error, s;
|
||||||
char *name, *value;
|
char *name, *value;
|
||||||
|
|
||||||
|
if (cmd == OFIOCGETOPTNODE) {
|
||||||
|
s = splhigh();
|
||||||
|
*(int *) data = OF_finddevice("/options");
|
||||||
|
splx(s);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Verify node id */
|
/* Verify node id */
|
||||||
of = (struct ofiocdesc *)data;
|
of = (struct ofiocdesc *)data;
|
||||||
node = of->of_nodeid;
|
node = of->of_nodeid;
|
||||||
@ -188,12 +195,12 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case OFIOCNEXTPROP: {
|
case OFIOCNEXTPROP: {
|
||||||
char newname[33];
|
char newname[32];
|
||||||
if ((flags & FREAD) == 0)
|
if ((flags & FREAD) == 0)
|
||||||
return (EBADF);
|
return (EBADF);
|
||||||
if (node == 0)
|
if (node == 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
if (of->of_namelen != 0 || of->of_name != NULL) {
|
if (of->of_namelen != 0) {
|
||||||
error = openfirmgetstr(of->of_namelen, of->of_name,
|
error = openfirmgetstr(of->of_namelen, of->of_name,
|
||||||
&name);
|
&name);
|
||||||
if (error)
|
if (error)
|
||||||
@ -202,6 +209,10 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
|
|||||||
s = splhigh();
|
s = splhigh();
|
||||||
ok = OF_nextprop(node, name, newname);
|
ok = OF_nextprop(node, name, newname);
|
||||||
splx(s);
|
splx(s);
|
||||||
|
if (ok == 0) {
|
||||||
|
error = ENOENT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (ok == -1) {
|
if (ok == -1) {
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
break;
|
break;
|
||||||
@ -246,7 +257,7 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
|
|||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
of->of_nodeid = node;
|
of->of_nodeid = lastnode = node;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user