Only in ChangeLog: stfufs-1.0


stfufs-1.0rc1/Makefile
stfufs-1.0/Makefile
11
2#2SW=stfufs
3# To less warnings, enter make WARN1=3VER=1.0
4#4SW_VER=$(SW)-$(VER)
5# To make DEBUG build, enter make DEBUG=1
6#
75
8CC=     gcc6# Edit pretocol.c when changing version info above (fixme: take from .h file).
97
10WARN0=  -Wall -Wstrict-prototypes -pedantic -Wno-long-long \8.DEFAULT:
11        -Wcast-align -Wpointer-arith #-Wfloat-equal #-Werror9         $(MAKE) -f Makefile.build $@
12WARN1?= -W -Wwrite-strings -Wcast-qual -Wshadow #-Wconversion
1310
14WOPTS=  $(WARN0) $(WARN1)11ohje:
15 
16O64= -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
17 
18OF=O2
19DEBUG=0
20 
21OPT= $(O64) -DDEBUG=$(DEBUG) -$(OF)
22OPT= $(O64) -DDEBUG=$(DEBUG) -$(OF)
23 
24TRGS=stfufs-server stfufs
25 
26ohje:12ohje:
27         @sed -n 's/^#+#//p' Makefile13         @sed -n 's/^#+#//p' Makefile
2814
33#+#   'make all'      to compile client and server19#+#   'make all'      to compile client and server
34#+#   'make debug'    to compile debug versions of the above20#+#   '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#+#
3925
40all:  $(TRGS)
41 
42debug: DEBUG=1
43debug: OF=ggdb
44debug: $(TRGS)
45 
46client: stfufs
47server: stfufs-server
48 
49COBJS=pretocol.o random.o util.o simplexdr.o
50 
51SRVONLY=stfufs-server.o stfufs-server-fs.o \
52        stfufs-server-buffer.o stfufs-server-errmap.o
53 
54CLIONLY=stfufs-client.o stfufs-client-fuse.o \
55        stfufs-client-buffer.o stfufs-client-errmap.o
56 
57SRVOBJS=$(SRVONLY) $(COBJS)
58CLIOBJS=$(CLIONLY) $(COBJS)
59 
60ALLOBJS=$(SRVONLY) $(CLIONLY) $(COBJS)
61 
62stfufs-server: $(SRVOBJS) depend
63        $(CC) -o $@ $(SRVOBJS)
64 
65stfufs: $(CLIOBJS) depend
66        $(CC) -o $@ $(CLIOBJS) `pkg-config --libs fuse`
67 
68stfufs-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 
74stfufs-client-buffer.o: stfufs-buffer.c
75        $(CC) -o $@ -c $<  $(OPT) $(WOPTS) -DSTFUFS_DATABUFSIZE=4112
76 
77stfufs-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...
83stfufs-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 
88depend: Makefile
89        echo; devel/mkdep.perl $(CC) "$(OPT) -E" $(ALLOBJS) | tee depend; echo
90 
91include depend
9226
93dist:27dist:
94        sed -n 's/^#tl# //p' Makefile | tarlisted -Vz -o stfufs-1.0rc1.tar.gz28        { 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
9533
96#tl# 755 root root . stfufs-1.0rc1 /34#,#  ChangeLog
97#tl# 644 root root . stfufs-1.0rc1/README.brief README.brief35#,#  README.brief
98#tl# 644 root root . stfufs-1.0rc1/Makefile Makefile36#,#  Makefile
99#tl# 644 root root . stfufs-1.0rc1/amiga_list.c amiga_list.c37#,#  Makefile.build
100#tl# 644 root root . stfufs-1.0rc1/amiga_list.h amiga_list.h38#,#  amiga_list.c
101#tl# 644 root root . stfufs-1.0rc1/defs.h defs.h39#,#  amiga_list.h
102#tl# 644 root root . stfufs-1.0rc1/pretocol.c pretocol.c40#,#  defs.h
103#tl# 644 root root . stfufs-1.0rc1/pretocol.h pretocol.h41#,#  pretocol.c
104#tl# 644 root root . stfufs-1.0rc1/random.c random.c42#,#  pretocol.h
105#tl# 644 root root . stfufs-1.0rc1/random.h random.h43#,#  random.c
106#tl# 644 root root . stfufs-1.0rc1/simplexdr.c simplexdr.c44#,#  random.h
107#tl# 644 root root . stfufs-1.0rc1/simplexdr.h simplexdr.h45#,#  simplexdr.c
108#tl# 644 root root . stfufs-1.0rc1/stfufs-buffer.c stfufs-buffer.c46#,#  simplexdr.h
109#tl# 644 root root . stfufs-1.0rc1/stfufs-buffer.h stfufs-buffer.h47#,#  stfufs-buffer.c
110#tl# 644 root root . stfufs-1.0rc1/stfufs-client.c stfufs-client.c48#,#  stfufs-buffer.h
111#tl# 644 root root . stfufs-1.0rc1/stfufs-client-errmap.c stfufs-client-errmap.c49#,#  stfufs-client.c
112#tl# 644 root root . stfufs-1.0rc1/stfufs-client-fuse.c stfufs-client-fuse.c50#,#  stfufs-client-errmap.c
113#tl# 644 root root . stfufs-1.0rc1/stfufs-errmaps.h stfufs-errmaps.h51#,#  stfufs-client-fuse.c
114#tl# 644 root root . stfufs-1.0rc1/stfufs.h stfufs.h52#,#  stfufs-errmaps.h
115#tl# 644 root root . stfufs-1.0rc1/stfufs-server.c stfufs-server.c53#,#  stfufs.h
116#tl# 644 root root . stfufs-1.0rc1/stfufs-server-fs.c stfufs-server-fs.c54#,#  stfufs-server.c
117#tl# 644 root root . stfufs-1.0rc1/util.c util.c55#,#  stfufs-server-fs.c
118#tl# 644 root root . stfufs-1.0rc1/util.h util.h56#,#  util.c
57#,#  util.h
11958
120#tl# 755 root root . stfufs-1.0rc1/devel /59#,#  devel
121#tl# 755 root root . stfufs-1.0rc1/devel/dbgsetup.sh devel/dbgsetup.sh60#,#  devel/dbgsetup.sh  x
122#tl# 755 root root . stfufs-1.0rc1/devel/genxtypes.sh devel/genxtypes.sh61#,#  devel/genxtypes.sh  x
123#tl# 755 root root . stfufs-1.0rc1/devel/mkdep.perl devel/mkdep.perl62#,#  devel/mkdep.perl x
124#tl# 644 root root . stfufs-1.0rc1/devel/speedtest-ia32.c devel/speedtest-ia32.c63#,#  devel/speedtest-ia32.c
125#tl# 755 root root . stfufs-1.0rc1/devel/stfufs-server-dbgwrapper.sh devel/stfuf64#,#  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.sh66#,#  devel/testreadwrite.sh  x
128#tl# 644 root root . stfufs-1.0rc1/devel/travis2stfufs.c devel/travis2stfufs.c67#,#  devel/travis2stfufs.c
129 
130tags:
131        etags *.c *.h
13268
13369
134clean:70clean distclean:
135        rm -f $(ALLOBJS) stfufs-server-errmap.c depend TAGS *~71        touch depend
72        $(MAKE) -f Makefile.build $@
13673
137 
138distclean: clean
139        rm -f $(TRGS)

Only in Makefile.build: stfufs-1.0


stfufs-1.0rc1/README.brief
stfufs-1.0/README.brief
2Simple TCP FUSE File System2Simple TCP FUSE File System
3===========================3===========================
44
5------5---
61.0rc161.0
7------7---
88
9Very brief for now, more to come if there is enough interest.9Very brief for now, more to come if there is enough interest.
1010
75For this to work, one must not have firewall to block on these ports;75For this to work, one must not have firewall to block on these ports;
76stfufs-server do know when port is already in use, but does not know about76stfufs-server do know when port is already in use, but does not know about
77firewall blocking connections. Today, most of the systems (linux distributions,77firewall blocking connections. Today, most of the systems (linux distributions,
78at least) have firewall blocking connections, so check withyour system78at least) have firewall blocking connections, so check with your system
79firewall configuration tool how to open the required port(s)79firewall configuration tool how to open the required port(s)
8080
8181
92``stfufs -b <portno> remote:[directory] mountpoint``92``stfufs -b <portno> remote:[directory] mountpoint``
9393
94Now client tries to bind on given port and if succeeds, listens for94Now client tries to bind on given port and if succeeds, listens for
95server to connect. The same firewall rules apply, now on client machinr95server to connect. The same firewall rules apply, now on client machine
9696
9797
98In both connection directions, there is also a *proxy* option available.98In both connection directions, there is also a *proxy* option available.
117Not more on these (tricky) issues for now. In most cases the proxyless117Not more on these (tricky) issues for now. In most cases the proxyless
118versions work fine.118versions work fine.
119119
120Testing
121=======
120122
121Why Release Candidate123(Move this part to developer documentation)
122=====================
123124
124for some reason the following sequence:125There has been many bugs that has been squashed in this program
125::126after some testing. No-one can ever be sure that all bugs are gone,
127since there is no resources to do indefinite testing.
126128
127  $ make clean all129I've so far done some basic testing with devel/test*.sh functions.
128  $ ln -s `pwd`/stfufs-server $HOME/bin/stfufs-server130Then I tarred ``usr/bin/\*``, which created 95M archive. ``tar -zdf`` verified
129  $ mkdir mnt131all ok. And, for heavy stfufs buffer runs, I've run
130  $ ./stfufs 127.0.0.1:/usr mnt132``while ls -l usr/bin; do :; done`` for some time..
131  $ while ls -s mnt; do :; done
132133
133Runs a few loops (sometimes dozens of) but then the client process134More tests needs to be developed for more certainty everyhing works fine
134either halts or sigsegv's. With gdb I have not found good cause what135-- and for regression testing when new releases are made. I'll investigate
135happens. This is my first self-made multithreaded program on unix machine136in this (slowly, though); suggestions for tools/methods are greatly
136(but I have some good experience for that on Amiga). I've got this problem137appreciated.
137on Ubuntu 7.10. On another machine which does not have (this) Ubuntu I have
138not succeeded to make this fail. Still, it might be timing/data corruption
139bug in client, but there is small change that this is pthread/glibc problem.
140More testing will tell...
141138
142Speaking of testing. I've run some basic tests (see devel/test*) functions,
143then I tarred /usr/bin/\*, which created 95M archive. ``tar -zdf`` verified
144all ok. Just now I cannot recall how much processor time this took...
145139
146TODO140TODO
147====141====
148::142::
149143
150  protocol docs144  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 general146  more docs in general
154  protocol updates for smarter stuff147  protocol updates for smarter stuff


stfufs-1.0rc1/amiga_list.h
stfufs-1.0/amiga_list.h
2 * $Id; amiga_list.h2 * $Id; amiga_list.h
3 *3 *
4 * Created: Fri Jun 17 14:17:17 1994 too4 * Created: Fri Jun 17 14:17:17 1994 too
5 * Last modified: Fri Dec 28 01:06:19 EET 2007 too5 * Last modified: Thu Jan 17 20:45:53 EET 2008 too
6 *6 *
7 */7 */
88
70    ;70    ;
71#else71#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 reserved7 *          All rights reserved
8 *8 *
9 * Created: Tue Aug 21 18:40:17 EEST 2007 too9 * Created: Tue Aug 21 18:40:17 EEST 2007 too
10 * Last modified: Tue Jan 01 16:18:44 EET 2008 too10 * Last modified: Sat Jan 19 14:42:20 EET 2008 too
11 */11 */
1212
13#ifndef DEFS_H13#ifndef DEFS_H
38void errf(const char * format, ...);38void 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#else43#else
42#undef UTIL_HAVE_ERRF44#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#endif49#endif
4650
47#if (__GNUC__ >= 4)51#if (__GNUC__ >= 4)


stfufs-1.0rc1/pretocol.c
stfufs-1.0/pretocol.c
7 *          All rights reserved7 *          All rights reserved
8 *8 *
9 * Created: Sun Aug 26 19:08:59 EEST 2007 too9 * Created: Sun Aug 26 19:08:59 EEST 2007 too
10 * Last modified: Wed Jan 122:51:13 EET 2008 too10 * Last modified: Sat Jan 19 14:20:55 EET 2008 too
11 */11 */
1212
13#include <unistd.h>13#include <unistd.h>
49}49}
5050
51/*                    123456789012345678901234567 */51/*                    123456789012345678901234567 */
52const char ident[] = "Simple TCP FUSE filesystem 1.0rc1 protocol version 1\n";52const char ident[] = "Simple TCP FUSE filesystem 1.0 protocol version 1\n";
5353
54void sendident(int fd)54void sendident(int fd)
55{55{


stfufs-1.0rc1/stfufs-buffer.c
stfufs-1.0/stfufs-buffer.c
7 *          All rights reserved7 *          All rights reserved
8 *8 *
9 * Created: Thu Dec 27 17:55:12 EET 2007 too9 * Created: Thu Dec 27 17:55:12 EET 2007 too
10 * Last modified: Sun Jan 13 11:29:36 EET 2008 too10 * Last modified: Sat Jan 19 14:47:15 EET 2008 too
11 */11 */
1212
13#include <unistd.h>13#include <unistd.h>
1818
19#include "stfufs-buffer.h"19#include "stfufs-buffer.h"
2020
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 
21struct {29struct {
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;
2640
27uint8_t * stfufs_buffer_init(int fd)41uint8_t * stfufs_buffer_init(int fd)
38    return read(fd, data, len);52    return read(fd, data, len);
39}53}
40#define read read_wrapper54#define read read_wrapper
55#endif
56 
57#if DEBUG
58static 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#endif67#endif
4268
43uint8_t * stfufs_buffer_reserve(uint8_t * p, int needbytes)69uint8_t * stfufs_buffer_reserve(uint8_t * p, int needbytes)
59    }85    }
6086
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);
7096
97    d1x( stfufs_buffer_chkcanary() );
71    return p;98    return p;
72}99}
73100


