Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -1,6 +1,6 @@ -CPPFLAGS := -I. -DUSE_TCL_STUBS=1 +CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_MODE=standalone CFLAGS := -fPIC -g3 -ggdb3 -Wall LDFLAGS := LIBS := -ltclstub8.6 all: example.so Index: xvfs-core.c ================================================================== --- xvfs-core.c +++ xvfs-core.c @@ -6,11 +6,10 @@ struct xvfs_tclfs_instance_info { struct Xvfs_FSInfo *fsInfo; Tcl_Obj *mountpoint; }; -static struct xvfs_tclfs_instance_info xvfs_tclfs_standalone_info; /* * Internal Core Utilities */ static const char *xvfs_relativePath(Tcl_Obj *path, struct xvfs_tclfs_instance_info *info) { @@ -76,13 +75,15 @@ fprintf(stderr, "Called open(%s)!\n", pathStr); return(NULL); } +#if XVFS_MODE == standalone /* * Tcl_Filesystem handlers for the standalone implementation */ +static struct xvfs_tclfs_instance_info xvfs_tclfs_standalone_info; static int xvfs_tclfs_standalone_pathInFilesystem(Tcl_Obj *path, ClientData *dataPtr) { return(xvfs_tclfs_pathInFilesystem(path, dataPtr, &xvfs_tclfs_standalone_info)); } static int xvfs_tclfs_standalone_stat(Tcl_Obj *path, Tcl_StatBuf *statBuf) { @@ -108,11 +109,11 @@ * 3. flexible -- Attempts to find a core Xvfs instance for the * process at runtime, if found do #2, otherwise * fallback to #1 * */ -static int xvfs_standalone_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) { +int xvfs_standalone_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) { Tcl_Filesystem *xvfs_tclfs_Info; int tcl_ret; static int registered = 0; /* @@ -187,9 +188,10 @@ return(tcl_ret); } return(TCL_OK); } - +#else int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) { - return(xvfs_standalone_register(interp, fsInfo)); + return(TCL_ERROR); } +#endif Index: xvfs-core.h ================================================================== --- xvfs-core.h +++ xvfs-core.h @@ -14,9 +14,13 @@ const char *name; xvfs_proc_getChildren_t getChildrenProc; xvfs_proc_getData_t getDataProc; xvfs_proc_getInfo_t getInfoProc; }; + +#if XVFS_MODE == standalone +#define Xvfs_Register(interp, fsInfo) xvfs_standalone_register(interp, fsInfo) +#endif int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo); #endif