gnunet-fuse

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

commit 0da6061bb7712259e739fe03e86a16bd5ce114cf
parent 56c93977afd9afc1446ce7598500a460acd6a5ca
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 24 Nov 2007 05:08:01 +0000

making fuse work with renamed APIs:


Diffstat:
MINSTALL | 103++++++++++++++++++++++++++++++++++++++-----------------------------------------
Mconfigure.ac | 2+-
Mdirectory.c | 78+++++++++++++++++++++++++++++++++++++++---------------------------------------
Mdirent.c | 88++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mfile.c | 22+++++++++++-----------
Mgetattr.c | 4++--
Mgnfs.h | 6+++---
Mmain.c | 51+++++++++++++++++++++++++--------------------------
Mmkdir.c | 4++--
Mmknod.c | 4++--
Mread.c | 16++++++++--------
Mreaddir.c | 6+++---
Mrename.c | 4++--
Mrmdir.c | 2+-
Mspecial_file.c | 32++++++++++++++++----------------
Munlink.c | 2+-
Mutimens.c | 4++--
Mwrite.c | 4++--
18 files changed, 213 insertions(+), 219 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -1,19 +1,13 @@ -Installation Instructions -************************* +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives + This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. + These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -26,9 +20,9 @@ debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is +the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale -cache files. +cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail @@ -38,17 +32,20 @@ some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. 2. Type `make' to compile the package. @@ -70,49 +67,51 @@ The simplest way to compile this package is: Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: - ./configure CC=c99 CFLAGS=-g LIBS=-lposix + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. Installation Names ================== -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular +options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -123,7 +122,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to + Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -138,11 +137,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -157,7 +156,7 @@ where SYSTEM can have one of these forms: need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will +use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a @@ -168,9 +167,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -179,7 +178,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the + Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -187,18 +186,14 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is +will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - `configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + `configure' recognizes the following options to control how it +operates. `--help' `-h' diff --git a/configure.ac b/configure.ac @@ -49,7 +49,7 @@ AC_CHECK_HEADERS([GNUnet/gnunet_util.h GNUnet/gnunet_getoption_lib.h],, AC_MSG_ERROR([compiling gnunet-fuse requires GNUnet core headers] )) -AC_CHECK_LIB(gnunetutil_boot,GNUNET_init,, +AC_CHECK_LIB(gnunetutil,GNUNET_init,, AC_MSG_ERROR([gnunet-fuse requires GNUnet-Util])) AC_CHECK_LIB(gnunetecrs,ECRS_createMetaData,, AC_MSG_ERROR([gnunet-fuse requires ECRS])) diff --git a/directory.c b/directory.c @@ -27,7 +27,7 @@ #include "gnfs.h" static void dpcb(unsigned long long totalBytes, - unsigned long long completedBytes, cron_t eta, + unsigned long long completedBytes, GNUNET_CronTime eta, unsigned long long lastBlockOffset, const char *lastBlock, unsigned int lastBlockSize, void *cls) { @@ -41,13 +41,13 @@ static int tt(void *cls) { (void)cls; if(closing) - return OK; + return GNUNET_OK; if(fuse_interrupted()) - return SYSERR; - return OK; + return GNUNET_SYSERR; + return GNUNET_OK; } -static int dir_cache_cb(const ECRS_FileInfo *fi, const HashCode512 *key, +static int dir_cache_cb(const ECRS_FileInfo *fi, const GNUNET_HashCode *key, int isRoot, void *data) { struct dirent *de, *deparent = data; @@ -56,8 +56,8 @@ static int dir_cache_cb(const ECRS_FileInfo *fi, const HashCode512 *key, (void)key; - if(isRoot == YES) - return OK; + if(isRoot == GNUNET_YES) + return GNUNET_OK; /* Figure out the filename and type from metadata */ filename = ECRS_getFromMetaData(fi->meta, EXTRACTOR_FILENAME); @@ -65,10 +65,10 @@ static int dir_cache_cb(const ECRS_FileInfo *fi, const HashCode512 *key, { GE_LOG(ectx, GE_BULK | GE_USER | GE_WARNING, "%s: dirent has no filename\n", __FUNCTION__); - return OK; + return GNUNET_OK; } len = strlen(filename); - if(ECRS_isDirectory(fi->meta) == YES) + if(ECRS_isDirectory(fi->meta) == GNUNET_YES) { if(filename[len - 1] == '/' || filename[len - 1] == '\\') filename[len - 1] = '\0'; @@ -80,11 +80,11 @@ static int dir_cache_cb(const ECRS_FileInfo *fi, const HashCode512 *key, /* Create newpath, the path to this entry */ path = gn_dirent_path_get(deparent); rlen = strlen(path); - newpath = MALLOC(rlen + len + 1); + newpath = GNUNET_malloc(rlen + len + 1); strcpy(newpath, path); if(path[rlen - 1] != G_DIR_SEPARATOR) strcat(newpath, G_DIR_SEPARATOR_S); - FREE(path); + GNUNET_free(path); strcat(newpath, filename); /* Create a new dirent for this entry only if one doesn't already exist @@ -102,16 +102,16 @@ static int dir_cache_cb(const ECRS_FileInfo *fi, const HashCode512 *key, } /* Add it to the directory's list (steals our ref)*/ - MUTEX_LOCK(de->de_path_mutex); + GNUNET_mutex_lock(de->de_path_mutex); 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); - MUTEX_UNLOCK(de->de_path_mutex); + GNUNET_mutex_unlock(de->de_path_mutex); /* Clean up */ - FREE(filename); - FREE(newpath); - return OK; + GNUNET_free(filename); + GNUNET_free(newpath); + return GNUNET_OK; } static int directory_cache_locked(struct dirent *de) @@ -122,22 +122,22 @@ static int directory_cache_locked(struct dirent *de) guint64 len; len = ECRS_fileSize(de->de_fi.uri); - mem = MALLOC(len); + mem = GNUNET_malloc(len); ret = ECRS_downloadPartialFile(ectx, cfg, de->de_fi.uri, - "/dev/null", 0, len, anonymity, YES, dpcb, mem, tt, + "/dev/null", 0, len, anonymity, GNUNET_YES, dpcb, mem, tt, NULL); - if(ret != OK) + if(ret != GNUNET_OK) { GE_LOG(ectx, GE_BULK | GE_USER | GE_ERROR, "%s: failed to download directory\n", __FUNCTION__); - FREE(mem); + GNUNET_free(mem); return -1; } de->de_dir_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)gn_dirent_put); ECRS_listDirectory(ectx, mem, len, &md, dir_cache_cb, de); - FREE(mem); + GNUNET_free(mem); ECRS_freeMetaData(md); de->de_cached = 1; GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, @@ -173,7 +173,7 @@ int gn_directory_foreach(struct dirent *de, gn_dir_foreach_callback cb, if(de->de_type != DE_DIR) return -1; - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) return -1; if(!de->de_cached) { @@ -185,7 +185,7 @@ int gn_directory_foreach(struct dirent *de, gn_dir_foreach_callback cb, d.data = data; g_hash_table_find(de->de_dir_hash, dir_foreach_callback, &d); out: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); return ret; } @@ -198,7 +198,7 @@ struct dirent *gn_directory_find(struct dirent *de, const gchar *filename) if(de->de_type != DE_DIR) return NULL; - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) return NULL; if(!de->de_cached) { @@ -209,7 +209,7 @@ struct dirent *gn_directory_find(struct dirent *de, const gchar *filename) if(ret != NULL) gn_dirent_ref(ret); out: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); return ret; } @@ -233,10 +233,10 @@ int gn_directory_insert(struct dirent *de, struct dirent *dechild) } /* If we're already in there, bail out */ - MUTEX_LOCK(dechild->de_path_mutex); + GNUNET_mutex_lock(dechild->de_path_mutex); if(g_hash_table_lookup(de->de_dir_hash, dechild->de_basename)) { - MUTEX_UNLOCK(dechild->de_path_mutex); + GNUNET_mutex_unlock(dechild->de_path_mutex); gn_unlock_path(de, GN_UNLOCK_CLEAN); return -1; } @@ -244,7 +244,7 @@ int gn_directory_insert(struct dirent *de, struct dirent *dechild) /* Insert the child in our de_dir_hash */ gn_dirent_ref(dechild); g_hash_table_replace(de->de_dir_hash, dechild->de_basename, dechild); - MUTEX_UNLOCK(dechild->de_path_mutex); + GNUNET_mutex_unlock(dechild->de_path_mutex); /* Cache the dirent */ gn_dirent_cache_insert(dechild); @@ -273,16 +273,16 @@ int gn_directory_remove(struct dirent *de, struct dirent *dechild) } /* Remove from dir_hash */ - MUTEX_LOCK(dechild->de_path_mutex); + GNUNET_mutex_lock(dechild->de_path_mutex); if(!g_hash_table_remove(de->de_dir_hash, dechild->de_basename)) { - MUTEX_UNLOCK(dechild->de_path_mutex); + GNUNET_mutex_unlock(dechild->de_path_mutex); GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: not found in dir_hash\n", __FUNCTION__); goto out_err; } - MUTEX_UNLOCK(dechild->de_path_mutex); + GNUNET_mutex_unlock(dechild->de_path_mutex); /* Remove from dirent cache */ gn_dirent_cache_remove(dechild); @@ -295,7 +295,7 @@ out_err: return -1; } -static void upcb(guint64 totalBytes, guint64 completedBytes, cron_t eta, +static void upcb(guint64 totalBytes, guint64 completedBytes, GNUNET_CronTime eta, void *closure) { (void)totalBytes; @@ -318,7 +318,7 @@ static gboolean dir_upload_callback(gpointer key, gpointer value, gpointer data) int ret = 0; (void)key; - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { d->failed = 1; return 1; @@ -346,7 +346,7 @@ static gboolean dir_upload_callback(gpointer key, gpointer value, gpointer data) d->fis[d->count].meta = ECRS_dupMetaData(de->de_fi.meta); d->count++; out: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); return ret; } @@ -366,7 +366,7 @@ int gn_directory_upload_locked(struct dirent *de) return 0; /* Collect FileInfo from hash table and make a GNUnet directory */ - d.fis = MALLOC(g_hash_table_size(de->de_dir_hash) * sizeof(*d.fis)); + d.fis = GNUNET_malloc(g_hash_table_size(de->de_dir_hash) * sizeof(*d.fis)); d.count = 0; d.failed = 0; g_hash_table_find(de->de_dir_hash, dir_upload_callback, &d); @@ -385,8 +385,8 @@ int gn_directory_upload_locked(struct dirent *de) ECRS_freeUri(d.fis[i].uri); ECRS_freeMetaData(d.fis[i].meta); } - FREE(d.fis); - if(ret == SYSERR) + GNUNET_free(d.fis); + if(ret == GNUNET_SYSERR) { GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: ECRS_createDirectory failed\n", @@ -406,11 +406,11 @@ int gn_directory_upload_locked(struct dirent *de) GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, "%s: wrote to %lld bytes to '%s'\n", __FUNCTION__, len, filename); - ret = ECRS_uploadFile(ectx, cfg, filename, NO, anonymity, priority, + ret = ECRS_uploadFile(ectx, cfg, filename, GNUNET_NO, anonymity, priority, -1, upcb, NULL, tt, NULL, &uri); close(fd); unlink(filename); - if(ret == SYSERR) + if(ret == GNUNET_SYSERR) { GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: ECRS_uploadFile failed\n", __FUNCTION__); diff --git a/dirent.c b/dirent.c @@ -25,16 +25,16 @@ #include "gnfs.h" GHashTable *path_hash; -struct SEMAPHORE *path_sema; +struct GNUNET_Semaphore *path_sema; /* * Reference a dirent, call gn_dirent_put when finished */ void gn_dirent_ref(struct dirent *de) { - MUTEX_LOCK(de->de_refs_mutex); + GNUNET_mutex_lock(de->de_refs_mutex); de->de_refs++; - MUTEX_UNLOCK(de->de_refs_mutex); + GNUNET_mutex_unlock(de->de_refs_mutex); } /* @@ -44,12 +44,12 @@ struct dirent *gn_dirent_get(const gchar *path) { struct dirent *de; - if(SEMAPHORE_DOWN(path_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(path_sema, GNUNET_YES) == GNUNET_SYSERR) return NULL; de = g_hash_table_lookup(path_hash, path); if(de != NULL) gn_dirent_ref(de); - SEMAPHORE_UP(path_sema); + GNUNET_semaphore_up(path_sema); return de; } @@ -58,18 +58,18 @@ struct dirent *gn_dirent_get(const gchar *path) */ void gn_dirent_put(struct dirent *de) { - MUTEX_LOCK(de->de_refs_mutex); + GNUNET_mutex_lock(de->de_refs_mutex); de->de_refs--; if(de->de_refs >= 1) { - MUTEX_UNLOCK(de->de_refs_mutex); + GNUNET_mutex_unlock(de->de_refs_mutex); return; } - MUTEX_UNLOCK(de->de_refs_mutex); - MUTEX_DESTROY(de->de_path_mutex); - FREE(de->de_path); - MUTEX_DESTROY(de->de_refs_mutex); - SEMAPHORE_DESTROY(de->de_sema); + GNUNET_mutex_unlock(de->de_refs_mutex); + GNUNET_mutex_destroy(de->de_path_mutex); + GNUNET_free(de->de_path); + GNUNET_mutex_destroy(de->de_refs_mutex); + GNUNET_semaphore_destroy(de->de_sema); if(de->de_fi.uri != NULL) ECRS_freeUri(de->de_fi.uri); if(de->de_fi.meta != NULL) @@ -87,19 +87,19 @@ void gn_dirent_put(struct dirent *de) { close(de->de_fd); unlink(de->de_filename); - FREE(de->de_filename); + GNUNET_free(de->de_filename); } } - FREE(de); + GNUNET_free(de); } char *gn_dirent_path_get(struct dirent *de) { char *ret; - MUTEX_LOCK(de->de_path_mutex); - ret = STRDUP(de->de_path); - MUTEX_UNLOCK(de->de_path_mutex); + GNUNET_mutex_lock(de->de_path_mutex); + ret = GNUNET_strdup(de->de_path); + GNUNET_mutex_unlock(de->de_path_mutex); return ret; } @@ -108,18 +108,18 @@ char *gn_dirent_path_get(struct dirent *de) */ void gn_dirent_path_set(struct dirent *de, const char *path) { - MUTEX_LOCK(de->de_path_mutex); - FREE(de->de_path); - de->de_path = STRDUP(path); + GNUNET_mutex_lock(de->de_path_mutex); + GNUNET_free(de->de_path); + de->de_path = GNUNET_strdup(path); de->de_basename = strrchr(de->de_path, G_DIR_SEPARATOR) + 1; - MUTEX_UNLOCK(de->de_path_mutex); + GNUNET_mutex_unlock(de->de_path_mutex); } void gn_dirent_cache_init(void) { path_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)gn_dirent_put); - path_sema = SEMAPHORE_CREATE(1); + path_sema = GNUNET_semaphore_create(1); } /* @@ -130,14 +130,14 @@ struct dirent *gn_dirent_new(const gchar *path, struct ECRS_URI *uri, { struct dirent *de; - de = MALLOC(sizeof(*de)); - de->de_path_mutex = MUTEX_CREATE(0); - de->de_path = STRDUP(path); + de = GNUNET_malloc(sizeof(*de)); + de->de_path_mutex = GNUNET_mutex_create(0); + de->de_path = GNUNET_strdup(path); de->de_basename = strrchr(de->de_path, G_DIR_SEPARATOR) + 1; - de->de_refs_mutex = MUTEX_CREATE(0); + de->de_refs_mutex = GNUNET_mutex_create(0); de->de_refs = 1; de->de_type = type; - de->de_sema = SEMAPHORE_CREATE(1); + de->de_sema = GNUNET_semaphore_create(1); if(uri != NULL) { de->de_dirty = 0; @@ -153,7 +153,7 @@ struct dirent *gn_dirent_new(const gchar *path, struct ECRS_URI *uri, char filename[] = GN_MKSTEMP_FILE; de->de_fd = mkstemp(filename); - de->de_filename = STRDUP(filename); + de->de_filename = GNUNET_strdup(filename); } else { @@ -177,14 +177,14 @@ void gn_dirent_cache_insert(struct dirent *de) /* TODO: Here we need to see if the cache has gotten too big and empty * it. * XXX: But what about diry entries?? */ - if(SEMAPHORE_DOWN(path_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(path_sema, GNUNET_YES) == GNUNET_SYSERR) return; - MUTEX_LOCK(de->de_path_mutex); + GNUNET_mutex_lock(de->de_path_mutex); GE_ASSERT(ectx, !g_hash_table_lookup(path_hash, de->de_path)); g_hash_table_replace(path_hash, de->de_path, de); - MUTEX_UNLOCK(de->de_path_mutex); + GNUNET_mutex_unlock(de->de_path_mutex); gn_dirent_ref(de); - SEMAPHORE_UP(path_sema); + GNUNET_semaphore_up(path_sema); } /* @@ -192,13 +192,13 @@ void gn_dirent_cache_insert(struct dirent *de) */ void gn_dirent_cache_remove(struct dirent *de) { - if(SEMAPHORE_DOWN(path_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(path_sema, GNUNET_YES) == GNUNET_SYSERR) return; /* This is safe because we still hold a ref */ - MUTEX_LOCK(de->de_path_mutex); + GNUNET_mutex_lock(de->de_path_mutex); g_hash_table_remove(path_hash, de->de_path); - MUTEX_UNLOCK(de->de_path_mutex); - SEMAPHORE_UP(path_sema); + GNUNET_mutex_unlock(de->de_path_mutex); + GNUNET_semaphore_up(path_sema); } /* @@ -216,7 +216,7 @@ int gn_path_foreach(const gchar *path, gn_dir_foreach_callback cb, void *data) /* Allocate partial path buffer */ len = strlen(path); - ppath = MALLOC(len + 1); + ppath = GNUNET_malloc(len + 1); plen = 0; /* Loop through each path element */ @@ -273,7 +273,7 @@ int gn_path_foreach(const gchar *path, gn_dir_foreach_callback cb, void *data) } /* Done */ - FREE(ppath); + GNUNET_free(ppath); if(de == NULL) return -1; gn_dirent_put(de); @@ -313,7 +313,7 @@ static gboolean lock_path_callback(struct dirent *de, void *data) { struct dirent **detmp = data; - if(SEMAPHORE_DOWN(de->de_sema, YES) == -1) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == -1) return 1; gn_dirent_ref(de); *detmp = de; @@ -331,7 +331,7 @@ int gn_lock_path(struct dirent *de) path = gn_dirent_path_get(de); if(gn_path_foreach(path, lock_path_callback, &detmp) == -1) { - FREE(path); + GNUNET_free(path); GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: failed!\n", __FUNCTION__); /* Back out all the locks we aquired */ @@ -339,7 +339,7 @@ int gn_lock_path(struct dirent *de) gn_unlock_path(detmp, GN_UNLOCK_CLEAN); return -1; } - FREE(path); + GNUNET_free(path); return 0; } @@ -357,7 +357,7 @@ static gboolean unlock_path_callback(struct dirent *de, void *data) de->de_dirty = 1; else if(d->dirty == GN_UNLOCK_ANCESTORS_DIRTY && de != d->de) de->de_dirty = 1; - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); return 0; } @@ -375,11 +375,11 @@ int gn_unlock_path(struct dirent *de, int dirty) path = gn_dirent_path_get(de); if(gn_path_foreach(path, unlock_path_callback, &d) == -1) { - FREE(path); + GNUNET_free(path); GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: failed!\n", __FUNCTION__); return -1; } - FREE(path); + GNUNET_free(path); return 0; } diff --git a/file.c b/file.c @@ -30,13 +30,13 @@ static int tt(void *cls) { (void)cls; if(closing) - return OK; + return GNUNET_OK; if(fuse_interrupted()) - return SYSERR; - return OK; + return GNUNET_SYSERR; + return GNUNET_OK; } -static void upcb(guint64 totalBytes, guint64 completedBytes, cron_t eta, +static void upcb(guint64 totalBytes, guint64 completedBytes, GNUNET_CronTime eta, void *closure) { (void)totalBytes; @@ -46,7 +46,7 @@ static void upcb(guint64 totalBytes, guint64 completedBytes, cron_t eta, } static void dpcb(unsigned long long totalBytes, - unsigned long long completedBytes, cron_t eta, + unsigned long long completedBytes, GNUNET_CronTime eta, unsigned long long lastBlockOffset, const char *lastBlock, unsigned int lastBlockSize, void *cls) { @@ -78,18 +78,18 @@ int gn_file_download_locked(struct dirent *de) | GE_ERROR, "mkstemp", filename); return -1; } - de->de_filename = STRDUP(filename); + de->de_filename = GNUNET_strdup(filename); GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_DEBUG, "%s: downloading '%s'\n", __FUNCTION__, de->de_filename); if(ECRS_downloadFile(ectx, cfg, de->de_fi.uri, filename, anonymity, - dpcb, NULL, tt, NULL) == SYSERR) + dpcb, NULL, tt, NULL) == GNUNET_SYSERR) { GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: download failed\n", __FUNCTION__); close(de->de_fd); unlink(de->de_filename); - FREE(de->de_filename); + GNUNET_free(de->de_filename); return -1; } @@ -106,8 +106,8 @@ int gn_file_upload_locked(struct dirent *de) if(!de->de_dirty) return 0; - if(ECRS_uploadFile(ectx, cfg, de->de_filename, NO, anonymity, priority, - -1, upcb, NULL, tt, NULL, &uri) == SYSERR) + if(ECRS_uploadFile(ectx, cfg, de->de_filename, GNUNET_NO, anonymity, priority, + -1, upcb, NULL, tt, NULL, &uri) == GNUNET_SYSERR) { GE_LOG(ectx, GE_BULK | GE_DEVELOPER | GE_ERROR, "%s: upload failed\n", __FUNCTION__); @@ -120,6 +120,6 @@ int gn_file_upload_locked(struct dirent *de) de->de_dirty = 0; close(de->de_fd); unlink(de->de_filename); - FREE(de->de_filename); + GNUNET_free(de->de_filename); return 0; } diff --git a/getattr.c b/getattr.c @@ -53,7 +53,7 @@ int gn_getattr(const char *path, struct stat *stbuf) } /* If it's a cached file just call stat */ - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { gn_dirent_put(de); return -EIO; @@ -80,7 +80,7 @@ int gn_getattr(const char *path, struct stat *stbuf) else stbuf->st_size = 0; out: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); return ret; } diff --git a/gnfs.h b/gnfs.h @@ -43,17 +43,17 @@ struct dirent { /* de_path_mutex protects de_path and de_basename */ - struct MUTEX *de_path_mutex; + struct GNUNET_Mutex *de_path_mutex; gchar *de_path; gchar *de_basename; /* de_refs_mutex protects de_refs */ - struct MUTEX *de_refs_mutex; + struct GNUNET_Mutex *de_refs_mutex; gint de_refs; gchar de_type; #define DE_FILE 'f' #define DE_DIR 'd' /* de_sema protects everything below */ - struct SEMAPHORE *de_sema; + struct GNUNET_Semaphore *de_sema; /* Cached entries have their entire contents in memory or on disk */ gboolean de_cached; /* Dirty entires have been changed and not published in GNUnet (implies diff --git a/main.c b/main.c @@ -25,8 +25,7 @@ #include <glib.h> #include <fuse.h> #include <GNUnet/gnunet_directories.h> -#include <GNUnet/gnunet_util_boot.h> -#include <GNUnet/gnunet_util_error_loggers.h> +#include <GNUnet/gnunet_util.h> #include <GNUnet/gnunet_ecrs_lib.h> #include "gnfs.h" #include "gettext.h" @@ -56,7 +55,7 @@ int fuse_argc; int root_fd; struct dirent *root_de; -int getopt_configure_argv(CommandLineProcessorContext *ctx, void *scls, +int getopt_configure_argv(GNUNET_CommandLineProcessorContext *ctx, void *scls, const char *cmdLineOption, const char *value) { (void)ctx; @@ -66,7 +65,7 @@ int getopt_configure_argv(CommandLineProcessorContext *ctx, void *scls, fuse_argv[fuse_argc] = (char *)value; fuse_argc++; fuse_argv[fuse_argc] = NULL; - return OK; + return GNUNET_OK; } static struct fuse_operations fops = @@ -86,24 +85,24 @@ static struct fuse_operations fops = .utimens = gn_utimens, }; -static struct CommandLineOption gn_options[] = +static struct GNUNET_CommandLineOption gn_options[] = { - COMMAND_LINE_OPTION_HELP("GNUnet filesystem"), - COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */ - COMMAND_LINE_OPTION_LOGGING, /* -L */ + GNUNET_COMMAND_LINE_OPTION_HELP("GNUnet filesystem"), + GNUNET_COMMAND_LINE_OPTION_CFG_FILE(&cfgFilename), /* -c */ + GNUNET_COMMAND_LINE_OPTION_LOGGING, /* -L */ { 'l', "logfile", "FILE", "set logfile name", 1, - &gnunet_getopt_configure_set_string, &cfgLogfile }, + &GNUNET_getopt_configure_set_string, &cfgLogfile }, { 'a', "anonymity", "LEVEL", "set the desired LEVEL of sender-anonymity", 1, - &gnunet_getopt_configure_set_uint, &anonymity }, + &GNUNET_getopt_configure_set_uint, &anonymity }, { 'p', "priority", "LEVEL", "set the desired LEVEL of priority", 1, - &gnunet_getopt_configure_set_uint, &priority }, + &GNUNET_getopt_configure_set_uint, &priority }, { 'u', "uri-files", NULL, "Make .uri files visible", 0, - &gnunet_getopt_configure_set_one, &uri_files }, + &GNUNET_getopt_configure_set_one, &uri_files }, { 'x', "Xfuse", NULL, "Escape fuse option", 1, &getopt_configure_argv, NULL }, - COMMAND_LINE_OPTION_END, + GNUNET_COMMAND_LINE_OPTION_END, }; int main(int argc, char **argv) @@ -114,7 +113,7 @@ int main(int argc, char **argv) /* Initialize fuse options */ fuse_argc = 1; - fuse_argv = MALLOC(sizeof(char *) * argc); + fuse_argv = GNUNET_malloc(sizeof(char *) * argc); fuse_argv[0] = argv[0]; fuse_argv[1] = NULL; @@ -129,8 +128,8 @@ int main(int argc, char **argv) } /* Set up log file */ - disk_directory_create_for_file(ectx, cfgLogfile); - ectx = GE_create_context_logfile(ectx, GE_ALL, cfgLogfile, YES, 0); + GNUNET_disk_directory_create_for_file(ectx, cfgLogfile); + ectx = GE_create_context_logfile(ectx, GE_ALL, cfgLogfile, NULL, GNUNET_YES, 0); GE_setDefaultContext(ectx); /* There should be exactly two extra arguments */ @@ -143,29 +142,29 @@ int main(int argc, char **argv) /* Set URI as our root directory entry */ gn_dirent_cache_init(); - if(disk_file_test(ectx, argv[i]) == YES) + if(GNUNET_disk_file_test(ectx, argv[i]) == GNUNET_YES) { guint64 len; char *uribuf; - root_fd = disk_file_open(ectx, argv[i], O_RDWR | O_SYNC); + root_fd = GNUNET_disk_file_open(ectx, argv[i], O_RDWR | O_SYNC); if(root_fd == -1) { printf("Unable to open URI file: %s\n", argv[i]); ret = -1; goto quit; } - if(disk_file_size(ectx, argv[i], &len, YES) == SYSERR) + if(GNUNET_disk_file_size(ectx, argv[i], &len, GNUNET_YES) == GNUNET_SYSERR) { printf("Unable to determine URI file size\n"); ret = -1; goto out_close_root; } - uribuf = MALLOC(len + 1); + uribuf = GNUNET_malloc(len + 1); read(root_fd, uribuf, len); uribuf[len] = '\0'; uri = ECRS_stringToUri(ectx, uribuf); - FREE(uribuf); + GNUNET_free(uribuf); if(uri == NULL) { printf("URI cannot be parsed\n"); @@ -193,7 +192,7 @@ int main(int argc, char **argv) { /* In the case where the file does not exist, let's mount an * empty directory and create the file to store its URI */ - root_fd = disk_file_open(ectx, argv[i], O_RDWR | O_SYNC + root_fd = GNUNET_disk_file_open(ectx, argv[i], O_RDWR | O_SYNC | O_CREAT, 0666); if(root_fd == -1) { @@ -205,7 +204,7 @@ int main(int argc, char **argv) } /* Add mount point as the last fuse option */ - fuse_argv = REALLOC(fuse_argv, sizeof(char *) * (fuse_argc + 2)); + fuse_argv = GNUNET_realloc(fuse_argv, sizeof(char *) * (fuse_argc + 2)); fuse_argv[fuse_argc] = argv[i + 1]; fuse_argc++; fuse_argv[fuse_argc] = NULL; @@ -222,12 +221,12 @@ int main(int argc, char **argv) ftruncate(root_fd, 0); lseek(root_fd, SEEK_SET, 0); write(root_fd, buf, strlen(buf)); - FREE(buf); + GNUNET_free(buf); } out_close_root: - disk_file_close(ectx, argv[i], root_fd); + GNUNET_disk_file_close(ectx, argv[i], root_fd); quit: - FREE(fuse_argv); + GNUNET_free(fuse_argv); GNUNET_fini(ectx, cfg); return ret; } diff --git a/mkdir.c b/mkdir.c @@ -53,7 +53,7 @@ int gn_mkdir(const char *path, mode_t mode) de = gn_dirent_find(parent); if(de == NULL) { - FREE(parent); + GNUNET_free(parent); return -ENOENT; } meta = ECRS_createMetaData(); @@ -64,7 +64,7 @@ int gn_mkdir(const char *path, mode_t mode) ret = gn_directory_insert(de, newde); gn_dirent_put(de); gn_dirent_put(newde); - FREE(parent); + GNUNET_free(parent); if(ret == -1) return -EIO; return 0; diff --git a/mknod.c b/mknod.c @@ -58,13 +58,13 @@ int gn_mknod(const char *path, mode_t mode, dev_t rdev) de = gn_dirent_find(parent); if(de == NULL) { - FREE(parent); + GNUNET_free(parent); return -ENOENT; } uri = ECRS_stringToUri(ectx, GN_EMPTY_FILE_URI); meta = ECRS_createMetaData(); ECRS_addToMetaData(meta, EXTRACTOR_FILENAME, file); - FREE(parent); + GNUNET_free(parent); newde = gn_dirent_new(path, uri, meta, DE_FILE); ECRS_freeMetaData(meta); ECRS_freeUri(uri); diff --git a/read.c b/read.c @@ -33,7 +33,7 @@ struct read_data }; static void dpcb(unsigned long long totalBytes, - unsigned long long completedBytes, cron_t eta, + unsigned long long completedBytes, GNUNET_CronTime eta, unsigned long long lastBlockOffset, const char *lastBlock, unsigned int lastBlockSize, void *cls) { @@ -72,7 +72,7 @@ static void dpcb(unsigned long long totalBytes, static int tt(void *cls) { (void)cls; - return fuse_interrupted() ? SYSERR : OK; + return fuse_interrupted() ? GNUNET_SYSERR : GNUNET_OK; } int gn_read(const char *path, char *buf, size_t size, off_t offset, @@ -98,7 +98,7 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, slen = strlen(special); if(offset >= slen) { - FREE(special); + GNUNET_free(special); return 0; } if(offset + size > slen) @@ -106,7 +106,7 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, size = slen - offset; } memcpy(buf, special + offset, size); - FREE(special); + GNUNET_free(special); return size; } @@ -125,7 +125,7 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, size = -ENOENT; goto out; } - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { size = -EIO; goto out; @@ -153,15 +153,15 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset, d.size = size; d.offset = offset; ret = ECRS_downloadPartialFile(ectx, cfg, de->de_fi.uri, "/dev/null", - offset, size, anonymity, YES, dpcb, &d, tt, NULL); - if(ret != OK) + offset, size, anonymity, GNUNET_YES, dpcb, &d, tt, NULL); + if(ret != GNUNET_OK) { GE_LOG(ectx, GE_BULK | GE_USER | GE_ERROR, "%s: failed to download file\n", __FUNCTION__); size = -ENODATA; } out_sema_up: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); out: gn_dirent_put(de); return size; diff --git a/readdir.c b/readdir.c @@ -45,18 +45,18 @@ static int readdir_callback(struct dirent *de, void *data) if(d->prefix != NULL) { - char *buf = MALLOC(strlen(d->prefix) + strlen(de->de_basename) + char *buf = GNUNET_malloc(strlen(d->prefix) + strlen(de->de_basename) + 1); sprintf(buf, "%s%s", d->prefix, de->de_basename); d->filler(d->buf, buf, NULL, 0); - FREE(buf); + GNUNET_free(buf); } else { d->filler(d->buf, de->de_basename, NULL, 0); } - return OK; + return GNUNET_OK; } int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler, diff --git a/rename.c b/rename.c @@ -80,7 +80,7 @@ int gn_rename(const char *from, const char *to) /* Now we can remove the 'from' */ from_parent = gn_dirname(from, &from_file); from_parent_de = gn_dirent_find(from_parent); - FREE(from_parent); + GNUNET_free(from_parent); if(from_parent_de == NULL) { ret = -ENOENT; @@ -97,7 +97,7 @@ int gn_rename(const char *from, const char *to) /* Replace the 'to' */ to_parent = gn_dirname(to, &to_file); to_parent_de = gn_dirent_find(to_parent); - FREE(to_parent); + GNUNET_free(to_parent); if(to_parent_de == NULL) { ret = -EIO; diff --git a/rmdir.c b/rmdir.c @@ -63,7 +63,7 @@ int gn_rmdir(const char *path) /* Remove directory */ parent = gn_dirname(path, &file); de = gn_dirent_find(parent); - FREE(parent); + GNUNET_free(parent); if(de == NULL) { gn_dirent_put(dechild); diff --git a/special_file.c b/special_file.c @@ -27,7 +27,7 @@ char *gn_dirname(const char *path, char **file) { char *parent, *slash; - parent = STRDUP(path); + parent = GNUNET_strdup(path); slash = strrchr(parent, G_DIR_SEPARATOR); if(slash != NULL) { @@ -55,20 +55,20 @@ int gn_exists_special_file(const char *path) } else if(strncmp(file, URI_FILE ".", URI_LEN + 1) == 0) { - char *actual_file = MALLOC(strlen(path)); + char *actual_file = GNUNET_malloc(strlen(path)); /* Return URI of the file named after the .uri. */ sprintf(actual_file, "%s" G_DIR_SEPARATOR_S "%s", parent, &file[URI_LEN + 1]); de = gn_dirent_find(actual_file); - FREE(actual_file); + GNUNET_free(actual_file); if(de == NULL) goto out; gn_dirent_put(de); ret = 1; } out: - FREE(parent); + GNUNET_free(parent); return ret; } @@ -90,7 +90,7 @@ char *gn_get_special_file(const char *path) de = gn_dirent_find(parent); if(de == NULL) goto out; - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { gn_dirent_put(de); goto out; @@ -99,29 +99,29 @@ char *gn_get_special_file(const char *path) { if(gn_directory_upload_locked(de) == -1) { - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); goto out; } } buf = ECRS_uriToString(de->de_fi.uri); - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); - buf = REALLOC(buf, strlen(buf) + 2); + buf = GNUNET_realloc(buf, strlen(buf) + 2); strcat(buf, "\n"); } else if(strncmp(file, URI_FILE ".", URI_LEN + 1) == 0) { - char *actual_file = MALLOC(strlen(path)); + char *actual_file = GNUNET_malloc(strlen(path)); /* Return URI of the file named after the .uri. */ sprintf(actual_file, "%s" G_DIR_SEPARATOR_S "%s", parent, &file[URI_LEN + 1]); de = gn_dirent_find(actual_file); - FREE(actual_file); + GNUNET_free(actual_file); if(de == NULL) goto out; - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { gn_dirent_put(de); goto out; @@ -132,7 +132,7 @@ char *gn_get_special_file(const char *path) { if(gn_directory_upload_locked(de) == -1) { - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); goto out; } @@ -141,19 +141,19 @@ char *gn_get_special_file(const char *path) { if(de->de_fi.uri == NULL) { - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); goto out; } } } buf = ECRS_uriToString(de->de_fi.uri); - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); - buf = REALLOC(buf, strlen(buf) + 2); + buf = GNUNET_realloc(buf, strlen(buf) + 2); strcat(buf, "\n"); } out: - FREE(parent); + GNUNET_free(parent); return buf; } diff --git a/unlink.c b/unlink.c @@ -53,7 +53,7 @@ int gn_unlink(const char *path) /* Remove file from parent dir */ parent = gn_dirname(path, &file); de = gn_dirent_find(parent); - FREE(parent); + GNUNET_free(parent); if(de == NULL) { gn_dirent_put(dechild); diff --git a/utimens.c b/utimens.c @@ -44,7 +44,7 @@ int gn_utimens(const char *path, const struct timespec ts[2]) return -ENOENT; /* If it's a cached file just call utime */ - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { gn_dirent_put(de); return -EIO; @@ -66,7 +66,7 @@ int gn_utimens(const char *path, const struct timespec ts[2]) /* For now we do nothing otherwise */ out: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); gn_dirent_put(de); return ret; } diff --git a/write.c b/write.c @@ -57,7 +57,7 @@ int gn_write(const char *path, const char *buf, size_t size, off_t offset, } /* We must be cached */ - if(SEMAPHORE_DOWN(de->de_sema, YES) == SYSERR) + if(GNUNET_semaphore_down(de->de_sema, GNUNET_YES) == GNUNET_SYSERR) { size = -EIO; goto out; @@ -81,7 +81,7 @@ int gn_write(const char *path, const char *buf, size_t size, off_t offset, /* Mark us dirty */ de->de_dirty = 1; out_unlock: - SEMAPHORE_UP(de->de_sema); + GNUNET_semaphore_up(de->de_sema); out: gn_dirent_put(de); return size;