[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21746 - gnunet-fuse/src/fuse
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21746 - gnunet-fuse/src/fuse |
Date: |
Sun, 3 Jun 2012 19:47:52 +0200 |
Author: grothoff
Date: 2012-06-03 19:47:51 +0200 (Sun, 03 Jun 2012)
New Revision: 21746
Modified:
gnunet-fuse/src/fuse/getattr.c
gnunet-fuse/src/fuse/gnunet-fuse.c
gnunet-fuse/src/fuse/gnunet-service-fuse.c
gnunet-fuse/src/fuse/mkdir.c
gnunet-fuse/src/fuse/mknod.c
gnunet-fuse/src/fuse/open.c
gnunet-fuse/src/fuse/read.c
gnunet-fuse/src/fuse/readdir.c
gnunet-fuse/src/fuse/release.c
gnunet-fuse/src/fuse/rename.c
gnunet-fuse/src/fuse/rmdir.c
gnunet-fuse/src/fuse/test_fuse_api.c
gnunet-fuse/src/fuse/truncate.c
gnunet-fuse/src/fuse/unlink.c
gnunet-fuse/src/fuse/utimens.c
gnunet-fuse/src/fuse/write.c
Log:
-indentation
Modified: gnunet-fuse/src/fuse/getattr.c
===================================================================
--- gnunet-fuse/src/fuse/getattr.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/getattr.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -18,19 +18,18 @@
#include <fuse.h>
#include <gnunet-fuse.h>
-int gn_getattr(const char *path, struct stat *stbuf)
+int
+gn_getattr (const char *path, struct stat *stbuf)
{
- memset(stbuf, 0, sizeof(*stbuf));
+ memset (stbuf, 0, sizeof (*stbuf));
- stbuf->st_mode = S_IFDIR | 0555;
- stbuf->st_nlink = 1;
+ stbuf->st_mode = S_IFDIR | 0555;
+ stbuf->st_nlink = 1;
- return 0;
+ return 0;
}
-
-
Modified: gnunet-fuse/src/fuse/gnunet-fuse.c
===================================================================
--- gnunet-fuse/src/fuse/gnunet-fuse.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/gnunet-fuse.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -56,12 +56,12 @@
struct GNUNET_FUSE_PathInfo *
create_path_info (const char *path, const struct GNUNET_FS_Uri *uri)
{
- struct GNUNET_FUSE_PathInfo * pi;
+ struct GNUNET_FUSE_PathInfo *pi;
pi = GNUNET_malloc (sizeof (struct GNUNET_FUSE_PathInfo));
pi->path = GNUNET_strdup (path);
- pi->uri = GNUNET_FS_uri_dup(uri);
- return pi;
+ pi->uri = GNUNET_FS_uri_dup (uri);
+ return pi;
}
@@ -83,10 +83,8 @@
* @param value value in the hash map, a 'struct GNUNET_FUSE_PathInfo'
* @return GNUNET_YES (we should continue to iterate)
*/
-static int
-cleanup_path_info (void *cls,
- const GNUNET_HashCode * key,
- void *value)
+static int
+cleanup_path_info (void *cls, const GNUNET_HashCode * key, void *value)
{
struct GNUNET_FUSE_PathInfo *pi = value;
@@ -106,19 +104,18 @@
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
{
static struct fuse_operations fops = {
- // .mkdir = gn_mkdir,
- // .mknod = gn_mknod,
- // .release = gn_release,
- // .rename = gn_rename,
- // .rmdir = gn_rmdir,
- // .truncate = gn_truncate,
- // .unlink = gn_unlink,
- // .utimens = gn_utimens,
- // .write = gn_write,
+ // .mkdir = gn_mkdir,
+ // .mknod = gn_mknod,
+ // .release = gn_release,
+ // .rename = gn_rename,
+ // .rmdir = gn_rmdir,
+ // .truncate = gn_truncate,
+ // .unlink = gn_unlink,
+ // .utimens = gn_utimens,
+ // .write = gn_write,
.getattr = gn_getattr,
.readdir = gn_readdir,
.open = gn_open,
@@ -131,41 +128,37 @@
char *emsg;
GNUNET_HashCode path_hash;
const char *path = "/";
-
+
ret = 0;
if (NULL == source)
- {
- fprintf(stderr,
- _("`%s' option for URI missing\n"),
- "-s");
- ret = 1;
- return;
- }
+ {
+ fprintf (stderr, _("`%s' option for URI missing\n"), "-s");
+ ret = 1;
+ return;
+ }
if (NULL == directory)
- {
- fprintf(stderr,
- _("`%s' option for mountpoint missing\n"),
- "-d");
- ret = 2;
- return;
- }
+ {
+ fprintf (stderr, _("`%s' option for mountpoint missing\n"), "-d");
+ ret = 2;
+ return;
+ }
/* parse source string to uri */
- if (NULL == (uri = GNUNET_FS_uri_parse(source, &emsg)))
- {
- fprintf(stderr,
- "%s\n", emsg);
- GNUNET_free (emsg);
- ret = 3;
- return;
- }
+ if (NULL == (uri = GNUNET_FS_uri_parse (source, &emsg)))
+ {
+ fprintf (stderr, "%s\n", emsg);
+ GNUNET_free (emsg);
+ ret = 3;
+ return;
+ }
map = GNUNET_CONTAINER_multihashmap_create (10);
GNUNET_CRYPTO_hash (path, strlen (path), &path_hash);
pi = create_path_info (path, uri);
- GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(map,
- &path_hash, pi,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (map,
+ &path_hash,
+ pi,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
if (GNUNET_YES == single_threaded)
@@ -173,20 +166,20 @@
else
argc = 2;
{
- char *a[argc+1];
- a[0]="gnunet-fuse";
- a[1]= directory;
+ char *a[argc + 1];
+ a[0] = "gnunet-fuse";
+ a[1] = directory;
if (GNUNET_YES == single_threaded)
- {
- a[2] = "-s";
- a[3] = "-f";
- a[4] = "-d";
- }
+ {
+ a[2] = "-s";
+ a[3] = "-f";
+ a[4] = "-d";
+ }
a[argc] = NULL;
- fuse_main(argc, a, &fops, NULL);
+ fuse_main (argc, a, &fops, NULL);
}
- GNUNET_CONTAINER_multihashmap_iterate(map, &cleanup_path_info, NULL);
- GNUNET_CONTAINER_multihashmap_destroy(map);
+ GNUNET_CONTAINER_multihashmap_iterate (map, &cleanup_path_info, NULL);
+ GNUNET_CONTAINER_multihashmap_destroy (map);
GNUNET_FS_uri_destroy (uri);
}
@@ -200,7 +193,7 @@
*/
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,
@@ -211,15 +204,15 @@
{'t', "single-threaded", NULL,
gettext_noop ("run in single-threaded mode"), 0,
&GNUNET_GETOPT_set_one, &single_threaded},
- GNUNET_GETOPT_OPTION_END
+ GNUNET_GETOPT_OPTION_END
};
return (GNUNET_OK ==
- GNUNET_PROGRAM_run2(argc,
- argv,
- "gnunet-fuse -s URI [-- FUSE-OPTIONS]
DIRECTORYNAME",
- gettext_noop
- ("fuse"),
- options, &run, NULL, GNUNET_YES)) ? ret : 1;
+ GNUNET_PROGRAM_run2 (argc,
+ argv,
+ "gnunet-fuse -s URI [-- FUSE-OPTIONS]
DIRECTORYNAME",
+ gettext_noop
+ ("fuse"),
+ options, &run, NULL, GNUNET_YES)) ? ret : 1;
}
/* end of gnunet-fuse.c */
Modified: gnunet-fuse/src/fuse/gnunet-service-fuse.c
===================================================================
--- gnunet-fuse/src/fuse/gnunet-service-fuse.c 2012-06-03 17:46:22 UTC (rev
21745)
+++ gnunet-fuse/src/fuse/gnunet-service-fuse.c 2012-06-03 17:47:51 UTC (rev
21746)
@@ -43,11 +43,10 @@
*/
static void
handle_ext (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
- GNUNET_SERVER_receive_done (client,
- GNUNET_OK);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -58,8 +57,7 @@
* @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
}
@@ -71,9 +69,7 @@
* @param client identification of the client
*/
static void
-handle_client_disconnect (void *cls,
- struct GNUNET_SERVER_Client
- * client)
+handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
{
}
@@ -96,12 +92,9 @@
};
cfg = c;
GNUNET_SERVER_add_handlers (server, handlers);
- GNUNET_SERVER_disconnect_notify (server,
- &handle_client_disconnect,
- NULL);
+ GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- NULL);
+ &shutdown_task, NULL);
}
@@ -116,9 +109,9 @@
main (int argc, char *const *argv)
{
return (GNUNET_OK ==
- GNUNET_SERVICE_run (argc,
- argv,
- "fuse",
+ GNUNET_SERVICE_run (argc,
+ argv,
+ "fuse",
GNUNET_SERVICE_OPTION_NONE,
&run, NULL)) ? 0 : 1;
}
Modified: gnunet-fuse/src/fuse/mkdir.c
===================================================================
--- gnunet-fuse/src/fuse/mkdir.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/mkdir.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -19,7 +19,8 @@
#include <fuse.h>
-int gn_mkdir(const char *path, mode_t mode)
+int
+gn_mkdir (const char *path, mode_t mode)
{
- return 0;
+ return 0;
}
Modified: gnunet-fuse/src/fuse/mknod.c
===================================================================
--- gnunet-fuse/src/fuse/mknod.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/mknod.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -17,7 +17,8 @@
#include <sys/stat.h>
#include <fuse.h>
-int gn_mknod(const char *path, mode_t mode, dev_t rdev)
+int
+gn_mknod (const char *path, mode_t mode, dev_t rdev)
{
- return 0;
+ return 0;
}
Modified: gnunet-fuse/src/fuse/open.c
===================================================================
--- gnunet-fuse/src/fuse/open.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/open.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -31,24 +31,23 @@
-int gn_open(const char *path, struct fuse_file_info *fi)
+int
+gn_open (const char *path, struct fuse_file_info *fi)
{
- //if (strcmp(path, "/home/mg/gnunet-fuse2/gnunet-fuse/src/ext/monti")
== 0)
- // return 0;
+ //if (strcmp(path, "/home/mg/gnunet-fuse2/gnunet-fuse/src/ext/monti") == 0)
+ // return 0;
//
-// else if ((fi->flags & 3) != O_RDONLY)
-// return -EACCES;
+// else if ((fi->flags & 3) != O_RDONLY)
+// return -EACCES;
-// else return 0;
+// else return 0;
/*
* when user is allowed to open, return 0
*/
- return 0;
- }
-
-
+ return 0;
+}
Modified: gnunet-fuse/src/fuse/read.c
===================================================================
--- gnunet-fuse/src/fuse/read.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/read.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -22,8 +22,9 @@
-int gn_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
+int
+gn_read (const char *path, char *buf, size_t size, off_t offset,
+ struct fuse_file_info *fi)
{
/* (void) fi;
size_t len;
@@ -69,5 +70,3 @@
*/
return -ENOENT;
}
-
-
Modified: gnunet-fuse/src/fuse/readdir.c
===================================================================
--- gnunet-fuse/src/fuse/readdir.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/readdir.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -77,209 +77,221 @@
struct GNUNET_FS_DownloadContext *d;
if (dc != NULL)
- {
- d = dc;
- dc = NULL;
- GNUNET_FS_download_stop (d, delete_incomplete);
- }
+ {
+ d = dc;
+ dc = NULL;
+ GNUNET_FS_download_stop (d, delete_incomplete);
+ }
}
/* callback function */
-void *progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo * info)
+static void *
+progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
{
- char *s;
- char*s2;
- char *t;
+ char *s;
+ char *s2;
+ char *t;
- switch (info->status)
+ switch (info->status)
+ {
+ case GNUNET_FS_STATUS_DOWNLOAD_START:
+ if (verbose > 1)
+ FPRINTF (stderr, _("Starting download `%s'.\n"),
+ info->value.download.filename);
+ break;
+ case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
+ if (verbose)
{
- case GNUNET_FS_STATUS_DOWNLOAD_START:
- if (verbose > 1)
- FPRINTF (stderr, _("Starting download `%s'.\n"),
- info->value.download.filename);
- break;
- case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
- if (verbose)
- {
- s = GNUNET_STRINGS_relative_time_to_string (info->value.download.eta);
- if
(info->value.download.specifics.progress.block_download_duration.rel_value
- == GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
- s2 = GNUNET_strdup (_("<unknown time>"));
+ s =
+ GNUNET_STRINGS_relative_time_to_string (info->value.download.eta);
+ if (info->value.download.specifics.progress.
+ block_download_duration.rel_value ==
+ GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
+ s2 = GNUNET_strdup (_("<unknown time>"));
else
- s2 = GNUNET_STRINGS_relative_time_to_string (
-
info->value.download.specifics.progress.block_download_duration);
- t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed *
- 1000LL /
- (info->value.download.
- duration.rel_value +
1));
+ s2 =
+ GNUNET_STRINGS_relative_time_to_string (info->value.
+ download.specifics.
+
progress.block_download_duration);
+ t =
+ GNUNET_STRINGS_byte_size_fancy (info->value.download.completed *
+ 1000LL /
+ (info->value.download.
+ duration.rel_value + 1));
FPRINTF (stdout,
- _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block
took %s to download\n"),
- info->value.download.filename,
- (unsigned long long) info->value.download.completed,
- (unsigned long long) info->value.download.size, s, t, s2);
- GNUNET_free (s);
- GNUNET_free (s2);
- GNUNET_free (t);
+ _
+ ("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block
took %s to download\n"),
+ info->value.download.filename,
+ (unsigned long long) info->value.download.completed,
+ (unsigned long long) info->value.download.size, s, t, s2);
+ GNUNET_free (s);
+ GNUNET_free (s2);
+ GNUNET_free (t);
}
- break;
- case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
- FPRINTF (stderr, _("Error downloading: %s.\n"),
- info->value.download.specifics.error.message);
+ break;
+ case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
+ FPRINTF (stderr, _("Error downloading: %s.\n"),
+ info->value.download.specifics.error.message);
+ GNUNET_SCHEDULER_shutdown ();
+ break;
+ case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
+ s =
+ GNUNET_STRINGS_byte_size_fancy (info->value.download.completed *
+ 1000 /
+ (info->value.download.
+ duration.rel_value + 1));
+ FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"),
+ info->value.download.filename, s);
+ GNUNET_free (s);
+ if (info->value.download.dc == dc)
GNUNET_SCHEDULER_shutdown ();
- break;
- case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
- s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed *
1000 /
- (info->value.download.
- duration.rel_value + 1));
- FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"),
- info->value.download.filename, s);
- GNUNET_free (s);
- if (info->value.download.dc == dc)
- GNUNET_SCHEDULER_shutdown ();
- break;
- case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
- if (info->value.download.dc == dc)
- GNUNET_SCHEDULER_add_continuation (&cleanup_task, NULL,
-
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
- break;
- case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE:
- case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
- break;
- default:
- FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
- break;
- }
+ break;
+ case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
+ if (info->value.download.dc == dc)
+ GNUNET_SCHEDULER_add_continuation (&cleanup_task, NULL,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ break;
+ case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE:
+ case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
+ break;
+ default:
+ FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
+ break;
+ }
-return NULL;
+ return NULL;
}
-void readdir_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext*
tc)
+void
+readdir_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- enum GNUNET_FS_DownloadOptions options;
+ enum GNUNET_FS_DownloadOptions options;
- if (NULL == uri)
- {
- FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
- GNUNET_free (emsg);
- GNUNET_FS_stop (ctx); // ?? hmmm....stop before start ??
- }
+ if (NULL == uri)
+ {
+ FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
+ GNUNET_free (emsg);
+ GNUNET_FS_stop (ctx); // ?? hmmm....stop before start ??
+ }
- fs = GNUNET_FS_start (cfg, "gnunet-fuse", &progress_cb, NULL,
- GNUNET_FS_FLAGS_NONE,
-
GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, parallelism,
-
GNUNET_FS_OPTIONS_REQUEST_PARALLELISM, request_parallelism,
- GNUNET_FS_OPTIONS_END);
+ fs = GNUNET_FS_start (cfg, "gnunet-fuse", &progress_cb, NULL,
+ GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, parallelism,
+ GNUNET_FS_OPTIONS_REQUEST_PARALLELISM,
+ request_parallelism, GNUNET_FS_OPTIONS_END);
- if (NULL == fs)
- {
- FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
- GNUNET_FS_uri_destroy (uri);
- ret = 1;
- return;
- }
+ if (NULL == fs)
+ {
+ FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+ GNUNET_FS_uri_destroy (uri);
+ ret = 1;
+ return;
+ }
- options = GNUNET_FS_DOWNLOAD_OPTION_NONE;
- if (do_recursive)
- options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
- if (local_only)
- options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY;
+ options = GNUNET_FS_DOWNLOAD_OPTION_NONE;
+ if (do_recursive)
+ options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
+ if (local_only)
+ options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY;
- struct GNUNET_FS_DownloadContext* dc;
- dc = GNUNET_FS_download_start (fs, uri, NULL, r->tmpfile, NULL, 0,
-
GNUNET_FS_uri_chk_get_file_size(uri),
- anonymity,
options, NULL, NULL);
+ struct GNUNET_FS_DownloadContext *dc;
+ dc = GNUNET_FS_download_start (fs, uri, NULL, r->tmpfile, NULL, 0,
+ GNUNET_FS_uri_chk_get_file_size (uri),
+ anonymity, options, NULL, NULL);
- GNUNET_FS_uri_destroy (uri);
- if (dc == NULL)
- {
- GNUNET_FS_stop (ctx);
- ctx = NULL;
- return;
- }
+ GNUNET_FS_uri_destroy (uri);
+ if (dc == NULL)
+ {
+ GNUNET_FS_stop (ctx);
+ ctx = NULL;
+ return;
+ }
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
+ NULL);
}
-int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
+int
+gn_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
+ off_t offset, struct fuse_file_info *fi)
{
- struct GNUNET_FUSE_path_info * path_info = NULL;
- printf("FUSE PATH gives me: `%s'\n", path);
- (void) fi;
- (void) offset;
+ struct GNUNET_FUSE_path_info *path_info = NULL;
+ printf ("FUSE PATH gives me: `%s'\n", path);
+ (void) fi;
+ (void) offset;
- GNUNET_HashCode path_hash;
- GNUNET_CRYPTO_hash (path, strlen (path), &path_hash);
- /* NOTE: Path can be like /.Trash/1000/files for the trash directory */
- if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(map,
&path_hash))
- {
- /* new path */
- //path_info = create_path_info (path, NULL);
- //GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put(map, &path_hash, path_info,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
- }
- else
- {
- /* existing path */
- path_info = GNUNET_CONTAINER_multihashmap_get (map, &path_hash);
- }
+ GNUNET_HashCode path_hash;
+ GNUNET_CRYPTO_hash (path, strlen (path), &path_hash);
+ /* NOTE: Path can be like /.Trash/1000/files for the trash directory */
+ if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (map, &path_hash))
+ {
+ /* new path */
+ //path_info = create_path_info (path, NULL);
+ //GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(map,
&path_hash, path_info, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ }
+ else
+ {
+ /* existing path */
+ path_info = GNUNET_CONTAINER_multihashmap_get (map, &path_hash);
+ }
- //GNUNET_assert (path_info != NULL);
+ //GNUNET_assert (path_info != NULL);
#if 0
- r = GNUNET_malloc (sizeof (struct GNUNET_FUSE_path_info));
+ r = GNUNET_malloc (sizeof (struct GNUNET_FUSE_path_info));
- int len = strlen(path);
- int exist = 0;
- r->path = path;
+ int len = strlen (path);
+ int exist = 0;
+ r->path = path;
- /* compute key */
+ /* compute key */
- GNUNET_CRYPTO_hash (r->path, len, r->hash);
+ GNUNET_CRYPTO_hash (r->path, len, r->hash);
- exist = GNUNET_CONTAINER_multihashmap_contains (map, r->hash);
- if ( exist == GNUNET_NO)
- {
+ exist = GNUNET_CONTAINER_multihashmap_contains (map, r->hash);
+ if (exist == GNUNET_NO)
+ {
/* Store a key-value pair in the map */
- GNUNET_CONTAINER_multihashmap_put (map, r->hash, r->path,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_CONTAINER_multihashmap_put (map, r->hash, r->path,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
/* store to temporary file */
- r->tmpfile = GNUNET_DISK_mktemp("gnunet-fuse-tempfile");
+ r->tmpfile = GNUNET_DISK_mktemp ("gnunet-fuse-tempfile");
/* find value with given key */
- r->source = GNUNET_CONTAINER_multihashmap_get (map, r->hash);
+ r->source = GNUNET_CONTAINER_multihashmap_get (map, r->hash);
/* parse uri from given source */
- uri = GNUNET_FS_uri_parse(r->source, &emsg);
- GNUNET_SCHEDULER_run(&readdir_task, NULL);
+ uri = GNUNET_FS_uri_parse (r->source, &emsg);
+ GNUNET_SCHEDULER_run (&readdir_task, NULL);
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
+ filler (buf, ".", NULL, 0);
+ filler (buf, "..", NULL, 0);
- return 0;
- }
+ return 0;
+ }
- else
- {
- uri = GNUNET_FS_uri_parse(r->source, &emsg);
- GNUNET_SCHEDULER_run(&readdir_task, NULL);
+ else
+ {
+ uri = GNUNET_FS_uri_parse (r->source, &emsg);
+ GNUNET_SCHEDULER_run (&readdir_task, NULL);
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- return 0;
- }
+ filler (buf, ".", NULL, 0);
+ filler (buf, "..", NULL, 0);
+ return 0;
+ }
#endif
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- return 0;
+ filler (buf, ".", NULL, 0);
+ filler (buf, "..", NULL, 0);
+ return 0;
}
Modified: gnunet-fuse/src/fuse/release.c
===================================================================
--- gnunet-fuse/src/fuse/release.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/release.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -23,7 +23,8 @@
#include <fuse.h>
//#include <gnunet-fuse.h>
-int gn_release(const char *path, struct fuse_file_info *fi)
+int
+gn_release (const char *path, struct fuse_file_info *fi)
{
- return 0;
+ return 0;
}
Modified: gnunet-fuse/src/fuse/rename.c
===================================================================
--- gnunet-fuse/src/fuse/rename.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/rename.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -15,8 +15,9 @@
#include <fuse.h>
-int gn_rename(const char *from, const char *to)
+int
+gn_rename (const char *from, const char *to)
{
- int ret=0;
- return ret;
+ int ret = 0;
+ return ret;
}
Modified: gnunet-fuse/src/fuse/rmdir.c
===================================================================
--- gnunet-fuse/src/fuse/rmdir.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/rmdir.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -15,7 +15,8 @@
#include <fuse.h>
-int gn_rmdir(const char *path)
+int
+gn_rmdir (const char *path)
{
- return 0;
+ return 0;
}
Modified: gnunet-fuse/src/fuse/test_fuse_api.c
===================================================================
--- gnunet-fuse/src/fuse/test_fuse_api.c 2012-06-03 17:46:22 UTC (rev
21745)
+++ gnunet-fuse/src/fuse/test_fuse_api.c 2012-06-03 17:47:51 UTC (rev
21746)
@@ -29,8 +29,7 @@
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
{
}
@@ -45,13 +44,11 @@
};
struct GNUNET_OS_Process *proc;
- proc = GNUNET_OS_start_process (NULL, NULL,
+ proc = GNUNET_OS_start_process (NULL, NULL,
"gnunet-service-fuse",
- "gnunet-service-fuse",
- NULL);
+ "gnunet-service-fuse", NULL);
GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run (1, argv, "test-fuse-api", "nohelp",
- options, &run, &ok);
+ GNUNET_PROGRAM_run (1, argv, "test-fuse-api", "nohelp", options, &run, &ok);
if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
@@ -66,9 +63,7 @@
int
main (int argc, char *argv[])
{
- GNUNET_log_setup ("test_statistics_api",
- "WARNING",
- NULL);
+ GNUNET_log_setup ("test_statistics_api", "WARNING", NULL);
return check ();
}
Modified: gnunet-fuse/src/fuse/truncate.c
===================================================================
--- gnunet-fuse/src/fuse/truncate.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/truncate.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -13,8 +13,9 @@
#include <fuse.h>
-int gn_truncate(const char *path, off_t size)
+int
+gn_truncate (const char *path, off_t size)
{
- int ret = 0;
- return ret;
+ int ret = 0;
+ return ret;
}
Modified: gnunet-fuse/src/fuse/unlink.c
===================================================================
--- gnunet-fuse/src/fuse/unlink.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/unlink.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -15,7 +15,8 @@
#include <fuse.h>
-int gn_unlink(const char *path)
+int
+gn_unlink (const char *path)
{
- return 0;
+ return 0;
}
Modified: gnunet-fuse/src/fuse/utimens.c
===================================================================
--- gnunet-fuse/src/fuse/utimens.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/utimens.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -18,8 +18,9 @@
-int gn_utimens(const char *path, const struct timespec ts[2])
+int
+gn_utimens (const char *path, const struct timespec ts[2])
{
- int ret = 0;
- return ret;
+ int ret = 0;
+ return ret;
}
Modified: gnunet-fuse/src/fuse/write.c
===================================================================
--- gnunet-fuse/src/fuse/write.c 2012-06-03 17:46:22 UTC (rev 21745)
+++ gnunet-fuse/src/fuse/write.c 2012-06-03 17:47:51 UTC (rev 21746)
@@ -19,8 +19,9 @@
#include <fuse.h>
-int gn_write(const char *path, const char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
+int
+gn_write (const char *path, const char *buf, size_t size, off_t offset,
+ struct fuse_file_info *fi)
{
- return -ENOENT;
+ return -ENOENT;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21746 - gnunet-fuse/src/fuse,
gnunet <=