Lines Matching refs:i
14 void hpfs_init_inode(struct inode *i) in hpfs_init_inode() argument
16 struct super_block *sb = i->i_sb; in hpfs_init_inode()
17 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_init_inode()
19 i->i_uid = hpfs_sb(sb)->sb_uid; in hpfs_init_inode()
20 i->i_gid = hpfs_sb(sb)->sb_gid; in hpfs_init_inode()
21 i->i_mode = hpfs_sb(sb)->sb_mode; in hpfs_init_inode()
22 i->i_size = -1; in hpfs_init_inode()
23 i->i_blocks = -1; in hpfs_init_inode()
39 i->i_ctime.tv_sec = i->i_ctime.tv_nsec = 0; in hpfs_init_inode()
40 i->i_mtime.tv_sec = i->i_mtime.tv_nsec = 0; in hpfs_init_inode()
41 i->i_atime.tv_sec = i->i_atime.tv_nsec = 0; in hpfs_init_inode()
44 void hpfs_read_inode(struct inode *i) in hpfs_read_inode() argument
48 struct super_block *sb = i->i_sb; in hpfs_read_inode()
49 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_read_inode()
53 if (!(fnode = hpfs_map_fnode(sb, i->i_ino, &bh))) { in hpfs_read_inode()
59 make_bad_inode(i); in hpfs_read_inode()
62 if (hpfs_sb(i->i_sb)->sb_eas) { in hpfs_read_inode()
63 if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) { in hpfs_read_inode()
65 i_uid_write(i, le16_to_cpu(*(__le16*)ea)); in hpfs_read_inode()
70 if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) { in hpfs_read_inode()
72 i_gid_write(i, le16_to_cpu(*(__le16*)ea)); in hpfs_read_inode()
77 if ((ea = hpfs_get_ea(i->i_sb, fnode, "SYMLINK", &ea_size))) { in hpfs_read_inode()
79 i->i_mode = S_IFLNK | 0777; in hpfs_read_inode()
80 i->i_op = &page_symlink_inode_operations; in hpfs_read_inode()
81 inode_nohighmem(i); in hpfs_read_inode()
82 i->i_data.a_ops = &hpfs_symlink_aops; in hpfs_read_inode()
83 set_nlink(i, 1); in hpfs_read_inode()
84 i->i_size = ea_size; in hpfs_read_inode()
85 i->i_blocks = 1; in hpfs_read_inode()
89 if ((ea = hpfs_get_ea(i->i_sb, fnode, "MODE", &ea_size))) { in hpfs_read_inode()
97 i->i_mode = mode; in hpfs_read_inode()
99 if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) { in hpfs_read_inode()
107 set_nlink(i, 1); in hpfs_read_inode()
108 i->i_size = 0; in hpfs_read_inode()
109 i->i_blocks = 1; in hpfs_read_inode()
110 init_special_inode(i, mode, in hpfs_read_inode()
118 i->i_mode |= S_IFDIR; in hpfs_read_inode()
119 i->i_op = &hpfs_dir_iops; in hpfs_read_inode()
120 i->i_fop = &hpfs_dir_ops; in hpfs_read_inode()
128 hpfs_count_dnodes(i->i_sb, hpfs_inode->i_dno, &n_dnodes, &n_subdirs, NULL); in hpfs_read_inode()
129 i->i_blocks = 4 * n_dnodes; in hpfs_read_inode()
130 i->i_size = 2048 * n_dnodes; in hpfs_read_inode()
131 set_nlink(i, 2 + n_subdirs); in hpfs_read_inode()
133 i->i_mode |= S_IFREG; in hpfs_read_inode()
134 if (!hpfs_inode->i_ea_mode) i->i_mode &= ~0111; in hpfs_read_inode()
135 i->i_op = &hpfs_file_iops; in hpfs_read_inode()
136 i->i_fop = &hpfs_file_ops; in hpfs_read_inode()
137 set_nlink(i, 1); in hpfs_read_inode()
138 i->i_size = le32_to_cpu(fnode->file_size); in hpfs_read_inode()
139 i->i_blocks = ((i->i_size + 511) >> 9) + 1; in hpfs_read_inode()
140 i->i_data.a_ops = &hpfs_aops; in hpfs_read_inode()
141 hpfs_i(i)->mmu_private = i->i_size; in hpfs_read_inode()
146 static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) in hpfs_write_inode_ea() argument
148 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_write_inode_ea()
153 } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { in hpfs_write_inode_ea()
155 if (!uid_eq(i->i_uid, hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { in hpfs_write_inode_ea()
156 ea = cpu_to_le32(i_uid_read(i)); in hpfs_write_inode_ea()
157 hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); in hpfs_write_inode_ea()
160 if (!gid_eq(i->i_gid, hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) { in hpfs_write_inode_ea()
161 ea = cpu_to_le32(i_gid_read(i)); in hpfs_write_inode_ea()
162 hpfs_set_ea(i, fnode, "GID", (char *)&ea, 2); in hpfs_write_inode_ea()
165 if (!S_ISLNK(i->i_mode)) in hpfs_write_inode_ea()
166 if ((i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0 : 0111)) in hpfs_write_inode_ea()
167 | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG)) in hpfs_write_inode_ea()
168 && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333)) in hpfs_write_inode_ea()
169 | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) { in hpfs_write_inode_ea()
170 ea = cpu_to_le32(i->i_mode); in hpfs_write_inode_ea()
172 hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2); in hpfs_write_inode_ea()
175 if (S_ISBLK(i->i_mode) || S_ISCHR(i->i_mode)) { in hpfs_write_inode_ea()
176 ea = cpu_to_le32(new_encode_dev(i->i_rdev)); in hpfs_write_inode_ea()
177 hpfs_set_ea(i, fnode, "DEV", (char *)&ea, 4); in hpfs_write_inode_ea()
182 void hpfs_write_inode(struct inode *i) in hpfs_write_inode() argument
184 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_write_inode()
186 if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return; in hpfs_write_inode()
187 if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) { in hpfs_write_inode()
193 if (!i->i_nlink) { in hpfs_write_inode()
196 parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir); in hpfs_write_inode()
204 hpfs_write_inode_nolock(i); in hpfs_write_inode()
209 void hpfs_write_inode_nolock(struct inode *i) in hpfs_write_inode_nolock() argument
211 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_write_inode_nolock()
216 if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return; in hpfs_write_inode_nolock()
217 if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) return; in hpfs_write_inode_nolock()
218 if (i->i_ino != hpfs_sb(i->i_sb)->sb_root && i->i_nlink) { in hpfs_write_inode_nolock()
219 if (!(de = map_fnode_dirent(i->i_sb, i->i_ino, fnode, &qbh))) { in hpfs_write_inode_nolock()
224 if (S_ISREG(i->i_mode)) { in hpfs_write_inode_nolock()
225 fnode->file_size = cpu_to_le32(i->i_size); in hpfs_write_inode_nolock()
226 if (de) de->file_size = cpu_to_le32(i->i_size); in hpfs_write_inode_nolock()
227 } else if (S_ISDIR(i->i_mode)) { in hpfs_write_inode_nolock()
231 hpfs_write_inode_ea(i, fnode); in hpfs_write_inode_nolock()
233 de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); in hpfs_write_inode_nolock()
234 de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); in hpfs_write_inode_nolock()
235 de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); in hpfs_write_inode_nolock()
236 de->read_only = !(i->i_mode & 0222); in hpfs_write_inode_nolock()
241 if (S_ISDIR(i->i_mode)) { in hpfs_write_inode_nolock()
242 if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { in hpfs_write_inode_nolock()
243 de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); in hpfs_write_inode_nolock()
244 de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); in hpfs_write_inode_nolock()
245 de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); in hpfs_write_inode_nolock()
246 de->read_only = !(i->i_mode & 0222); in hpfs_write_inode_nolock()
252 hpfs_error(i->i_sb, in hpfs_write_inode_nolock()
254 (unsigned long)i->i_ino); in hpfs_write_inode_nolock()