diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2001-12-20 12:17:25 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2001-12-20 12:17:25 +0000 |
commit | 2e50d4376f3124a87d5723ae66c09fa71c7ecf88 (patch) | |
tree | 9994175ffb91284c2d906c89dfcfc903ba6fb704 /lib | |
parent | 20dd496d09b6f698eba37c64c7f8ad9745db1c02 (diff) | |
download | libfuse-2e50d4376f3124a87d5723ae66c09fa71c7ecf88.tar.gz |
preparations for cred checking in fs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 22 | ||||
-rw-r--r-- | lib/fuse_i.h | 2 | ||||
-rw-r--r-- | lib/helper.c | 3 |
3 files changed, 17 insertions, 10 deletions
@@ -290,7 +290,6 @@ static void rename_node(struct fuse *f, fino_t olddir, const char *oldname, pthread_mutex_unlock(&f->lock); } - static void convert_stat(struct stat *stbuf, struct fuse_attr *attr) { attr->mode = stbuf->st_mode; @@ -442,7 +441,7 @@ static int do_chmod(struct fuse *f, const char *path, struct fuse_attr *attr) } static int do_chown(struct fuse *f, const char *path, struct fuse_attr *attr, - int valid) + int valid) { int res; uid_t uid = (valid & FATTR_UID) ? attr->uid : (uid_t) -1; @@ -912,7 +911,15 @@ void fuse_loop(struct fuse *f) } } -struct fuse *fuse_new(int fd, int flags) +struct fuse_context *fuse_get_context(struct fuse *f) +{ + if(f->getcontext) + return f->getcontext(f); + else + return &f->context; +} + +struct fuse *fuse_new(int fd, int flags, const struct fuse_operations *op) { struct fuse *f; struct node *root; @@ -943,6 +950,10 @@ struct fuse *fuse_new(int fd, int flags) pthread_mutex_init(&f->lock, NULL); f->numworker = 0; f->numavail = 0; + f->op = *op; + f->getcontext = NULL; + f->context.uid = 0; + f->context.gid = 0; root = (struct node *) calloc(1, sizeof(struct node)); root->mode = 0; @@ -954,11 +965,6 @@ struct fuse *fuse_new(int fd, int flags) return f; } -void fuse_set_operations(struct fuse *f, const struct fuse_operations *op) -{ - f->op = *op; -} - void fuse_destroy(struct fuse *f) { size_t i; diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 6e1453e..604c297 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -35,6 +35,8 @@ struct fuse { pthread_mutex_t lock; int numworker; int numavail; + struct fuse_context *(*getcontext)(struct fuse *); + struct fuse_context context; }; struct fuse_dirhandle { diff --git a/lib/helper.c b/lib/helper.c index f4a8a16..556a1c1 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -143,8 +143,7 @@ void fuse_main(int argc, char *argv[], const struct fuse_operations *op) exit(1); } - fuse = fuse_new(fd, flags); - fuse_set_operations(fuse, op); + fuse = fuse_new(fd, flags, op); if(multithreaded) fuse_loop_mt(fuse); |