Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / KernelLand / Modules / Filesystems / NTFS / common.h
1 /*
2  * Acess2 - NTFS Driver
3  * By John Hodge (thePowersGang)
4  * This file is published under the terms of the Acess licence. See the
5  * file COPYING for details.
6  *
7  * common.h - Common Types and Definitions
8  */
9 #ifndef _NTFS__COMMON_H_
10 #define _NTFS__COMMON_H_
11
12 #include <acess.h>
13 #include <vfs.h>
14 #include "ntfs.h"
15
16 typedef struct sNTFS_File       tNTFS_File;
17 typedef struct sNTFS_Directory  tNTFS_Directory;
18 typedef struct sNTFS_Disk       tNTFS_Disk;
19 typedef struct sNTFS_Attrib     tNTFS_Attrib;
20 typedef struct sNTFS_AttribDataRun      tNTFS_AttribDataRun;
21
22 // === STRUCTURES ===
23
24 struct sNTFS_File
25 {
26         tVFS_Node       Node;
27         tNTFS_Attrib    *Data;
28 };
29
30 struct sNTFS_Directory
31 {
32         tVFS_Node       Node;
33         tNTFS_Attrib    *I30Root;
34         tNTFS_Attrib    *I30Allocation;
35 };
36
37 /**
38  * In-memory representation of an NTFS Disk
39  */
40 struct sNTFS_Disk
41 {
42          int    FD;
43         tInodeCache     *InodeCache;
44          
45          int    ClusterSize;
46         
47         Uint64  MFTBase;
48         Uint32  MFTRecSize;
49         
50         tNTFS_Attrib    *MFTDataAttr;
51         tNTFS_Attrib    *MFTBitmapAttr;
52
53         tNTFS_Directory RootDir;
54 };
55
56 struct sNTFS_AttribDataRun
57 {
58         Uint64  Count;
59         Uint64  LCN;
60 };
61
62 struct sNTFS_Attrib
63 {
64         tNTFS_Disk      *Disk;
65         Uint32  Type;
66
67         char    *Name;
68
69         Uint64  DataSize;       
70
71          int    IsResident;
72         union {
73                 void    *ResidentData;
74                 struct {
75                          int    nRuns;
76                          int    CompressionUnitL2Size;  // 0 = uncompressed
77                         Uint64  FirstPopulatedCluster;
78                         tNTFS_AttribDataRun     *Runs;
79                 } NonResident;
80         };
81 };
82
83 extern tVFS_NodeType    gNTFS_DirType;
84 extern tVFS_NodeType    gNTFS_FileType;
85
86 extern void     NTFS_Close(tVFS_Node *Node);
87 extern void     NTFS_FreeNode(tVFS_Node *Node);
88 extern int      NTFS_int_ApplyUpdateSequence(void *Buf, size_t BufLen, const Uint16 *Sequence, size_t NumEntries);
89 // -- MFT Access / Manipulation
90 extern tNTFS_FILE_Header        *NTFS_GetMFT(tNTFS_Disk *Disk, Uint32 MFTEntry);
91 extern void     NTFS_ReleaseMFT(tNTFS_Disk *Disk, Uint32 MFTEntry, tNTFS_FILE_Header *Entry);
92 extern tNTFS_Attrib     *NTFS_GetAttrib(tNTFS_Disk *Disk, Uint32 MFTEntry, int Type, const char *Name, int DesIdx);
93 extern void     NTFS_FreeAttrib(tNTFS_Attrib *Attrib);
94 extern size_t   NTFS_ReadAttribData(tNTFS_Attrib *Attrib, Uint64 Offset, size_t Length, void *Buffer);
95 // -- dir.c
96 extern int      NTFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]);
97 extern tVFS_Node        *NTFS_FindDir(tVFS_Node *Node, const char *Name, Uint Flags);
98 // -- io.c
99 extern size_t   NTFS_ReadFile(tVFS_Node *Node, Uint64 Offset, size_t Length, void *Buffer, Uint Flags);
100
101 #endif

UCC git Repository :: git.ucc.asn.au