2b7fa3a8fa 2019-09-20 rkeene: #include <xvfs-core.h>
2b7fa3a8fa 2019-09-20 rkeene: #include <sys/stat.h>
2b7fa3a8fa 2019-09-20 rkeene: #include <unistd.h>
2b7fa3a8fa 2019-09-20 rkeene: #include <string.h>
2b7fa3a8fa 2019-09-20 rkeene: #include <tcl.h>
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: #define XVFS_NAME_LOOKUP_ERROR (-1)
2b7fa3a8fa 2019-09-20 rkeene: #define XVFS_FILE_BLOCKSIZE 1024
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * XXX:TODO: Determine this automatically rather than
2b7fa3a8fa 2019-09-20 rkeene: * by heuristics
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: #define HAVE_STRUCT_STAT_ST_BLKSIZE 1
2b7fa3a8fa 2019-09-20 rkeene: #define HAVE_STRUCT_STAT_ST_BLOCKS 1
2b7fa3a8fa 2019-09-20 rkeene: #ifdef WIN32
2b7fa3a8fa 2019-09-20 rkeene: # undef HAVE_STRUCT_STAT_ST_BLKSIZE
2b7fa3a8fa 2019-09-20 rkeene: # undef HAVE_STRUCT_STAT_ST_BLOCKS
2b7fa3a8fa 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
c57d8bead8 2019-09-20 rkeene: #ifndef MIN
2b7fa3a8fa 2019-09-20 rkeene: #define MIN(a, b) (((a) < (b)) ? (a) : (b))
c57d8bead8 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
c57d8bead8 2019-09-20 rkeene: #ifndef HAVE_DEFINED_XVFS_FILE_TYPE_T
c57d8bead8 2019-09-20 rkeene: #define HAVE_DEFINED_XVFS_FILE_TYPE_T 1
2b7fa3a8fa 2019-09-20 rkeene: typedef enum {
2b7fa3a8fa 2019-09-20 rkeene: XVFS_FILE_TYPE_REG,
2b7fa3a8fa 2019-09-20 rkeene: XVFS_FILE_TYPE_DIR
2b7fa3a8fa 2019-09-20 rkeene: } xvfs_file_type_t;
c57d8bead8 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
c57d8bead8 2019-09-20 rkeene: #ifndef HAVE_DEFINED_XVFS_SIZE_T
c57d8bead8 2019-09-20 rkeene: #define HAVE_DEFINED_XVFS_SIZE_T 1
2b7fa3a8fa 2019-09-20 rkeene: typedef Tcl_WideInt xvfs_size_t;
c57d8bead8 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
c57d8bead8 2019-09-20 rkeene: #ifndef HAVE_DEFINED_XVFS_FILE_DATA
c57d8bead8 2019-09-20 rkeene: #define HAVE_DEFINED_XVFS_FILE_DATA 1
2b7fa3a8fa 2019-09-20 rkeene: struct xvfs_file_data {
2b7fa3a8fa 2019-09-20 rkeene: const char *name;
2b7fa3a8fa 2019-09-20 rkeene: xvfs_file_type_t type;
2b7fa3a8fa 2019-09-20 rkeene: xvfs_size_t size;
2b7fa3a8fa 2019-09-20 rkeene: union {
2b7fa3a8fa 2019-09-20 rkeene: const unsigned char *fileContents;
2b7fa3a8fa 2019-09-20 rkeene: const char **dirChildren;
2b7fa3a8fa 2019-09-20 rkeene: } data;
2b7fa3a8fa 2019-09-20 rkeene: };
c57d8bead8 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: package require xvfs
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: set ::xvfs::hashNameThreshold 3
2b7fa3a8fa 2019-09-20 rkeene: if {[info exists ::env(XVFS_CREATE_HASH_NAME_THRESHOLD)]} {
2b7fa3a8fa 2019-09-20 rkeene: set ::xvfs::hashNameThreshold $::env(XVFS_CREATE_HASH_NAME_THRESHOLD)
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: if {$::xvfs::hashNameThreshold < 0} {
2b7fa3a8fa 2019-09-20 rkeene: set ::xvfs::hashNameThreshold [expr {2**31}]
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: xvfs::main $::xvfs::argv
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: proc emitFilenameVerification {indentLevel outputFileNameLen outputFileIndexes} {
2b7fa3a8fa 2019-09-20 rkeene: set indent [string repeat "\t" $indentLevel]
2b7fa3a8fa 2019-09-20 rkeene: foreach outputFileIndex $outputFileIndexes {
2b7fa3a8fa 2019-09-20 rkeene: ?><?= $indent ?>if (memcmp(path, xvfs_<?= $::xvfs::fsName ?>_data[<?= $outputFileIndex ?>].name, <?= $outputFileNameLen ?>) == 0) {
2b7fa3a8fa 2019-09-20 rkeene: <?= $indent ?> return(<?= $outputFileIndex ?>);
2b7fa3a8fa 2019-09-20 rkeene: <?= $indent ?>}
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: ?>
2b7fa3a8fa 2019-09-20 rkeene: static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) {
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: for {set index 0} {$index < [llength $::xvfs::outputFiles]} {incr index} {
2b7fa3a8fa 2019-09-20 rkeene: set outputFileName [lindex $::xvfs::outputFiles $index]
2b7fa3a8fa 2019-09-20 rkeene: set outputFileNameLen [string length $outputFileName]
2b7fa3a8fa 2019-09-20 rkeene: set outputFileNameHash [zlib adler32 $outputFileName 0]
2b7fa3a8fa 2019-09-20 rkeene: lappend outputFileNameHashToIndex([list $outputFileNameLen $outputFileNameHash]) $index
2b7fa3a8fa 2019-09-20 rkeene: lappend outputFileNameLenToIndex($outputFileNameLen) $index
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: set needZlib false
2b7fa3a8fa 2019-09-20 rkeene: foreach {outputFileNameLen outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileNameLenToIndex]] {
2b7fa3a8fa 2019-09-20 rkeene: if {[llength $outputFileIndexes] > $::xvfs::hashNameThreshold} {
2b7fa3a8fa 2019-09-20 rkeene: set needZlib true
2b7fa3a8fa 2019-09-20 rkeene: break;
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: ?><?
2b7fa3a8fa 2019-09-20 rkeene: if {$needZlib} {
2b7fa3a8fa 2019-09-20 rkeene: ?> unsigned int pathHash;
2b7fa3a8fa 2019-09-20 rkeene: <? } ?> size_t pathLen;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: if (path == NULL) {
2b7fa3a8fa 2019-09-20 rkeene: return(XVFS_NAME_LOOKUP_ERROR);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: pathLen = strlen(path);
2b7fa3a8fa 2019-09-20 rkeene: switch (pathLen) {
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: foreach {outputFileNameLen outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileNameLenToIndex]] {
2b7fa3a8fa 2019-09-20 rkeene: ?> case <?= $outputFileNameLen ?>:
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: if {[llength $outputFileIndexes] > $::xvfs::hashNameThreshold} {
2b7fa3a8fa 2019-09-20 rkeene: ?> pathHash = Tcl_ZlibAdler32(0, (const unsigned char *) path, <?= $outputFileNameLen ?>);
2b7fa3a8fa 2019-09-20 rkeene: switch (pathHash) {
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: foreach {key outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileNameHashToIndex [list $outputFileNameLen *]]] {
2b7fa3a8fa 2019-09-20 rkeene: set outputFileNameHash [lindex $key 1]
2b7fa3a8fa 2019-09-20 rkeene: ?> case <?= $outputFileNameHash ?>:
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: emitFilenameVerification 5 $outputFileNameLen $outputFileIndexes
2b7fa3a8fa 2019-09-20 rkeene: ?> break;
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: ?> }
2b7fa3a8fa 2019-09-20 rkeene: <?
2b7fa3a8fa 2019-09-20 rkeene: } else {
2b7fa3a8fa 2019-09-20 rkeene: emitFilenameVerification 3 $outputFileNameLen $outputFileIndexes
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: ?> break;
2b7fa3a8fa 2019-09-20 rkeene: <? } ?> }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: return(XVFS_NAME_LOOKUP_ERROR);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: static const char **xvfs_<?= $::xvfs::fsName ?>_getChildren(const char *path, Tcl_WideInt *count) {
2b7fa3a8fa 2019-09-20 rkeene: const struct xvfs_file_data *fileInfo;
2b7fa3a8fa 2019-09-20 rkeene: long inode;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Validate input parameters
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (count == NULL) {
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Get the inode from the lookup function
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: inode = xvfs_<?= $::xvfs::fsName ?>_nameToIndex(path);
2b7fa3a8fa 2019-09-20 rkeene: if (inode == XVFS_NAME_LOOKUP_ERROR) {
2b7fa3a8fa 2019-09-20 rkeene: *count = XVFS_RV_ERR_ENOENT;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: fileInfo = &xvfs_<?= $::xvfs::fsName ?>_data[inode];
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Ensure this is a directory
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (fileInfo->type != XVFS_FILE_TYPE_DIR) {
2b7fa3a8fa 2019-09-20 rkeene: *count = XVFS_RV_ERR_ENOTDIR;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: *count = fileInfo->size;
2b7fa3a8fa 2019-09-20 rkeene: return(fileInfo->data.dirChildren);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: static const unsigned char *xvfs_<?= $::xvfs::fsName ?>_getData(const char *path, Tcl_WideInt start, Tcl_WideInt *length) {
2b7fa3a8fa 2019-09-20 rkeene: const struct xvfs_file_data *fileInfo;
2b7fa3a8fa 2019-09-20 rkeene: Tcl_WideInt resultLength;
2b7fa3a8fa 2019-09-20 rkeene: long inode;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Validate input parameters
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (length == NULL) {
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: if (start < 0) {
2b7fa3a8fa 2019-09-20 rkeene: *length = XVFS_RV_ERR_EINVAL;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: if (*length < 0) {
2b7fa3a8fa 2019-09-20 rkeene: *length = XVFS_RV_ERR_EINVAL;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Get the inode from the lookup function
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: inode = xvfs_<?= $::xvfs::fsName ?>_nameToIndex(path);
2b7fa3a8fa 2019-09-20 rkeene: if (inode == XVFS_NAME_LOOKUP_ERROR) {
2b7fa3a8fa 2019-09-20 rkeene: *length = XVFS_RV_ERR_ENOENT;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: fileInfo = &xvfs_<?= $::xvfs::fsName ?>_data[inode];
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Ensure this is a file that can be read
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (fileInfo->type != XVFS_FILE_TYPE_REG) {
2b7fa3a8fa 2019-09-20 rkeene: *length = XVFS_RV_ERR_EISDIR;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Validate the length
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (start > fileInfo->size) {
2b7fa3a8fa 2019-09-20 rkeene: *length = XVFS_RV_ERR_EFAULT;
2b7fa3a8fa 2019-09-20 rkeene: return(NULL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: if (*length == 0) {
2b7fa3a8fa 2019-09-20 rkeene: resultLength = fileInfo->size - start;
2b7fa3a8fa 2019-09-20 rkeene: } else {
2b7fa3a8fa 2019-09-20 rkeene: resultLength = MIN(fileInfo->size - start, *length);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: *length = resultLength;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Return the data
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: return(fileInfo->data.fileContents + start);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: static int xvfs_<?= $::xvfs::fsName ?>_getStat(const char *path, Tcl_StatBuf *statBuf) {
2b7fa3a8fa 2019-09-20 rkeene: const struct xvfs_file_data *fileInfo;
2b7fa3a8fa 2019-09-20 rkeene: long inode;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Validate input parameters
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: if (!statBuf) {
2b7fa3a8fa 2019-09-20 rkeene: return(XVFS_RV_ERR_EINVAL);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: /*
2b7fa3a8fa 2019-09-20 rkeene: * Get the inode from the lookup function
2b7fa3a8fa 2019-09-20 rkeene: */
2b7fa3a8fa 2019-09-20 rkeene: inode = xvfs_<?= $::xvfs::fsName ?>_nameToIndex(path);
2b7fa3a8fa 2019-09-20 rkeene: if (inode == XVFS_NAME_LOOKUP_ERROR) {
2b7fa3a8fa 2019-09-20 rkeene: return(XVFS_RV_ERR_ENOENT);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: fileInfo = &xvfs_<?= $::xvfs::fsName ?>_data[inode];
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_dev = <?= [zlib adler32 $::xvfs::fsName] ?>;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_rdev = <?= [zlib adler32 $::xvfs::fsName] ?>;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_ino = inode;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_uid = 0;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_gid = 0;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_atime = 0;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_ctime = 0;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_mtime = 0;
2b7fa3a8fa 2019-09-20 rkeene: #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_blksize = XVFS_FILE_BLOCKSIZE;
2b7fa3a8fa 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: if (fileInfo->type == XVFS_FILE_TYPE_REG) {
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_mode = 0100444;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_nlink = 1;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_size = fileInfo->size;
2b7fa3a8fa 2019-09-20 rkeene: #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_blocks = (fileInfo->size + statBuf->st_blksize - 1) / statBuf->st_blksize;
2b7fa3a8fa 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene: } else if (fileInfo->type == XVFS_FILE_TYPE_DIR) {
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_mode = 040555;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_nlink = fileInfo->size;
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_size = fileInfo->size;
2b7fa3a8fa 2019-09-20 rkeene: #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
2b7fa3a8fa 2019-09-20 rkeene: statBuf->st_blocks = 1;
2b7fa3a8fa 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: return(0);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: static struct Xvfs_FSInfo xvfs_<?= $::xvfs::fsName ?>_fsInfo = {
2b7fa3a8fa 2019-09-20 rkeene: .protocolVersion = XVFS_PROTOCOL_VERSION,
2b7fa3a8fa 2019-09-20 rkeene: .name = "<?= $::xvfs::fsName ?>",
2b7fa3a8fa 2019-09-20 rkeene: .getChildrenProc = xvfs_<?= $::xvfs::fsName ?>_getChildren,
2b7fa3a8fa 2019-09-20 rkeene: .getDataProc = xvfs_<?= $::xvfs::fsName ?>_getData,
2b7fa3a8fa 2019-09-20 rkeene: .getStatProc = xvfs_<?= $::xvfs::fsName ?>_getStat
2b7fa3a8fa 2019-09-20 rkeene: };
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: int Xvfs_<?= $::xvfs::fsName ?>_Init(Tcl_Interp *interp) {
2b7fa3a8fa 2019-09-20 rkeene: int register_ret;
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: #ifdef USE_TCL_STUBS
2b7fa3a8fa 2019-09-20 rkeene: const char *tclInitStubs_ret;
2b7fa3a8fa 2019-09-20 rkeene: /* Initialize Stubs */
2b7fa3a8fa 2019-09-20 rkeene: tclInitStubs_ret = Tcl_InitStubs(interp, TCL_PATCH_LEVEL, 0);
2b7fa3a8fa 2019-09-20 rkeene: if (!tclInitStubs_ret) {
2b7fa3a8fa 2019-09-20 rkeene: return(TCL_ERROR);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: #endif
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: register_ret = Xvfs_Register(interp, &xvfs_<?= $::xvfs::fsName ?>_fsInfo);
2b7fa3a8fa 2019-09-20 rkeene: if (register_ret != TCL_OK) {
2b7fa3a8fa 2019-09-20 rkeene: return(register_ret);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene:
2b7fa3a8fa 2019-09-20 rkeene: return(TCL_OK);
2b7fa3a8fa 2019-09-20 rkeene: }
2b7fa3a8fa 2019-09-20 rkeene: #undef XVFS_NAME_LOOKUP_ERROR
2b7fa3a8fa 2019-09-20 rkeene: #undef XVFS_FILE_BLOCKSIZE