gnunet-fuse

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

commit a4189b2fc3d0c37477b4967e58eb888b01bba4ad
parent 5a9f7c3be98359085615795873eb1ec277f52108
Author: Mauricio Günther <mauricio@140774ce-b5e7-0310-ab8b-a85725594a96>
Date:   Fri, 23 Mar 2012 15:58:42 +0000

-n.w.c homework to do


Diffstat:
Msrc/ext/gnunet-fuse.c | 5+++++
Msrc/ext/gnunet-fuse.h | 11+++++++++++
Msrc/ext/readdir.c | 11+++++++----
3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/ext/gnunet-fuse.c b/src/ext/gnunet-fuse.c @@ -30,6 +30,7 @@ #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) #include "gnunet-fuse.h" +#include <gnunet/gnunet_container_lib.h> static int ret; @@ -147,6 +148,8 @@ int main (int argc, char *const *argv) { + + static const struct GNUNET_GETOPT_CommandLineOption options[] = { {'s', "source", "URI", gettext_noop ("Source you get the URI from"), 1, @@ -156,6 +159,8 @@ main (int argc, char *const *argv) &GNUNET_GETOPT_set_string, &directory}, GNUNET_GETOPT_OPTION_END }; + + return (GNUNET_OK == GNUNET_PROGRAM_run2(argc, argv, diff --git a/src/ext/gnunet-fuse.h b/src/ext/gnunet-fuse.h @@ -46,6 +46,17 @@ static char *source; static char *directory; +/* struct containing mapped Path, with URI and other Information like Attributes etc. */ + +struct gnunet_fuse_path_uri +{ +/* uri to corresponding path */ + char* source; + +/*name of temporary file */ + char* tf; +}; + /* FUSE function files */ int gn_getattr(const char *path, struct stat *stbuf); diff --git a/src/ext/readdir.c b/src/ext/readdir.c @@ -161,10 +161,13 @@ void readdir_task (void *cls, struct GNUNET_FS_Uri *uri; char *emsg; enum GNUNET_FS_DownloadOptions options; - const char* w = "datei1"; - char* filename = GNUNET_DISK_mktemp(w); + struct gnunet_fuse_path_uri *w; - uri = GNUNET_FS_uri_parse(source, &emsg); + w = GNUNET_malloc (sizeof (struct gnunet_fuse_path_uri)); + + w->tf = GNUNET_DISK_mktemp("gnunet-fuse-tempfile"); + w->source = source; + uri = GNUNET_FS_uri_parse(w->source, &emsg); if (NULL == uri) { @@ -194,7 +197,7 @@ void readdir_task (void *cls, options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY; struct GNUNET_FS_DownloadContext* dc; - dc = GNUNET_FS_download_start (fs, uri, NULL, filename, NULL, 0, + dc = GNUNET_FS_download_start (fs, uri, NULL, w->tf, NULL, 0, GNUNET_FS_uri_chk_get_file_size(uri), anonymity, options, NULL, NULL);