Overview
Comment: | Use adler32 to hash values |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fb9dd5d783a3f485c5f45948d6c3cbea |
User & Date: | rkeene on 2019-05-03 22:18:54 |
Other Links: | manifest | tags |
Context
2019-05-03
| ||
22:30 | Slightly better optimizations check-in: 73cbe7370b user: rkeene tags: trunk | |
22:18 | Use adler32 to hash values check-in: fb9dd5d783 user: rkeene tags: trunk | |
13:30 | Added start of flexible mode check-in: 88f96696b7 user: rkeene tags: trunk | |
Changes
Modified xvfs.c.rvt from [eb4591d1ce] to [57ce2c31b4].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <xvfs-core.h> #include <unistd.h> #include <string.h> #include <tcl.h> #include <sys/stat.h> #define XVFS_NAME_LOOKUP_ERROR (-1) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) typedef enum { XVFS_FILE_TYPE_REG, XVFS_FILE_TYPE_DIR } xvfs_file_type_t; | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <xvfs-core.h> #include <unistd.h> #include <string.h> #include <tcl.h> #include <sys/stat.h> #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 } xvfs_file_type_t; |
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 | }; <? package require xvfs xvfs::main $argv ?> static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) { if (path == NULL) { return(XVFS_NAME_LOOKUP_ERROR); } | > > | > > > | > > > | > | > > > | | > > > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | }; <? package require xvfs xvfs::main $argv ?> static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) { unsigned int pathHash; if (path == NULL) { return(XVFS_NAME_LOOKUP_ERROR); } pathHash = Tcl_ZlibAdler32(0, (const unsigned char *) path, strlen(path)); switch (pathHash) { <? for {set index 0} {$index < [llength $::xvfs::outputFiles]} {incr index} { set outputFile [lindex $::xvfs::outputFiles $index] set outputFileHash [zlib adler32 $outputFile 0] lappend outputFileHashToIndex($outputFileHash) $index } foreach {outputFileHash outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileHashToIndex]] { ?> case <?= $outputFileHash ?>: <? foreach outputFileIndex $outputFileIndexes { ?> if (strcmp(path, xvfs_<?= $::xvfs::fsName ?>_data[<?= $outputFileIndex ?>].name) == 0) { return(<?= $outputFileIndex ?>); } <? } ?> break; <? } ?> } return(XVFS_NAME_LOOKUP_ERROR); } static const char **xvfs_<?= $::xvfs::fsName ?>_getChildren(const char *path, Tcl_WideInt *count) { struct xvfs_file_data *fileInfo; long inode; |
︙ | ︙ | |||
158 159 160 161 162 163 164 | statBuf->st_rdev = 0; statBuf->st_ino = inode; statBuf->st_uid = -1; statBuf->st_gid = -1; statBuf->st_atime = 0; statBuf->st_ctime = 0; statBuf->st_mtime = 0; | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | statBuf->st_rdev = 0; statBuf->st_ino = inode; statBuf->st_uid = -1; statBuf->st_gid = -1; statBuf->st_atime = 0; statBuf->st_ctime = 0; statBuf->st_mtime = 0; 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; statBuf->st_blocks = (fileInfo->size + statBuf->st_blksize - 1) / statBuf->st_blksize; } else if (fileInfo->type == XVFS_FILE_TYPE_DIR) { |
︙ | ︙ |