gnunet-fuse

GNUnet file-sharing directory mounting via FUSE
Log | Files | Refs | Submodules | README | LICENSE

commit c7f3b7128015f609f0fe8f67e70bc61c90bf91d0
parent a03089799bd8f48223e0dd163a08dbe79c776c5f
Author: Mauricio Günther <mauricio@140774ce-b5e7-0310-ab8b-a85725594a96>
Date:   Mon, 19 Mar 2012 16:24:35 +0000

-working changes: "Transport endpoint is not connected" fixed


Diffstat:
Msrc/ext/getattr.c | 19++++++++++++++-----
Msrc/ext/open.c | 6+++---
Msrc/ext/read.c | 8++++----
Msrc/ext/readdir.c | 21++++++++++++++-------
4 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/src/ext/getattr.c b/src/ext/getattr.c @@ -13,33 +13,42 @@ */ #include <sys/stat.h> -#include <string.h> -#include <errno.h> +//#include <string.h> +//#include <errno.h> #include <fuse.h> #include <gnunet-fuse.h> int gn_getattr(const char *path, struct stat *stbuf) { int ret = 0; - GNUNET_break (0); + //GNUNET_break (0); memset(stbuf, 0, sizeof(struct stat)); - if(strcmp(path, "/") == 0) + if(strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0) { stbuf->st_mode = S_IFDIR | 0755; - stbuf->st_nlink = 2; + stbuf->st_nlink = 1; // changed from 2 } + + + /* else if(strcmp(path, directory) == 0) { stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 1; } + + + else if(strcmp(path, "/probe/mal") == 0) { stbuf->st_mode = S_IFREG | 0444; stbuf->st_nlink = 1; stbuf->st_size = strlen("/probe/mal/inhalt"); } + + */ + else return -ENOENT; return ret; diff --git a/src/ext/open.c b/src/ext/open.c @@ -22,8 +22,8 @@ * Changed in version 2.2 */ -#include <string.h> -#include <errno.h> +//#include <string.h> +//#include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fuse.h> @@ -35,7 +35,7 @@ int gn_open(const char *path, struct fuse_file_info *fi) { - if (strcmp(path, directory) | strcmp(path, "/") == 0) + if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") | strcmp(path, "/") == 0) return 0; else if ((fi->flags & 3) != O_RDONLY) diff --git a/src/ext/read.c b/src/ext/read.c @@ -17,8 +17,8 @@ * Changed in version 2.2 */ -#include <string.h> -#include <errno.h> +//#include <string.h> +//#include <errno.h> #include <unistd.h> #include <fuse.h> #include <gnunet-fuse.h> @@ -30,9 +30,9 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { size_t len; - if (strcmp(path, directory) == 0) + if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0) { - len = strlen(directory); + len = strlen("/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount"); if (offset < len) { diff --git a/src/ext/readdir.c b/src/ext/readdir.c @@ -30,8 +30,8 @@ #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> -#include <string.h> -#include <errno.h> +//#include <string.h> +//#include <errno.h> //#include <glib.h> #include <fuse.h> //#include <GNUnet/gnunet_ecrs_lib.h> @@ -45,17 +45,22 @@ int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { - static char* track = "directory/mal"; - int len = strlen(directory); + //char* track = "mal"; + //char var[strlen(directory)+strlen(track)+1]; + //memcpy(var,directory,strlen(directory)); + //int len = strlen(directory); +// GNUNET_asprintf(); - - if (strcmp(path, "/") == 0) + if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0) { filler(buf, ".", NULL, 0); filler(buf, "..", NULL, 0); - filler(buf, directory+1, NULL, 0); + filler(buf, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount"+1, NULL, 0); return 0; } + + /* + else if (strcmp(path, directory) == 0) // mounted directory with content { filler(buf, ".", NULL, 0); @@ -64,6 +69,8 @@ int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler, return 0; } + */ + else return -ENOENT; }