patch-2.3.48 linux/fs/hfs/inode.c
Next file: linux/fs/hfs/super.c
Previous file: linux/fs/hfs/file_hdr.c
Back to the patch index
Back to the overall index
- Lines: 130
- Date:
Sat Feb 26 20:33:42 2000
- Orig file:
v2.3.47/linux/fs/hfs/inode.c
- Orig date:
Thu Feb 10 17:11:17 2000
diff -u --recursive --new-file v2.3.47/linux/fs/hfs/inode.c linux/fs/hfs/inode.c
@@ -106,7 +106,9 @@
* 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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
inode->i_op = &hfs_nat_hdir_inode_operations;
HFS_I(inode)->file_type = HFS_NAT_HDR;
}
+ inode->i_fop = &hfs_nat_dir_operations;
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)