opensubscriber
   Find in this group all groups
 
Unknown more information…

g : gnunet-svn@gnu.org 26 March 2012 • 11:12PM -0400

[GNUnet-SVN] r20773 - gnunet-fuse/src/ext
by gnunet

REPLY TO AUTHOR
 
REPLY TO GROUP




Author: mauricio
Date: 2012-03-26 17:12:34 +0200 (Mon, 26 Mar 2012)
New Revision: 20773

Modified:
   gnunet-fuse/src/ext/gnunet-fuse.c
   gnunet-fuse/src/ext/gnunet-fuse.h
   gnunet-fuse/src/ext/readdir.c
Log:
-n.w.c


Modified: gnunet-fuse/src/ext/gnunet-fuse.c
===================================================================
--- gnunet-fuse/src/ext/gnunet-fuse.c 2012-03-26 13:58:21 UTC (rev 20772)
+++ gnunet-fuse/src/ext/gnunet-fuse.c 2012-03-26 15:12:34 UTC (rev 20773)
@@ -33,7 +33,7 @@
#include <gnunet/gnunet_container_lib.h>
#include <gnunet/gnunet_crypto_lib.h>

-struct GNUNET_CONTAINER_MultiHashMap *map;
+//struct GNUNET_CONTAINER_MultiHashMap *map;

static int ret;

@@ -140,44 +140,13 @@
}


- /* Store a key-value pair in the map. */
- struct path_uri *t;
+/* create MultiHashMap */
+unsigned int len = strlen(directory);

- t = GNUNET_malloc (sizeof (struct path_uri));
-
- GNUNET_CONTAINER_multihashmap_put (map, directory, source, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
-
-
-
-/* create MultiHashMap
struct GNUNET_CONTAINER_MultiHashMap *map;
-unsigned int len = strlen(path);
-
-map = GNUNET_malloc (sizeof (struct GNUNET_CONTAINER_MultiHashMap));
map = GNUNET_CONTAINER_multihashmap_create (len);
-*/

-/* compute key

-int size = sizeof(block);
-struct path_uri * r;
-
-GNUNET_CRYPTO_hash (path, len, r);
-*/
-
-
-/* Store a key-value pair in the map.
-
-struct path_uri *t;
-
-t = GNUNET_malloc (sizeof (struct path_uri));
-
-GNUNET_CONTAINER_multihashmap_put (map, t->path, t->source, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
-
-
-*/
-
-
/* main function of fuse */
fuse_main(argc, a, &fops, NULL);
}

Modified: gnunet-fuse/src/ext/gnunet-fuse.h
===================================================================
--- gnunet-fuse/src/ext/gnunet-fuse.h 2012-03-26 13:58:21 UTC (rev 20772)
+++ gnunet-fuse/src/ext/gnunet-fuse.h 2012-03-26 15:12:34 UTC (rev 20773)
@@ -49,16 +49,18 @@

/* struct containing mapped Path, with URI and other Information like Attributes etc. */

-struct path_uri
+struct GNUNET_FUSE_path_info
{
/* uri to corresponding path */
char* source;
/* pathname */
char* path;
/* key */
- int key;
+ GNUNET_HashCode hash;
/*name of temporary file */
char* tmpfile;
+/*file attributes*/
+ struct stat;
};



Modified: gnunet-fuse/src/ext/readdir.c
===================================================================
--- gnunet-fuse/src/ext/readdir.c 2012-03-26 13:58:21 UTC (rev 20772)
+++ gnunet-fuse/src/ext/readdir.c 2012-03-26 15:12:34 UTC (rev 20773)
@@ -27,15 +27,18 @@
  * Introduced in version 2.3
  */

+//#include <string.h>
+//#include <errno.h>
+//#include <glib.h>
+//#include <GNUnet/gnunet_ecrs_lib.h>
+
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
-//#include <string.h>
-//#include <errno.h>
-//#include <glib.h>
+
#include <fuse.h>
-//#include <GNUnet/gnunet_ecrs_lib.h>
+
#include <gnunet-fuse.h>
#include <gnunet/gnunet_fs_service.h>
#include <gnunet/gnunet_container_lib.h>
@@ -67,8 +70,10 @@

struct GNUNET_CONTAINER_MultiHashMap *map;

+struct GNUNET_FS_Uri *uri;


+
static void
cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
@@ -164,14 +169,14 @@
void readdir_task (void *cls,
   const struct GNUNET_SCHEDULER_TaskContext* tc)
{
- struct GNUNET_FS_Uri *uri;
+
char *emsg;
enum GNUNET_FS_DownloadOptions options;



- uri = GNUNET_FS_uri_parse(w->source, &emsg);

+
if (NULL == uri)
{
  FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
@@ -219,38 +224,36 @@


int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
+ off_t offset, struct fuse_file_info *fi)
{

(void) fi;
(void) offset;
+ struct GNUNET_FUSE_path_info *r;
+ int len = strlen(path);
+ int exist = 0;

+ r = GNUNET_malloc (sizeof (struct GNUNET_FUSE_path_info));

- /* create MultiHashMap */
- unsigned int len = strlen();
+ exist = GNUNET_CONTAINER_multihashmap_contains (map, r->hash,);
+ if ( exist == GNUNET_NO)

- map = GNUNET_malloc (sizeof (struct GNUNET_CONTAINER_MultiHashMap));
- map = GNUNET_CONTAINER_multihashmap_create (len);
+/* compute key */
+ GNUNET_CRYPTO_hash (r->path, len, r->hash);

+/* Store a key-value pair in the map */
+ GNUNET_CONTAINER_multihashmap_put (map, directory, source, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);

- /* compute key */
- struct path_uri * r;
+/* store to temporary file */
+ r->tmpfile = GNUNET_DISK_mktemp("gnunet-fuse-tempfile");

- GNUNET_CRYPTO_hash (r->path, len, r->key);
+/* find value with given key */
+ r->source = GNUNET_CONTAINER_multihashmap_get (map, r->path);

-
- /* find value with given key */
-
- w = GNUNET_malloc (sizeof (struct path_uri));
- w->tmpfile = GNUNET_DISK_mktemp("gnunet-fuse-tempfile");
- w->source = GNUNET_CONTAINER_multihashmap_get (map, w->path);
-
-
-
+/* parse uri from given source */
+ uri = GNUNET_FS_uri_parse(r->source, &emsg);
GNUNET_SCHEDULER_run(&readdir_task, NULL);

-
-
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);



_______________________________________________
GNUnet-SVN mailing list
GNUnet-SVN@gnu....
https://lists.gnu.org/mailman/listinfo/gnunet-svn

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.