// === PROTOTYPES ===\r
// --- Driver Core\r
int FAT_Install(char **Arguments);\r
+ int FAT_Detect(int FD);\r
tVFS_Node *FAT_InitDevice(const char *device, const char **options);\r
void FAT_Unmount(tVFS_Node *Node);\r
// --- Helpers\r
MODULE_DEFINE(0, VER2(0,80) /*v0.80*/, VFAT, FAT_Install, NULL, NULL);\r
tFAT_VolInfo gFAT_Disks[8];\r
int giFAT_PartCount = 0;\r
-tVFS_Driver gFAT_FSInfo = {"fat", 0, FAT_InitDevice, FAT_Unmount, FAT_GetNodeFromINode, NULL};\r
+tVFS_Driver gFAT_FSInfo = {\r
+ .Name = "fat",\r
+ .Detect = FAT_Detect,\r
+ .InitDevice = FAT_InitDevice,\r
+ .Unmount = FAT_Unmount,\r
+ .GetNodeFromINode = FAT_GetNodeFromINode\r
+};\r
tVFS_NodeType gFAT_DirType = {\r
.TypeName = "FAT-Dir",\r
.ReadDir = FAT_ReadDir,\r
return MODULE_ERR_OK;\r
}\r
\r
+/**\r
+ * \brief Detect if a file is a FAT device\r
+ */\r
+int FAT_Detect(int FD)\r
+{\r
+ fat_bootsect bs;\r
+ \r
+ if( VFS_ReadAt(FD, 0, 512, &bs) != 512) {\r
+ return 0;\r
+ }\r
+\r
+ if(bs.bps == 0 || bs.spc == 0)\r
+ return 0;\r
+ \r
+ return 1;\r
+}\r
/**\r
* \brief Reads the boot sector of a disk and prepares the structures for it\r
*/\r