When a driver successfully created a device on demand, we can directly

pick up the DEVFS inode number from the dev_t and find our directory
entry from that, we don't need to scan the directory to find it.

This also solves an issue with on-demand devices in subdirectories.

Submitted by:	cognet
This commit is contained in:
phk 2003-10-20 07:04:09 +00:00
parent ba669f6199
commit c096f8aa94

View File

@ -297,8 +297,9 @@ devfs_lookupx(ap)
struct vnode *dvp, **vpp;
struct thread *td;
struct devfs_dirent *de, *dd;
struct devfs_dirent **dde;
struct devfs_mount *dmp;
dev_t cdev, *cpdev;
dev_t cdev;
int error, flags, nameiop;
char specname[SPECNAMELEN + 1], *pname;
@ -382,13 +383,11 @@ devfs_lookupx(ap)
goto notfound;
devfs_populate(dmp);
dd = dvp->v_data;
TAILQ_FOREACH(de, &dd->de_dlist, de_list) {
cpdev = devfs_itod(de->de_inode);
if (cpdev != NULL && cdev == *cpdev)
goto found;
continue;
dde = devfs_itode(dmp, cdev->si_inode);
if (dde != NULL && *dde != DE_DELETED && *dde != NULL) {
de = *dde;
goto found;
}
notfound: