mirror of
https://github.com/openharmony/third_party_libfuse.git
synced 2026-07-19 21:43:34 -04:00
lib: fix locking when loading a filesystem module
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2007-06-22 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* lib: fix locking when loading a filesystem module
|
||||
|
||||
2007-06-21 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Add fs subtype support to mount.fuse
|
||||
|
||||
+4
-4
@@ -97,9 +97,9 @@ struct fuse_operations {
|
||||
|
||||
/** Create a file node
|
||||
*
|
||||
* If the filesystem doesn't define a create() operation, mknod()
|
||||
* will be called for creation of all non-directory, non-symlink
|
||||
* nodes.
|
||||
* This is called for creation of all non-directory, non-symlink
|
||||
* nodes. If the filesystem defines a create() method, then for
|
||||
* regular files that will be called instead.
|
||||
*/
|
||||
int (*mknod) (const char *, mode_t, dev_t);
|
||||
|
||||
@@ -722,7 +722,7 @@ void fuse_register_module(struct fuse_module *mod);
|
||||
#define FUSE_REGISTER_MODULE(name_, factory_) \
|
||||
static __attribute__((constructor)) void name_ ## _register(void) \
|
||||
{ \
|
||||
static struct fuse_module mod = { .name = #name_, .factory = factory_ }; \
|
||||
static struct fuse_module mod = { #name_, factory_, NULL, NULL, 0 }; \
|
||||
fuse_register_module(&mod); \
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -161,11 +161,9 @@ static int fuse_load_so_name(const char *soname)
|
||||
return -1;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&fuse_context_lock);
|
||||
fuse_current_so = so;
|
||||
so->handle = dlopen(soname, RTLD_NOW);
|
||||
fuse_current_so = NULL;
|
||||
pthread_mutex_unlock(&fuse_context_lock);
|
||||
if (!so->handle) {
|
||||
fprintf(stderr, "fuse: %s\n", dlerror());
|
||||
goto err;
|
||||
@@ -191,9 +189,7 @@ static int fuse_load_so_module(const char *module)
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (soname)
|
||||
sprintf(soname, "libfusemod_%s.so", module);
|
||||
|
||||
sprintf(soname, "libfusemod_%s.so", module);
|
||||
res = fuse_load_so_name(soname);
|
||||
free(soname);
|
||||
return res;
|
||||
@@ -3157,6 +3153,7 @@ struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
|
||||
called on the filesystem without init being called first */
|
||||
fs->op.destroy = NULL;
|
||||
fuse_fs_destroy(f->fs);
|
||||
free(f->conf.modules);
|
||||
out_free:
|
||||
free(f);
|
||||
out_delete_context_key:
|
||||
@@ -3213,6 +3210,7 @@ void fuse_destroy(struct fuse *f)
|
||||
pthread_mutex_destroy(&f->lock);
|
||||
pthread_rwlock_destroy(&f->tree_lock);
|
||||
fuse_session_destroy(f->se);
|
||||
free(f->conf.modules);
|
||||
free(f);
|
||||
fuse_delete_context_key();
|
||||
}
|
||||
|
||||
+5
-5
@@ -392,6 +392,11 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
|
||||
int fd;
|
||||
int res;
|
||||
|
||||
if (!mnt) {
|
||||
fprintf(stderr, "fuse: missing mountpoint\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = lstat(mnt, &stbuf);
|
||||
if (res == -1) {
|
||||
fprintf(stderr ,"fuse: failed to access mountpoint %s: %s\n",
|
||||
@@ -516,11 +521,6 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
|
||||
int res = -1;
|
||||
char *mnt_opts = NULL;
|
||||
|
||||
if (!mountpoint) {
|
||||
fprintf(stderr, "fuse: missing mountpoint\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&mo, 0, sizeof(mo));
|
||||
mo.flags = MS_NOSUID | MS_NODEV;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user