From 1936d0565af1e1a4e7105147f1d4ac46d755a0cb Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 14 Nov 2000 21:10:05 +0000 Subject: [PATCH] some cleanup. Add back OFIOCGETOPTNODE. --- sys/dev/ofw/openfirmio.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index a7d50fab17d5..8acf9d46b7a3 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -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 @@ -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; char *name, *value; + if (cmd == OFIOCGETOPTNODE) { + s = splhigh(); + *(int *) data = OF_finddevice("/options"); + splx(s); + return (0); + } + /* Verify node id */ of = (struct ofiocdesc *)data; node = of->of_nodeid; @@ -188,12 +195,12 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) #endif case OFIOCNEXTPROP: { - char newname[33]; + char newname[32]; if ((flags & FREAD) == 0) return (EBADF); if (node == 0) return (EINVAL); - if (of->of_namelen != 0 || of->of_name != NULL) { + if (of->of_namelen != 0) { error = openfirmgetstr(of->of_namelen, of->of_name, &name); if (error) @@ -202,6 +209,10 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) s = splhigh(); ok = OF_nextprop(node, name, newname); splx(s); + if (ok == 0) { + error = ENOENT; + break; + } if (ok == -1) { error = EINVAL; break; @@ -246,7 +257,7 @@ openfirmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) error = ENOENT; break; } - of->of_nodeid = node; + of->of_nodeid = lastnode = node; break; default: