3 * By John Hodge (thePowersGang)
4 * This file is published under the terms of the Acess licence. See the
5 * file COPYING for details.
15 int NTFS_Install(char **Arguments);
16 tVFS_Node *NTFS_InitDevice(char *Devices, char **Options);
17 void NTFS_Unmount(tVFS_Node *Node);
20 MODULE_DEFINE(0, 0x0A /*v0.1*/, FS_NTFS, NTFS_Install, NULL);
21 tVFS_Driver gNTFS_FSInfo = {"ntfs", 0, NTFS_InitDevice, NTFS_Unmount, NULL};
23 tNTFS_Disk gNTFS_Disks;
27 * \brief Installs the NTFS driver
29 int NTFS_Install(char **Arguments)
31 VFS_AddDriver( &gNTFS_FSInfo );
36 * \brief Mount a NTFS volume
38 tVFS_Node *NTFS_InitDevice(char *Device, char **Options)
43 disk = malloc( sizeof(tNTFS_Disk) );
45 disk->FD = VFS_Open(Device, VFS_OPENFLAG_READ);
51 VFS_ReadAt(disk->FD, 0, 512, &bs);
53 disk->ClusterSize = bs.BytesPerSector * bs.SectorsPerCluster;
54 Log_Debug("NTFS", "Cluster Size = %i KiB", disk->ClusterSize/1024);
55 disk->MFTBase = bs.MFTStart;
56 Log_Debug("NTFS", "MFT Base = %i", disk->MFTBase);
58 disk->RootNode.Inode = 5; // MFT Ent #5 is '.'
59 disk->RootNode.ImplPtr = disk;
61 disk->RootNode.UID = 0;
62 disk->RootNode.GID = 0;
64 disk->RootNode.NumACLs = 1;
65 disk->RootNode.ACLs = &gVFS_ACL_EveryoneRX;
67 disk->RootNode.ReadDir = NTFS_ReadDir;
68 disk->RootNode.FindDir = NTFS_FindDir;
69 disk->RootNode.MkNod = NULL;
70 disk->RootNode.Link = NULL;
71 disk->RootNode.Relink = NULL;
72 disk->RootNode.Close = NULL;
74 return &disk->RootNode;
78 * \brief Unmount an NTFS Disk
80 void NTFS_Unmount(tVFS_Node *Node)