summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fuse_i.h5
-rw-r--r--src/main.c7
-rw-r--r--src/netfs.c12
3 files changed, 18 insertions, 6 deletions
diff --git a/src/fuse_i.h b/src/fuse_i.h
index 49c4c0639..472bc6503 100644
--- a/src/fuse_i.h
+++ b/src/fuse_i.h
@@ -22,6 +22,8 @@
# include "fuse_compat.h"
#endif
+struct iouser;
+
/* write out message to stderr, that some routine is not yet implemented,
* thus misbehaviour must be accepted. */
#define NOT_IMPLEMENTED() \
@@ -36,7 +38,6 @@ struct fuse {
struct fuse_operations ops;
} op;
struct fuse_conn_info conn;
- void *user_data;
void *private_data;
};
@@ -58,6 +59,8 @@ extern struct fuse *libfuse_fuse;
extern __thread struct fuse_context *libfuse_ctx;
+extern void update_context_struct(struct iouser *cred, struct fuse *fuse);
+
/*****************************************************************************
*** netnodes (in memory representation of libfuse's files or directories) ***
*****************************************************************************/
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;
}
diff --git a/src/netfs.c b/src/netfs.c
index 51de2ee12..a8718369c 100644
--- a/src/netfs.c
+++ b/src/netfs.c
@@ -54,6 +54,12 @@ struct fuse_dirhandle {
static inline void
refresh_context_struct(struct iouser *cred)
{
+ update_context_struct(cred, libfuse_fuse);
+}
+
+void
+update_context_struct(struct iouser *cred, struct fuse *fuse)
+{
FUNC_PROLOGUE("refresh_context_struct");
struct fuse_context *ctx = libfuse_ctx;
@@ -68,14 +74,14 @@ refresh_context_struct(struct iouser *cred)
libfuse_ctx = ctx;
- ctx->fuse = libfuse_fuse;
- ctx->private_data = libfuse_fuse->private_data;
-
/* 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;
+
if(cred)
{
ctx->uid = cred->uids->num ? cred->uids->ids[0] :