• Home
  • Raw
  • Download

Lines Matching refs:fat

138 checkclnum(struct bootblock *boot, int fat, cl_t cl, cl_t *next)  in checkclnum()  argument
153 cl, fat, in checkclnum()
209 struct fatEntry *fat; in readfat() local
219 fat = calloc(boot->NumClusters, sizeof(struct fatEntry)); in readfat()
220 if (fat == NULL) { in readfat()
289 fat[cl].next = p[0] + (p[1] << 8) in readfat()
291 fat[cl].next &= boot->ClustMask; in readfat()
292 ret |= checkclnum(boot, no, cl, &fat[cl].next); in readfat()
297 fat[cl].next = p[0] + (p[1] << 8); in readfat()
298 ret |= checkclnum(boot, no, cl, &fat[cl].next); in readfat()
303 fat[cl].next = (p[0] + (p[1] << 8)) & 0x0fff; in readfat()
304 ret |= checkclnum(boot, no, cl, &fat[cl].next); in readfat()
308 fat[cl].next = ((p[1] >> 4) + (p[2] << 4)) & 0x0fff; in readfat()
309 ret |= checkclnum(boot, no, cl, &fat[cl].next); in readfat()
317 *fp = fat; in readfat()
420 clearchain(struct bootblock *boot, struct fatEntry *fat, cl_t head) in clearchain() argument
425 if (fat[p].head != head) in clearchain()
427 q = fat[p].next; in clearchain()
428 fat[p].next = fat[p].head = CLUST_FREE; in clearchain()
429 fat[p].length = 0; in clearchain()
434 tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *trunc) in tryclear() argument
437 clearchain(boot, fat, head); in tryclear()
450 checkfat(struct bootblock *boot, struct fatEntry *fat) in checkfat() argument
462 if (fat[head].head != 0 /* cluster already belongs to some chain */ in checkfat()
463 || fat[head].next == CLUST_FREE in checkfat()
464 || fat[head].next == CLUST_BAD) in checkfat()
470 p = fat[p].next) { in checkfat()
477 fat[p].head = head; in checkfat()
482 fat[head].length = fat[head].next == CLUST_FREE ? 0 : len; in checkfat()
492 if (fat[head].head != head) in checkfat()
498 (n = fat[p].next) >= CLUST_FIRST && n < boot->NumClusters && wdk; in checkfat()
500 if (fat[n].head != head) in checkfat()
510 ret |= tryclear(boot, fat, head, &fat[p].next); in checkfat()
516 ret |= tryclear(boot, fat, head, &fat[p].next); in checkfat()
520 head, fat[n].head, n); in checkfat()
521 conf = tryclear(boot, fat, head, &fat[p].next); in checkfat()
522 if (ask(1, "Clear chain starting at %u", h = fat[n].head)) { in checkfat()
529 p = fat[p].next) { in checkfat()
530 if (h != fat[p].head) { in checkfat()
537 fat[p].head = head; in checkfat()
540 clearchain(boot, fat, h); in checkfat()
553 writefat(int fs, struct bootblock *boot, struct fatEntry *fat, int correct_fat) in writefat() argument
617 if (fat[cl].next == CLUST_FREE) in writefat()
619 *p++ = (u_char)fat[cl].next; in writefat()
620 *p++ = (u_char)(fat[cl].next >> 8); in writefat()
621 *p++ = (u_char)(fat[cl].next >> 16); in writefat()
623 *p++ |= (fat[cl].next >> 24)&0x0f; in writefat()
626 if (fat[cl].next == CLUST_FREE) in writefat()
628 *p++ = (u_char)fat[cl].next; in writefat()
629 *p++ = (u_char)(fat[cl].next >> 8); in writefat()
632 if (fat[cl].next == CLUST_FREE) in writefat()
635 && fat[cl + 1].next == CLUST_FREE) in writefat()
637 *p++ = (u_char)fat[cl].next; in writefat()
638 *p++ = (u_char)((fat[cl].next >> 8) & 0xf) in writefat()
639 |(u_char)(fat[cl+1].next << 4); in writefat()
640 *p++ = (u_char)(fat[++cl].next >> 4); in writefat()
661 checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) in checklost() argument
669 if (fat[head].head != head in checklost()
670 || fat[head].next == CLUST_FREE in checklost()
671 || (fat[head].next >= CLUST_RSRVD in checklost()
672 && fat[head].next < CLUST_EOFS) in checklost()
673 || (fat[head].flags & FAT_USED)) in checklost()
677 head, fat[head].length); in checklost()
678 mod |= ret = reconnect(dosfs, boot, fat, head); in checklost()
683 clearchain(boot, fat, head); in checklost()
688 clearchain(boot, fat, head); in checklost()
706 if ((boot->FSNext >= boot->NumClusters) || (fat[boot->FSNext].next != CLUST_FREE)) { in checklost()
711 if (fat[head].next == CLUST_FREE) { in checklost()
725 if (boot->NumFree && fat[boot->FSNext].next != CLUST_FREE) { in checklost()
730 if (fat[head].next == CLUST_FREE) { in checklost()