gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4972 - gnunet-fuse


From: gnunet
Subject: [GNUnet-SVN] r4972 - gnunet-fuse
Date: Fri, 8 Jun 2007 23:02:04 -0600 (MDT)

Author: amatus
Date: 2007-06-08 23:02:04 -0600 (Fri, 08 Jun 2007)
New Revision: 4972

Modified:
   gnunet-fuse/ChangeLog
   gnunet-fuse/Makefile.am
   gnunet-fuse/configure.ac
   gnunet-fuse/getattr.c
   gnunet-fuse/gnfs.h
   gnunet-fuse/open.c
   gnunet-fuse/read.c
   gnunet-fuse/readdir.c
Log:
Added .uri files which read the uri of the containing directory

Modified: gnunet-fuse/ChangeLog
===================================================================
--- gnunet-fuse/ChangeLog       2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/ChangeLog       2007-06-09 05:02:04 UTC (rev 4972)
@@ -1,3 +1,5 @@
+2007-06-08 David Barksdale <address@hidden> 0.4
+* Added .uri files which read the uri of the containing directory
 2007-05-30 David Barksdale <address@hidden> 0.3
 * Added support for ECRS_downloadPartialFile (requires GNUnet > 0.7.1c)
 2007-05-29 David Barksdale <address@hidden> 0.2

Modified: gnunet-fuse/Makefile.am
===================================================================
--- gnunet-fuse/Makefile.am     2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/Makefile.am     2007-06-09 05:02:04 UTC (rev 4972)
@@ -7,6 +7,7 @@
        open.c \
        read.c \
        readdir.c \
+       special_file.c \
        gnfs.h \
        gettext.h
 

Modified: gnunet-fuse/configure.ac
===================================================================
--- gnunet-fuse/configure.ac    2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/configure.ac    2007-06-09 05:02:04 UTC (rev 4972)
@@ -1,4 +1,4 @@
-AC_INIT(gnunet-fuse, 0.3)
+AC_INIT(gnunet-fuse, 0.4)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
 

Modified: gnunet-fuse/getattr.c
===================================================================
--- gnunet-fuse/getattr.c       2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/getattr.c       2007-06-09 05:02:04 UTC (rev 4972)
@@ -28,10 +28,24 @@
 int gn_getattr(const char *path, struct stat *stbuf)
 {
        struct dirent *de;
+       char *special;
 
        GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, "getattr for '%s'\n",
                path);
 
+       /* Check to see if this is a special file */
+       special = gn_get_special_file(path);
+       if(special != NULL)
+       {
+               memset(stbuf, 0, sizeof(*stbuf));
+               stbuf->st_mode = 0555 | S_IFREG;
+               stbuf->st_nlink = 1;
+               stbuf->st_size = strlen(special);
+               FREE(special);
+               return 0;
+       }
+
+       /* Fill in dirent stat info */
        de = gn_dirent_find(path);
        if(de == NULL)
                return -ENOENT;

Modified: gnunet-fuse/gnfs.h
===================================================================
--- gnunet-fuse/gnfs.h  2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/gnfs.h  2007-06-09 05:02:04 UTC (rev 4972)
@@ -32,6 +32,9 @@
 #define _(x) x
 #define STRERROR strerror
 
+#define URI_FILE       ".uri"
+#define URI_LEN                4
+
 struct dirent
 {
        gchar *de_path;
@@ -66,6 +69,7 @@
 int gn_directory_for_each(struct dirent *de, gn_dir_for_each_callback cb,
         void *data);
 
+/* FUSE function files */
 int gn_getattr(const char *path, struct stat *stbuf);
 int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
        off_t offset, struct fuse_file_info *fi);
@@ -73,4 +77,7 @@
 int gn_read(const char *path, char *buf, size_t size, off_t offset,
        struct fuse_file_info *fi);
 
+/* special_file.c */
+char *gn_get_special_file(const char *path);
+
 #endif /* _GNFS_H_ */

Modified: gnunet-fuse/open.c
===================================================================
--- gnunet-fuse/open.c  2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/open.c  2007-06-09 05:02:04 UTC (rev 4972)
@@ -27,10 +27,20 @@
 int gn_open(const char *path, struct fuse_file_info *fi)
 {
        struct dirent *de;
+       char *special;
 
        (void)fi;
        GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, "open for '%s'\n",
                path);
+       
+       /* Check for special file */
+       special = gn_get_special_file(path);
+       if(special != NULL)
+       {
+               FREE(special);
+               return 0;
+       }
+
        de = gn_dirent_find(path);
        if(de == NULL)
        {

Modified: gnunet-fuse/read.c
===================================================================
--- gnunet-fuse/read.c  2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/read.c  2007-06-09 05:02:04 UTC (rev 4972)
@@ -74,13 +74,35 @@
 {
        struct dirent *de;
        struct read_data d;
-       int ret;
+       char *special;
+       int ret, slen;
        guint64 len;
 
        (void)fi;
 
        GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, "read '%s' %d bytes\n",
                path, size);
+
+       /* Check for special file */
+       special = gn_get_special_file(path);
+       if(special != NULL)
+       {
+               slen = strlen(special);
+               if(offset >= slen)
+               {
+                       FREE(special);
+                       return 0;
+               }
+               if(offset + size > slen)
+               {
+                       size = slen - offset;
+               }
+               memcpy(buf, special + offset, size);
+               FREE(special);
+               return size;
+       }
+
+       /* Lookup dirent for path */
        de = gn_dirent_find(path);
        if(de == NULL)
        {

Modified: gnunet-fuse/readdir.c
===================================================================
--- gnunet-fuse/readdir.c       2007-06-09 04:32:40 UTC (rev 4971)
+++ gnunet-fuse/readdir.c       2007-06-09 05:02:04 UTC (rev 4972)
@@ -81,6 +81,7 @@
        }
        filler(buf, ".", NULL, 0);
        filler(buf, "..", NULL, 0);
+       filler(buf, URI_FILE, NULL, 0);
        d.filler = filler;
        d.buf = buf;
        ret = gn_directory_for_each(de, readdir_callback, &d);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]