12 #include <linux/sched.h>
22 struct buffer_head *bh;
40 bh = affs_bread(sb, block);
42 affs_warning(sb,
"read_inode",
"Cannot read block %d", block);
47 "Checksum or type (ptype=%d) error on inode %d",
59 AFFS_I(inode)->i_extcnt = 1;
60 AFFS_I(inode)->i_ext_last = ~1;
61 AFFS_I(inode)->i_protect = prot;
63 AFFS_I(inode)->i_blkcnt = 0;
64 AFFS_I(inode)->i_lc =
NULL;
65 AFFS_I(inode)->i_lc_size = 0;
66 AFFS_I(inode)->i_lc_shift = 0;
67 AFFS_I(inode)->i_lc_mask = 0;
68 AFFS_I(inode)->i_ac =
NULL;
69 AFFS_I(inode)->i_ext_bh =
NULL;
70 AFFS_I(inode)->mmu_private = 0;
71 AFFS_I(inode)->i_lastalloc = 0;
72 AFFS_I(inode)->i_pa_cnt = 0;
83 i_uid_write(inode, 0);
85 i_uid_write(inode,
id);
91 i_gid_write(inode, 0);
93 i_gid_write(inode,
id);
132 AFFS_I(inode)->mmu_private = inode->
i_size =
size;
134 AFFS_I(inode)->i_blkcnt = (size - 1) /
136 AFFS_I(inode)->i_extcnt = (AFFS_I(inode)->i_blkcnt - 1) /
156 ((8 * 365 + 2) * 24 * 60 * 60)) +
157 sys_tz.tz_minuteswest * 60;
166 return ERR_PTR(-
EIO);
173 struct buffer_head *bh;
183 bh = affs_bread(sb, inode->
i_ino);
196 uid = i_uid_read(inode);
197 gid = i_gid_read(inode);
199 if (uid == 0 || uid == 0xFFFF)
201 if (gid == 0 || gid == 0xFFFF)
239 attr->
ia_size != i_size_read(inode)) {
246 mark_inode_dirty(inode);
257 unsigned long cache_page;
269 cache_page = (
unsigned long)AFFS_I(inode)->i_lc;
271 pr_debug(
"AFFS: freeing ext cache\n");
272 AFFS_I(inode)->i_lc =
NULL;
273 AFFS_I(inode)->i_ac =
NULL;
276 affs_brelse(AFFS_I(inode)->i_ext_bh);
277 AFFS_I(inode)->i_ext_last = ~1;
278 AFFS_I(inode)->i_ext_bh =
NULL;
290 struct buffer_head *bh;
298 bh = affs_getzeroblk(sb, block);
310 AFFS_I(inode)->i_blkcnt = 0;
311 AFFS_I(inode)->i_lc =
NULL;
312 AFFS_I(inode)->i_lc_size = 0;
313 AFFS_I(inode)->i_lc_shift = 0;
314 AFFS_I(inode)->i_lc_mask = 0;
315 AFFS_I(inode)->i_ac =
NULL;
316 AFFS_I(inode)->i_ext_bh =
NULL;
317 AFFS_I(inode)->mmu_private = 0;
318 AFFS_I(inode)->i_protect = 0;
319 AFFS_I(inode)->i_lastalloc = 0;
320 AFFS_I(inode)->i_pa_cnt = 0;
321 AFFS_I(inode)->i_extcnt = 1;
322 AFFS_I(inode)->i_ext_last = ~1;
324 insert_inode_hash(inode);
345 struct buffer_head *inode_bh =
NULL;
346 struct buffer_head *bh =
NULL;
350 pr_debug(
"AFFS: add_entry(dir=%u, inode=%u, \"%*s\", type=%d)\n", (
u32)dir->
i_ino,
354 bh = affs_bread(sb, inode->
i_ino);
358 affs_lock_link(inode);
368 bh = affs_getzeroblk(sb, block);
384 chain =
AFFS_TAIL(sb, inode_bh)->link_chain;
388 affs_adjust_checksum(inode_bh, block -
be32_to_cpu(chain));
395 dentry->
d_fsdata = (
void *)(
long)bh->b_blocknr;
400 affs_unlock_dir(dir);
401 affs_unlock_link(inode);
405 affs_brelse(inode_bh);
411 affs_unlock_link(inode);