summaryrefslogtreecommitdiffstats
path: root/fs/hfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfs/inode.c')
-rw-r--r--fs/hfs/inode.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 60014426b..34e365663 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -106,7 +106,9 @@ void hfs_put_inode(struct inode * inode)
* to permissions must be applied to all other in-core inodes which
* correspond to the same HFS file.
*/
-int hfs_notify_change(struct dentry *dentry, struct iattr * attr)
+enum {HFS_NORM, HFS_HDR, HFS_CAP};
+
+static int __hfs_notify_change(struct dentry *dentry, struct iattr * attr, int kind)
{
struct inode *inode = dentry->d_inode;
struct hfs_cat_entry *entry = HFS_I(inode)->entry;
@@ -148,6 +150,22 @@ int hfs_notify_change(struct dentry *dentry, struct iattr * attr)
}
attr->ia_mode &= ~hsb->s_umask;
}
+ /*
+ * Normal files handle size change in normal way.
+ * Oddballs are served here.
+ */
+ if (attr->ia_valid & ATTR_SIZE) {
+ if (kind == HFS_CAP) {
+ inode->i_size = attr->ia_size;
+ if (inode->i_size > HFS_FORK_MAX)
+ inode->i_size = HFS_FORK_MAX;
+ mark_inode_dirty(inode);
+ attr->ia_valid &= ~ATTR_SIZE;
+ } else if (kind == HFS_HDR) {
+ hdr_truncate(inode, attr->ia_size);
+ attr->ia_valid &= ~ATTR_SIZE;
+ }
+ }
inode_setattr(inode, attr);
/* We wouldn't want to mess with the sizes of the other fork */
@@ -184,6 +202,21 @@ int hfs_notify_change(struct dentry *dentry, struct iattr * attr)
return 0;
}
+int hfs_notify_change(struct dentry *dentry, struct iattr * attr)
+{
+ return __hfs_notify_change(dentry, attr, HFS_NORM);
+}
+
+int hfs_notify_change_cap(struct dentry *dentry, struct iattr * attr)
+{
+ return __hfs_notify_change(dentry, attr, HFS_CAP);
+}
+
+int hfs_notify_change_hdr(struct dentry *dentry, struct iattr * attr)
+{
+ return __hfs_notify_change(dentry, attr, HFS_HDR);
+}
+
static int hfs_writepage(struct dentry *dentry, struct page *page)
{
return block_write_full_page(page,hfs_get_block);
@@ -329,10 +362,12 @@ void hfs_cap_ifill(struct inode * inode, ino_t type, const int version)
inode->i_nlink = 1;
inode->i_mode = S_IRUGO | S_IWUGO | S_IFREG;
inode->i_op = &hfs_cap_info_inode_operations;
+ inode->i_fop = &hfs_cap_info_operations;
} else if (entry->type == HFS_CDR_FIL) {
init_file_inode(inode, (type == HFS_CAP_DATA) ?
HFS_FK_DATA : HFS_FK_RSRC);
inode->i_op = &hfs_file_inode_operations;
+ inode->i_fop = &hfs_file_operations;
inode->i_mapping->a_ops = &hfs_aops;
inode->u.hfs_i.mmu_private = inode->i_size;
} else { /* Directory */
@@ -345,16 +380,19 @@ void hfs_cap_ifill(struct inode * inode, ino_t type, const int version)
inode->i_mode = S_IRWXUGO | S_IFDIR;
inode->i_nlink = hdir->dirs + 4;
inode->i_op = &hfs_cap_ndir_inode_operations;
+ inode->i_fop = &hfs_cap_dir_operations;
HFS_I(inode)->file_type = HFS_CAP_NORM;
} else if (type == HFS_CAP_FDIR) {
inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
inode->i_nlink = 2;
inode->i_op = &hfs_cap_fdir_inode_operations;
+ inode->i_fop = &hfs_cap_dir_operations;
HFS_I(inode)->file_type = HFS_CAP_FNDR;
} else if (type == HFS_CAP_RDIR) {
inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
inode->i_nlink = 2;
inode->i_op = &hfs_cap_rdir_inode_operations;
+ inode->i_fop = &hfs_cap_dir_operations;
HFS_I(inode)->file_type = HFS_CAP_RSRC;
}
}
@@ -385,9 +423,11 @@ void hfs_dbl_ifill(struct inode * inode, ino_t type, const int version)
HFS_I(inode)->default_layout = &hfs_dbl_dir_hdr_layout;
}
inode->i_op = &hfs_hdr_inode_operations;
+ inode->i_fop = &hfs_hdr_operations;
} else if (entry->type == HFS_CDR_FIL) {
init_file_inode(inode, HFS_FK_DATA);
inode->i_op = &hfs_file_inode_operations;
+ inode->i_fop = &hfs_file_operations;
inode->i_mapping->a_ops = &hfs_aops;
inode->u.hfs_i.mmu_private = inode->i_size;
} else { /* Directory */
@@ -398,6 +438,7 @@ void hfs_dbl_ifill(struct inode * inode, ino_t type, const int version)
inode->i_size = 3 + 2 * (hdir->dirs + hdir->files);
inode->i_mode = S_IRWXUGO | S_IFDIR;
inode->i_op = &hfs_dbl_dir_inode_operations;
+ inode->i_fop = &hfs_dbl_dir_operations;
HFS_I(inode)->file_type = HFS_DBL_NORM;
HFS_I(inode)->dir_size = 2;
}
@@ -426,11 +467,13 @@ void hfs_nat_ifill(struct inode * inode, ino_t type, const int version)
inode->i_nlink = 1;
}
inode->i_op = &hfs_hdr_inode_operations;
+ inode->i_fop = &hfs_hdr_operations;
HFS_I(inode)->default_layout = (version == 2) ?
&hfs_nat2_hdr_layout : &hfs_nat_hdr_layout;
} else if (entry->type == HFS_CDR_FIL) {
init_file_inode(inode, HFS_FK_DATA);
inode->i_op = &hfs_file_inode_operations;
+ inode->i_fop = &hfs_file_operations;
inode->i_mapping->a_ops = &hfs_aops;
inode->u.hfs_i.mmu_private = inode->i_size;
} else { /* Directory */
@@ -449,5 +492,6 @@ void hfs_nat_ifill(struct inode * inode, ino_t type, const int version)
inode->i_op = &hfs_nat_hdir_inode_operations;
HFS_I(inode)->file_type = HFS_NAT_HDR;
}
+ inode->i_fop = &hfs_nat_dir_operations;
}
}