diff options
author | Pino Toscano <toscano.pino@tiscali.it> | 2013-03-30 15:28:07 +0100 |
---|---|---|
committer | Pino Toscano <toscano.pino@tiscali.it> | 2013-03-30 15:28:07 +0100 |
commit | 748ef0df0ae891c65043a2a3c8d0f29cad358f5a (patch) | |
tree | 02a3725d7e1885d063474de92db351e90c03863b /src/netfs.c | |
parent | cd50c0de1db93520000bfb907caf07e51aa6cec5 (diff) |
Switch from __thread to pthread_key_t for fuse_contextlibfuse/pinotree/fuse-improvements/master
This allows to properly cleanup the per-thread context.
* src/fuse_i.h (libfuse_ctx): Remove declaration.
* src/main.c (libfuse_ctx): Remove variable.
(libfuse_ctx_key): New variable.
(fuse_destroy_context): New function.
(fuse_create_key): Likewise.
(fuse_new): Use fuse_get_context instead of libfuse_ctx.
(fuse_get_context): Create fuse_create_key only once. Allocate a new
struct fuse_context if needed, and return it.
* src/netfs.c (update_context_struct): Use fuse_get_context instead of
libfuse_ctx.
Diffstat (limited to 'src/netfs.c')
-rw-r--r-- | src/netfs.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/netfs.c b/src/netfs.c index a8718369c..9a11dfcf4 100644 --- a/src/netfs.c +++ b/src/netfs.c @@ -61,24 +61,8 @@ void update_context_struct(struct iouser *cred, struct fuse *fuse) { FUNC_PROLOGUE("refresh_context_struct"); - struct fuse_context *ctx = libfuse_ctx; + struct fuse_context *ctx = fuse_get_context(); - if(! ctx) - { - ctx = malloc(sizeof(struct fuse_context)); - if(! ctx) - { - perror(PACKAGE_NAME); - return; - } - - libfuse_ctx = ctx; - - /* FIXME, how to figure out the pid of the program asking for the - * filesystem operation? */ - ctx->pid = 0; - } - ctx->fuse = fuse; ctx->private_data = ctx->fuse ? ctx->fuse->private_data : NULL; |