See the file COPYING.LIB
*/
-#include <config.h>
#include "fuse_i.h"
#include "fuse_compat.h"
#include "fuse_kernel.h"
struct fuse_entry_out arg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
res = lookup_path(f, in->nodeid, in->unique, name, path, &arg);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
res2 = send_reply(f, in, res, &arg, sizeof(arg));
if (res == 0 && res2 == -ENOENT)
cancel_lookup(f, arg.nodeid, in->unique);
struct fuse_attr_out arg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.getattr(path, &buf);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
if (res == 0) {
memset(&arg, 0, sizeof(struct fuse_attr_out));
struct fuse_attr_out outarg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, &outarg, sizeof(outarg));
}
char *path;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.readlink(path, link, sizeof(link));
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
link[PATH_MAX] = '\0';
send_reply(f, in, res, link, res == 0 ? strlen(link) : 0);
}
struct fuse_entry_out outarg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
if (res == 0 && res2 == -ENOENT)
cancel_lookup(f, outarg.nodeid, in->unique);
struct fuse_entry_out outarg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
if (res == 0 && res2 == -ENOENT)
cancel_lookup(f, outarg.nodeid, in->unique);
char *path;
res = -ENOENT;
+ pthread_rwlock_wrlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
char *path;
res = -ENOENT;
+ pthread_rwlock_wrlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
struct fuse_entry_out outarg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path_name(f, in->nodeid, name);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
}
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
if (res == 0 && res2 == -ENOENT)
cancel_lookup(f, outarg.nodeid, in->unique);
char *newpath;
res = -ENOENT;
+ pthread_rwlock_wrlock(&f->tree_lock);
oldpath = get_path_name(f, olddir, oldname);
if (oldpath != NULL) {
newpath = get_path_name(f, newdir, newname);
}
free(oldpath);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
struct fuse_entry_out outarg;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
oldpath = get_path(f, arg->oldnodeid);
if (oldpath != NULL) {
newpath = get_path_name(f, in->nodeid, name);
}
free(oldpath);
}
+ pthread_rwlock_unlock(&f->tree_lock);
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
if (res == 0 && res2 == -ENOENT)
cancel_lookup(f, outarg.nodeid, in->unique);
memset(&fi, 0, sizeof(fi));
fi.flags = arg->flags;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
if (path)
free(path);
+ pthread_rwlock_unlock(&f->tree_lock);
}
static void do_flush(struct fuse *f, struct fuse_in_header *in,
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
res = f->op.flush(path, &fi);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
unlink_hidden = (node->is_hidden && !node->open_count);
pthread_mutex_unlock(&f->lock);
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (f->flags & FUSE_DEBUG) {
printf("RELEASE[%lu] flags: 0x%x\n", fi.fh, fi.flags);
if (path)
free(path);
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, 0, NULL, 0);
}
fi.fh = arg->fh;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
res = f->op.read(path, buf, arg->size, arg->offset, &fi);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
size = 0;
if (res >= 0) {
fi.writepage = arg->write_flags & 1;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
res = f->op.write(path, PARAM(arg), arg->size, arg->offset, &fi);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
memset(&outarg, 0, sizeof(outarg));
if (res >= 0) {
fi.fh = inarg->fh;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
if (f->flags & FUSE_DEBUG) {
res = f->op.fsync(path, inarg->fsync_flags & 1, &fi);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
unsigned char *value = name + strlen(name) + 1;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.setxattr(path, name, value, arg->size, arg->flags);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
char *path;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.getxattr(path, name, value, size);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
return res;
}
char *path;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.listxattr(path, list, size);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
return res;
}
char *path;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.removexattr(path, name);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}
fi.flags = arg->flags;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = f->op.opendir(path, &fi);
free(dh);
}
free(path);
+ pthread_rwlock_unlock(&f->tree_lock);
} else
send_reply(f, in, 0, &outarg, SIZEOF_COMPAT(f, fuse_open_out));
}
struct fuse_read_in *arg, struct fuse_dirhandle *dh)
{
int err = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
char *path = get_path(f, in->nodeid);
if (path != NULL) {
struct fuse_file_info fi;
dh->filled = 0;
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
return err;
}
memset(&fi, 0, sizeof(fi));
fi.fh = dh->fh;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
f->op.releasedir(path ? path : "-", &fi);
free(path);
+ pthread_rwlock_unlock(&f->tree_lock);
}
pthread_mutex_lock(&dh->lock);
pthread_mutex_unlock(&dh->lock);
fi.fh = dh->fh;
res = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, in->nodeid);
if (path != NULL) {
res = -ENOSYS;
res = f->op.fsyncdir(path, inarg->fsync_flags & 1, &fi);
free(path);
}
+ pthread_rwlock_unlock(&f->tree_lock);
send_reply(f, in, res, NULL, 0);
}