Check-in [a101629cc6]
Overview
Comment:Restructured things a bit
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a101629cc65bfd4c6af12cc943f389d7449b26e069843b6bced6c80472be641b
User & Date: rkeene on 2019-09-17 05:43:49
Other Links: manifest | tags
Context
2019-09-17
14:34
Ignore coverage files check-in: 61f76061a1 user: rkeene tags: trunk
05:43
Restructured things a bit check-in: a101629cc6 user: rkeene tags: trunk
05:06
Undefine macros because we may concatencat translation units in some modes check-in: 5f2895faba user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [8344e93bfa] to [adc97ad9ab].

1
2
3
4




5
6
7
8
1
2
3
4
5
6
7
8
9
10
11
12




+
+
+
+




example.c.new
example.c
example.o
example.so
example-client.o
example-client.so
example-server.o
example-server.so
xvfs-core.o
xvfs-create-standalone.new
xvfs-create-standalone
__test__.tcl

Modified Makefile from [ba72f8ca71] to [4529931791].

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
63
64
65
66
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

63
64
65
66
67
68
69
70
71
72






-
+














+
+
+



-
-
+
+









-
+

-
-
-
+
+
+
+
+

















-
+
+








CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_DEBUG $(XVFS_ADD_CPPFLAGS)
CFLAGS   := -fPIC -g3 -ggdb3 -Wall $(XVFS_ADD_CFLAGS)
LDFLAGS  := $(XVFS_ADD_LDFLAGS)
LIBS     := -ltclstub8.6
TCLSH    := tclsh

all: example.so example-client-server.so
all: example.so example-client.so example-server.so

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 xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example.o -c example.c

example.so: example.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example.so example.o $(LIBS)

example-client.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-client.o -c example.c

example-client.so: example-client.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client.so example-client.o $(LIBS)

example-server.o: xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o example-server.o -c xvfs-core.c

example-client-server.so: example-client.o example-server.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client-server.so example-client.o example-server.o $(LIBS)
example-server.so: example-server.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-server.so example-server.o $(LIBS)

# xvfs-create-standalone is a standalone (i.e., no external dependencies
# like lib/minirivet, xvfs-core.c, etc) version of "xvfs-create"
xvfs-create-standalone: $(shell find lib -type f) xvfs-create xvfs-core.c xvfs-core.h xvfs.c.rvt Makefile
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	./xvfs-create --dump-tcl --remove-debug > xvfs-create-standalone.new
	chmod +x xvfs-create-standalone.new
	mv xvfs-create-standalone.new xvfs-create-standalone

test: example.so example-client-server.so Makefile
test: example.so example-server.so example-client.so Makefile
	rm -f __test__.tcl
	echo 'if {[catch { load $$::env(XVFS_SHARED_OBJECT) Xvfs_example; source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	XVFS_SHARED_OBJECT=./example.so $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)
	XVFS_SHARED_OBJECT=./example-client-server.so $(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)
	echo 'if {[catch { load ./example.so Xvfs_example; source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)
	rm -f __test__.tcl
	echo 'if {[catch { load ./example-server.so Xvfs; load ./example-client.so Xvfs_example; source //xvfs:/example/main.tcl }]} { puts stderr $$::errorInfo; exit 1 }; exit 0' > __test__.tcl
	$(GDB) $(TCLSH) __test__.tcl $(TCL_TEST_ARGS)
	rm -f __test__.tcl

coverage:
	$(MAKE) clean
	$(MAKE) example.so XVFS_ADD_CFLAGS=-coverage XVFS_ADD_LDFLAGS=-coverage
	$(MAKE) test XVFS_TEST_EXIT_ON_FAILURE=0
	rm -f xvfs-test-coverage.info
	lcov --capture --directory . --output-file xvfs-test-coverage.info
	rm -rf xvfs-test-coverage
	mkdir xvfs-test-coverage
	genhtml xvfs-test-coverage.info --output-directory xvfs-test-coverage
	rm -f xvfs-test-coverage.info

clean:
	rm -f xvfs-create-standalone.new xvfs-create-standalone
	rm -f example.c example.c.new
	rm -f example.so example.o
	rm -f example-client.o example-server.o example-client-server.so
	rm -f example-client.o example-server.o
	rm -f example-client.so example-server.so
	rm -f example.gcda example.gcno
	rm -f __test__.tcl
	rm -f xvfs-test-coverage.info
	rm -rf xvfs-test-coverage

