source: trunk/minix/commands/i386/mtools-3.9.7/fsP.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.0 KB
Line 
1#ifndef MTOOLS_FSP_H
2#define MTOOLS_FSP_H
3
4#include "stream.h"
5#include "msdos.h"
6#include "fs.h"
7
8typedef enum fatAccessMode_t {
9 FAT_ACCESS_READ,
10 FAT_ACCESS_WRITE
11} fatAccessMode_t;
12
13typedef struct Fs_t {
14 Class_t *Class;
15 int refs;
16 Stream_t *Next;
17 Stream_t *Buffer;
18
19 int serialized;
20 unsigned long serial_number;
21 int cluster_size;
22 unsigned int sector_size;
23 int fat_error;
24
25 unsigned int (*fat_decode)(struct Fs_t *This, unsigned int num);
26 void (*fat_encode)(struct Fs_t *This, unsigned int num,
27 unsigned int code);
28
29 Stream_t *Direct;
30 int fat_dirty;
31 unsigned int fat_start;
32 unsigned int fat_len;
33
34 int num_fat;
35 unsigned int end_fat;
36 unsigned int last_fat;
37 int fat_bits;
38 struct FatMap_t *FatMap;
39
40 int dir_start;
41 int dir_len;
42 int clus_start;
43
44 int num_clus;
45 char *drive; /* for error messages */
46
47 /* fat 32 */
48 unsigned int primaryFat;
49 unsigned int writeAllFats;
50 unsigned int rootCluster;
51 int infoSectorLoc;
52 unsigned int last; /* last sector allocated, or MAX32 if unknown */
53 unsigned int freeSpace; /* free space, or MAX32 if unknown */
54 int preallocatedClusters;
55
56 int lastFatSectorNr;
57 unsigned char *lastFatSectorData;
58 fatAccessMode_t lastFatAccessMode;
59 int sectorMask;
60 int sectorShift;
61} Fs_t;
62
63int fs_free(Stream_t *Stream);
64
65void set_fat12(Fs_t *Fs);
66void set_fat16(Fs_t *Fs);
67void set_fat32(Fs_t *Fs);
68unsigned int get_next_free_cluster(Fs_t *Fs, unsigned int last);
69unsigned int fatDecode(Fs_t *This, unsigned int pos);
70void fatAppend(Fs_t *This, unsigned int pos, unsigned int newpos);
71void fatDeallocate(Fs_t *This, unsigned int pos);
72void fatAllocate(Fs_t *This, unsigned int pos, unsigned int value);
73void fatEncode(Fs_t *This, unsigned int pos, unsigned int value);
74
75int fat_read(Fs_t *This, struct bootsector *boot, int fat_bits,
76 size_t tot_sectors, int nodups);
77void fat_write(Fs_t *This);
78int zero_fat(Fs_t *Fs, int media_descriptor);
79extern Class_t FsClass;
80int fsPreallocateClusters(Fs_t *Fs, long);
81Fs_t *getFs(Stream_t *Stream);
82
83
84#endif
Note: See TracBrowser for help on using the repository browser.