Check-in [acfc5037c6]
Overview
Comment:Added start of split into standalone/client/flexible modes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: acfc5037c6924ac59fa2e9d2c701ad9adc7436b3a07e93c85f00299e68f1a206
User & Date: rkeene on 2019-05-02 23:11:24
Other Links: manifest | tags
Context
2019-05-02
23:37
More work on splitting up modes check-in: 3e44e1def1 user: rkeene tags: trunk
23:11
Added start of split into standalone/client/flexible modes check-in: acfc5037c6 user: rkeene tags: trunk
23:06
Basic functionality to the point where Tcl_Channel types need to be implemented check-in: d121970301 user: rkeene tags: trunk
Changes

Modified Makefile from [ff706ebdb4] to [f8b4f602df].

1
2
3
4
5
6
7
8
CPPFLAGS := -I. -DUSE_TCL_STUBS=1
CFLAGS   := -fPIC -g3 -ggdb3 -Wall
LDFLAGS  :=
LIBS     := -ltclstub8.6

all: example.so

example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile
|







1
2
3
4
5
6
7
8
CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_MODE=standalone
CFLAGS   := -fPIC -g3 -ggdb3 -Wall
LDFLAGS  :=
LIBS     := -ltclstub8.6

all: example.so

example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile

Modified xvfs-core.c from [449d9d44b1] to [d180e1465c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <xvfs-core.h>
#include <string.h>
#include <tcl.h>

#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"

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) {
	const char *pathStr, *rootStr;
	int pathLen, rootLen;










<







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
#include <xvfs-core.h>
#include <string.h>
#include <tcl.h>

#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"

struct xvfs_tclfs_instance_info {
	struct Xvfs_FSInfo *fsInfo;
	Tcl_Obj            *mountpoint;
};


/*
 * Internal Core Utilities
 */
static const char *xvfs_relativePath(Tcl_Obj *path, struct xvfs_tclfs_instance_info *info) {
	const char *pathStr, *rootStr;
	int pathLen, rootLen;
74
75
76
77
78
79
80

81
82
83

84
85
86
87
88
89
90

	pathStr = xvfs_relativePath(path, instanceInfo);
fprintf(stderr, "Called open(%s)!\n", pathStr);
	
	return(NULL);
}


/*
 * Tcl_Filesystem handlers for the standalone implementation
 */

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) {
	return(xvfs_tclfs_stat(path, statBuf, &xvfs_tclfs_standalone_info));
}







>



>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

	pathStr = xvfs_relativePath(path, instanceInfo);
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) {
	return(xvfs_tclfs_stat(path, statBuf, &xvfs_tclfs_standalone_info));
}
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 *                 then dispatches to the appropriate registered
 *                 handler
 *    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) {
	Tcl_Filesystem *xvfs_tclfs_Info;
	int tcl_ret;
	static int registered = 0;
	
	/*
	 * Ensure this instance is not already registered
	 */







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 *                 then dispatches to the appropriate registered
 *                 handler
 *    3. flexible -- Attempts to find a core Xvfs instance for the
 *                   process at runtime, if found do #2, otherwise
 *                   fallback to #1
 *
 */
int xvfs_standalone_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
	Tcl_Filesystem *xvfs_tclfs_Info;
	int tcl_ret;
	static int registered = 0;
	
	/*
	 * Ensure this instance is not already registered
	 */
185
186
187
188
189
190
191
192
193
194
195

		}
		
		return(tcl_ret);
	}
	
	return(TCL_OK);
}

int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
	return(xvfs_standalone_register(interp, fsInfo));
}








|

|

>
186
187
188
189
190
191
192
193
194
195
196
197
		}
		
		return(tcl_ret);
	}
	
	return(TCL_OK);
}
#else
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
	return(TCL_ERROR);
}
#endif

Modified xvfs-core.h from [9145593486] to [f7f064c7b1].

12
13
14
15
16
17
18




19
20
21
22
struct Xvfs_FSInfo {
	int                      protocolVersion;
	const char               *name;
	xvfs_proc_getChildren_t  getChildrenProc;
	xvfs_proc_getData_t      getDataProc;
	xvfs_proc_getInfo_t      getInfoProc;
};





int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);

#endif







>
>
>
>




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
struct Xvfs_FSInfo {
	int                      protocolVersion;
	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