Lines Matching +full:p +full:- +full:256

1 // SPDX-License-Identifier: GPL-2.0
5 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999
14 return hpfs_map_4sectors(s, hpfs_sb(s)->sb_dmap, qbh, 0); in hpfs_map_dnode_bitmap()
22 unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; in hpfs_map_bitmap()
23 if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) { in hpfs_map_bitmap()
27 sec = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block]); in hpfs_map_bitmap()
28 if (!sec || sec > hpfs_sb(s)->sb_fs_size-4) { in hpfs_map_bitmap()
29 hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id); in hpfs_map_bitmap()
40 unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; in hpfs_prefetch_bitmap()
43 to_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block]); in hpfs_prefetch_bitmap()
47 next_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block + 1]); in hpfs_prefetch_bitmap()
52 * Load first code page into kernel memory, return pointer to 256-byte array,
53 * first 128 bytes are uppercasing table for chars 128-255, next 128 bytes are
68 if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) { in hpfs_load_code_page()
70 le32_to_cpu(cp->magic)); in hpfs_load_code_page()
74 if (!le32_to_cpu(cp->n_code_pages)) { in hpfs_load_code_page()
79 cpds = le32_to_cpu(cp->array[0].code_page_data); in hpfs_load_code_page()
80 cpi = le16_to_cpu(cp->array[0].index); in hpfs_load_code_page()
89 if (le16_to_cpu(cpd->offs[cpi]) > 0x178) { in hpfs_load_code_page()
94 ptr = (unsigned char *)cpd + le16_to_cpu(cpd->offs[cpi]) + 6; in hpfs_load_code_page()
95 if (!(cp_table = kmalloc(256, GFP_KERNEL))) { in hpfs_load_code_page()
105 for (i=128; i<256; i++) cp_table[i]=i; in hpfs_load_code_page()
106 for (i=128; i<256; i++) if (cp_table[i-128]!=i && cp_table[i-128]>=128) in hpfs_load_code_page()
107 cp_table[cp_table[i-128]] = i; in hpfs_load_code_page()
115 int n = (hpfs_sb(s)->sb_fs_size + 0x200000 - 1) >> 21; in hpfs_load_bitmap_directory()
123 __le32 *d = hpfs_map_sector(s, bmp+i, &bh, n - i - 1); in hpfs_load_bitmap_directory()
141 n_hotfixes = le32_to_cpu(spareblock->n_spares); in hpfs_load_hotfix_map()
142 n_used_hotfixes = le32_to_cpu(spareblock->n_spares_used); in hpfs_load_hotfix_map()
144 if (n_hotfixes > 256 || n_used_hotfixes > n_hotfixes) { in hpfs_load_hotfix_map()
148 if (!(directory = hpfs_map_4sectors(s, le32_to_cpu(spareblock->hotfix_map), &qbh, 0))) { in hpfs_load_hotfix_map()
153 hpfs_sb(s)->hotfix_from[i] = le32_to_cpu(directory[i]); in hpfs_load_hotfix_map()
154 hpfs_sb(s)->hotfix_to[i] = le32_to_cpu(directory[n_hotfixes + i]); in hpfs_load_hotfix_map()
156 hpfs_sb(s)->n_hotfixes = n_used_hotfixes; in hpfs_load_hotfix_map()
167 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ino, 1, "fnode")) { in hpfs_map_fnode()
171 if (hpfs_sb(s)->sb_chk) { in hpfs_map_fnode()
174 if (le32_to_cpu(fnode->magic) != FNODE_MAGIC) { in hpfs_map_fnode()
180 if ((unsigned)fnode->btree.n_used_nodes + (unsigned)fnode->btree.n_free_nodes != in hpfs_map_fnode()
181 (bp_internal(&fnode->btree) ? 12 : 8)) { in hpfs_map_fnode()
187 if (le16_to_cpu(fnode->btree.first_free) != in hpfs_map_fnode()
188 8 + fnode->btree.n_used_nodes * (bp_internal(&fnode->btree) ? 8 : 12)) { in hpfs_map_fnode()
195 if (le16_to_cpu(fnode->ea_size_s) && (le16_to_cpu(fnode->ea_offs) < 0xc4 || in hpfs_map_fnode()
196 …le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x2… in hpfs_map_fnode()
200 le16_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s)); in hpfs_map_fnode()
224 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ano, 1, "anode")) return NULL; in hpfs_map_anode()
226 if (hpfs_sb(s)->sb_chk) { in hpfs_map_anode()
227 if (le32_to_cpu(anode->magic) != ANODE_MAGIC) { in hpfs_map_anode()
231 if (le32_to_cpu(anode->self) != ano) { in hpfs_map_anode()
235 if ((unsigned)anode->btree.n_used_nodes + (unsigned)anode->btree.n_free_nodes != in hpfs_map_anode()
236 (bp_internal(&anode->btree) ? 60 : 40)) { in hpfs_map_anode()
240 if (le16_to_cpu(anode->btree.first_free) != in hpfs_map_anode()
241 8 + anode->btree.n_used_nodes * (bp_internal(&anode->btree) ? 8 : 12)) { in hpfs_map_anode()
260 if (hpfs_sb(s)->sb_chk) { in hpfs_map_dnode()
263 hpfs_error(s, "dnode %08x not byte-aligned", secno); in hpfs_map_dnode()
268 if (hpfs_sb(s)->sb_chk) { in hpfs_map_dnode()
269 unsigned p, pp = 0; in hpfs_map_dnode() local
272 if (le32_to_cpu(dnode->magic) != DNODE_MAGIC) { in hpfs_map_dnode()
276 if (le32_to_cpu(dnode->self) != secno) in hpfs_map_dnode()
277 hpfs_error(s, "bad self pointer on dnode %08x self = %08x", secno, le32_to_cpu(dnode->self)); in hpfs_map_dnode()
278 /* Check dirents - bad dirents would cause infinite in hpfs_map_dnode()
280 if (le32_to_cpu(dnode->first_free) > 2048) { in hpfs_map_dnode()
281 hpfs_error(s, "dnode %08x has first_free == %08x", secno, le32_to_cpu(dnode->first_free)); in hpfs_map_dnode()
284 for (p = 20; p < le32_to_cpu(dnode->first_free); p += d[p] + (d[p+1] << 8)) { in hpfs_map_dnode()
285 struct hpfs_dirent *de = (struct hpfs_dirent *)((char *)dnode + p); in hpfs_map_dnode()
286 …if (le16_to_cpu(de->length) > 292 || (le16_to_cpu(de->length) < 32) || (le16_to_cpu(de->length) & … in hpfs_map_dnode()
287 hpfs_error(s, "bad dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); in hpfs_map_dnode()
290 if (((31 + de->namelen + de->down*4 + 3) & ~3) != le16_to_cpu(de->length)) { in hpfs_map_dnode()
291 …if (((31 + de->namelen + de->down*4 + 3) & ~3) < le16_to_cpu(de->length) && s->s_flags & SB_RDONLY… in hpfs_map_dnode()
292 …error(s, "namelen does not match dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); in hpfs_map_dnode()
296 if (hpfs_sb(s)->sb_chk >= 2) b |= 1 << de->down; in hpfs_map_dnode()
297 if (de->down) if (de_down_pointer(de) < 0x10) { in hpfs_map_dnode()
298 hpfs_error(s, "bad down pointer in dnode %08x, dirent %03x, last %03x", secno, p, pp); in hpfs_map_dnode()
301 pp = p; in hpfs_map_dnode()
304 if (p != le32_to_cpu(dnode->first_free)) { in hpfs_map_dnode()
332 dno = le32_to_cpu(fnode->u.external[0].disk_secno); in hpfs_fnode_dno()