Lines Matching refs:i
16 int i = 1; in get_pos() local
18 if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i; in get_pos()
19 i++; in get_pos()
28 int i = 0; in hpfs_add_pos() local
32 for (; hpfs_inode->i_rddir_off[i]; i++) in hpfs_add_pos()
33 if (hpfs_inode->i_rddir_off[i] == pos) in hpfs_add_pos()
35 if (!(i&0x0f)) { in hpfs_add_pos()
36 ppos = kmalloc_array(i + 0x11, sizeof(loff_t *), GFP_NOFS); in hpfs_add_pos()
42 memcpy(ppos, hpfs_inode->i_rddir_off, i * sizeof(loff_t)); in hpfs_add_pos()
47 hpfs_inode->i_rddir_off[i] = pos; in hpfs_add_pos()
48 hpfs_inode->i_rddir_off[i + 1] = NULL; in hpfs_add_pos()
55 loff_t **i, **j; in hpfs_del_pos() local
58 for (i = hpfs_inode->i_rddir_off; *i; i++) if (*i == pos) goto fnd; in hpfs_del_pos()
61 for (j = i + 1; *j; j++) ; in hpfs_del_pos()
62 *i = *(j - 1); in hpfs_del_pos()
79 loff_t **i; in for_all_poss() local
82 for (i = hpfs_inode->i_rddir_off; *i; i++) (*f)(*i, p1, p2); in for_all_poss()
237 static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, in hpfs_add_to_dnode() argument
258 hpfs_error(i->i_sb, "%s(): namelen == %d", __func__, namelen); in hpfs_add_to_dnode()
263 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { in hpfs_add_to_dnode()
269 if (hpfs_sb(i->i_sb)->sb_chk) in hpfs_add_to_dnode()
270 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { in hpfs_add_to_dnode()
278 copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de); in hpfs_add_to_dnode()
280 for_all_poss(i, hpfs_pos_ins, t, 1); in hpfs_add_to_dnode()
281 for_all_poss(i, hpfs_pos_subst, 4, t); in hpfs_add_to_dnode()
282 for_all_poss(i, hpfs_pos_subst, 5, t + 1); in hpfs_add_to_dnode()
301 copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de); in hpfs_add_to_dnode()
302 for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1); in hpfs_add_to_dnode()
304 if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) { in hpfs_add_to_dnode()
305 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); in hpfs_add_to_dnode()
311 i->i_size += 2048; in hpfs_add_to_dnode()
312 i->i_blocks += 4; in hpfs_add_to_dnode()
315 copy_de(hpfs_add_de(i->i_sb, ad, de->name, de->namelen, de->down ? de_down_pointer(de) : 0), de); in hpfs_add_to_dnode()
316 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, ((loff_t)adno << 4) | pos); in hpfs_add_to_dnode()
323 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, 4); in hpfs_add_to_dnode()
325 set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0); in hpfs_add_to_dnode()
330 for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos); in hpfs_add_to_dnode()
331 fix_up_ptrs(i->i_sb, ad); in hpfs_add_to_dnode()
341 if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) { in hpfs_add_to_dnode()
342 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); in hpfs_add_to_dnode()
349 i->i_size += 2048; in hpfs_add_to_dnode()
350 i->i_blocks += 4; in hpfs_add_to_dnode()
353 if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) { in hpfs_add_to_dnode()
354 hpfs_free_dnode(i->i_sb, rdno); in hpfs_add_to_dnode()
365 hpfs_i(i)->i_dno = rdno; in hpfs_add_to_dnode()
373 set_last_pointer(i->i_sb, rd, dno); in hpfs_add_to_dnode()
387 int hpfs_add_dirent(struct inode *i, in hpfs_add_dirent() argument
391 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in hpfs_add_dirent()
400 if (hpfs_sb(i->i_sb)->sb_chk) in hpfs_add_dirent()
401 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_dirent")) return 1; in hpfs_add_dirent()
402 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 1; in hpfs_add_dirent()
405 if (!(c = hpfs_compare_names(i->i_sb, name, namelen, de->name, de->namelen, de->last))) { in hpfs_add_dirent()
419 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) { in hpfs_add_dirent()
423 c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0); in hpfs_add_dirent()
433 static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to) in move_to_top() argument
445 if (hpfs_sb(i->i_sb)->sb_chk) in move_to_top()
446 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "move_to_top")) in move_to_top()
448 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0; in move_to_top()
449 if (hpfs_sb(i->i_sb)->sb_chk) { in move_to_top()
451 hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x", in move_to_top()
459 hpfs_error(i->i_sb, "move_to_top: dnode %08x has no last de", dno); in move_to_top()
470 hpfs_free_dnode(i->i_sb, dno); in move_to_top()
471 i->i_size -= 2048; in move_to_top()
472 i->i_blocks -= 4; in move_to_top()
473 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, 5); in move_to_top()
475 if (!(dnode = hpfs_map_dnode(i->i_sb, up, &qbh))) return 0; in move_to_top()
477 hpfs_error(i->i_sb, "move_to_top: got to root_dnode while moving from %08x to %08x", from, to); in move_to_top()
483 hpfs_error(i->i_sb, "move_to_top: dnode %08x doesn't point down to %08x", up, dno); in move_to_top()
494 for_all_poss(i, hpfs_pos_subst, t, 4); in move_to_top()
495 for_all_poss(i, hpfs_pos_subst, t + 1, 5); in move_to_top()
497 hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted"); in move_to_top()
503 hpfs_delete_de(i->i_sb, dnode, de); in move_to_top()
504 set_last_pointer(i->i_sb, dnode, ddno); in move_to_top()
507 a = hpfs_add_to_dnode(i, to, nde->name, nde->namelen, nde, from); in move_to_top()
518 static void delete_empty_dnode(struct inode *i, dnode_secno dno) in delete_empty_dnode() argument
520 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); in delete_empty_dnode()
528 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return; in delete_empty_dnode()
529 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return; in delete_empty_dnode()
537 if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) { in delete_empty_dnode()
538 hpfs_error(i->i_sb, "delete_empty_dnode: root dnode %08x is empty", dno); in delete_empty_dnode()
542 hpfs_free_dnode(i->i_sb, dno); in delete_empty_dnode()
543 i->i_size -= 2048; in delete_empty_dnode()
544 i->i_blocks -= 4; in delete_empty_dnode()
550 if (hpfs_sb(i->i_sb)->sb_chk) in delete_empty_dnode()
551 if (up != i->i_ino) { in delete_empty_dnode()
552 hpfs_error(i->i_sb, in delete_empty_dnode()
555 (unsigned long)i->i_ino); in delete_empty_dnode()
558 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { in delete_empty_dnode()
564 if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) { in delete_empty_dnode()
570 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, (loff_t) 12); in delete_empty_dnode()
573 if (!(dnode = hpfs_map_dnode(i->i_sb, up, &qbh))) return; in delete_empty_dnode()
578 hpfs_error(i->i_sb, "delete_empty_dnode: pointer to dnode %08x not found in dnode %08x", dno, up); in delete_empty_dnode()
581 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p); in delete_empty_dnode()
592 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { in delete_empty_dnode()
599 …hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, le32_to_cpu(dnode->… in delete_empty_dnode()
615 hpfs_delete_de(i->i_sb, dnode, de); in delete_empty_dnode()
618 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4); in delete_empty_dnode()
619 for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1); in delete_empty_dnode()
620 if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) { in delete_empty_dnode()
625 …hpfs_add_to_dnode(i, ndown, de_cp->name, de_cp->namelen, de_cp, de_cp->down ? de_down_pointer(de_c… in delete_empty_dnode()
638 hpfs_error(i->i_sb, "delete_empty_dnode: empty dnode %08x", up); in delete_empty_dnode()
646 if ((d1 = hpfs_map_dnode(i->i_sb, ndown, &qbh1))) { in delete_empty_dnode()
651 if (hpfs_sb(i->i_sb)->sb_chk >= 2) { in delete_empty_dnode()
658 if (hpfs_sb(i->i_sb)->sb_chk >= 2) { in delete_empty_dnode()
681 hpfs_delete_de(i->i_sb, dnode, de_prev); in delete_empty_dnode()
690 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4); in delete_empty_dnode()
691 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1)); in delete_empty_dnode()
692 if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) { in delete_empty_dnode()
697 hpfs_add_to_dnode(i, ndown, de_cp->name, de_cp->namelen, de_cp, dlp); in delete_empty_dnode()
711 int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de, in hpfs_remove_dirent() argument
718 …hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dn… in hpfs_remove_dirent()
724 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) { in hpfs_remove_dirent()
729 for_all_poss(i, hpfs_pos_del, (t = get_pos(dnode, de)) + 1, 1); in hpfs_remove_dirent()
730 hpfs_delete_de(i->i_sb, dnode, de); in hpfs_remove_dirent()
734 dnode_secno a = move_to_top(i, down, dno); in hpfs_remove_dirent()
735 for_all_poss(i, hpfs_pos_subst, 5, t); in hpfs_remove_dirent()
736 if (a) delete_empty_dnode(i, a); in hpfs_remove_dirent()
739 delete_empty_dnode(i, dno); in hpfs_remove_dirent()
799 int i; in map_nth_dirent() local
807 for (i = 1; de < de_end; i++, de = de_next_de(de)) { in map_nth_dirent()
808 if (i == n) { in map_nth_dirent()