stfufs-1.0rc1/stfufs-client-fuse.c
stfufs-1.0/stfufs-client-fuse.c
7 *          All rights reserved7 *          All rights reserved
8 *8 *
9 * Created: Tue Aug 28 21:47:30 EEST 2007 too9 * Created: Tue Aug 28 21:47:30 EEST 2007 too
10 * Last modified: Mon Jan 14 22:40:55 EET 2008 too10 * Last modified: Sat Jan 109:56:24 EET 2008 too
11 */11 */
1212
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;
362362
363    /* actually, it is an error if rlen > size, protecting for such */
363    min = size < rlen? size: rlen;364    min = size < rlen? size: rlen;
364365
365    ((struct iovec *)cbdata)->iov_len = min;366    ((struct iovec *)cbdata)->iov_len = min;
381382
382    d1(("--- %s(\"%s\", %p, %d)", __func__, path, lbuf, size));383    d1(("--- %s(\"%s\", %p, %d)", __func__, path, lbuf, size));
383384
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;
388389
389    (void)xencode_uint32(buf + REQUEST_HEADER_LEN, size);390    (void)xencode_uint32(buf + REQUEST_HEADER_LEN, size);
390391
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 0416#if 0


stfufs-1.0rc1/stfufs-server-fs.c
stfufs-1.0/stfufs-server-fs.c
7 *          All rights reserved7 *          All rights reserved
8 *8 *
9 * Created: Tue Aug 28 21:47:42 EEST 2007 too9 * Created: Tue Aug 28 21:47:42 EEST 2007 too
10 * Last modified: Mon Jan 14 22:41:04 EET 2008 too10 * Last modified: Thu Jan 17 19:31:44 EET 2008 too
11 */11 */
1212
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;
492492
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 reserved7 *          All rights reserved
8 *8 *
9 * Created: Sun 26 Aug 2007 08:18:39 AM EEST too9 * Created: Sun 26 Aug 2007 08:18:39 AM EEST too
10 * Last modified: Sat Jan 12 14:45:24 EET 2008 too10 * Last modified: Thu Jan 17 19:32:43 EET 2008 too
11 */11 */
1212
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 */
5151
52    writehsmsg(1, msg, 10);52    writehsmsg(1, msg, 10);
5353