From e2aa2e243d729e29ad67f1b30aa3392ca9a9cdb2 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 15 Jul 2005 13:31:36 +0000 Subject: [PATCH] cleanup --- include/fuse.h | 5 ++++- include/fuse_lowlevel.h | 2 +- lib/Makefile.am | 1 - lib/fuse.c | 33 ++++++++++++++++++++++++++++++++- lib/fuse_i.h | 38 -------------------------------------- lib/fuse_mt.c | 8 +++++--- lib/helper.c | 6 +++++- 7 files changed, 47 insertions(+), 46 deletions(-) delete mode 100644 lib/fuse_i.h diff --git a/include/fuse.h b/include/fuse.h index 07438b1..6c6cf09 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -497,11 +497,14 @@ int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data); /** Return the exited flag, which indicates if fuse_exit() has been called */ -int fuse_exited(struct fuse* f); +int fuse_exited(struct fuse *f); /** Set function which can be used to get the current context */ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); +/** Returns the lowlevel FUSE object */ +struct fuse_ll *fuse_get_lowlevel(struct fuse *f); + /* ----------------------------------------------------------- * * Compatibility stuff * * ----------------------------------------------------------- */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index dce091c..deab718 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -15,10 +15,10 @@ #include "fuse_common.h" +#include #include #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/lib/Makefile.am b/lib/Makefile.am index 07e7142..223b975 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,7 +9,6 @@ libfuse_la_SOURCES = \ fuse_lowlevel_mt.c \ helper.c \ mount.c \ - fuse_i.h \ fuse_lowlevel_i.h libfuse_la_LDFLAGS = -lpthread -version-number 2:3:1 \ diff --git a/lib/fuse.c b/lib/fuse.c index b93ded3..79ce5e7 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -6,7 +6,12 @@ See the file COPYING.LIB */ -#include "fuse_i.h" + +/* For pthread_rwlock_t */ +#define _GNU_SOURCE + +#include "fuse.h" +#include "fuse_lowlevel.h" #include "fuse_compat.h" #include @@ -17,6 +22,7 @@ #include #include #include +#include #include #include @@ -53,6 +59,26 @@ #define ENTRY_REVALIDATE_TIME 1.0 /* sec */ #define ATTR_REVALIDATE_TIME 1.0 /* sec */ +struct fuse { + struct fuse_ll *fll; + int flags; + struct fuse_operations op; + int compat; + struct node **name_table; + size_t name_table_size; + struct node **id_table; + size_t id_table_size; + fuse_ino_t ctr; + unsigned int generation; + unsigned int hidectr; + pthread_mutex_t lock; + pthread_rwlock_t tree_lock; + void *user_data; + uid_t uid; + gid_t gid; + mode_t umask; +}; + struct node { struct node *name_next; struct node *id_next; @@ -1626,6 +1652,11 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void)) fuse_getcontext = func; } +struct fuse_ll *fuse_get_lowlevel(struct fuse *f) +{ + return f->fll; +} + static int begins_with(const char *s, const char *beg) { if (strncmp(s, beg, strlen(beg)) == 0) diff --git a/lib/fuse_i.h b/lib/fuse_i.h deleted file mode 100644 index de1724c..0000000 --- a/lib/fuse_i.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2005 Miklos Szeredi - - This program can be distributed under the terms of the GNU LGPL. - See the file COPYING.LIB. -*/ - -/* For pthread_rwlock_t */ -#define _GNU_SOURCE - -#include "fuse.h" -#include "fuse_lowlevel.h" -#include - -struct fuse { - struct fuse_ll *fll; - int flags; - struct fuse_operations op; - int compat; - struct node **name_table; - size_t name_table_size; - struct node **id_table; - size_t id_table_size; - fuse_ino_t ctr; - unsigned int generation; - unsigned int hidectr; - pthread_mutex_t lock; - pthread_rwlock_t tree_lock; - void *user_data; - uid_t uid; - gid_t gid; - mode_t umask; -}; - -struct fuse *fuse_new_common(int fd, const char *opts, - const struct fuse_operations *op, - size_t op_size, int compat); diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index c1801c9..c9fe63c 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -6,11 +6,13 @@ See the file COPYING.LIB. */ -#include "fuse_i.h" +#include "fuse.h" +#include "fuse_lowlevel.h" #include #include #include +#include static pthread_key_t context_key; @@ -92,7 +94,7 @@ int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data) if (mt_create_context_key() != 0) return -1; - res = fuse_ll_loop_mt_proc(f->fll, mt_generic_proc, &pd); + res = fuse_ll_loop_mt_proc(fuse_get_lowlevel(f), mt_generic_proc, &pd); mt_delete_context_key(); return res; @@ -105,7 +107,7 @@ int fuse_loop_mt(struct fuse *f) if (mt_create_context_key() != 0) return -1; - res = fuse_ll_loop_mt(f->fll); + res = fuse_ll_loop_mt(fuse_get_lowlevel(f)); mt_delete_context_key(); return res; diff --git a/lib/helper.c b/lib/helper.c index d5c63f2..d8e694f 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -6,7 +6,7 @@ See the file COPYING.LIB. */ -#include "fuse_i.h" +#include "fuse.h" #include "fuse_compat.h" #include @@ -16,6 +16,10 @@ #include #include +struct fuse *fuse_new_common(int fd, const char *opts, + const struct fuse_operations *op, + size_t op_size, int compat); + static struct fuse *fuse_instance; static void usage(const char *progname) -- 2.30.2