Index: xvfs.c.rvt ================================================================== --- xvfs.c.rvt +++ xvfs.c.rvt @@ -3,10 +3,12 @@ #include #include #include #define XVFS_NAME_LOOKUP_ERROR (-1) +#define XVFS_FILE_BLOCKSIZE 1024 + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) typedef enum { XVFS_FILE_TYPE_REG, XVFS_FILE_TYPE_DIR @@ -27,21 +29,38 @@ static long xvfs__nameToIndex(const char *path) { + unsigned int pathHash; + if (path == NULL) { return(XVFS_NAME_LOOKUP_ERROR); } - - - if (strcmp(path, "") == 0) { - return(); + set outputFileHash [zlib adler32 $outputFile 0] + lappend outputFileHashToIndex($outputFileHash) $index } + + foreach {outputFileHash outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileHashToIndex]] { +?> case : + if (strcmp(path, xvfs__data[].name) == 0) { + return(); + } + break; + } + return(XVFS_NAME_LOOKUP_ERROR); } static const char **xvfs__getChildren(const char *path, Tcl_WideInt *count) { struct xvfs_file_data *fileInfo; @@ -160,11 +179,11 @@ statBuf->st_uid = -1; statBuf->st_gid = -1; statBuf->st_atime = 0; statBuf->st_ctime = 0; statBuf->st_mtime = 0; - statBuf->st_blksize = 1024; + statBuf->st_blksize = XVFS_FILE_BLOCKSIZE; if (fileInfo->type == XVFS_FILE_TYPE_REG) { statBuf->st_mode = 0400; statBuf->st_nlink = 1; statBuf->st_size = fileInfo->size;