• Home
  • Raw
  • Download

Lines Matching +refs:entry +refs:buffer

361     struct fat32_cache_entry *entry)  in fat_flush_fat32_cache_entry()  argument
369 if (!entry->dirty) in fat_flush_fat32_cache_entry()
372 writesize = fat_get_iosize(fat, entry->addr); in fat_flush_fat32_cache_entry()
374 fat_addr = fat->fat32_offset + entry->addr; in fat_flush_fat32_cache_entry()
376 (size_t)write(fd, entry->chunk, writesize) != writesize) { in fat_flush_fat32_cache_entry()
381 entry->dirty = false; in fat_flush_fat32_cache_entry()
390 struct fat32_cache_entry *entry, *first; in fat_get_fat32_cache_entry() local
401 TAILQ_FOREACH(entry, &fat->fat32_cache_head, entries) { in fat_get_fat32_cache_entry()
402 if (entry->addr == addr) { in fat_get_fat32_cache_entry()
404 entry->dirty = true; in fat_get_fat32_cache_entry()
406 if (entry != first) { in fat_get_fat32_cache_entry()
408 TAILQ_REMOVE(&fat->fat32_cache_head, entry, entries); in fat_get_fat32_cache_entry()
409 TAILQ_INSERT_HEAD(&fat->fat32_cache_head, entry, entries); in fat_get_fat32_cache_entry()
411 return (entry); in fat_get_fat32_cache_entry()
419 entry = TAILQ_LAST(&fat->fat32_cache_head, cachehead); in fat_get_fat32_cache_entry()
420 TAILQ_REMOVE(&fat->fat32_cache_head, entry, entries); in fat_get_fat32_cache_entry()
421 if (fat_flush_fat32_cache_entry(fat, entry) != FSOK) { in fat_get_fat32_cache_entry()
427 entry->addr = addr; in fat_get_fat32_cache_entry()
430 (size_t)read(fd, entry->chunk, rwsize) != rwsize) { in fat_get_fat32_cache_entry()
435 entry->dirty = true; in fat_get_fat32_cache_entry()
437 TAILQ_INSERT_HEAD(&fat->fat32_cache_head, entry, entries); in fat_get_fat32_cache_entry()
439 return (entry); in fat_get_fat32_cache_entry()
446 struct fat32_cache_entry *entry; in fat_get_fat32_cached_ptr() local
449 entry = fat_get_fat32_cache_entry(fat, addr, writing); in fat_get_fat32_cached_ptr()
451 if (entry != NULL) { in fat_get_fat32_cached_ptr()
453 return (entry->chunk + off); in fat_get_fat32_cached_ptr()
585 u_char *buffer; in checkdirty() local
595 buffer = malloc(len = boot->bpbBytesPerSec); in checkdirty()
596 if (buffer == NULL) { in checkdirty()
606 if ((size_t)read(fs, buffer, boot->bpbBytesPerSec) != in checkdirty()
616 if (buffer[0] != boot->bpbMedia || buffer[1] != 0xff) in checkdirty()
619 if ((buffer[2] & 0xf8) != 0xf8 || (buffer[3] & 0x3f) != 0x3f) in checkdirty()
622 if (buffer[2] != 0xff || (buffer[3] & 0x0f) != 0x0f in checkdirty()
623 || (buffer[4] & 0xf8) != 0xf8 || buffer[5] != 0xff in checkdirty()
624 || buffer[6] != 0xff || (buffer[7] & 0x03) != 0x03) in checkdirty()
632 if ((buffer[3] & 0xc0) == 0xc0) in checkdirty()
635 if ((buffer[7] & 0x0c) == 0x0c) in checkdirty()
640 free(buffer); in checkdirty()
649 u_char *buffer; in cleardirty() local
662 buffer = malloc(len = boot->bpbBytesPerSec); in cleardirty()
663 if (buffer == NULL) { in cleardirty()
668 if ((size_t)pread(fd, buffer, len, off) != len) { in cleardirty()
674 buffer[3] |= 0x80; in cleardirty()
676 buffer[7] |= 0x08; in cleardirty()
679 if ((size_t)pwrite(fd, buffer, len, off) != len) { in cleardirty()
687 free(buffer); in cleardirty()
702 struct fat32_cache_entry *entry; in _readfat() local
765 entry = calloc(fat32_cache_entries, sizeof(*entry)); in _readfat()
766 if (entry == NULL) { in _readfat()
768 fat32_cache_entries, sizeof(entry)); in _readfat()
772 entry[i].addr = fat32_cache_chunk_size * i; in _readfat()
773 entry[i].chunk = &fat->fatbuf[entry[i].addr]; in _readfat()
775 &entry[i], entries); in _readfat()
777 fat->fat32_cache_allentries = entry; in _readfat()
811 u_char *buffer, *p; in readfat() local
830 buffer = fat->fatbuf; in readfat()
867 if (buffer[0] != boot->bpbMedia in readfat()
868 || buffer[1] != 0xff || buffer[2] != 0xff in readfat()
869 || (boot->ClustMask == CLUST16_MASK && buffer[3] != 0xff) in readfat()
871 && ((buffer[3]&0x0f) != 0x0f in readfat()
872 || buffer[4] != 0xff || buffer[5] != 0xff in readfat()
873 || buffer[6] != 0xff || (buffer[7]&0x0f) != 0x0f))) { in readfat()
881 if (buffer[0] == boot->bpbMedia && buffer[1] == 0xff in readfat()
882 && buffer[2] == 0xff in readfat()
883 && ((boot->ClustMask == CLUST16_MASK && buffer[3] == 0x7f) in readfat()
885 && buffer[3] == 0x0f && buffer[4] == 0xff in readfat()
886 && buffer[5] == 0xff && buffer[6] == 0xff in readfat()
887 && buffer[7] == 0x07))) in readfat()
896 buffer[0], buffer[1], buffer[2], buffer[3], in readfat()
897 buffer[4], buffer[5], buffer[6], buffer[7]); in readfat()
902 buffer[0], buffer[1], buffer[2], buffer[3]); in readfat()
907 buffer[0], buffer[1], buffer[2]); in readfat()
913 p = buffer; in readfat()
1197 struct fat32_cache_entry *entry; in writefat() local
1209 TAILQ_FOREACH(entry, &fat->fat32_cache_head, entries) { in writefat()
1210 if (fat_flush_fat32_cache_entry(fat, entry) != FSOK) { in writefat()