16 #include <linux/sched.h>
26 #define HFS_VALID_MODE_BITS (S_IFREG | S_IFDIR | S_IRWXUGO)
39 loff_t
pos,
unsigned len,
unsigned flags,
40 struct page **pagep,
void **fsdata)
49 loff_t isize = mapping->
host->i_size;
50 if (pos + len > isize)
71 switch (inode->
i_ino) {
73 tree =
HFS_SB(sb)->ext_tree;
76 tree =
HFS_SB(sb)->cat_tree;
113 }
while (--i && nidx < tree->node_count);
120 const struct iovec *iov, loff_t
offset,
unsigned long nr_segs)
122 struct file *file = iocb->
ki_filp;
123 struct inode *inode = file->
f_path.dentry->d_inode->i_mapping->host;
126 ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
134 loff_t isize = i_size_read(inode);
135 loff_t
end = offset + iov_length(iov, nr_segs);
151 .readpage = hfs_readpage,
152 .writepage = hfs_writepage,
153 .write_begin = hfs_write_begin,
156 .releasepage = hfs_releasepage,
160 .readpage = hfs_readpage,
161 .writepage = hfs_writepage,
162 .write_begin = hfs_write_begin,
165 .direct_IO = hfs_direct_IO,
166 .writepages = hfs_writepages,
180 INIT_LIST_HEAD(&
HFS_I(inode)->open_dir_list);
188 HFS_I(inode)->flags = 0;
190 HFS_I(inode)->fs_blocks = 0;
193 HFS_SB(sb)->folder_count++;
201 HFS_I(inode)->clump_blocks =
HFS_SB(sb)->clumpablks;
205 inode->
i_op = &hfs_file_inode_operations;
206 inode->
i_fop = &hfs_file_operations;
212 HFS_I(inode)->phys_size = 0;
213 HFS_I(inode)->alloc_blocks = 0;
214 HFS_I(inode)->first_blocks = 0;
215 HFS_I(inode)->cached_start = 0;
216 HFS_I(inode)->cached_blocks = 0;
220 insert_inode_hash(inode);
221 mark_inode_dirty(inode);
234 HFS_SB(sb)->folder_count--;
263 for (count = 0, i = 0; i < 3; i++)
267 inode->
i_size =
HFS_I(inode)->phys_size = log_size;
272 HFS_I(inode)->clump_blocks = clump_size /
HFS_SB(sb)->alloc_blksz;
273 if (!
HFS_I(inode)->clump_blocks)
274 HFS_I(inode)->clump_blocks =
HFS_SB(sb)->clumpablks;
282 static int hfs_test_inode(
struct inode *inode,
void *
data)
302 static int hfs_read_inode(
struct inode *inode,
void *
data)
308 HFS_I(inode)->flags = 0;
311 INIT_LIST_HEAD(&
HFS_I(inode)->open_dir_list);
319 HFS_I(inode)->cat_key = *idata->
key;
322 HFS_I(inode)->tz_secondswest =
sys_tz.tz_minuteswest * 60;
343 inode->
i_op = &hfs_file_inode_operations;
344 inode->
i_fop = &hfs_file_operations;
350 HFS_I(inode)->fs_blocks = 0;
388 inode =
iget5_locked(sb, cnid, hfs_test_inode, hfs_read_inode, &data);
408 struct inode *main_inode =
inode;
416 switch (inode->
i_ino) {
432 main_inode =
HFS_I(inode)->rsrc_inode;
464 &rec.file.RLgLen, &rec.file.RPyLen);
494 struct inode *inode =
NULL;
502 inode =
HFS_I(dir)->rsrc_inode;
511 fd.search_key->cat =
HFS_I(dir)->cat_key;
515 hfs_read_inode(inode, &idata);
522 HFS_I(inode)->rsrc_inode = dir;
525 hlist_add_fake(&inode->
i_hash);
526 mark_inode_dirty(inode);
528 d_add(dentry, inode);
542 static int hfs_file_open(
struct inode *inode,
struct file *file)
545 inode =
HFS_I(inode)->rsrc_inode;
550 static int hfs_file_release(
struct inode *inode,
struct file *file)
555 inode =
HFS_I(inode)->rsrc_inode;
587 struct inode *inode = dentry->
d_inode;
617 attr->
ia_size != i_size_read(inode)) {
626 mark_inode_dirty(inode);
630 static int hfs_file_fsync(
struct file *filp, loff_t
start, loff_t
end,
633 struct inode *inode = filp->
f_mapping->host;
664 .fsync = hfs_file_fsync,
665 .open = hfs_file_open,
666 .release = hfs_file_release,
670 .lookup = hfs_file_lookup,