55
56
57
58
59
60
61
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
|
55
56
57
58
59
60
61
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
|
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
+
+
|
<?
package require xvfs
xvfs::main $::xvfs::argv
?>
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;
?> 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;
|