Lines Matching refs:d

11 static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde)  in get_pos()  argument
14 struct hpfs_dirent *de_end = dnode_end_de(d); in get_pos()
16 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { in get_pos()
17 if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i; in get_pos()
21 return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1; in get_pos()
92 static void hpfs_pos_ins(loff_t *p, loff_t d, loff_t c) in hpfs_pos_ins() argument
94 if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { in hpfs_pos_ins()
104 static void hpfs_pos_del(loff_t *p, loff_t d, loff_t c) in hpfs_pos_del() argument
106 if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { in hpfs_pos_del()
116 static struct hpfs_dirent *dnode_pre_last_de(struct dnode *d) in dnode_pre_last_de() argument
119 de_end = dnode_end_de(d); in dnode_pre_last_de()
120 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { in dnode_pre_last_de()
126 static struct hpfs_dirent *dnode_last_de(struct dnode *d) in dnode_last_de() argument
129 de_end = dnode_end_de(d); in dnode_last_de()
130 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { in dnode_last_de()
136 static void set_last_pointer(struct super_block *s, struct dnode *d, dnode_secno ptr) in set_last_pointer() argument
139 if (!(de = dnode_last_de(d))) { in set_last_pointer()
140 hpfs_error(s, "set_last_pointer: empty dnode %08x", le32_to_cpu(d->self)); in set_last_pointer()
146 le32_to_cpu(d->self), de_down_pointer(de)); in set_last_pointer()
150 hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", le32_to_cpu(d->self)); in set_last_pointer()
155 le32_add_cpu(&d->first_free, 4); in set_last_pointer()
156 if (le32_to_cpu(d->first_free) > 2048) { in set_last_pointer()
157 hpfs_error(s, "set_last_pointer: too long dnode %08x", le32_to_cpu(d->self)); in set_last_pointer()
158 le32_add_cpu(&d->first_free, -4); in set_last_pointer()
169 struct hpfs_dirent *hpfs_add_de(struct super_block *s, struct dnode *d, in hpfs_add_de() argument
174 struct hpfs_dirent *de_end = dnode_end_de(d); in hpfs_add_de()
176 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { in hpfs_add_de()
179 hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, le32_to_cpu(d->self)); in hpfs_add_de()
194 le32_add_cpu(&d->first_free, d_size); in hpfs_add_de()
200 static void hpfs_delete_de(struct super_block *s, struct dnode *d, in hpfs_delete_de() argument
204 hpfs_error(s, "attempt to delete last dirent in dnode %08x", le32_to_cpu(d->self)); in hpfs_delete_de()
207 d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - le16_to_cpu(de->length)); in hpfs_delete_de()
208 memmove(de, de_next_de(de), le32_to_cpu(d->first_free) + (char *)d - (char *)de); in hpfs_delete_de()
211 static void fix_up_ptrs(struct super_block *s, struct dnode *d) in fix_up_ptrs() argument
214 struct hpfs_dirent *de_end = dnode_end_de(d); in fix_up_ptrs()
215 dnode_secno dno = le32_to_cpu(d->self); in fix_up_ptrs()
216 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) in fix_up_ptrs()
238 struct dnode *d, *ad, *rd, *nd = NULL; in hpfs_add_to_dnode() local
259 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { in hpfs_add_to_dnode()
272 if (le32_to_cpu(d->first_free) + de_size(namelen, down_ptr) <= 2048) { in hpfs_add_to_dnode()
274 copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de); in hpfs_add_to_dnode()
275 t = get_pos(d, de); in hpfs_add_to_dnode()
296 memcpy(nd, d, le32_to_cpu(d->first_free)); in hpfs_add_to_dnode()
300 if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) { in hpfs_add_to_dnode()
325 memcpy(d, nd, le32_to_cpu(nd->first_free)); in hpfs_add_to_dnode()
328 if (!d->root_dnode) { in hpfs_add_to_dnode()
329 ad->up = d->up; in hpfs_add_to_dnode()
337 if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) { in hpfs_add_to_dnode()
348 rd->up = d->up; in hpfs_add_to_dnode()
349 if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) { in hpfs_add_to_dnode()
362 d->up = ad->up = cpu_to_le32(rdno); in hpfs_add_to_dnode()
363 d->root_dnode = ad->root_dnode = 0; in hpfs_add_to_dnode()
371 d = rd; in hpfs_add_to_dnode()
388 struct dnode *d; in hpfs_add_dirent() local
398 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 1; in hpfs_add_dirent()
399 de_end = dnode_end_de(d); in hpfs_add_dirent()
400 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { in hpfs_add_dirent()
819 dnode_secno d = dno; in hpfs_de_as_down_as_possible() local
826 if (hpfs_stop_cycles(s, d, &c1, &c2, "hpfs_de_as_down_as_possible")) in hpfs_de_as_down_as_possible()
827 return d; in hpfs_de_as_down_as_possible()
828 if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno; in hpfs_de_as_down_as_possible()
831 …own_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, le32_to_cpu(((struc… in hpfs_de_as_down_as_possible()
834 return d; in hpfs_de_as_down_as_possible()
836 up = d; in hpfs_de_as_down_as_possible()
837 d = de_down_pointer(de); in hpfs_de_as_down_as_possible()
848 struct hpfs_dirent *de, *d; in map_pos_dirent() local
862 if ((d = de_next_de(de)) < dnode_end_de(dnode)) { in map_pos_dirent()
870 if (d->down) { in map_pos_dirent()
871 *posp = ((loff_t) hpfs_de_as_down_as_possible(inode->i_sb, de_down_pointer(d)) << 4) + 1; in map_pos_dirent()
1002 struct dnode *d; in map_fnode_dirent() local
1038 if (!(d = hpfs_map_dnode(s, dno, qbh))) { in map_fnode_dirent()
1042 de_end = dnode_end_de(d); in map_fnode_dirent()
1043 de = dnode_first_de(d); in map_fnode_dirent()
1078 if (d->root_dnode) goto not_found; in map_fnode_dirent()
1080 dno = le32_to_cpu(d->up); in map_fnode_dirent()