Added basic iso-9660 file system driver. Thanks to Art Yerkes.
[reactos.git] / reactos / drivers / fs / cdfs / cdfs.h
1 #ifndef CDFS_H
2 #define CDFS_H
3
4 #include <ddk/ntifs.h>
5
6 #define CDFS_BASIC_SECTOR 2048
7 #define CDFS_PRIMARY_DESCRIPTOR_LOCATION 16
8 #define BLOCKSIZE CDFS_BASIC_SECTOR
9 #define CDFS_MAX_NAME_LEN 256
10
11 struct _DIR_RECORD
12 {
13 UCHAR RecordLength; // 1
14 UCHAR ExtAttrRecordLength; // 2
15 ULONG ExtentLocationL; // 3-6
16 ULONG ExtentLocationM; // 7-10
17 ULONG DataLengthL; // 11-14
18 ULONG DataLengthM; // 15-18
19 UCHAR Year; // 19
20 UCHAR Month; // 20
21 UCHAR Day; // 21
22 UCHAR Hour; // 22
23 UCHAR Minute; // 23
24 UCHAR Second; // 24
25 UCHAR TimeZone; // 25
26 UCHAR FileFlags; // 26
27 UCHAR FileUnitSize; // 27
28 UCHAR InterleaveGapSize; // 28
29 ULONG VolumeSequenceNumber; // 29-32
30 UCHAR FileIdLength; // 33
31 UCHAR FileId[1]; // 34
32 } __attribute__((packed));
33
34 typedef struct _DIR_RECORD DIR_RECORD, PDIR_RECORD;
35
36
37 /* Primary Volume Descriptor */
38 struct _PVD
39 {
40 unsigned char VdType; // 1
41 unsigned char StandardId[5]; // 2-6
42 unsigned char VdVersion; // 7
43 unsigned char unused0; // 8
44 unsigned char SystemId[32]; // 9-40
45 unsigned char VolumeId[32]; // 41-72
46 unsigned char unused1[8]; // 73-80
47 unsigned long VolumeSpaceSizeL; // 81-84
48 unsigned long VolumeSpaceSizeM; // 85-88
49 unsigned char unused2[32]; // 89-120
50 unsigned long VolumeSetSize; // 121-124
51 unsigned long VolumeSequenceNumber; // 125-128
52 unsigned long LogicalBlockSize; // 129-132
53 unsigned long PathTableSizeL; // 133-136
54 unsigned long PathTableSizeM; // 137-140
55 ULONG LPathTablePos; // 141-144
56 ULONG LOptPathTablePos; // 145-148
57 ULONG MPathTablePos; // 149-152
58 ULONG MOptPathTablePos; // 153-156
59 DIR_RECORD RootDirRecord; // 157-190
60
61 /* more data ... */
62
63 } __attribute__((packed));
64
65 typedef struct _PVD PVD, *PPVD;
66
67
68
69 typedef struct _FCB
70 {
71 REACTOS_COMMON_FCB_HEADER RFCB;
72 SECTION_OBJECT_POINTERS SectionObjectPointers;
73
74 /* CDFS owned elements */
75
76 struct _FCB *next;
77 struct _FCB *parent;
78
79 wchar_t name[CDFS_MAX_NAME_LEN];
80 int hashval;
81 unsigned int extent_start;
82 unsigned int byte_count;
83 unsigned int file_pointer;
84 } FsdFcbEntry, FCB, *PFCB;
85
86
87 NTSTATUS
88 CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
89 IN ULONG DiskSector,
90 IN ULONG SectorCount,
91 IN OUT PUCHAR Buffer);
92
93 int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );
94 void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max );
95
96
97 /*
98 CDFS: FCB system (Perhaps there should be a library to make this easier)
99 */
100
101 typedef struct _fcb_system
102 {
103 int fcbs_in_use;
104 int fcb_table_size;
105 int fcb_table_mask;
106 FsdFcbEntry **fcb_table;
107 FsdFcbEntry *parent;
108 } fcb_system;
109
110
111 PFCB
112 FsdGetFcbEntry(fcb_system *fss,
113 PFCB ParentFcb,
114 PWSTR name);
115
116 #endif//CDFS_H