distclean: clean

.PHONY: all clean distclean test coverage

Modified xvfs-core.c from [b50c976369] to [1493b408fe].

984
985
986
987
988
989
990
991

992
993
994
995
996
997
998
984
985
986
987
988
989
990

991
992
993
994
995
996
997
998







-
+







#endif /* XVFS_MODE_FLEXIBLE */

#if defined(XVFS_MODE_SERVER)
static Tcl_Filesystem xvfs_tclfs_dispatch_fs;
static Tcl_HashTable xvfs_tclfs_dispatch_map;
static struct xvfs_tclfs_server_info xvfs_tclfs_dispatch_fsdata;

static int xvfs_tclfs_dispatch_pathInFilesystem(Tcl_Obj *path, ClientData *dataPtr) {
static int xvfs_tclfs_dispatch_pathInFS(Tcl_Obj *path, ClientData *dataPtr) {
	const char *pathStr, *rootStr;
	int pathLen, rootLen;

	XVFS_DEBUG_ENTER;

	XVFS_DEBUG_PRINTF("Verifying that \"%s\" belongs in XVFS ...", Tcl_GetString(path));
	
1024
1025
1026
1027
1028
1029
1030
1031

1032
1033
1034
1035
1036
1037
1038
1024
1025
1026
1027
1028
1029
1030

1031
1032
1033
1034
1035
1036
1037
1038







-
+







	Tcl_HashEntry *mapEntry;
	struct xvfs_tclfs_instance_info *retval;
	int rootLen;
	char *pathStr, *fsName, *fsNameEnds, origSep;

	XVFS_DEBUG_ENTER;

	if (xvfs_tclfs_dispatch_pathInFilesystem(path, NULL) != TCL_OK) {
	if (xvfs_tclfs_dispatch_pathInFS(path, NULL) != TCL_OK) {
		XVFS_DEBUG_LEAVE;

		return(NULL);
	}

	rootLen = strlen(XVFS_ROOT_MOUNTPOINT);
	pathStr = Tcl_GetString(path);
1110
1111
1112
1113
1114
1115
1116









1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127

1128
1129
1130
1131
1132
1133
1134
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135

1136
1137
1138
1139
1140
1141
1142
1143







+
+
+
+
+
+
+
+
+










-
+








	return(xvfs_tclfs_matchInDir(interp, resultPtr, pathPtr, pattern, types, instanceInfo));
}

int Xvfs_Init(Tcl_Interp *interp) {
	static int registered = 0;
	int tclRet;

#ifdef USE_TCL_STUBS
	const char *tclInitStubs_ret;
	/* Initialize Stubs */
	tclInitStubs_ret = Tcl_InitStubs(interp, TCL_PATCH_LEVEL, 0);
	if (!tclInitStubs_ret) {
		return(TCL_ERROR);
	}
#endif

	/* XXX:TODO: Make this thread-safe */
	if (registered) {
		return(TCL_OK);
	}
	registered = 1;

	xvfs_tclfs_dispatch_fs.typeName                   = "xvfsDispatch";
	xvfs_tclfs_dispatch_fs.structureLength            = sizeof(xvfs_tclfs_dispatch_fs);
	xvfs_tclfs_dispatch_fs.version                    = TCL_FILESYSTEM_VERSION_1;
	xvfs_tclfs_dispatch_fs.pathInFilesystemProc       = xvfs_tclfs_dispatch_pathInFilesystem;
	xvfs_tclfs_dispatch_fs.pathInFilesystemProc       = xvfs_tclfs_dispatch_pathInFS;
	xvfs_tclfs_dispatch_fs.dupInternalRepProc         = NULL;
	xvfs_tclfs_dispatch_fs.freeInternalRepProc        = NULL;
	xvfs_tclfs_dispatch_fs.internalToNormalizedProc   = NULL;
	xvfs_tclfs_dispatch_fs.createInternalRepProc      = NULL;
	xvfs_tclfs_dispatch_fs.normalizePathProc          = NULL;
	xvfs_tclfs_dispatch_fs.filesystemPathTypeProc     = NULL;
	xvfs_tclfs_dispatch_fs.filesystemSeparatorProc    = NULL;