Add OPIOCFINDDEVICE to match dev/ofw/openfirmio.[ch].

This commit is contained in:
briggs 2002-01-10 20:38:11 +00:00
parent 7b6f872d11
commit e44b2beeac
2 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: openpromio.h,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */
/* $NetBSD: openpromio.h,v 1.2 2002/01/10 20:38:11 briggs Exp $ */
/*
* Copyright (c) 1992, 1993
@ -58,3 +58,4 @@ struct opiocdesc {
#define OPIOCGETOPTNODE _IOR('O', 4, int) /* get openprom field */
#define OPIOCGETNEXT _IOWR('O', 5, int) /* get next node of node */
#define OPIOCGETCHILD _IOWR('O', 6, int) /* get first child of node */
#define OPIOCFINDDEVICE _IOWR('O', 7, struct opiocdesc) /* find a specific device */

View File

@ -1,4 +1,4 @@
/* $NetBSD: openprom.c,v 1.5 2002/01/10 16:04:43 briggs Exp $ */
/* $NetBSD: openprom.c,v 1.6 2002/01/10 20:38:11 briggs Exp $ */
/*
* Copyright (c) 1992, 1993
@ -259,6 +259,20 @@ openpromioctl(dev, cmd, data, flags, p)
*(int *)data = lastnode = node;
break;
case OPIOCFINDDEVICE:
if ((flags & FREAD) == 0)
return (EBADF);
error = openpromgetstr(op->op_namelen, op->op_name, &name);
if (error)
break;
node = OF_finddevice(name);
if (node == 0 || node == -1) {
error = ENOENT;
break;
}
op->op_nodeid = lastnode = node;
break;
default:
return (ENOTTY);
}