Check-in [0e19d8e3c2]
Overview
Comment:Renamed fuse daemon as "appfsd"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0e19d8e3c2d71b90fa88c60484319050837d036e
User & Date: rkeene on 2014-09-10 07:22:18
Other Links: manifest | tags
Context
2014-09-10
07:24
Finished renames check-in: 6958ab0b94 user: rkeene tags: trunk
07:22
Renamed fuse daemon as "appfsd" check-in: 0e19d8e3c2 user: rkeene tags: trunk
04:02
Reorganized check-in: 1f01cf90b5 user: rkeene tags: trunk
Changes

Modified Makefile from [51fd163395] to [66bca1d85f].

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







-
+

-
-
+
+

-
-
-
+
-
-
+

-
-
-
-
-
-
+
+
+

-
-
+
+

-
-
-

-
+
-
-
+




export TCLKIT_SDK_DIR
else
TCLCONFIG_SH_PATH = $(shell echo 'puts [::tcl::pkgconfig get libdir,install]' | tclsh)/tclConfig.sh
endif
TCL_CFLAGS = $(shell . $(TCLCONFIG_SH_PATH); echo "$${TCL_INCLUDE_SPEC}")
TCL_LIBS = $(shell . $(TCLCONFIG_SH_PATH); echo "$${TCL_LIB_SPEC}")

all: appfs
all: appfsd

appfs: appfs.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfs appfs.o $(LIBS)
appfsd: appfsd.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfsd appfsd.o $(LIBS)

appfs-test: appfs-test.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfs-test appfs-test.o $(LIBS)

appfsd.o: appfsd.c appfsd.tcl.h
appfs.o: appfs.c appfs.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -o appfs.o -c appfs.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -o appfsd.o -c appfsd.c

appfs-test.o: appfs.c appfs.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -DAPPFS_TEST_DRIVER=1 -o appfs-test.o -c appfs.c

appfs.tcl.h: appfs.tcl stringify.tcl
	./stringify.tcl appfs.tcl > appfs.tcl.h.new
	mv appfs.tcl.h.new appfs.tcl.h
appfsd.tcl.h: appfsd.tcl stringify.tcl
	./stringify.tcl appfsd.tcl > appfsd.tcl.h.new
	mv appfsd.tcl.h.new appfsd.tcl.h

install: appfs
	cp appfs $(bindir)
install: appfsd
	cp appfsd $(bindir)

test: appfs-test
	./appfs-test

clean:
	rm -f appfs appfs.o
	rm -f appfsd appfsd.o
	rm -f appfs-test appfs-test.o
	rm -f appfs.tcl.h
	rm -f appfsd.tcl.h

distclean: clean

.PHONY: all test clean distclean install

Renamed and modified appfs.c [c11522a03a] to appfsd.c [2342477e32].

195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209







-
+







	if (tcl_ret != TCL_OK) {
		fprintf(stderr, "Unable to initialize Tcl.  Aborting.\n");

		return(NULL);
	}

	tcl_ret = Tcl_Eval(interp, ""
#include "appfs.tcl.h"
#include "appfsd.tcl.h"
	"");
	if (tcl_ret != TCL_OK) {
		fprintf(stderr, "Unable to initialize Tcl AppFS script.  Aborting.\n");
		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));

		return(NULL);
	}
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
920
921
922
923
924
925
926



































































927
928
929
930
931
932

933
934
935
936
937
938
939







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-






-







	}

	read_ret = read(fi->fh, buf, size);

	return(read_ret);
}

#ifdef APPFS_TEST_DRIVER
static int appfs_test_driver(void) {
	struct appfs_site *sites, *site;
	struct appfs_package *packages, *package;
	struct appfs_children *files, *file;
	char *sha1 = NULL;
	int packages_count = 0, sites_count = 0, files_count;

	sites = appfs_getsites(&sites_count);
	printf("Sites:\n");
	for (site = sites; site; site = site->_next) {
		printf("\tname = %s\n", site->name);
	}

	appfs_free_list_site(sites);

	packages = appfs_getindex("rkeene.org", &packages_count);
	if (packages == NULL || packages_count == 0) {
		fprintf(stderr, "Unable to fetch package index from rkeene.org.\n");

		return(1);
	}

	for (package = packages; package; package = package->_next) {
		sha1 = package->sha1;

		printf("Package:\n\tname = %s\n\tversion = %s\n\tsha1 = %s\n\tos = %s\n\tcpuArch = %s\n",
			package->name,
			package->version,
			package->sha1,
			appfs_convert_os_toString(package->os),
			appfs_convert_cpuArch_toString(package->cpuArch)
		);
	}

	files = appfs_getchildren("rkeene.org", sha1, "", &files_count);
	if (files == NULL) {
		fprintf(stderr, "Unable to list files in the last package.\n");

		return(1);
	}

	printf("Files:\n");
	for (file = files; file; file = file->_next) {
		printf("\t%s\n", file->name);
	}

	appfs_free_list_children(files);

	files = appfs_getchildren("rkeene.org", sha1, "tcl", &files_count);
	if (files == NULL) {
		fprintf(stderr, "Unable to list files in the last package.\n");

		return(1);
	}

	printf("Files:\n");
	for (file = files; file; file = file->_next) {
		printf("\ttcl/%s\n", file->name);
	}

	appfs_free_list_children(files);
	appfs_free_list_package(packages);

	return(0);
}
#else
static struct fuse_operations appfs_oper = {
	.getattr	= appfs_fuse_getattr,
	.readdir	= appfs_fuse_readdir,
	.open		= appfs_fuse_open,
	.read		= appfs_fuse_read
};
#endif

int main(int argc, char **argv) {
	const char *cachedir = APPFS_CACHEDIR;
	char dbfilename[1024];
	int pthread_ret, snprintf_ret, sqlite_ret;

	globalThread.cachedir = cachedir;
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
956
957
958
959
960
961
962



963

964
965







-
-
-

-


	sqlite_ret = sqlite3_open(dbfilename, &globalThread.db);
	if (sqlite_ret != SQLITE_OK) {
		fprintf(stderr, "Unable to open database: %s\n", dbfilename);

		return(1);
	}

#ifdef APPFS_TEST_DRIVER
	return(appfs_test_driver());
#else
	return(fuse_main(argc, argv, &appfs_oper, NULL));
#endif
}
 

Name change from appfs.tcl to appfsd.tcl.