Only in ChangeLog: stfufs-1.0
| stfufs-1.0rc1/Makefile | stfufs-1.0/Makefile | ||||
|---|---|---|---|---|---|
| 1 | 1 | ||||
| 2 | # | 2 | SW=stfufs | ||
| 3 | # To less warnings, enter make WARN1= | 3 | VER=1.0 | ||
| 4 | # | 4 | SW_VER=$(SW)-$(VER) | ||
| 5 | # To make DEBUG build, enter make DEBUG=1 | ||||
| 6 | # | ||||
| 7 | 5 | ||||
| 8 | CC= gcc | 6 | # Edit pretocol.c when changing version info above (fixme: take from .h file). | ||
| 9 | 7 | ||||
| 10 | WARN0= -Wall -Wstrict-prototypes -pedantic -Wno-long-long \ | 8 | .DEFAULT: | ||
| 11 | -Wcast-align -Wpointer-arith #-Wfloat-equal #-Werror | 9 | $(MAKE) -f Makefile.build $@ | ||
| 12 | WARN1?= -W -Wwrite-strings -Wcast-qual -Wshadow #-Wconversion | ||||
| 13 | 10 | ||||
| 14 | WOPTS= $(WARN0) $(WARN1) | 11 | ohje: | ||
| 15 | |||||
| 16 | O64= -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 | ||||
| 17 | |||||
| 18 | OF=O2 | ||||
| 19 | DEBUG=0 | ||||
| 20 | |||||
| 21 | OPT= $(O64) -DDEBUG=$(DEBUG) -$(OF) | ||||
| 22 | OPT= $(O64) -DDEBUG=$(DEBUG) -$(OF) | ||||
| 23 | |||||
| 24 | TRGS=stfufs-server stfufs | ||||
| 25 | |||||
| 26 | ohje: | 12 | ohje: | ||
| 27 | @sed -n 's/^#+#//p' Makefile | 13 | @sed -n 's/^#+#//p' Makefile | ||
| 28 | 14 | ||||
| 33 | #+# 'make all' to compile client and server | 19 | #+# 'make all' to compile client and server | ||
| 34 | #+# 'make debug' to compile debug versions of the above | 20 | #+# 'make debug' to compile debug versions of the above | ||
| 35 | #+# | 21 | #+# | ||
| 36 | #+# Client requires fuse headers abd libraries and C99 compiler. | 22 | #+# Client requires FUSE headers and libraries and C99 compiler. | ||
| 37 | #+# Server does not (see devel/genxtypes.sh for missing types, if any). | 23 | #+# Server does not (see devel/genxtypes.sh for missing types, if any). | ||
| 38 | #+# | 24 | #+# | ||
| 39 | 25 | ||||
| 40 | all: $(TRGS) | ||||
| 41 | |||||
| 42 | debug: DEBUG=1 | ||||
| 43 | debug: OF=ggdb | ||||
| 44 | debug: $(TRGS) | ||||
| 45 | |||||
| 46 | client: stfufs | ||||
| 47 | server: stfufs-server | ||||
| 48 | |||||
| 49 | COBJS=pretocol.o random.o util.o simplexdr.o | ||||
| 50 | |||||
| 51 | SRVONLY=stfufs-server.o stfufs-server-fs.o \ | ||||
| 52 | stfufs-server-buffer.o stfufs-server-errmap.o | ||||
| 53 | |||||
| 54 | CLIONLY=stfufs-client.o stfufs-client-fuse.o \ | ||||
| 55 | stfufs-client-buffer.o stfufs-client-errmap.o | ||||
| 56 | |||||
| 57 | SRVOBJS=$(SRVONLY) $(COBJS) | ||||
| 58 | CLIOBJS=$(CLIONLY) $(COBJS) | ||||
| 59 | |||||
| 60 | ALLOBJS=$(SRVONLY) $(CLIONLY) $(COBJS) | ||||
| 61 | |||||
| 62 | stfufs-server: $(SRVOBJS) depend | ||||
| 63 | $(CC) -o $@ $(SRVOBJS) | ||||
| 64 | |||||
| 65 | stfufs: $(CLIOBJS) depend | ||||
| 66 | $(CC) -o $@ $(CLIOBJS) `pkg-config --libs fuse` | ||||
| 67 | |||||
| 68 | stfufs-client-fuse.o: stfufs-client-fuse.c | ||||
| 69 | $(CC) -o $@ -c $< `pkg-config --cflags fuse` $(OPT) $(WOPTS) | ||||
| 70 | |||||
| 71 | .c.o: depend | ||||
| 72 | $(CC) -o $@ -c $< $(OPT) $(WOPTS) | ||||
| 73 | |||||
| 74 | stfufs-client-buffer.o: stfufs-buffer.c | ||||
| 75 | $(CC) -o $@ -c $< $(OPT) $(WOPTS) -DSTFUFS_DATABUFSIZE=4112 | ||||
| 76 | |||||
| 77 | stfufs-server-buffer.o: stfufs-buffer.c | ||||
| 78 | $(CC) -o $@ -c $< $(OPT) $(WOPTS) -DSTFUFS_DATABUFSIZE=32768 | ||||
| 79 | |||||
| 80 | # This is not currently cross-compiler compatible. Sorry. | ||||
| 81 | # That would require using just c preprocessor and perl/... | ||||
| 82 | # I'll leave this exercise to be done later... | ||||
| 83 | stfufs-server-errmap.c: stfufs-client-errmap.c stfufs-errmaps.h | ||||
| 84 | sh $< gen-srv-errmap | ||||
| 85 | ./gen-srv-errmap > $@ | ||||
| 86 | rm ./gen-srv-errmap | ||||
| 87 | |||||
| 88 | depend: Makefile | ||||
| 89 | echo; devel/mkdep.perl $(CC) "$(OPT) -E" $(ALLOBJS) | tee depend; echo | ||||
| 90 | |||||
| 91 | include depend | ||||
| 92 | 26 | ||||
| 93 | dist: | 27 | dist: | ||
| 94 | sed -n 's/^#tl# //p' Makefile | tarlisted -Vz -o stfufs-1.0rc1.tar.gz | 28 | { echo 755 root root . $(SW_VER) /; \ | ||
| 29 | grep '^#,#' Makefile | while read _ f x; do p=755; d=$$f; \ | ||||
| 30 | test -d $$f && d=/ || case $$x in '') p=644;; esac; \ | ||||
| 31 | echo $$p root root . $(SW_VER)/$$f $$d; done; } \ | ||||
| 32 | | tarlisted -Vz -o $(SW_VER).tar.gz | ||||
| 95 | 33 | ||||
| 96 | #tl# 755 root root . stfufs-1.0rc1 / | 34 | #,# ChangeLog | ||
| 97 | #tl# 644 root root . stfufs-1.0rc1/README.brief README.brief | 35 | #,# README.brief | ||
| 98 | #tl# 644 root root . stfufs-1.0rc1/Makefile Makefile | 36 | #,# Makefile | ||
| 99 | #tl# 644 root root . stfufs-1.0rc1/amiga_list.c amiga_list.c | 37 | #,# Makefile.build | ||
| 100 | #tl# 644 root root . stfufs-1.0rc1/amiga_list.h amiga_list.h | 38 | #,# amiga_list.c | ||
| 101 | #tl# 644 root root . stfufs-1.0rc1/defs.h defs.h | 39 | #,# amiga_list.h | ||
| 102 | #tl# 644 root root . stfufs-1.0rc1/pretocol.c pretocol.c | 40 | #,# defs.h | ||
| 103 | #tl# 644 root root . stfufs-1.0rc1/pretocol.h pretocol.h | 41 | #,# pretocol.c | ||
| 104 | #tl# 644 root root . stfufs-1.0rc1/random.c random.c | 42 | #,# pretocol.h | ||
| 105 | #tl# 644 root root . stfufs-1.0rc1/random.h random.h | 43 | #,# random.c | ||
| 106 | #tl# 644 root root . stfufs-1.0rc1/simplexdr.c simplexdr.c | 44 | #,# random.h | ||
| 107 | #tl# 644 root root . stfufs-1.0rc1/simplexdr.h simplexdr.h | 45 | #,# simplexdr.c | ||
| 108 | #tl# 644 root root . stfufs-1.0rc1/stfufs-buffer.c stfufs-buffer.c | 46 | #,# simplexdr.h | ||
| 109 | #tl# 644 root root . stfufs-1.0rc1/stfufs-buffer.h stfufs-buffer.h | 47 | #,# stfufs-buffer.c | ||
| 110 | #tl# 644 root root . stfufs-1.0rc1/stfufs-client.c stfufs-client.c | 48 | #,# stfufs-buffer.h | ||
| 111 | #tl# 644 root root . stfufs-1.0rc1/stfufs-client-errmap.c stfufs-client-errmap.c | 49 | #,# stfufs-client.c | ||
| 112 | #tl# 644 root root . stfufs-1.0rc1/stfufs-client-fuse.c stfufs-client-fuse.c | 50 | #,# stfufs-client-errmap.c | ||
| 113 | #tl# 644 root root . stfufs-1.0rc1/stfufs-errmaps.h stfufs-errmaps.h | 51 | #,# stfufs-client-fuse.c | ||
| 114 | #tl# 644 root root . stfufs-1.0rc1/stfufs.h stfufs.h | 52 | #,# stfufs-errmaps.h | ||
| 115 | #tl# 644 root root . stfufs-1.0rc1/stfufs-server.c stfufs-server.c | 53 | #,# stfufs.h | ||
| 116 | #tl# 644 root root . stfufs-1.0rc1/stfufs-server-fs.c stfufs-server-fs.c | 54 | #,# stfufs-server.c | ||
| 117 | #tl# 644 root root . stfufs-1.0rc1/util.c util.c | 55 | #,# stfufs-server-fs.c | ||
| 118 | #tl# 644 root root . stfufs-1.0rc1/util.h util.h | 56 | #,# util.c | ||
| 57 | #,# util.h | ||||
| 119 | 58 | ||||
| 120 | #tl# 755 root root . stfufs-1.0rc1/devel / | 59 | #,# devel | ||
| 121 | #tl# 755 root root . stfufs-1.0rc1/devel/dbgsetup.sh devel/dbgsetup.sh | 60 | #,# devel/dbgsetup.sh x | ||
| 122 | #tl# 755 root root . stfufs-1.0rc1/devel/genxtypes.sh devel/genxtypes.sh | 61 | #,# devel/genxtypes.sh x | ||
| 123 | #tl# 755 root root . stfufs-1.0rc1/devel/mkdep.perl devel/mkdep.perl | 62 | #,# devel/mkdep.perl x | ||
| 124 | #tl# 644 root root . stfufs-1.0rc1/devel/speedtest-ia32.c devel/speedtest-ia32.c | 63 | #,# devel/speedtest-ia32.c | ||
| 125 | #tl# 755 root root . stfufs-1.0rc1/devel/stfufs-server-dbgwrapper.sh devel/stfuf | 64 | #,# devel/stfufs-server-dbgwrapper.sh x | ||
| > | s-server-dbgwrapper.sh | ||||
| 126 | #tl# 755 root root . stfufs-1.0rc1/devel/testoperations.sh devel/testoperations. | 65 | #,# devel/testoperations.sh x | ||
| > | sh | ||||
| 127 | #tl# 755 root root . stfufs-1.0rc1/devel/testreadwrite.sh devel/testreadwrite.sh | 66 | #,# devel/testreadwrite.sh x | ||
| 128 | #tl# 644 root root . stfufs-1.0rc1/devel/travis2stfufs.c devel/travis2stfufs.c | 67 | #,# devel/travis2stfufs.c | ||
| 129 | |||||
| 130 | tags: | ||||
| 131 | etags *.c *.h | ||||
| 132 | 68 | ||||
| 133 | 69 | ||||
| 134 | clean: | 70 | clean distclean: | ||
| 135 | rm -f $(ALLOBJS) stfufs-server-errmap.c depend TAGS *~ | 71 | touch depend | ||
| 72 | $(MAKE) -f Makefile.build $@ | ||||
| 136 | 73 | ||||
| 137 | |||||
| 138 | distclean: clean | ||||
| 139 | rm -f $(TRGS) | ||||
Only in Makefile.build: stfufs-1.0
| stfufs-1.0rc1/README.brief | stfufs-1.0/README.brief | ||||
|---|---|---|---|---|---|
| 2 | Simple TCP FUSE File System | 2 | Simple TCP FUSE File System | ||
| 3 | =========================== | 3 | =========================== | ||
| 4 | 4 | ||||
| 5 | ------ | 5 | --- | ||
| 6 | 1.0rc1 | 6 | 1.0 | ||
| 7 | ------ | 7 | --- | ||
| 8 | 8 | ||||
| 9 | Very brief for now, more to come if there is enough interest. | 9 | Very brief for now, more to come if there is enough interest. | ||
| 10 | 10 | ||||
| 75 | For this to work, one must not have firewall to block on these ports; | 75 | For this to work, one must not have firewall to block on these ports; | ||
| 76 | stfufs-server do know when port is already in use, but does not know about | 76 | stfufs-server do know when port is already in use, but does not know about | ||
| 77 | firewall blocking connections. Today, most of the systems (linux distributions, | 77 | firewall blocking connections. Today, most of the systems (linux distributions, | ||
| 78 | at least) have firewall blocking connections, so check withyour system | 78 | at least) have firewall blocking connections, so check with your system | ||
| 79 | firewall configuration tool how to open the required port(s) | 79 | firewall configuration tool how to open the required port(s) | ||
| 80 | 80 | ||||
| 81 | 81 | ||||
| 92 | ``stfufs -b <portno> remote:[directory] mountpoint`` | 92 | ``stfufs -b <portno> remote:[directory] mountpoint`` | ||
| 93 | 93 | ||||
| 94 | Now client tries to bind on given port and if succeeds, listens for | 94 | Now client tries to bind on given port and if succeeds, listens for | ||
| 95 | server to connect. The same firewall rules apply, now on client machinr | 95 | server to connect. The same firewall rules apply, now on client machine | ||
| 96 | 96 | ||||
| 97 | 97 | ||||
| 98 | In both connection directions, there is also a *proxy* option available. | 98 | In both connection directions, there is also a *proxy* option available. | ||
| 117 | Not more on these (tricky) issues for now. In most cases the proxyless | 117 | Not more on these (tricky) issues for now. In most cases the proxyless | ||
| 118 | versions work fine. | 118 | versions work fine. | ||
| 119 | 119 | ||||
| 120 | Testing | ||||
| 121 | ======= | ||||
| 120 | 122 | ||||
| 121 | Why Release Candidate | 123 | (Move this part to developer documentation) | ||
| 122 | ===================== | ||||
| 123 | 124 | ||||
| 124 | for some reason the following sequence: | 125 | There has been many bugs that has been squashed in this program | ||
| 125 | :: | 126 | after some testing. No-one can ever be sure that all bugs are gone, | ||
| 127 | since there is no resources to do indefinite testing. | ||||
| 126 | 128 | ||||
| 127 | $ make clean all | 129 | I've so far done some basic testing with devel/test*.sh functions. | ||
| 128 | $ ln -s `pwd`/stfufs-server $HOME/bin/stfufs-server | 130 | Then I tarred ``usr/bin/\*``, which created 95M archive. ``tar -zdf`` verified | ||
| 129 | $ mkdir mnt | 131 | all ok. And, for heavy stfufs buffer runs, I've run | ||
| 130 | $ ./stfufs 127.0.0.1:/usr mnt | 132 | ``while ls -l usr/bin; do :; done`` for some time.. | ||
| 131 | $ while ls -s mnt; do :; done | ||||
| 132 | 133 | ||||
| 133 | Runs a few loops (sometimes dozens of) but then the client process | 134 | More tests needs to be developed for more certainty everyhing works fine | ||
| 134 | either halts or sigsegv's. With gdb I have not found good cause what | 135 | -- and for regression testing when new releases are made. I'll investigate | ||
| 135 | happens. This is my first self-made multithreaded program on unix machine | 136 | in this (slowly, though); suggestions for tools/methods are greatly | ||
| 136 | (but I have some good experience for that on Amiga). I've got this problem | 137 | appreciated. | ||
| 137 | on Ubuntu 7.10. On another machine which does not have (this) Ubuntu I have | ||||
| 138 | not succeeded to make this fail. Still, it might be timing/data corruption | ||||
| 139 | bug in client, but there is small change that this is pthread/glibc problem. | ||||
| 140 | More testing will tell... | ||||
| 141 | 138 | ||||
| 142 | Speaking of testing. I've run some basic tests (see devel/test*) functions, | ||||
| 143 | then I tarred /usr/bin/\*, which created 95M archive. ``tar -zdf`` verified | ||||
| 144 | all ok. Just now I cannot recall how much processor time this took... | ||||
| 145 | 139 | ||||
| 146 | TODO | 140 | TODO | ||
| 147 | ==== | 141 | ==== | ||
| 148 | :: | 142 | :: | ||
| 149 | 143 | ||||
| 150 | protocol docs | 144 | protocol docs | ||
| 151 | large reads (need more FUSE knowledge) | ||||
| 152 | caching (single element or more, client/server side stuff) | 145 | caching (single element or more, client/server side stuff) | ||
| 153 | more docs in general | 146 | more docs in general | ||
| 154 | protocol updates for smarter stuff | 147 | protocol updates for smarter stuff | ||
| stfufs-1.0rc1/amiga_list.h | stfufs-1.0/amiga_list.h | ||||
|---|---|---|---|---|---|
| 2 | * $Id; amiga_list.h | 2 | * $Id; amiga_list.h | ||
| 3 | * | 3 | * | ||
| 4 | * Created: Fri Jun 17 14:17:17 1994 too | 4 | * Created: Fri Jun 17 14:17:17 1994 too | ||
| 5 | * Last modified: Fri Dec 28 01:06:19 EET 2007 too | 5 | * Last modified: Thu Jan 17 20:45:53 EET 2008 too | ||
| 6 | * | 6 | * | ||
| 7 | */ | 7 | */ | ||
| 8 | 8 | ||||
| 70 | ; | 70 | ; | ||
| 71 | #else | 71 | #else | ||
| 72 | { | 72 | { | ||
| 73 | /* order is importart, for atomicity */ | 73 | /* order is importart, for atomicity (many readers, one writer) */ | ||
| 74 | node->pred = list->tailpred; | 74 | node->pred = list->tailpred; | ||
| 75 | node->succ = (AListNode *)&list->tail; | 75 | node->succ = (AListNode *)&list->tail; | ||
| 76 | list->tailpred->succ = node; | 76 | list->tailpred->succ = node; | ||
| stfufs-1.0rc1/defs.h | stfufs-1.0/defs.h | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Tue Aug 21 18:40:17 EEST 2007 too | 9 | * Created: Tue Aug 21 18:40:17 EEST 2007 too | ||
| 10 | * Last modified: Tue Jan 01 16:18:44 EET 2008 too | 10 | * Last modified: Sat Jan 19 14:42:20 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #ifndef DEFS_H | 13 | #ifndef DEFS_H | ||
| 38 | void errf(const char * format, ...); | 38 | void errf(const char * format, ...); | ||
| 39 | #define d1(x) do { errf x; } while (0) | 39 | #define d1(x) do { errf x; } while (0) | ||
| 40 | #define d0(x) do {} while (0) | 40 | #define d0(x) do {} while (0) | ||
| 41 | #define d1x(x) do { x; } while (0) | ||||
| 42 | #define d0x(x) do {} while (0) | ||||
| 41 | #else | 43 | #else | ||
| 42 | #undef UTIL_HAVE_ERRF | 44 | #undef UTIL_HAVE_ERRF | ||
| 43 | #define d1(x) do {} while (0) | 45 | #define d1(x) do {} while (0) | ||
| 44 | #define d0(x) do {} while (0) | 46 | #define d0(x) do {} while (0) | ||
| 47 | #define d1x(x) do {} while (0) | ||||
| 48 | #define d0x(x) do {} while (0) | ||||
| 45 | #endif | 49 | #endif | ||
| 46 | 50 | ||||
| 47 | #if (__GNUC__ >= 4) | 51 | #if (__GNUC__ >= 4) | ||
| stfufs-1.0rc1/pretocol.c | stfufs-1.0/pretocol.c | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Sun Aug 26 19:08:59 EEST 2007 too | 9 | * Created: Sun Aug 26 19:08:59 EEST 2007 too | ||
| 10 | * Last modified: Wed Jan 16 22:51:13 EET 2008 too | 10 | * Last modified: Sat Jan 19 14:20:55 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #include <unistd.h> | 13 | #include <unistd.h> | ||
| 49 | } | 49 | } | ||
| 50 | 50 | ||||
| 51 | /* 123456789012345678901234567 */ | 51 | /* 123456789012345678901234567 */ | ||
| 52 | const char ident[] = "Simple TCP FUSE filesystem 1.0rc1 protocol version 1\n"; | 52 | const char ident[] = "Simple TCP FUSE filesystem 1.0 protocol version 1\n"; | ||
| 53 | 53 | ||||
| 54 | void sendident(int fd) | 54 | void sendident(int fd) | ||
| 55 | { | 55 | { | ||
| stfufs-1.0rc1/stfufs-buffer.c | stfufs-1.0/stfufs-buffer.c | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Thu Dec 27 17:55:12 EET 2007 too | 9 | * Created: Thu Dec 27 17:55:12 EET 2007 too | ||
| 10 | * Last modified: Sun Jan 13 11:29:36 EET 2008 too | 10 | * Last modified: Sat Jan 19 14:47:15 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #include <unistd.h> | 13 | #include <unistd.h> | ||
| 18 | 18 | ||||
| 19 | #include "stfufs-buffer.h" | 19 | #include "stfufs-buffer.h" | ||
| 20 | 20 | ||||
| 21 | #if STFUFS_CLIENT | ||||
| 22 | #define STFUFS_DATABUFSIZE 4116 /* 4096 + 16 + 4 */ | ||||
| 23 | #elif STFUFS_SERVER | ||||
| 24 | #define STFUFS_DATABUFSIZE 36892 /* 32768 + 4096 + 12 + 16 */ | ||||
| 25 | #else | ||||
| 26 | #error fixme | ||||
| 27 | #endif | ||||
| 28 | |||||
| 21 | struct { | 29 | struct { | ||
| 22 | int fd; | 30 | int fd; | ||
| 23 | uint8_t * p; | 31 | uint8_t * p; | ||
| 24 | uint8_t b[STFUFS_DATABUFSIZE]; /* defined by makefile of target. */ | 32 | #if DEBUG | ||
| 33 | uint8_t canary0[16]; | ||||
| 34 | #endif | ||||
| 35 | uint8_t b[STFUFS_DATABUFSIZE]; | ||||
| 36 | #if DEBUG | ||||
| 37 | uint8_t canary1[16]; | ||||
| 38 | #endif | ||||
| 25 | } BUFFER; | 39 | } BUFFER; | ||
| 26 | 40 | ||||
| 27 | uint8_t * stfufs_buffer_init(int fd) | 41 | uint8_t * stfufs_buffer_init(int fd) | ||
| 38 | return read(fd, data, len); | 52 | return read(fd, data, len); | ||
| 39 | } | 53 | } | ||
| 40 | #define read read_wrapper | 54 | #define read read_wrapper | ||
| 55 | #endif | ||||
| 56 | |||||
| 57 | #if DEBUG | ||||
| 58 | static void stfufs_buffer_chkcanary(void) | ||||
| 59 | { | ||||
| 60 | static char xbuf[16]; | ||||
| 61 | |||||
| 62 | if (memcmp(BUFFER.canary0, xbuf, 16) != 0) | ||||
| 63 | die("Canary 0 XXX"); | ||||
| 64 | if (memcmp(BUFFER.canary1, xbuf, 16) != 0) | ||||
| 65 | die("Canary 1 XXX"); | ||||
| 66 | } | ||||
| 41 | #endif | 67 | #endif | ||
| 42 | 68 | ||||
| 43 | uint8_t * stfufs_buffer_reserve(uint8_t * p, int needbytes) | 69 | uint8_t * stfufs_buffer_reserve(uint8_t * p, int needbytes) | ||
| 59 | } | 85 | } | ||
| 60 | 86 | ||||
| 61 | do { | 87 | do { | ||
| 88 | int s = STFUFS_DATABUFSIZE - (BUFFER.p - BUFFER.b); | ||||
| 62 | int l = read(BUFFER.fd, BUFFER.p, STFUFS_DATABUFSIZE - havebytes); | 89 | int l = read(BUFFER.fd, BUFFER.p, s); | ||
| 63 | d1(("%d = read(%d, %p, %d)", | 90 | d1(("%d = read(%d, %d, %d)", l, BUFFER.fd, BUFFER.p - BUFFER.b, s)); | ||
| 64 | l, BUFFER.fd, BUFFER.p, STFUFS_DATABUFSIZE - havebytes)); | ||||
| 65 | if (l <= 0) | 91 | if (l <= 0) | ||
| 66 | return null; | 92 | return null; | ||
| 67 | BUFFER.p += l; | 93 | BUFFER.p += l; | ||
| 68 | havebytes += l; | 94 | havebytes += l; | ||
| 69 | } while (havebytes < needbytes); | 95 | } while (havebytes < needbytes); | ||
| 70 | 96 | ||||
| 97 | d1x( stfufs_buffer_chkcanary() ); | ||||
| 71 | return p; | 98 | return p; | ||
| 72 | } | 99 | } | ||
| 73 | 100 | ||||
| stfufs-1.0rc1/stfufs-client-fuse.c | stfufs-1.0/stfufs-client-fuse.c | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Tue Aug 28 21:47:30 EEST 2007 too | 9 | * Created: Tue Aug 28 21:47:30 EEST 2007 too | ||
| 10 | * Last modified: Mon Jan 14 22:40:55 EET 2008 too | 10 | * Last modified: Sat Jan 19 09:56:24 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #include <unistd.h> | 13 | #include <unistd.h> | ||
| 360 | if ((p = stfufs_buffer_reserve(p, alen)) == null) | 360 | if ((p = stfufs_buffer_reserve(p, alen)) == null) | ||
| 361 | return null; | 361 | return null; | ||
| 362 | 362 | ||||
| 363 | /* actually, it is an error if rlen > size, protecting for such */ | ||||
| 363 | min = size < rlen? size: rlen; | 364 | min = size < rlen? size: rlen; | ||
| 364 | 365 | ||||
| 365 | ((struct iovec *)cbdata)->iov_len = min; | 366 | ((struct iovec *)cbdata)->iov_len = min; | ||
| 381 | 382 | ||||
| 382 | d1(("--- %s(\"%s\", %p, %d)", __func__, path, lbuf, size)); | 383 | d1(("--- %s(\"%s\", %p, %d)", __func__, path, lbuf, size)); | ||
| 383 | 384 | ||||
| 384 | /* XXX define + makefile-provided STFUFS_DATABUFSIZE */ | 385 | /* XXX use sizeof BUFFER.b - xxx */ | ||
| 385 | /* using scatter read will make this limit server-bound, later... */ | 386 | /* using scatter read will make this limit server-bound, later... */ | ||
| 386 | if (size > 4084) | 387 | if (size > 4100) | ||
| 387 | size = 4084; | 388 | size = 4100; | ||
| 388 | 389 | ||||
| 389 | (void)xencode_uint32(buf + REQUEST_HEADER_LEN, size); | 390 | (void)xencode_uint32(buf + REQUEST_HEADER_LEN, size); | ||
| 390 | 391 | ||||
| 409 | stfufs_readlink_cb, (void*)&lbufdata); | 410 | stfufs_readlink_cb, (void*)&lbufdata); | ||
| 410 | if (error < 0) | 411 | if (error < 0) | ||
| 411 | return error; | 412 | return error; | ||
| 412 | if (lbufdata.iov_len > 4080) | 413 | if (lbufdata.iov_len > 4097) | ||
| 413 | return ENAMETOOLONG; | 414 | return ENAMETOOLONG; | ||
| 414 | d1(("readlink rv: %d", lbufdata.iov_len)); | 415 | d1(("readlink rv: %d", lbufdata.iov_len)); | ||
| 415 | #if 0 | 416 | #if 0 | ||
| stfufs-1.0rc1/stfufs-server-fs.c | stfufs-1.0/stfufs-server-fs.c | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Tue Aug 28 21:47:42 EEST 2007 too | 9 | * Created: Tue Aug 28 21:47:42 EEST 2007 too | ||
| 10 | * Last modified: Mon Jan 14 22:41:04 EET 2008 too | 10 | * Last modified: Thu Jan 17 19:31:44 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #include <unistd.h> | 13 | #include <unistd.h> | ||
| 488 | return r; | 488 | return r; | ||
| 489 | } | 489 | } | ||
| 490 | if (size > 32768) | 490 | if (size > 32768) | ||
| 491 | size = 32768; /* XXX sync with 32500 XXX */ | 491 | size = 32768; | ||
| 492 | 492 | ||||
| 493 | len = areadfully(fd, buf + 16, size); | 493 | len = areadfully(fd, buf + 16, size); | ||
| 494 | d1(("%d = read(%d, %p, %d)", len, fd, buf + 16, size)); | 494 | d1(("%d = read(%d, %p, %d)", len, fd, buf + 16, size)); | ||
| stfufs-1.0rc1/stfufs-server.c | stfufs-1.0/stfufs-server.c | ||||
|---|---|---|---|---|---|
| 7 | * All rights reserved | 7 | * All rights reserved | ||
| 8 | * | 8 | * | ||
| 9 | * Created: Sun 26 Aug 2007 08:18:39 AM EEST too | 9 | * Created: Sun 26 Aug 2007 08:18:39 AM EEST too | ||
| 10 | * Last modified: Sat Jan 12 14:45:24 EET 2008 too | 10 | * Last modified: Thu Jan 17 19:32:43 EET 2008 too | ||
| 11 | */ | 11 | */ | ||
| 12 | 12 | ||||
| 13 | #include <unistd.h> | 13 | #include <unistd.h> | ||
| 47 | /* currently a big hacky, let's see if ever changed. */ | 47 | /* currently a big hacky, let's see if ever changed. */ | ||
| 48 | memcpy(msg, buf, 4); | 48 | memcpy(msg, buf, 4); | ||
| 49 | msg[4] = port >> 8; msg[5] = port; | 49 | msg[4] = port >> 8; msg[5] = port; | ||
| 50 | msg[6] = 0; msg[7] = 0; msg[8] = 126; msg[9] = 244; /* 32500 */ | 50 | msg[6] = 0; msg[7] = 0; msg[8] = 128; msg[9] = 0; /* 32768 */ | ||
| 51 | 51 | ||||
| 52 | writehsmsg(1, msg, 10); | 52 | writehsmsg(1, msg, 10); | ||
| 53 | 53 | ||||