Commit ca30bc99 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

[PATCH] hpfs: cleanup ->setattr

Reformat hpfs_notify_change to standard kernel style to make it readable
and rename it to hpfs_setattr as that's what the method is called.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 72e8264e
...@@ -143,5 +143,5 @@ const struct file_operations hpfs_file_ops = ...@@ -143,5 +143,5 @@ const struct file_operations hpfs_file_ops =
const struct inode_operations hpfs_file_iops = const struct inode_operations hpfs_file_iops =
{ {
.truncate = hpfs_truncate, .truncate = hpfs_truncate,
.setattr = hpfs_notify_change, .setattr = hpfs_setattr,
}; };
...@@ -275,7 +275,7 @@ void hpfs_init_inode(struct inode *); ...@@ -275,7 +275,7 @@ void hpfs_init_inode(struct inode *);
void hpfs_read_inode(struct inode *); void hpfs_read_inode(struct inode *);
void hpfs_write_inode(struct inode *); void hpfs_write_inode(struct inode *);
void hpfs_write_inode_nolock(struct inode *); void hpfs_write_inode_nolock(struct inode *);
int hpfs_notify_change(struct dentry *, struct iattr *); int hpfs_setattr(struct dentry *, struct iattr *);
void hpfs_write_if_changed(struct inode *); void hpfs_write_if_changed(struct inode *);
void hpfs_delete_inode(struct inode *); void hpfs_delete_inode(struct inode *);
......
...@@ -260,19 +260,28 @@ void hpfs_write_inode_nolock(struct inode *i) ...@@ -260,19 +260,28 @@ void hpfs_write_inode_nolock(struct inode *i)
brelse(bh); brelse(bh);
} }
int hpfs_notify_change(struct dentry *dentry, struct iattr *attr) int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error=0; int error = -EINVAL;
lock_kernel(); lock_kernel();
if ( ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) || if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
(hpfs_sb(inode->i_sb)->sb_root == inode->i_ino) ) { goto out_unlock;
error = -EINVAL; if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
} else if ((error = inode_change_ok(inode, attr))) { goto out_unlock;
} else if ((error = inode_setattr(inode, attr))) {
} else { error = inode_change_ok(inode, attr);
hpfs_write_inode(inode); if (error)
} goto out_unlock;
error = inode_setattr(inode, attr);
if (error)
goto out_unlock;
hpfs_write_inode(inode);
out_unlock:
unlock_kernel(); unlock_kernel();
return error; return error;
} }
......
...@@ -669,5 +669,5 @@ const struct inode_operations hpfs_dir_iops = ...@@ -669,5 +669,5 @@ const struct inode_operations hpfs_dir_iops =
.rmdir = hpfs_rmdir, .rmdir = hpfs_rmdir,
.mknod = hpfs_mknod, .mknod = hpfs_mknod,
.rename = hpfs_rename, .rename = hpfs_rename,
.setattr = hpfs_notify_change, .setattr = hpfs_setattr,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment