aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2007-10-18 06:07:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:30 -0400
commit49d4914fd7c10ae846d0f30d5f6f4732cc68499c (patch)
tree958f5ef12b5bb6f7c58a76c9ca7583b028a6c2b5 /fs/fuse/dir.c
parentc79e322f63592c00b25b17af6a1782fad6c6fe6e (diff)
fuse: clean up open file passing in setattr
Clean up supplying open file to the setattr operation. In addition to being a cleanup it prepares for the changes in the way the open file is passed to the setattr method. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 8c5d156284a0..1e941b3f2453 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1032,11 +1032,6 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
1032 arg->atime = iattr->ia_atime.tv_sec; 1032 arg->atime = iattr->ia_atime.tv_sec;
1033 arg->mtime = iattr->ia_mtime.tv_sec; 1033 arg->mtime = iattr->ia_mtime.tv_sec;
1034 } 1034 }
1035 if (ivalid & ATTR_FILE) {
1036 struct fuse_file *ff = iattr->ia_file->private_data;
1037 arg->valid |= FATTR_FH;
1038 arg->fh = ff->fh;
1039 }
1040} 1035}
1041 1036
1042/* 1037/*
@@ -1047,7 +1042,8 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
1047 * vmtruncate() doesn't allow for this case, so do the rlimit checking 1042 * vmtruncate() doesn't allow for this case, so do the rlimit checking
1048 * and the actual truncation by hand. 1043 * and the actual truncation by hand.
1049 */ 1044 */
1050static int fuse_setattr(struct dentry *entry, struct iattr *attr) 1045static int fuse_do_setattr(struct dentry *entry, struct iattr *attr,
1046 struct file *file)
1051{ 1047{
1052 struct inode *inode = entry->d_inode; 1048 struct inode *inode = entry->d_inode;
1053 struct fuse_conn *fc = get_fuse_conn(inode); 1049 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -1082,6 +1078,11 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1082 1078
1083 memset(&inarg, 0, sizeof(inarg)); 1079 memset(&inarg, 0, sizeof(inarg));
1084 iattr_to_fattr(attr, &inarg); 1080 iattr_to_fattr(attr, &inarg);
1081 if (file) {
1082 struct fuse_file *ff = file->private_data;
1083 inarg.valid |= FATTR_FH;
1084 inarg.fh = ff->fh;
1085 }
1085 req->in.h.opcode = FUSE_SETATTR; 1086 req->in.h.opcode = FUSE_SETATTR;
1086 req->in.h.nodeid = get_node_id(inode); 1087 req->in.h.nodeid = get_node_id(inode);
1087 req->in.numargs = 1; 1088 req->in.numargs = 1;
@@ -1108,6 +1109,14 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1108 return 0; 1109 return 0;
1109} 1110}
1110 1111
1112static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1113{
1114 if (attr->ia_valid & ATTR_FILE)
1115 return fuse_do_setattr(entry, attr, attr->ia_file);
1116 else
1117 return fuse_do_setattr(entry, attr, NULL);
1118}
1119
1111static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, 1120static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1112 struct kstat *stat) 1121 struct kstat *stat)
1113{ 1122{