diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:45 -0400 |
commit | 9e6268db496a2592e89457537ea54a496feabb77 (patch) | |
tree | e01d0d7585886fd318b6f16de9329349a629e3f8 /fs/fuse/inode.c | |
parent | e5e5558e923f35839108a12718494ecb73fb782f (diff) |
[PATCH] FUSE - read-write operations
This patch adds the write filesystem operations of FUSE.
The following operations are added:
o setattr
o symlink
o mknod
o mkdir
o create
o unlink
o rmdir
o rename
o link
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r-- | fs/fuse/inode.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 41498a1952a0..fa03f80806e5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -51,6 +51,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb) | |||
51 | fi = get_fuse_inode(inode); | 51 | fi = get_fuse_inode(inode); |
52 | fi->i_time = jiffies - 1; | 52 | fi->i_time = jiffies - 1; |
53 | fi->nodeid = 0; | 53 | fi->nodeid = 0; |
54 | fi->nlookup = 0; | ||
54 | fi->forget_req = fuse_request_alloc(); | 55 | fi->forget_req = fuse_request_alloc(); |
55 | if (!fi->forget_req) { | 56 | if (!fi->forget_req) { |
56 | kmem_cache_free(fuse_inode_cachep, inode); | 57 | kmem_cache_free(fuse_inode_cachep, inode); |
@@ -74,10 +75,10 @@ static void fuse_read_inode(struct inode *inode) | |||
74 | } | 75 | } |
75 | 76 | ||
76 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | 77 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, |
77 | unsigned long nodeid, int version) | 78 | unsigned long nodeid, u64 nlookup) |
78 | { | 79 | { |
79 | struct fuse_forget_in *inarg = &req->misc.forget_in; | 80 | struct fuse_forget_in *inarg = &req->misc.forget_in; |
80 | inarg->version = version; | 81 | inarg->nlookup = nlookup; |
81 | req->in.h.opcode = FUSE_FORGET; | 82 | req->in.h.opcode = FUSE_FORGET; |
82 | req->in.h.nodeid = nodeid; | 83 | req->in.h.nodeid = nodeid; |
83 | req->in.numargs = 1; | 84 | req->in.numargs = 1; |
@@ -91,7 +92,7 @@ static void fuse_clear_inode(struct inode *inode) | |||
91 | struct fuse_conn *fc = get_fuse_conn(inode); | 92 | struct fuse_conn *fc = get_fuse_conn(inode); |
92 | if (fc) { | 93 | if (fc) { |
93 | struct fuse_inode *fi = get_fuse_inode(inode); | 94 | struct fuse_inode *fi = get_fuse_inode(inode); |
94 | fuse_send_forget(fc, fi->forget_req, fi->nodeid, inode->i_version); | 95 | fuse_send_forget(fc, fi->forget_req, fi->nodeid, fi->nlookup); |
95 | fi->forget_req = NULL; | 96 | fi->forget_req = NULL; |
96 | } | 97 | } |
97 | } | 98 | } |
@@ -156,9 +157,10 @@ static int fuse_inode_set(struct inode *inode, void *_nodeidp) | |||
156 | } | 157 | } |
157 | 158 | ||
158 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | 159 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, |
159 | int generation, struct fuse_attr *attr, int version) | 160 | int generation, struct fuse_attr *attr) |
160 | { | 161 | { |
161 | struct inode *inode; | 162 | struct inode *inode; |
163 | struct fuse_inode *fi; | ||
162 | struct fuse_conn *fc = get_fuse_conn_super(sb); | 164 | struct fuse_conn *fc = get_fuse_conn_super(sb); |
163 | int retried = 0; | 165 | int retried = 0; |
164 | 166 | ||
@@ -181,8 +183,9 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | |||
181 | goto retry; | 183 | goto retry; |
182 | } | 184 | } |
183 | 185 | ||
186 | fi = get_fuse_inode(inode); | ||
187 | fi->nlookup ++; | ||
184 | fuse_change_attributes(inode, attr); | 188 | fuse_change_attributes(inode, attr); |
185 | inode->i_version = version; | ||
186 | return inode; | 189 | return inode; |
187 | } | 190 | } |
188 | 191 | ||
@@ -389,7 +392,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode) | |||
389 | 392 | ||
390 | attr.mode = mode; | 393 | attr.mode = mode; |
391 | attr.ino = FUSE_ROOT_ID; | 394 | attr.ino = FUSE_ROOT_ID; |
392 | return fuse_iget(sb, 1, 0, &attr, 0); | 395 | return fuse_iget(sb, 1, 0, &attr); |
393 | } | 396 | } |
394 | 397 | ||
395 | static struct super_operations fuse_super_operations = { | 398 | static struct super_operations fuse_super_operations = { |