gnunet-fuse

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

commit 22b5742f4852f97220f449ba57d0702f34cc6136
parent dc49b4e7957a7b8205f28fcc5878bf759a3aacb6
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 25 Nov 2007 12:38:19 +0000

fix

Diffstat:
Mdirectory.c | 60++++++++++++++++++++++++++++++------------------------------
Mdirent.c | 18+++++++++---------
Mfile.c | 16++++++++--------
Mgetattr.c | 8++++----
Mgnfs.h | 2+-
Mmain.c | 22+++++++++++-----------
Mmkdir.c | 10+++++-----
Mmknod.c | 12++++++------
Mopen.c | 4++--
Mread.c | 12++++++------
Mreaddir.c | 6+++---
Mrelease.c | 4++--
Mrename.c | 8++++----
Mrmdir.c | 2+-
Mspecial_file.c | 4++--
Mtruncate.c | 6+++---
Munlink.c | 2+-
Mutimens.c | 4++--
Mwrite.c | 6+++---
19 files changed, 103 insertions(+), 103 deletions(-)

diff --git a/directory.c b/directory.c @@ -60,15 +60,15 @@ static int dir_cache_cb(const GNUNET_ECRS_FileInfo *fi, const GNUNET_HashCode *k return GNUNET_OK; /* Figure out the filename and type from metadata */ - filename = GNUNET_ECRS_getFromMetaData(fi->meta, EXTRACTOR_FILENAME); + filename = GNUNET_ECRS_meta_data_get_by_type(fi->meta, EXTRACTOR_FILENAME); if(filename == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GWARNING, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_WARNING, "%s: dirent has no filename\n", __FUNCTION__); return GNUNET_OK; } len = strlen(filename); - if(GNUNET_ECRS_isDirectory(fi->meta) == GNUNET_YES) + if(GNUNET_ECRS_meta_data_test_for_directory(fi->meta) == GNUNET_YES) { if(filename[len - 1] == '/' || filename[len - 1] == '\\') filename[len - 1] = '\0'; @@ -103,7 +103,7 @@ static int dir_cache_cb(const GNUNET_ECRS_FileInfo *fi, const GNUNET_HashCode *k /* Add it to the directory's list (steals our ref)*/ GNUNET_mutex_lock(de->de_path_mutex); - GNUNET_GASSERT(ectx, + GNUNET_GE_ASSERT(ectx, !g_hash_table_lookup(deparent->de_dir_hash, de->de_basename)); g_hash_table_replace(deparent->de_dir_hash, de->de_basename, de); GNUNET_mutex_unlock(de->de_path_mutex); @@ -121,14 +121,14 @@ static int directory_cache_locked(struct dirent *de) int ret; guint64 len; - len = GNUNET_ECRS_fileSize(de->de_fi.uri); + len = GNUNET_ECRS_uri_get_file_size(de->de_fi.uri); mem = GNUNET_malloc(len); - ret = GNUNET_ECRS_downloadPartialFile(ectx, cfg, de->de_fi.uri, + ret = GNUNET_ECRS_file_download_partial(ectx, cfg, de->de_fi.uri, "/dev/null", 0, len, anonymity, GNUNET_YES, dpcb, mem, tt, NULL); if(ret != GNUNET_OK) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_ERROR, "%s: failed to download directory\n", __FUNCTION__); GNUNET_free(mem); @@ -136,11 +136,11 @@ static int directory_cache_locked(struct dirent *de) } de->de_dir_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)gn_dirent_put); - GNUNET_ECRS_listDirectory(ectx, mem, len, &md, dir_cache_cb, de); + GNUNET_ECRS_directory_list_contents(ectx, mem, len, &md, dir_cache_cb, de); GNUNET_free(mem); - GNUNET_ECRS_freeMetaData(md); + GNUNET_ECRS_meta_data_destroy(md); de->de_cached = 1; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: cached %d entries\n", __FUNCTION__, g_hash_table_size(de->de_dir_hash)); return 0; @@ -224,7 +224,7 @@ int gn_directory_insert(struct dirent *de, struct dirent *dechild) { if(directory_cache_locked(de) == -1) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: failed to cache parent dir\n", __FUNCTION__); gn_unlock_path(de, GN_UNLOCK_CLEAN); @@ -265,7 +265,7 @@ int gn_directory_remove(struct dirent *de, struct dirent *dechild) { if(directory_cache_locked(de) == -1) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: failed to cache parent dir\n", __FUNCTION__); goto out_err; @@ -277,7 +277,7 @@ int gn_directory_remove(struct dirent *de, struct dirent *dechild) if(!g_hash_table_remove(de->de_dir_hash, dechild->de_basename)) { GNUNET_mutex_unlock(dechild->de_path_mutex); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: not found in dir_hash\n", __FUNCTION__); goto out_err; @@ -342,8 +342,8 @@ static gboolean dir_upload_callback(gpointer key, gpointer value, gpointer data) } } } - d->fis[d->count].uri = GNUNET_ECRS_dupUri(de->de_fi.uri); - d->fis[d->count].meta = GNUNET_ECRS_dupMetaData(de->de_fi.meta); + d->fis[d->count].uri = GNUNET_ECRS_uri_duplicate(de->de_fi.uri); + d->fis[d->count].meta = GNUNET_ECRS_meta_data_duplicate(de->de_fi.meta); d->count++; out: GNUNET_semaphore_up(de->de_sema); @@ -372,24 +372,24 @@ int gn_directory_upload_locked(struct dirent *de) g_hash_table_find(de->de_dir_hash, dir_upload_callback, &d); if(d.failed) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: failed\n", __FUNCTION__); return -1; } - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: creating dir of %d elements\n", __FUNCTION__, d.count); - ret = GNUNET_ECRS_createDirectory(ectx, &buf, &len, d.count, d.fis, + ret = GNUNET_ECRS_directory_create(ectx, &buf, &len, d.count, d.fis, de->de_fi.meta); for(i = 0; i < d.count; i++) { - GNUNET_ECRS_freeUri(d.fis[i].uri); - GNUNET_ECRS_freeMetaData(d.fis[i].meta); + GNUNET_ECRS_uri_destroy(d.fis[i].uri); + GNUNET_ECRS_meta_data_destroy(d.fis[i].meta); } GNUNET_free(d.fis); if(ret == GNUNET_SYSERR) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, - "%s: GNUNET_ECRS_createDirectory failed\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, + "%s: GNUNET_ECRS_directory_create failed\n", __FUNCTION__); return -1; } @@ -398,30 +398,30 @@ int gn_directory_upload_locked(struct dirent *de) fd = mkstemp(filename); if(fd == -1) { - GNUNET_GLOG_STRERROR_FILE(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER - | GNUNET_GERROR, "mkstemp", filename); + GNUNET_GE_LOG_STRERROR_FILE(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER + | GNUNET_GE_ERROR, "mkstemp", filename); return -1; } write(fd, buf, len); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: wrote to %lld bytes to '%s'\n", __FUNCTION__, len, filename); - ret = GNUNET_ECRS_uploadFile(ectx, cfg, filename, GNUNET_NO, anonymity, priority, + ret = GNUNET_ECRS_file_upload(ectx, cfg, filename, GNUNET_NO, anonymity, priority, -1, upcb, NULL, tt, NULL, &uri); close(fd); unlink(filename); if(ret == GNUNET_SYSERR) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, - "%s: GNUNET_ECRS_uploadFile failed\n", __FUNCTION__); + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, + "%s: GNUNET_ECRS_file_upload failed\n", __FUNCTION__); return -1; } - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: done\n", __FUNCTION__); /* Update the dirent info with our new URI and mark it clean */ if(de->de_fi.uri != NULL) - GNUNET_ECRS_freeUri(de->de_fi.uri); + GNUNET_ECRS_uri_destroy(de->de_fi.uri); de->de_fi.uri = uri; de->de_dirty = 0; return 0; diff --git a/dirent.c b/dirent.c @@ -71,9 +71,9 @@ void gn_dirent_put(struct dirent *de) GNUNET_mutex_destroy(de->de_refs_mutex); GNUNET_semaphore_destroy(de->de_sema); if(de->de_fi.uri != NULL) - GNUNET_ECRS_freeUri(de->de_fi.uri); + GNUNET_ECRS_uri_destroy(de->de_fi.uri); if(de->de_fi.meta != NULL) - GNUNET_ECRS_freeMetaData(de->de_fi.meta); + GNUNET_ECRS_meta_data_destroy(de->de_fi.meta); if(de->de_type == DE_DIR) { if(de->de_cached) @@ -142,7 +142,7 @@ struct dirent *gn_dirent_new(const gchar *path, struct GNUNET_ECRS_URI *uri, { de->de_dirty = 0; de->de_cached = 0; - de->de_fi.uri = GNUNET_ECRS_dupUri(uri); + de->de_fi.uri = GNUNET_ECRS_uri_duplicate(uri); } else { @@ -163,9 +163,9 @@ struct dirent *gn_dirent_new(const gchar *path, struct GNUNET_ECRS_URI *uri, } } if(meta == NULL) - de->de_fi.meta = GNUNET_ECRS_createMetaData(); + de->de_fi.meta = GNUNET_ECRS_meta_data_create(); else - de->de_fi.meta = GNUNET_ECRS_dupMetaData(meta); + de->de_fi.meta = GNUNET_ECRS_meta_data_duplicate(meta); return de; } @@ -180,7 +180,7 @@ void gn_dirent_cache_insert(struct dirent *de) if(GNUNET_semaphore_down(path_sema, GNUNET_YES) == GNUNET_SYSERR) return; GNUNET_mutex_lock(de->de_path_mutex); - GNUNET_GASSERT(ectx, !g_hash_table_lookup(path_hash, de->de_path)); + GNUNET_GE_ASSERT(ectx, !g_hash_table_lookup(path_hash, de->de_path)); g_hash_table_replace(path_hash, de->de_path, de); GNUNET_mutex_unlock(de->de_path_mutex); gn_dirent_ref(de); @@ -298,7 +298,7 @@ struct dirent *gn_dirent_find(const gchar *path) { struct dirent *de = NULL; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: called for '%s'\n", __FUNCTION__, path); if(gn_path_foreach(path, dirent_find_callback, &de) == -1) { @@ -332,7 +332,7 @@ int gn_lock_path(struct dirent *de) if(gn_path_foreach(path, lock_path_callback, &detmp) == -1) { GNUNET_free(path); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: failed!\n", __FUNCTION__); /* Back out all the locks we aquired */ if(detmp != NULL) @@ -376,7 +376,7 @@ int gn_unlock_path(struct dirent *de, int dirty) if(gn_path_foreach(path, unlock_path_callback, &d) == -1) { GNUNET_free(path); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: failed!\n", __FUNCTION__); return -1; } diff --git a/file.c b/file.c @@ -74,18 +74,18 @@ int gn_file_download_locked(struct dirent *de) de->de_fd = mkstemp(filename); if(de->de_fd == -1) { - GNUNET_GLOG_STRERROR_FILE(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER - | GNUNET_GERROR, "mkstemp", filename); + GNUNET_GE_LOG_STRERROR_FILE(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER + | GNUNET_GE_ERROR, "mkstemp", filename); return -1; } de->de_filename = GNUNET_strdup(filename); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: downloading '%s'\n", __FUNCTION__, de->de_filename); - if(GNUNET_ECRS_downloadFile(ectx, cfg, de->de_fi.uri, filename, anonymity, + if(GNUNET_ECRS_file_download(ectx, cfg, de->de_fi.uri, filename, anonymity, dpcb, NULL, tt, NULL) == GNUNET_SYSERR) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: download failed\n", __FUNCTION__); close(de->de_fd); unlink(de->de_filename); @@ -106,15 +106,15 @@ int gn_file_upload_locked(struct dirent *de) if(!de->de_dirty) return 0; - if(GNUNET_ECRS_uploadFile(ectx, cfg, de->de_filename, GNUNET_NO, anonymity, priority, + if(GNUNET_ECRS_file_upload(ectx, cfg, de->de_filename, GNUNET_NO, anonymity, priority, -1, upcb, NULL, tt, NULL, &uri) == GNUNET_SYSERR) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR, "%s: upload failed\n", __FUNCTION__); return -1; } if(de->de_fi.uri != NULL) - GNUNET_ECRS_freeUri(de->de_fi.uri); + GNUNET_ECRS_uri_destroy(de->de_fi.uri); de->de_fi.uri = uri; de->de_cached = 0; de->de_dirty = 0; diff --git a/getattr.c b/getattr.c @@ -29,7 +29,7 @@ int gn_getattr(const char *path, struct stat *stbuf) struct dirent *de; int ret = 0; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check to see if this is a special file */ @@ -47,7 +47,7 @@ int gn_getattr(const char *path, struct stat *stbuf) de = gn_dirent_find(path); if(de == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_DEBUG, "%s: could not find path '%s'\n", __FUNCTION__, path); return -ENOENT; } @@ -64,7 +64,7 @@ int gn_getattr(const char *path, struct stat *stbuf) if(ret == -1) { ret = -errno; - GNUNET_GLOG_STRERROR(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GERROR, + GNUNET_GE_LOG_STRERROR(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_ERROR, "stat"); goto out; } @@ -76,7 +76,7 @@ int gn_getattr(const char *path, struct stat *stbuf) stbuf->st_mode |= de->de_type == DE_DIR ? S_IFDIR : S_IFREG; stbuf->st_nlink = 1; if(de->de_fi.uri != NULL) - stbuf->st_size = GNUNET_ECRS_fileSize(de->de_fi.uri); + stbuf->st_size = GNUNET_ECRS_uri_get_file_size(de->de_fi.uri); else stbuf->st_size = 0; out: diff --git a/gnfs.h b/gnfs.h @@ -76,7 +76,7 @@ struct dirent typedef gboolean (*gn_dir_foreach_callback)(struct dirent *de, void *data); extern struct GNUNET_GC_Configuration *cfg; -extern struct GNUNET_GContext *ectx; +extern struct GNUNET_GE_Context *ectx; extern int closing; extern unsigned int anonymity; extern unsigned int priority; diff --git a/main.c b/main.c @@ -31,8 +31,8 @@ #include "gettext.h" struct GNUNET_GC_Configuration *cfg; -struct GNUNET_GContext *ectx; -static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE; +struct GNUNET_GE_Context *ectx; +static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE; static char *cfgLogfile = "/tmp/gnunet_fuse.log"; /* Flag to indicate that we are shutting down */ @@ -129,8 +129,8 @@ int main(int argc, char **argv) /* Set up log file */ GNUNET_disk_directory_create_for_file(ectx, cfgLogfile); - ectx = GNUNET_Gcreate_context_logfile(ectx, GNUNET_GALL, cfgLogfile, NULL, GNUNET_YES, 0); - GNUNET_GsetDefaultContext(ectx); + ectx = GNUNET_GE_create_context_logfile(ectx, GNUNET_GE_ALL, cfgLogfile, NULL, GNUNET_YES, 0); + GNUNET_GE_setDefaultContext(ectx); /* There should be exactly two extra arguments */ if(i + 2 != argc) @@ -163,7 +163,7 @@ int main(int argc, char **argv) uribuf = GNUNET_malloc(len + 1); read(root_fd, uribuf, len); uribuf[len] = '\0'; - uri = GNUNET_ECRS_stringToUri(ectx, uribuf); + uri = GNUNET_ECRS_string_to_uri(ectx, uribuf); GNUNET_free(uribuf); if(uri == NULL) { @@ -171,22 +171,22 @@ int main(int argc, char **argv) ret = -1; goto out_close_root; } - if(!GNUNET_ECRS_isFileUri(uri)) + if(!GNUNET_ECRS_uri_test_chk(uri)) { struct GNUNET_ECRS_URI *new_uri; - new_uri = GNUNET_ECRS_getContentUri(uri); + new_uri = GNUNET_ECRS_uri_get_content_uri_from_loc(uri); if(new_uri == NULL) { printf("URI cannot be mounted\n"); ret = -1; goto out_close_root; } - GNUNET_ECRS_freeUri(uri); + GNUNET_ECRS_uri_destroy(uri); uri = new_uri; } root_de = gn_dirent_new(G_DIR_SEPARATOR_S, uri, NULL, DE_DIR); - GNUNET_ECRS_freeUri(uri); + GNUNET_ECRS_uri_destroy(uri); } else { @@ -209,9 +209,9 @@ int main(int argc, char **argv) fuse_argc++; fuse_argv[fuse_argc] = NULL; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GDEBUG, "calling fuse_main\n"); + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_DEBUG, "calling fuse_main\n"); ret = fuse_main(fuse_argc, fuse_argv, &fops, NULL); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GDEBUG, "fuse_main returned\n"); + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_DEBUG, "fuse_main returned\n"); /* Save root uri */ closing = 1; diff --git a/mkdir.c b/mkdir.c @@ -33,7 +33,7 @@ int gn_mkdir(const char *path, mode_t mode) int ret; (void)mode; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check for special file */ @@ -56,11 +56,11 @@ int gn_mkdir(const char *path, mode_t mode) GNUNET_free(parent); return -ENOENT; } - meta = GNUNET_ECRS_createMetaData(); - GNUNET_ECRS_addToMetaData(meta, EXTRACTOR_FILENAME, file); - GNUNET_ECRS_addToMetaData(meta, EXTRACTOR_MIMETYPE, GNUNET_DIRECTORY_MIME); + meta = GNUNET_ECRS_meta_data_create(); + GNUNET_ECRS_meta_data_insert(meta, EXTRACTOR_FILENAME, file); + GNUNET_ECRS_meta_data_insert(meta, EXTRACTOR_MIMETYPE, GNUNET_DIRECTORY_MIME); newde = gn_dirent_new(path, NULL, meta, DE_DIR); - GNUNET_ECRS_freeMetaData(meta); + GNUNET_ECRS_meta_data_destroy(meta); ret = gn_directory_insert(de, newde); gn_dirent_put(de); gn_dirent_put(newde); diff --git a/mknod.c b/mknod.c @@ -34,7 +34,7 @@ int gn_mknod(const char *path, mode_t mode, dev_t rdev) int ret; (void)rdev; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* We only support regular files */ @@ -61,13 +61,13 @@ int gn_mknod(const char *path, mode_t mode, dev_t rdev) GNUNET_free(parent); return -ENOENT; } - uri = GNUNET_ECRS_stringToUri(ectx, GN_EMPTY_FILE_URI); - meta = GNUNET_ECRS_createMetaData(); - GNUNET_ECRS_addToMetaData(meta, EXTRACTOR_FILENAME, file); + uri = GNUNET_ECRS_string_to_uri(ectx, GN_EMPTY_FILE_URI); + meta = GNUNET_ECRS_meta_data_create(); + GNUNET_ECRS_meta_data_insert(meta, EXTRACTOR_FILENAME, file); GNUNET_free(parent); newde = gn_dirent_new(path, uri, meta, DE_FILE); - GNUNET_ECRS_freeMetaData(meta); - GNUNET_ECRS_freeUri(uri); + GNUNET_ECRS_meta_data_destroy(meta); + GNUNET_ECRS_uri_destroy(uri); ret = gn_directory_insert(de, newde); gn_dirent_put(de); gn_dirent_put(newde); diff --git a/open.c b/open.c @@ -29,7 +29,7 @@ int gn_open(const char *path, struct fuse_file_info *fi) { struct dirent *de; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check for special file */ @@ -48,7 +48,7 @@ int gn_open(const char *path, struct fuse_file_info *fi) return -ENOENT; if(de->de_type != DE_FILE) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: not a file\n", __FUNCTION__); gn_dirent_put(de); return -ENOENT; diff --git a/read.c b/read.c @@ -87,7 +87,7 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, (void)fi; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: called for '%s' %u bytes %lld offset\n", __FUNCTION__, path, size, offset); @@ -114,13 +114,13 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, de = gn_dirent_find(path); if(de == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: file not found\n", __FUNCTION__); return -ENOENT; } if(de->de_type != DE_FILE) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: not a file\n", __FUNCTION__); size = -ENOENT; goto out; @@ -139,7 +139,7 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, size = slen; goto out_sema_up; } - len = GNUNET_ECRS_fileSize(de->de_fi.uri); + len = GNUNET_ECRS_uri_get_file_size(de->de_fi.uri); if((guint64)offset >= len) { size = 0; @@ -152,11 +152,11 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, d.buf = buf; d.size = size; d.offset = offset; - ret = GNUNET_ECRS_downloadPartialFile(ectx, cfg, de->de_fi.uri, "/dev/null", + ret = GNUNET_ECRS_file_download_partial(ectx, cfg, de->de_fi.uri, "/dev/null", offset, size, anonymity, GNUNET_YES, dpcb, &d, tt, NULL); if(ret != GNUNET_OK) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GERROR, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_ERROR, "%s: failed to download file\n", __FUNCTION__); size = -ENODATA; } diff --git a/readdir.c b/readdir.c @@ -69,18 +69,18 @@ int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler, (void)offset; (void)fi; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "readdir for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "readdir for '%s'\n", path); de = gn_dirent_find(path); if(de == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "readdir: file not found\n"); return -ENOENT; } if(de->de_type != DE_DIR) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "readdir: not a directory\n"); gn_dirent_put(de); ret = -ENOENT; diff --git a/release.c b/release.c @@ -27,7 +27,7 @@ int gn_release(const char *path, struct fuse_file_info *fi) int dirty = GN_UNLOCK_CLEAN; (void)fi; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Don't do anything for special files */ @@ -40,7 +40,7 @@ int gn_release(const char *path, struct fuse_file_info *fi) return 0; if(de->de_type != DE_FILE) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: not a file\n", __FUNCTION__); gn_dirent_put(de); return 0; diff --git a/rename.c b/rename.c @@ -40,7 +40,7 @@ int gn_rename(const char *from, const char *to) char *from_parent, *from_file, *to_parent, *to_file; int ret = 0, empty = 1; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: '%s' to '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: '%s' to '%s'\n", __FUNCTION__, from, to); /* Check for special file */ @@ -88,7 +88,7 @@ int gn_rename(const char *from, const char *to) } gn_directory_remove(from_parent_de, from_de); gn_dirent_put(from_parent_de); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: removed '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: removed '%s'\n", __FUNCTION__, from); /* Modify our path */ @@ -113,7 +113,7 @@ int gn_rename(const char *from, const char *to) ret = -EIO; goto out; } - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: removed '%s'\n", __FUNCTION__, to); } if(gn_directory_insert(to_parent_de, from_de) == -1) @@ -123,7 +123,7 @@ int gn_rename(const char *from, const char *to) goto out; } gn_dirent_put(to_parent_de); - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: inserted '%s'\n", __FUNCTION__, to); out: diff --git a/rmdir.c b/rmdir.c @@ -40,7 +40,7 @@ int gn_rmdir(const char *path) char *parent, *file; int ret, empty = 1; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check for special file */ diff --git a/special_file.c b/special_file.c @@ -104,7 +104,7 @@ char *gn_get_special_file(const char *path) goto out; } } - buf = GNUNET_ECRS_uriToString(de->de_fi.uri); + buf = GNUNET_ECRS_uri_to_string(de->de_fi.uri); GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); buf = GNUNET_realloc(buf, strlen(buf) + 2); @@ -147,7 +147,7 @@ char *gn_get_special_file(const char *path) } } } - buf = GNUNET_ECRS_uriToString(de->de_fi.uri); + buf = GNUNET_ECRS_uri_to_string(de->de_fi.uri); GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); buf = GNUNET_realloc(buf, strlen(buf) + 2); diff --git a/truncate.c b/truncate.c @@ -28,7 +28,7 @@ int gn_truncate(const char *path, off_t size) struct dirent *de; int ret = 0, dirty = GN_UNLOCK_CLEAN; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: called for '%s' %lld bytes\n", __FUNCTION__, path, size); /* Check for special file */ @@ -39,13 +39,13 @@ int gn_truncate(const char *path, off_t size) de = gn_dirent_find(path); if(de == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: file not found\n", __FUNCTION__); return -ENOENT; } if(de->de_type != DE_FILE) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: not a file\n", __FUNCTION__); ret = -EISDIR; goto out; diff --git a/unlink.c b/unlink.c @@ -31,7 +31,7 @@ int gn_unlink(const char *path) char *parent, *file; int ret; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check for special file */ diff --git a/utimens.c b/utimens.c @@ -31,7 +31,7 @@ int gn_utimens(const char *path, const struct timespec ts[2]) struct timeval tv[2]; int ret = 0; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, "%s: for '%s'\n", + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: for '%s'\n", __FUNCTION__, path); /* Check to see if this is a special file */ @@ -57,7 +57,7 @@ int gn_utimens(const char *path, const struct timespec ts[2]) if(ret == -1) { ret = -errno; - GNUNET_GLOG_STRERROR(ectx, GNUNET_GBULK | GNUNET_GUSER | GNUNET_GERROR, + GNUNET_GE_LOG_STRERROR(ectx, GNUNET_GE_BULK | GNUNET_GE_USER | GNUNET_GE_ERROR, "utimes"); goto out; } diff --git a/write.c b/write.c @@ -33,7 +33,7 @@ int gn_write(const char *path, const char *buf, size_t size, off_t offset, (void)fi; - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: called for '%s' %d bytes\n", __FUNCTION__, path, size); /* Check for special file */ @@ -44,13 +44,13 @@ int gn_write(const char *path, const char *buf, size_t size, off_t offset, de = gn_dirent_find(path); if(de == NULL) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: file not found\n", __FUNCTION__); return -ENOENT; } if(de->de_type != DE_FILE) { - GNUNET_GLOG(ectx, GNUNET_GBULK | GNUNET_GDEVELOPER | GNUNET_GDEBUG, + GNUNET_GE_LOG(ectx, GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG, "%s: not a file\n", __FUNCTION__); size = -ENOENT; goto out;