Check-in [3e44e1def1]
Overview
Comment:More work on splitting up modes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3e44e1def1cbf31a1ac810522b72d8d9818bbbd8fb8b831826f06422e1ae8f14
User & Date: rkeene on 2019-05-02 23:37:38
Other Links: manifest | tags
Context
2019-05-03
13:30
Added start of flexible mode check-in: 88f96696b7 user: rkeene tags: trunk
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
Changes

Modified Makefile from [f8b4f602df] to [0d56f35fbc].

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
|







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 [d180e1465c] to [6b6c879bfa].

1
2
3
4

5
6
7
8
9
10
11
#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;
};





>







1
2
3
4
5
6
7
8
9
10
11
12
#include <xvfs-core.h>
#include <string.h>
#include <tcl.h>

#if defined(XVFS_MODE_SERVER) || defined(XVFS_MODE_STANDALONE) || defined(XVFS_MODE_FLEXIBLE)
#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"

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

72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
	const char *pathStr;

	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));
}







>

|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	const char *pathStr;

	pathStr = xvfs_relativePath(path, instanceInfo);
fprintf(stderr, "Called open(%s)!\n", pathStr);
	
	return(NULL);
}
#endif /* XVFS_MODE_SERVER || XVFS_MODE_STANDALONE || XVFS_MODE_FLEIXBLE */

#if defined(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));
}
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	if (!xvfs_tclfs_Info) {
		if (interp) {
			Tcl_SetResult(interp, "Unable to allocate Tcl_Filesystem object", NULL);
		}
		return(TCL_ERROR);
	}
	
	xvfs_tclfs_Info->typeName                   = strdup("xvfs");
	xvfs_tclfs_Info->structureLength            = sizeof(*xvfs_tclfs_Info);
	xvfs_tclfs_Info->version                    = TCL_FILESYSTEM_VERSION_1;
	xvfs_tclfs_Info->pathInFilesystemProc       = xvfs_tclfs_standalone_pathInFilesystem;
	xvfs_tclfs_Info->dupInternalRepProc         = NULL;
	xvfs_tclfs_Info->freeInternalRepProc        = NULL;
	xvfs_tclfs_Info->internalToNormalizedProc   = NULL;
	xvfs_tclfs_Info->createInternalRepProc      = NULL;







|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	if (!xvfs_tclfs_Info) {
		if (interp) {
			Tcl_SetResult(interp, "Unable to allocate Tcl_Filesystem object", NULL);
		}
		return(TCL_ERROR);
	}
	
	xvfs_tclfs_Info->typeName                   = "xvfs";
	xvfs_tclfs_Info->structureLength            = sizeof(*xvfs_tclfs_Info);
	xvfs_tclfs_Info->version                    = TCL_FILESYSTEM_VERSION_1;
	xvfs_tclfs_Info->pathInFilesystemProc       = xvfs_tclfs_standalone_pathInFilesystem;
	xvfs_tclfs_Info->dupInternalRepProc         = NULL;
	xvfs_tclfs_Info->freeInternalRepProc        = NULL;
	xvfs_tclfs_Info->internalToNormalizedProc   = NULL;
	xvfs_tclfs_Info->createInternalRepProc      = NULL;
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







|
>
>




188
189
190
191
192
193
194
195
196
197
198
199
200
201
		}
		
		return(tcl_ret);
	}
	
	return(TCL_OK);
}
#endif

#if defined(XVFS_MODE_SERVER)
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
	return(TCL_ERROR);
}
#endif

Modified xvfs-core.h from [f7f064c7b1] to [51b24fa92d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20






21






























22
23
24
25
26
#ifndef XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
#define XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1

#include <tcl.h>

#define XVFS_PROTOCOL_VERSION 1

typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt *count);
typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt *length);
typedef int (*xvfs_proc_getInfo_t)(const char *path, Tcl_StatBuf *statBuf);

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
|
|

















>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


<


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
#ifndef XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
#define XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1

#include <tcl.h>

#define XVFS_PROTOCOL_VERSION 1

typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt *count);
typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt *length);
typedef int (*xvfs_proc_getInfo_t)(const char *path, Tcl_StatBuf *statBuf);

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

#define XVFS_REGISTER_INTERFACE(name) int name(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);

#if defined(XVFS_MODE_STANDALONE)
/*
 * In standalone mode, we just redefine calls to
 * Xvfs_Register() to go to the xvfs_standalone_register()
 * function
 */
#  define Xvfs_Register xvfs_standalone_register
XVFS_REGISTER_INTERFACE(Xvfs_Register)

#elif defined(XVFS_MODE_FLEXIBLE)
/*
 * In flexible mode we declare an external symbol named
 * Xvfs_Register(), as well as an internal symbol called
 * xvfs_flexible_register(), which we redefine future
 * calls to Xvfs_Register() to invoke
 */
extern XVFS_REGISTER_INTERFACE(Xvfs_Register)
#  define Xvfs_Register xvfs_flexible_register
XVFS_REGISTER_INTERFACE(Xvfs_Register)

#elif defined(XVFS_MODE_CLIENT)
/*
 * In client mode we declare an external symbol named
 * Xvfs_Register() that must be provided by the environment
 * we are loaded into
 */
extern XVFS_REGISTER_INTERFACE(Xvfs_Register)

#elif defined(XVFS_MODE_SERVER)
/*
 * In server mode we are going to implementing Xvfs_Register()
 * for flexible/client modes, just forward declare it
 */
XVFS_REGISTER_INTERFACE(Xvfs_Register)

#else
#  error Unsupported XVFS_MODE
#endif



#endif