From cd50c0de1db93520000bfb907caf07e51aa6cec5 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 24 Mar 2013 16:46:37 +0100 Subject: Fix context and user data handling at init time Make sure, using an helper function, to have an existing context before calling the init fuse operation. Also, the USER_DATA arg of fuse_new must be set as new PRIVATE_DATA in the fuse context before calling the init fuse operation. * src/fuse_i.h (struct iouser): New forward declaration. (struct fuse): Remove field 'user_data'. (update_context_struct): New function. * src/main.c (fuse_new): Update LIBFUSE_CTX correctly before and after calling init. * src/netfs.c (refresh_context_struct): Call refresh_context_struct. (update_context_struct): New function, mostly derived from refresh_context_struct. Update CTX->FUSE and CTX->PRIVATE_DATA correctly. --- src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 39d5f6acb..b8f25c8cd 100644 --- a/src/main.c +++ b/src/main.c @@ -314,8 +314,6 @@ fuse_new(struct fuse_chan *ch, struct fuse_args *args, } memcpy(&new->op, op, op_size); - new->user_data = user_data; - /* FIXME: figure out better values for fuse_conn_info fields. */ new->conn.proto_major = FUSE_MAJOR_VERSION; new->conn.proto_minor = FUSE_MINOR_VERSION; @@ -323,6 +321,9 @@ fuse_new(struct fuse_chan *ch, struct fuse_args *args, new->conn.max_write = UINT_MAX; new->conn.max_readahead = UINT_MAX; + update_context_struct(NULL, new); + libfuse_ctx->private_data = user_data; + if(new->op.ops.init != NULL) { if (new->version >= 26) @@ -331,6 +332,8 @@ fuse_new(struct fuse_chan *ch, struct fuse_args *args, new->private_data = new->op.ops25.init(); } + update_context_struct(NULL, NULL); + return new; } -- cgit v1.2.3