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