diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index 0e71823..f5e981f 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.8 2004/05/19 15:31:27 reddawg + Fixed up the rest of the references + Revision 1.7 2004/05/19 04:07:42 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been @@ -60,11 +63,15 @@ #include #include #include +#include #include #include #include +static spinLock_t devfsSpinLock = SPIN_LOCK_INITIALIZER; + + int devFSEnable() { //Add DevFS i will if (vfsRegisterFS(1,devFSInit,devFSRead,devFSWrite,devFSOpen,0x0,0x0,0x0,0x0) != 0x0) { @@ -92,6 +99,9 @@ struct devFsInfo *fsInfo = fd->mp->fsInfo; struct devFsDevices *tmpDev = 0x0; struct deviceNode *device = 0x0; + + spinLock(&devfsSpinLock); + for (tmpDev = fsInfo->deviceList;tmpDev != 0x0;tmpDev = tmpDev->next) { if (kstrcmp(tmpDev->devName,file) == 0x0) { switch ((fd->mode & 0x3)) { @@ -103,12 +113,15 @@ break; default: kprintf("Invalid File Mode\n"); - return(0x0); + spinUnlock(&devfsSpinLock); + return(-1); break; } + spinUnlock(&devfsSpinLock); return(0x1); } } + spinUnlock(&devfsSpinLock); return(0x0); } @@ -125,7 +138,7 @@ uInt16 diff = 0x0; struct deviceNode *device = 0x0; struct devFsDevices *tmpDev = (void *)fd->start; - + device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); @@ -178,12 +191,15 @@ struct mountPoints *mp = 0x0; struct devFsInfo *fsInfo = 0x0; struct devFsDevices *tmpDev = 0x0; + + spinLock(&devfsSpinLock); mp = findMount("devfs"); if (mp == 0x0) { kprintf("Error: Can't Find Mount Point\n"); - return(0x0); + spinUnlock(&devfsSpinLock); + return(-1); } fsInfo = mp->fsInfo; @@ -203,6 +219,7 @@ fsInfo->deviceList = tmpDev; - return(0x1); + spinUnlock(&devfsSpinLock); + return(0x0); }