diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-12-07 16:46:42 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-12-07 16:46:42 +0000 |
commit | f458b8c07b521cfb48152e5d3344cd22989aa4ab (patch) | |
tree | 04d70769fdcd6284d1fcd67c1755e8c4a86e0794 /lib | |
parent | d59bb9d2896476252a4daa8e6dd8ed1125bf5f45 (diff) | |
download | libfuse-f458b8c07b521cfb48152e5d3344cd22989aa4ab.tar.gz |
cleanup
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 106 | ||||
-rw-r--r-- | lib/fuse_i.h | 2 | ||||
-rw-r--r-- | lib/fuse_mt.c | 14 | ||||
-rw-r--r-- | lib/fuse_versionscript | 28 | ||||
-rw-r--r-- | lib/helper.c | 37 | ||||
-rw-r--r-- | lib/mount.c | 2 |
6 files changed, 95 insertions, 94 deletions
@@ -61,7 +61,6 @@ static const char *opname(enum fuse_opcode opcode) } } - static inline void dec_avail(struct fuse *f) { pthread_mutex_lock(&f->lock); @@ -69,7 +68,7 @@ static inline void dec_avail(struct fuse *f) pthread_mutex_unlock(&f->lock); } -static struct node *__get_node(struct fuse *f, nodeid_t nodeid) +static struct node *get_node_nocheck(struct fuse *f, nodeid_t nodeid) { size_t hash = nodeid % f->id_table_size; struct node *node; @@ -83,7 +82,7 @@ static struct node *__get_node(struct fuse *f, nodeid_t nodeid) static struct node *get_node(struct fuse *f, nodeid_t nodeid) { - struct node *node = __get_node(f, nodeid); + struct node *node = get_node_nocheck(f, nodeid); if (node != NULL) return node; @@ -116,7 +115,7 @@ static nodeid_t next_id(struct fuse *f) f->ctr++; if (!f->ctr) f->generation ++; - } while (f->ctr == 0 || __get_node(f, f->ctr) != NULL); + } while (f->ctr == 0 || get_node_nocheck(f, f->ctr) != NULL); return f->ctr; } @@ -137,7 +136,7 @@ static unsigned int name_hash(struct fuse *f, nodeid_t parent, const char *name) return (hash + parent) % f->name_table_size; } -static struct node *__lookup_node(struct fuse *f, nodeid_t parent, +static struct node *lookup_node(struct fuse *f, nodeid_t parent, const char *name) { size_t hash = name_hash(f, parent, name); @@ -150,22 +149,6 @@ static struct node *__lookup_node(struct fuse *f, nodeid_t parent, return NULL; } -static struct node *lookup_node(struct fuse *f, nodeid_t parent, - const char *name) -{ - struct node *node; - - pthread_mutex_lock(&f->lock); - node = __lookup_node(f, parent, name); - pthread_mutex_unlock(&f->lock); - if (node != NULL) - return node; - - fprintf(stderr, "fuse internal error: node %lu/%s not found\n", parent, - name); - abort(); -} - static int hash_name(struct fuse *f, struct node *node, nodeid_t parent, const char *name) { @@ -212,7 +195,7 @@ static struct node *find_node(struct fuse *f, nodeid_t parent, char *name, rdev = attr->rdev; pthread_mutex_lock(&f->lock); - node = __lookup_node(f, parent, name); + node = lookup_node(f, parent, name); if (node != NULL) { if (node->mode == mode && node->rdev == rdev && (!(f->flags & FUSE_USE_INO) || node->ino == attr->ino)) { @@ -270,7 +253,7 @@ static int path_lookup(struct fuse *f, const char *path, nodeid_t *nodeidp, err = 0; for (s = tmp; (name = strsep(&s, "/")) != NULL; ) { if (name[0]) { - struct node *node = __lookup_node(f, nodeid, name); + struct node *node = lookup_node(f, nodeid, name); if (node == NULL) { err = -ENOENT; break; @@ -350,7 +333,7 @@ static void destroy_node(struct fuse *f, nodeid_t nodeid, int version) struct node *node; pthread_mutex_lock(&f->lock); - node = __get_node(f, nodeid); + node = get_node_nocheck(f, nodeid); if (node && node->version == version && nodeid != FUSE_ROOT_ID) { unhash_name(f, node); unhash_id(f, node); @@ -365,7 +348,7 @@ static void remove_node(struct fuse *f, nodeid_t dir, const char *name) struct node *node; pthread_mutex_lock(&f->lock); - node = __lookup_node(f, dir, name); + node = lookup_node(f, dir, name); if (node == NULL) { fprintf(stderr, "fuse internal error: unable to remove node %lu/%s\n", dir, name); @@ -383,8 +366,8 @@ static int rename_node(struct fuse *f, nodeid_t olddir, const char *oldname, int err = 0; pthread_mutex_lock(&f->lock); - node = __lookup_node(f, olddir, oldname); - newnode = __lookup_node(f, newdir, newname); + node = lookup_node(f, olddir, oldname); + newnode = lookup_node(f, newdir, newname); if (node == NULL) { fprintf(stderr, "fuse internal error: unable to rename node %lu/%s\n", olddir, oldname); @@ -488,8 +471,8 @@ static int send_reply_raw(struct fuse *f, char *outbuf, size_t outsize, return 0; } -static int __send_reply(struct fuse *f, struct fuse_in_header *in, int error, - void *arg, size_t argsize, int locked) +static int do_send_reply(struct fuse *f, struct fuse_in_header *in, int error, + void *arg, size_t argsize, int locked) { int res; char *outbuf; @@ -525,9 +508,15 @@ static int __send_reply(struct fuse *f, struct fuse_in_header *in, int error, } static int send_reply(struct fuse *f, struct fuse_in_header *in, int error, - void *arg, size_t argsize) + void *arg, size_t argsize) +{ + return do_send_reply(f, in, error, arg, argsize, 0); +} + +static int send_reply_locked(struct fuse *f, struct fuse_in_header *in, + int error, void *arg, size_t argsize) { - return __send_reply(f, in, error, arg, argsize, 0); + return do_send_reply(f, in, error, arg, argsize, 1); } static int is_open(struct fuse *f, nodeid_t dir, const char *name) @@ -535,7 +524,7 @@ static int is_open(struct fuse *f, nodeid_t dir, const char *name) struct node *node; int isopen = 0; pthread_mutex_lock(&f->lock); - node = __lookup_node(f, dir, name); + node = lookup_node(f, dir, name); if (node && node->open_count > 0) isopen = 1; pthread_mutex_unlock(&f->lock); @@ -556,13 +545,18 @@ static char *hidden_name(struct fuse *f, nodeid_t dir, const char *oldname, return NULL; do { - node = lookup_node(f, dir, oldname); pthread_mutex_lock(&f->lock); + node = lookup_node(f, dir, oldname); + if (node == NULL) { + fprintf(stderr, "fuse internal error: node %lu/%s not found\n", + dir, oldname); + abort(); + } do { f->hidectr ++; snprintf(newname, bufsize, ".fuse_hidden%08x%08x", (unsigned int) node->nodeid, f->hidectr); - newnode = __lookup_node(f, dir, newname); + newnode = lookup_node(f, dir, newname); } while(newnode); pthread_mutex_unlock(&f->lock); @@ -1089,7 +1083,7 @@ static void do_open(struct fuse *f, struct fuse_in_header *in, fflush(stdout); } - res2 = __send_reply(f, in, res, &outarg, sizeof(outarg), 1); + res2 = send_reply_locked(f, in, res, &outarg, sizeof(outarg)); if(res2 == -ENOENT) { /* The open syscall was interrupted, so it must be cancelled */ if(f->op.release.curr) { @@ -1266,7 +1260,7 @@ static int default_statfs(struct statfs *buf) return 0; } -static void convert_statfs_compat(struct _fuse_statfs_compat1 *compatbuf, +static void convert_statfs_compat(struct fuse_statfs_compat1 *compatbuf, struct statfs *statfs) { statfs->f_bsize = compatbuf->block_size; @@ -1300,8 +1294,8 @@ static void do_statfs(struct fuse *f, struct fuse_in_header *in) if (!f->compat || f->compat > 11) res = f->op.statfs.curr("/", &buf); else { - struct _fuse_statfs_compat1 compatbuf; - memset(&compatbuf, 0, sizeof(struct _fuse_statfs_compat1)); + struct fuse_statfs_compat1 compatbuf; + memset(&compatbuf, 0, sizeof(struct fuse_statfs_compat1)); res = f->op.statfs.compat1(&compatbuf); if (res == 0) convert_statfs_compat(&compatbuf, &buf); @@ -1517,7 +1511,7 @@ static void free_cmd(struct fuse_cmd *cmd) free(cmd); } -void __fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd) +void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd) { struct fuse_in_header *in = (struct fuse_in_header *) cmd->buf; void *inarg = cmd->buf + sizeof(struct fuse_in_header); @@ -1641,12 +1635,12 @@ void __fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd) free_cmd(cmd); } -int __fuse_exited(struct fuse* f) +int fuse_exited(struct fuse* f) { return f->exited; } -struct fuse_cmd *__fuse_read_cmd(struct fuse *f) +struct fuse_cmd *fuse_read_cmd(struct fuse *f) { ssize_t res; struct fuse_cmd *cmd; @@ -1670,7 +1664,7 @@ struct fuse_cmd *__fuse_read_cmd(struct fuse *f) res = read(f->fd, cmd->buf, FUSE_MAX_IN); if (res == -1) { free_cmd(cmd); - if (__fuse_exited(f) || errno == EINTR) + if (fuse_exited(f) || errno == EINTR) return NULL; /* ENODEV means we got unmounted, so we silenty return failure */ @@ -1709,14 +1703,14 @@ int fuse_loop(struct fuse *f) while (1) { struct fuse_cmd *cmd; - if (__fuse_exited(f)) + if (fuse_exited(f)) break; - cmd = __fuse_read_cmd(f); + cmd = fuse_read_cmd(f); if (cmd == NULL) continue; - __fuse_process_cmd(f, cmd); + fuse_process_cmd(f, cmd); } f->exited = 0; return 0; @@ -1772,7 +1766,7 @@ struct fuse_context *fuse_get_context() return &context; } -void __fuse_set_getcontext_func(struct fuse_context *(*func)(void)) +void fuse_set_getcontext_func(struct fuse_context *(*func)(void)) { fuse_getcontext = func; } @@ -1944,21 +1938,21 @@ struct fuse *fuse_new(int fd, const char *opts, return fuse_new_common(fd, opts, op, op_size, 0); } -struct fuse *_fuse_new_compat2(int fd, const char *opts, - const struct _fuse_operations_compat2 *op) +struct fuse *fuse_new_compat2(int fd, const char *opts, + const struct fuse_operations_compat2 *op) { return fuse_new_common(fd, opts, (struct fuse_operations *) op, - sizeof(struct _fuse_operations_compat2), 21); + sizeof(struct fuse_operations_compat2), 21); } -struct fuse *_fuse_new_compat1(int fd, int flags, - const struct _fuse_operations_compat1 *op) +struct fuse *fuse_new_compat1(int fd, int flags, + const struct fuse_operations_compat1 *op) { char *opts = NULL; - if (flags & _FUSE_DEBUG_COMPAT1) + if (flags & FUSE_DEBUG_COMPAT1) opts = "debug"; return fuse_new_common(fd, opts, (struct fuse_operations *) op, - sizeof(struct _fuse_operations_compat1), 11); + sizeof(struct fuse_operations_compat1), 11); } void fuse_destroy(struct fuse *f) @@ -1990,4 +1984,8 @@ void fuse_destroy(struct fuse *f) free(f); } -__asm__(".symver _fuse_new_compat2,fuse_new@"); +__asm__(".symver fuse_exited,__fuse_exited@"); +__asm__(".symver fuse_process_cmd,__fuse_process_cmd@"); +__asm__(".symver fuse_read_cmd,__fuse_read_cmd@"); +__asm__(".symver fuse_set_getcontext_func,__fuse_set_getcontext_func@"); +__asm__(".symver fuse_new_compat2,fuse_new@"); diff --git a/lib/fuse_i.h b/lib/fuse_i.h index f88dda1..f3c3076 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -66,7 +66,7 @@ struct fuse_operations_i { struct fuse_file_info *); union { int (*curr) (const char *, struct statfs *); - int (*compat1) (struct _fuse_statfs_compat1 *); + int (*compat1) (struct fuse_statfs_compat1 *); } statfs; int (*flush) (const char *, struct fuse_file_info *); union { diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index 58ec847..94d3bb8 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -53,10 +53,10 @@ static void *do_work(void *data) while (1) { struct fuse_cmd *cmd; - if (__fuse_exited(f)) + if (fuse_exited(f)) break; - cmd = __fuse_read_cmd(w->f); + cmd = fuse_read_cmd(w->f); if (cmd == NULL) continue; @@ -131,7 +131,7 @@ static int mt_create_context_key() fprintf(stderr, "fuse: failed to create thread specific key: %s\n", strerror(err)); else - __fuse_set_getcontext_func(mt_getcontext); + fuse_set_getcontext_func(mt_getcontext); } if (!err) context_ref ++; @@ -144,13 +144,13 @@ static void mt_delete_context_key() pthread_mutex_lock(&context_lock); context_ref--; if (!context_ref) { - __fuse_set_getcontext_func(NULL); + fuse_set_getcontext_func(NULL); pthread_key_delete(context_key); } pthread_mutex_unlock(&context_lock); } -int __fuse_loop_mt(struct fuse *f, fuse_processor_t proc, void *data) +int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data) { struct fuse_worker *w; int i; @@ -187,5 +187,7 @@ int fuse_loop_mt(struct fuse *f) if (f == NULL) return -1; - return __fuse_loop_mt(f, (fuse_processor_t) __fuse_process_cmd, NULL); + return fuse_loop_mt_proc(f, (fuse_processor_t) fuse_process_cmd, NULL); } + +__asm__(".symver fuse_loop_mt_proc,__fuse_loop_mt@"); diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index 175cf32..329c4ad 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -1,28 +1,28 @@ FUSE_2.2 { global: - __fuse_exited; - __fuse_loop_mt; - __fuse_main; - __fuse_process_cmd; - __fuse_read_cmd; - __fuse_set_getcontext_func; - __fuse_setup; - __fuse_teardown; - _fuse_setup_compat2; - _fuse_main_compat1; - _fuse_main_compat2; - _fuse_mount_compat1; - _fuse_new_compat1; - _fuse_new_compat2; fuse_destroy; fuse_exit; + fuse_exited; fuse_get_context; fuse_invalidate; fuse_is_lib_option; fuse_loop; fuse_loop_mt; + fuse_loop_mt_proc; + fuse_main_compat1; + fuse_main_compat2; + fuse_main_real; fuse_mount; + fuse_mount_compat1; fuse_new; + fuse_new_compat1; + fuse_new_compat2; + fuse_process_cmd; + fuse_read_cmd; + fuse_set_getcontext_func; + fuse_setup; + fuse_setup_compat2; + fuse_teardown; fuse_unmount; local: *; diff --git a/lib/helper.c b/lib/helper.c index 5f7f1f5..1ac5aa2 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -268,7 +268,7 @@ static struct fuse *fuse_setup_common(int argc, char *argv[], int res; if (fuse_instance != NULL) { - fprintf(stderr, "fuse: __fuse_setup() called twice\n"); + fprintf(stderr, "fuse: fuse_setup() called twice\n"); return NULL; } @@ -314,7 +314,7 @@ static struct fuse *fuse_setup_common(int argc, char *argv[], return NULL; } -struct fuse *__fuse_setup(int argc, char *argv[], +struct fuse *fuse_setup(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, char **mountpoint, int *multithreaded, int *fd) @@ -323,20 +323,20 @@ struct fuse *__fuse_setup(int argc, char *argv[], multithreaded, fd, 0); } -struct fuse *_fuse_setup_compat2(int argc, char *argv[], - const struct _fuse_operations_compat2 *op, +struct fuse *fuse_setup_compat2(int argc, char *argv[], + const struct fuse_operations_compat2 *op, char **mountpoint, int *multithreaded, int *fd) { return fuse_setup_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct _fuse_operations_compat2), + sizeof(struct fuse_operations_compat2), mountpoint, multithreaded, fd, 21); } -void __fuse_teardown(struct fuse *fuse, int fd, char *mountpoint) +void fuse_teardown(struct fuse *fuse, int fd, char *mountpoint) { if (fuse_instance != fuse) - fprintf(stderr, "fuse: __fuse_teardown() with unknown fuse object\n"); + fprintf(stderr, "fuse: fuse_teardown() with unknown fuse object\n"); else fuse_instance = NULL; @@ -366,32 +366,33 @@ static int fuse_main_common(int argc, char *argv[], else res = fuse_loop(fuse); - __fuse_teardown(fuse, fd, mountpoint); + fuse_teardown(fuse, fd, mountpoint); if (res == -1) return 1; return 0; } -int __fuse_main(int argc, char *argv[], const struct fuse_operations *op, - size_t op_size) +int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, + size_t op_size) { return fuse_main_common(argc, argv, op, op_size, 0); } -void _fuse_main_compat1(int argc, char *argv[], - const struct _fuse_operations_compat1 *op) +void fuse_main_compat1(int argc, char *argv[], + const struct fuse_operations_compat1 *op) { fuse_main_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct _fuse_operations_compat1), 11); + sizeof(struct fuse_operations_compat1), 11); } -int _fuse_main_compat2(int argc, char *argv[], - const struct _fuse_operations_compat2 *op) +int fuse_main_compat2(int argc, char *argv[], + const struct fuse_operations_compat2 *op) { return fuse_main_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct _fuse_operations_compat2), 21); + sizeof(struct fuse_operations_compat2), 21); } -__asm__(".symver _fuse_setup_compat2,__fuse_setup@"); -__asm__(".symver _fuse_main_compat2,fuse_main@"); +__asm__(".symver fuse_setup_compat2,__fuse_setup@"); +__asm__(".symver fuse_teardown,__fuse_teardown@"); +__asm__(".symver fuse_main_compat2,fuse_main@"); diff --git a/lib/mount.c b/lib/mount.c index fd29020..1870ca9 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -126,7 +126,7 @@ int fuse_mount(const char *mountpoint, const char *opts) return rv; } -int _fuse_mount_compat1(const char *mountpoint, const char *args[]) +int fuse_mount_compat1(const char *mountpoint, const char *args[]) { /* just ignore mount args for now */ (void) args; |