Working on a NTFS implementation (it's only going to be RO)
authorJohn Hodge <[email protected]>
Sun, 20 Jun 2010 13:51:38 +0000 (21:51 +0800)
committerJohn Hodge <[email protected]>
Sun, 20 Jun 2010 13:51:38 +0000 (21:51 +0800)
Modules/Filesystems/NTFS/common.h [new file with mode: 0644]
Modules/Filesystems/NTFS/main.c [new file with mode: 0644]

diff --git a/Modules/Filesystems/NTFS/common.h b/Modules/Filesystems/NTFS/common.h
new file mode 100644 (file)
index 0000000..ba25c18
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ */
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+// === STRUCTURES ===
+typedef struct sNTFS_Disk
+{
+       
+}      tNTFS_Disk;
+
+typedef struct sNTFS_FILE_Header
+{
+       Uint32  Magic;  // 'FILE'
+       Uint16  UpdateSequenceOfs;
+       Uint16  UpdateSequenceSize;     // Size in words of the UpdateSequenceArray
+       
+       Uint64  LSN;    // $LogFile Sequence Number
+       
+       Uint16  SequenceNumber;
+       Uint16  HardLinkCount;  
+       Uint16  FirstAttribOfs; // Size of header?
+       Uint16  Flags;  // 0: In Use, 1: Directory
+       
+       Uint32  RecordSize;             // Real Size of FILE Record
+       Uint32  RecordSpace;    // Allocated Size for FILE Record
+       
+       /**
+        * Base address of the MFT containing this record
+        */
+       Uint64  Reference;      // "File reference to the base FILE record" ???
+       
+       Uint16  NextAttribID;
+       union
+       {
+               // Only in XP
+               struct {
+                       Uint16  AlignTo4Byte;
+                       Uint16  RecordNumber;   // Number of this MFT Record
+                       Uint16  UpdateSequenceNumber;
+                       Uint16  UpdateSequenceArray[];
+               }       XP;
+               struct {
+                       Uint16  UpdateSequenceNumber;
+                       Uint16  UpdateSequenceArray[];
+               }       All;
+       } OSDep;        
+       
+}      tNTFS_FILE_Header;
+
+typedef struct sNTFS_FILE_Attrib
+{
+       Uint32  Type;   // See eNTFS_FILE_Attribs
+       Uint32  Size;   // Includes header
+       
+       Uint8   ResidentFlag;   // (What does this mean?)
+       Uint8   NameLength;
+       Uint16  NameOffset;
+       Uint16  Flags;  // 0: Compressed, 14: Encrypted, 15: Sparse
+       Uint16  AttributeID;
+       
+       union
+       {
+               struct {
+                       Uint32  AttribLen;      // In words
+                       Uint16  AttribOfs;
+                       Uint8   IndexedFlag;
+                       Uint8   Padding;
+                       
+                       Uint16  Name[]; // UTF-16
+                       // Attribute Data
+               }       Resident;
+               struct {
+                       Uint64  StartingVCN;
+                       Uint64  LastVCN;
+                       Uint16  DataRunOfs;
+                       Uint16  CompressionUnitSize;
+                       Uint32  Padding;
+                       Uint64  AllocatedSize;
+                       Uint64  RealSize;
+                       Uint64  InitiatedSize;  // One assumes, ammount of actual data stored
+                       Uint16  Name[]; // UTF-16
+                       // Data Runs
+               }       NonResident;
+       };
+}      tNTFS_FILE_Attrib;
+
+#endif
diff --git a/Modules/Filesystems/NTFS/main.c b/Modules/Filesystems/NTFS/main.c
new file mode 100644 (file)
index 0000000..3fdab01
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Acess2 - NTFS Driver
+ * By John Hodge (thePowersGang)
+ * This file is published under the terms of the Acess licence. See the
+ * file COPYING for details.
+ *
+ * main.c - Driver core
+ */
+#define DEBUG  1
+#define VERBOSE        0
+#include "common.h"
+#include <modules.h>
+
+// === PROTOTYPES ===
+ int   NTFS_Install(char **Arguments);
+tVFS_Node      *NTFS_InitDevice(char *Devices, char **Options);
+void   NTFS_Unmount(tVFS_Node *Node);
+
+// === GLOBALS ===
+MODULE_DEFINE(0, 0x0A /*v0.1*/, FS_NTFS, NTFS_Install, NULL);
+tVFS_Driver    gNTFS_FSInfo = {"ntfs", 0, NTFS_InitDevice, NTFS_Unmount, NULL};
+
+tNTFS_Disk     gNTFS_Disks;
+
+// === CODE ===
+/**
+ * \brief Installs the NTFS driver
+ */
+int NTFS_Install(char **Arguments)
+{
+       VFS_AddDriver( &gNTFS_FSInfo );
+       return 1;
+}
+
+/**
+ * \brief Mount a NTFS volume
+ */
+tVFS_Node *NTFS_InitDevice(char *Device, char **Options)
+{
+       char    *path, *host;
+       tNTFS_Disk      *disk;
+       
+       disk = malloc( sizeof(tNTFS_Disk) );
+       
+       return &disk->RootNode;
+}
+
+/**
+ * \brief Unmount an NTFS Disk
+ */
+void NTFS_Unmount(tVFS_Node *Node)
+{
+       
+}

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