#include "sysincludes.h"#include "msdos.h"#include "stream.h"#include "mtools.h"#include "fsP.h"#include "file.h"#include "htable.h"#include "dirCache.h"Include dependency graph for file.c:

Go to the source code of this file.
Data Structures | |
| struct | File_t |
Functions | |
| static File_t * | getUnbufferedFile (Stream_t *Stream) |
| Fs_t * | getFs (Stream_t *Stream) |
| dirCache_t ** | getDirCacheP (Stream_t *Stream) |
| direntry_t * | getDirentry (Stream_t *Stream) |
| static int | recalcPreallocSize (File_t *This) |
| static int | _loopDetect (unsigned int *oldrel, unsigned int rel, unsigned int *oldabs, unsigned int abs) |
| static int | loopDetect (File_t *This, unsigned int rel, unsigned int abs) |
| static unsigned int | _countBlocks (Fs_t *This, unsigned int block) |
| unsigned int | countBlocks (Stream_t *Dir, unsigned int block) |
| static size_t | countBytes (Stream_t *Dir, unsigned int block) |
| void | printFat (Stream_t *Stream) |
| static int | normal_map (File_t *This, off_t where, size_t *len, int mode, mt_off_t *res) |
| static int | root_map (File_t *This, off_t where, size_t *len, int mode, mt_off_t *res) |
| static int | read_file (Stream_t *Stream, char *buf, mt_off_t iwhere, size_t len) |
| static int | write_file (Stream_t *Stream, char *buf, mt_off_t iwhere, size_t len) |
| static time_t | conv_stamp (struct directory *dir) |
| static int | get_file_data (Stream_t *Stream, time_t *date, mt_size_t *size, int *type, int *address) |
| static int | free_file (Stream_t *Stream) |
| static int | flush_file (Stream_t *Stream) |
| static int | pre_allocate_file (Stream_t *Stream, mt_size_t isize) |
| static unsigned int | getAbsCluNr (File_t *This) |
| static unsigned int | func1 (void *Stream) |
| static unsigned int | func2 (void *Stream) |
| static int | comp (void *Stream, void *Stream2) |
| static void | init_hash (void) |
| static Stream_t * | _internalFileOpen (Stream_t *Dir, unsigned int first, size_t size, direntry_t *entry) |
| Stream_t * | OpenRoot (Stream_t *Dir) |
| Stream_t * | OpenFileByDirentry (direntry_t *entry) |
| int | isRootDir (Stream_t *Stream) |
Variables | |
| static Class_t | FileClass |
| T_HashTable * | filehash |
| static int | month [] |
| static Class_t | FileClass |
|
||||||||||||
|
Definition at line 117 of file file.c. References _loopDetect(), blocks, and fatDecode(). Referenced by countBlocks(), and countBytes(). |
|
||||||||||||||||||||
|
Definition at line 552 of file file.c. References File_t::Class, COPY, DeclareThis, entry, FileClass, filehash, File_t::FirstAbsCluNr, File_t::Fs, GetFs(), hash_add(), hash_lookup(), init_hash(), IS_DIR, File_t::loopDetectAbs, File_t::loopDetectRel, File_t::map, New, normal_map(), NULL, and root_map(). Referenced by OpenFileByDirentry(), and OpenRoot(). |
|
||||||||||||||||||||
|
Definition at line 95 of file file.c. References fprintf(), and stderr. Referenced by _countBlocks(), and loopDetect(). |
|
||||||||||||
|
Definition at line 531 of file file.c. References DeclareThis, File_t::Fs, and getAbsCluNr(). Referenced by init_hash(), and re_compile(). |
|
|
Definition at line 377 of file file.c. References dir, DOS_DAY, DOS_HOUR, DOS_MINUTE, DOS_MONTH, DOS_SEC, DOS_YEAR, gettimeofday(), L, localtime(), long(), month, time_t, timezone, tm::tm_isdst, tmp, and tzset(). Referenced by get_file_data(). |
|
||||||||||||
|
Definition at line 136 of file file.c. References _countBlocks(), DeclareThis, and GetFs(). Referenced by dir_mdu(), and file_mdu(). |
|
||||||||||||
|
Definition at line 147 of file file.c. References _countBlocks(), DeclareThis, and GetFs(). Referenced by OpenFileByDirentry(), and OpenRoot(). |
|
|
Definition at line 466 of file file.c. References DeclareThis, entry::dir, dir_write(), entry, getStart(), and isRootDir(). |
|
|
Definition at line 455 of file file.c. References DeclareThis, filehash, FREE, freeDirCache(), fsPreallocateClusters(), hash_remove(), and Fs_t::preallocatedClusters. |
|
|
Definition at line 517 of file file.c. References DeclareThis, getAbsCluNr(), and long(). Referenced by init_hash(). |
|
|
Definition at line 524 of file file.c. References DeclareThis, and getAbsCluNr(). Referenced by init_hash(). |
|
||||||||||||||||||||||||
|
Definition at line 438 of file file.c. References ATTR_DIR, conv_stamp(), and DeclareThis. |
|
|
Definition at line 508 of file file.c. References File_t::FirstAbsCluNr, and isRootDir(). |
|
|
Definition at line 54 of file file.c. References File_t::dcp, and getUnbufferedFile(). Referenced by allocDirCache(), and freeDirCache(). |
|
|
Definition at line 59 of file file.c. References File_t::direntry, and getUnbufferedFile(). Referenced by _fprintPwd(), dos_copydir(), enterDirectory(), getParent(), getPathLen(), isSubdirOf(), recurs_dos_loop(), rename_directory(), renameit(), and sprintPwd(). |
|
|
Definition at line 49 of file file.c. References File_t::Fs, and getUnbufferedFile(). Referenced by dos_doctorfat(). |
|
|
Definition at line 42 of file file.c. References Stream_t::Class, FileClass, and Stream_t::Next. Referenced by getDirCacheP(), getDirentry(), getFs(), isRootDir(), and printFat(). |
|
|
Definition at line 541 of file file.c. References comp(), filehash, func1(), func2(), and make_ht(). Referenced by _internalFileOpen(). |
|
|
Definition at line 671 of file file.c. References getUnbufferedFile(), File_t::map, and root_map(). Referenced by dir_mdu(), flush_file(), getAbsCluNr(), and lookupForInsert(). |
|
||||||||||||||||
|
Definition at line 112 of file file.c. References _loopDetect(), File_t::loopDetectAbs, and File_t::loopDetectRel. Referenced by normal_map(), and printFat(). |
|
||||||||||||||||||||||||
|
Definition at line 198 of file file.c. References batchmode, Fs_t::cluster_size, EIO, Fs_t::end_fat, ENOSPC, errno, exit(), fatAllocate(), fatAppend(), fatDecode(), filehash, File_t::FileSize, File_t::FirstAbsCluNr, fprintf(), File_t::Fs, get_next_free_cluster(), hash_add(), hash_remove(), File_t::hint, Fs_t::last_fat, loopDetect(), maximize, MT_READ, MT_WRITE, Fs_t::num_clus, offset, File_t::PreviousAbsCluNr, File_t::PreviousRelCluNr, ROUND_UP, Fs_t::sector_size, sectorsToBytes(), and stderr. Referenced by _internalFileOpen(). |
|
|
Definition at line 646 of file file.c. References _internalFileOpen(), bufferize(), countBytes(), entry::dir, dir_grow(), entry, file, FILE_SIZE, first, getStart(), IS_DIR, OpenRoot(), and size. Referenced by _dos_loop(), del_file(), handle_leaf(), makeit(), recurs_dos_loop(), and subDir(). |
|
|
Definition at line 618 of file file.c. References _internalFileOpen(), ATTR_DIR, bufferize(), countBytes(), entry::dir, Fs_t::dir_len, entry, fat32RootCluster(), file, GetFs(), memset(), mk_entry(), entry::name, num(), Fs_t::sector_size, and size. Referenced by format_root(), OpenFileByDirentry(), and print_volume_label(). |
|
||||||||||||
|
Definition at line 484 of file file.c. References DeclareThis, recalcPreallocSize(), size, and truncBytes32(). |
|
|
Definition at line 156 of file file.c. References begin, fatDecode(), first, File_t::FirstAbsCluNr, File_t::Fs, getUnbufferedFile(), loopDetect(), n, and printf. Referenced by dos_showfat(). |
|
||||||||||||||||||||
|
Definition at line 328 of file file.c. References DeclareThis, err, MT_READ, pos, READS, truncBytes32(), and where. |
|
|
Definition at line 65 of file file.c. References Fs_t::cluster_size, File_t::FileSize, fprintf(), File_t::Fs, fsPreallocateClusters(), File_t::preallocatedClusters, File_t::preallocatedSize, r, Fs_t::sector_size, and stderr. Referenced by pre_allocate_file(), and write_file(). |
|
||||||||||||||||||||||||
|
Definition at line 308 of file file.c. References Fs_t::dir_len, ENOSPC, errno, File_t::Fs, maximize, Fs_t::sector_size, and sectorsToBytes(). Referenced by _internalFileOpen(), and isRootDir(). |
|
||||||||||||||||||||
|
Definition at line 344 of file file.c. References batchmode, DeclareThis, err, force_write(), MT_WRITE, pos, recalcPreallocSize(), truncBytes32(), where, and WRITES. |
|
|
Initial value: {
read_file,
write_file,
flush_file,
free_file,
0,
get_file_data,
pre_allocate_file
}
|
|
|
Definition at line 39 of file file.c. Referenced by _internalFileOpen(), and getUnbufferedFile(). |
|
|
Definition at line 40 of file file.c. Referenced by _internalFileOpen(), free_file(), init_hash(), and normal_map(). |
|
|
Initial value: {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
0, 0, 0 }
Definition at line 375 of file file.c. Referenced by conv_stamp(), date_of(), date_pat(), doyear(), fill_date(), fmtdate(), main(), mktime(), output(), print_date(), servxcheck(), timestamp(), and write_log(). |
1.4.6