62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
<?
package require xvfs
set ::xvfs::fileInfoStruct [xvfs::main $::xvfs::argv]
?><?= $::xvfs::fileInfoStruct ?>
static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) {
<?
if {[llength $::xvfs::outputFiles] < 3} {
set hashMode perfectHashFunction
} else {
set hashMode hashTable
}
if {$hashMode eq "hashTable"} {
set hashTable [::xvfs::generateHashTable pathIndex path pathLen XVFS_NAME_LOOKUP_ERROR $::xvfs::outputFiles prefix "\t" hashTableSize 30 validate "strcmp(path, xvfs_${::xvfs::fsName}_data\[pathIndex\].name) == 0" onValidated "return(pathIndex);"]
set hashTableHeader [dict get $hashTable header]
puts $hashTableHeader
}
?> long pathIndex;
ssize_t pathLen;
if (path == NULL) {
return(XVFS_NAME_LOOKUP_ERROR);
}
pathLen = strlen(path);
<?
if {$hashMode eq "perfectHashFunction"} {
?>
pathIndex = <?= [::xvfs::generatePerfectHashFunctionCall "path" pathLen XVFS_NAME_LOOKUP_ERROR $::xvfs::outputFiles] ?>;
if (pathIndex < 0 || pathIndex >= <?= [llength $::xvfs::outputFiles] ?>) {
pathIndex = XVFS_NAME_LOOKUP_ERROR;
}
if (pathIndex != XVFS_NAME_LOOKUP_ERROR) {
if (strcmp(path, xvfs_<?= $::xvfs::fsName ?>_data[pathIndex].name) == 0) {
return(pathIndex);
}
}
<?
} else {
puts [dict get $hashTable body]
}
?>
return(XVFS_NAME_LOOKUP_ERROR);
}
static const char **xvfs_<?= $::xvfs::fsName ?>_getChildren(const char *path, Tcl_WideInt *count) {
const struct xvfs_file_data *fileInfo;
long inode;
|
<
<
<
<
<
<
<
|
|
|
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<?
package require xvfs
set ::xvfs::fileInfoStruct [xvfs::main $::xvfs::argv]
?><?= $::xvfs::fileInfoStruct ?>
static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) {
<?
set hashTable [::xvfs::generateHashTable pathIndex path pathLen XVFS_NAME_LOOKUP_ERROR $::xvfs::outputFiles prefix "\t" hashTableSize 30 validate "strcmp(path, xvfs_${::xvfs::fsName}_data\[pathIndex\].name) == 0" onValidated "return(pathIndex);"]
set hashTableHeader [dict get $hashTable header]
?><?= $hashTableHeader ?>
long pathIndex;
ssize_t pathLen;
if (path == NULL) {
return(XVFS_NAME_LOOKUP_ERROR);
}
pathLen = strlen(path);
<?= [dict get $hashTable body] ?>
return(XVFS_NAME_LOOKUP_ERROR);
}
static const char **xvfs_<?= $::xvfs::fsName ?>_getChildren(const char *path, Tcl_WideInt *count) {
const struct xvfs_file_data *fileInfo;
long inode;
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
inode = xvfs_<?= $::xvfs::fsName ?>_nameToIndex(path);
if (inode == XVFS_NAME_LOOKUP_ERROR) {
return(XVFS_RV_ERR_ENOENT);
}
fileInfo = &xvfs_<?= $::xvfs::fsName ?>_data[inode];
statBuf->st_dev = <?= [zlib adler32 $::xvfs::fsName] ?>;
statBuf->st_rdev = <?= [zlib adler32 $::xvfs::fsName] ?>;
statBuf->st_ino = inode;
statBuf->st_uid = 0;
statBuf->st_gid = 0;
statBuf->st_atime = 0;
statBuf->st_ctime = 0;
statBuf->st_mtime = 0;
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
|
|
|
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
inode = xvfs_<?= $::xvfs::fsName ?>_nameToIndex(path);
if (inode == XVFS_NAME_LOOKUP_ERROR) {
return(XVFS_RV_ERR_ENOENT);
}
fileInfo = &xvfs_<?= $::xvfs::fsName ?>_data[inode];
statBuf->st_dev = <?= [zlib adler32 $::xvfs::fsName 0] ?>;
statBuf->st_rdev = <?= [zlib adler32 $::xvfs::fsName 0] ?>;
statBuf->st_ino = inode;
statBuf->st_uid = 0;
statBuf->st_gid = 0;
statBuf->st_atime = 0;
statBuf->st_ctime = 0;
statBuf->st_mtime = 0;
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|