From 383a9dfa0011cce8b5619a6a3f6b69142f8388b8 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 10 Dec 2002 14:54:57 +0000 Subject: [PATCH] release() changes --- kernel/dev.c | 6 +++--- kernel/file.c | 21 ++++++++++----------- kernel/fuse_i.h | 3 --- lib/fuse.c | 6 +----- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/kernel/dev.c b/kernel/dev.c index 002e23b..e703b11 100644 --- a/kernel/dev.c +++ b/kernel/dev.c @@ -142,8 +142,9 @@ static inline void destroy_request(struct fuse_conn *fc, struct fuse_req *req) } } -/* This one is currently only used for sending the FORGET request, which is - a kernel initiated request. So the outstanding semaphore is not used. */ +/* This one is currently only used for sending FORGET and RELEASE, + which are kernel initiated request. So the outstanding semaphore + is not used. */ int request_send_noreply(struct fuse_conn *fc, struct fuse_in *in) { struct fuse_req *req; @@ -447,7 +448,6 @@ static struct fuse_conn *new_conn(void) INIT_LIST_HEAD(&fc->processing); sema_init(&fc->outstanding, MAX_OUTSTANDING); fc->reqctr = 1; - fc->has_release = 1; } return fc; } diff --git a/kernel/file.c b/kernel/file.c index 4940117..0ba4892 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -43,22 +43,21 @@ static int fuse_open(struct inode *inode, struct file *file) static int fuse_release(struct inode *inode, struct file *file) { struct fuse_conn *fc = INO_FC(inode); - struct fuse_in in = FUSE_IN_INIT; - struct fuse_out out = FUSE_OUT_INIT; + struct fuse_in *in = NULL; - if(!fc->has_release) - return 0; + in = kmalloc(sizeof(struct fuse_in), GFP_NOFS); + if(!in) + return -ENOMEM; - in.h.opcode = FUSE_RELEASE; - in.h.ino = inode->i_ino; - request_send(fc, &in, &out); + memset(in, 0, sizeof(struct fuse_in)); - if(out.h.error == -ENOSYS) { - fc->has_release = 0; + in->h.opcode = FUSE_RELEASE; + in->h.ino = inode->i_ino; + if(!request_send_noreply(fc, in)) return 0; - } - return out.h.error; + kfree(in); + return 0; } diff --git a/kernel/fuse_i.h b/kernel/fuse_i.h index e4730e6..23cc914 100644 --- a/kernel/fuse_i.h +++ b/kernel/fuse_i.h @@ -56,9 +56,6 @@ struct fuse_conn { /** The next unique request id */ int reqctr; - - /* Flag indicating whether the release call is supported */ - int has_release; }; /** One input argument of a request */ diff --git a/lib/fuse.c b/lib/fuse.c index 71959c4..fe670d8 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -755,18 +755,14 @@ static void do_open(struct fuse *f, struct fuse_in_header *in, static void do_release(struct fuse *f, struct fuse_in_header *in) { - int res; char *path; - res = -ENOENT; path = get_path(f, in->ino); if(path != NULL) { - res = -ENOSYS; if(f->op.release) - res = f->op.release(path); + f->op.release(path); free(path); } - send_reply(f, in, res, NULL, 0); } static void do_read(struct fuse *f, struct fuse_in_header *in, -- 2.30.2