Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -3,17 +3,17 @@ example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile ./xvfs-create --directory example --name example > example.c.new mv example.c.new example.c example.o: example.c xvfs-core.h Makefile - cc -Wall -I. -o example.o -c example.c + cc -fPIC -Wall -I. -o example.o -c example.c example.so: example.o Makefile - cc -shared -o example.so example.o + cc -fPIC -shared -o example.so example.o -test: - @echo not implemented +test: example.so + echo 'load ./example.so Xvfs_example; puts OK' | tclsh | grep '^OK$$' clean: rm -f example.so example.o example.c distclean: clean Index: xvfs-core.h ================================================================== --- xvfs-core.h +++ xvfs-core.h @@ -1,6 +1,13 @@ #ifndef XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 #define XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1 + +#include #define XVFS_PROTOCOL_VERSION 1 +typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt limit); +typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt length); + +int Xvfs_Register(const char *fsName, int protocolVersion, xvfs_proc_getChildren_t getChildrenProc, xvfs_proc_getData_t getData); + #endif Index: xvfs.c.rvt ================================================================== --- xvfs.c.rvt +++ xvfs.c.rvt @@ -20,13 +20,22 @@ package require xvfs xvfs::main $argv ?> static const char **xvfs__getChildren(const char *path, Tcl_WideInt limit) { + return(NULL); } static const unsigned char *xvfs__getData(const char *path, Tcl_WideInt start, Tcl_WideInt length) { + return(NULL); } int Xvfs__Init() { - // Init->Register("", XVFS_PROTOCOL_VERSION, xvfs__getChildren, xvfs__getData) + int register_ret; + + register_ret = Xvfs_Register("", XVFS_PROTOCOL_VERSION, xvfs__getChildren, xvfs__getData); + if (register_ret != TCL_OK) { + return(register_ret); + } + + return(TCL_OK); }