X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=9fc4417eb958954b448558eb4b45a294332c520b;hp=041287c1e77405a01ee575bb13a4906928fcf0a2;hb=4a700fe570d217c2c5df87070db7c2652bc0eaaf;hpb=25f6e492e7010f585367a4f6abf4d2e17c5c0e1a diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 041287c..9fc4417 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -30,13 +30,6 @@ #define YAFFSFS_RW_SHIFT (13) #define YAFFSFS_RW_SIZE (1<prefix && cfg->dev){ + ylist_for_each(cfg, &yaffsfs_deviceList){ + dev = ylist_entry(cfg, yaffs_Device, devList); leftOver = path; - p = cfg->prefix; + p = dev->param.name; thisMatchLength = 0; matching = 1; @@ -319,16 +318,23 @@ static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath) /* Skip over any /s in leftOver */ while(yaffsfs_IsPathDivider(*leftOver)) leftOver++; - - if( matching && (thisMatchLength > longestMatch)){ - /* Matched prefix */ + // Skip over any /s in p + while(yaffsfs_IsPathDivider(*p)) + p++; + + // p should now be at the end of the string (ie. fully matched) + if(*p) + matching = 0; + + if( matching && (thisMatchLength > longestMatch)) + { + // Matched prefix *restOfPath = (YCHAR *)leftOver; - retval = cfg->dev; + retval = dev; longestMatch = thisMatchLength; } - cfg++; } return retval; } @@ -1091,7 +1097,7 @@ static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf) obj = yaffs_GetEquivalentObject(obj); if(obj && buf){ - buf->st_dev = (int)obj->myDev->context; + buf->st_dev = (int)obj->myDev->osContext; buf->st_ino = obj->objectId; buf->st_mode = obj->yst_mode & ~S_IFMT; /* clear out file type bits */ @@ -1859,26 +1865,23 @@ int yaffs_inodecount(const YCHAR *path) } - -void yaffs_initialise(yaffsfs_DeviceConfiguration *cfgList) +void yaffs_AddDevice(yaffs_Device *dev) { + dev->isMounted = 0; + dev->param.removeObjectCallback = yaffsfs_RemoveObjectCallback; - yaffsfs_DeviceConfiguration *cfg; + if(!dev->devList.next) + YINIT_LIST_HEAD(&dev->devList); - yaffsfs_configurationList = cfgList; - - yaffsfs_InitHandles(); - - cfg = yaffsfs_configurationList; + ylist_add(&dev->devList,&yaffsfs_deviceList); +} - while(cfg && cfg->prefix && cfg->dev){ - cfg->dev->isMounted = 0; - cfg->dev->param.removeObjectCallback = yaffsfs_RemoveObjectCallback; - cfg++; - } +void yaffs_RemoveDevice(yaffs_Device *dev) +{ + ylist_del_init(&dev->devList); +} -} /* Directory search stuff. */