Merge branch 'master' of git.mutabah.net:acess2
[tpg/acess2.git] / KernelLand / Kernel / vfs / fs / devfs.c
index b3f4a57..9ab2b7b 100644 (file)
@@ -3,6 +3,7 @@
  * Device Filesystem (DevFS)
  * - vfs/fs/devfs.c
  */
+#define DEBUG  0
 #include <acess.h>
 #include <vfs.h>
 #include <fs_devfs.h>
 void   DevFS_DelDevice(tDevFS_Driver *Device);
 #endif
 tVFS_Node      *DevFS_InitDevice(const char *Device, const char **Options);
+void   DevFS_Unmount(tVFS_Node *RootNode);
 char   *DevFS_ReadDir(tVFS_Node *Node, int Pos);
 tVFS_Node      *DevFS_FindDir(tVFS_Node *Node, const char *Name);
 
 // === GLOBALS ===
 tVFS_Driver    gDevFS_Info = {
-       "devfs", 0, DevFS_InitDevice, NULL, NULL
+       .Name = "devfs",
+       .InitDevice = DevFS_InitDevice,
+       .Unmount = DevFS_Unmount
        };
 tVFS_NodeType  gDevFS_DirType = {
        .TypeName = "DevFS-Dir",
@@ -44,6 +48,9 @@ int DevFS_AddDevice(tDevFS_Driver *Device)
 {
         int    ret = 0;
        tDevFS_Driver   *dev;
+
+       ENTER("pDevice", Device);
+       LOG("Device->Name = '%s'", Device->Name);
        
        SHORTLOCK( &glDevFS_ListLock );
        
@@ -61,7 +68,7 @@ int DevFS_AddDevice(tDevFS_Driver *Device)
                else
                        Log_Warning("DevFS", "Device %p attempted to register '%s' which was owned by %p",
                                Device, dev->Name, dev);
-               ret = 0;        // Error
+               ret = -1;       // Error
        }
        else {
                Device->Next = gDevFS_Drivers;
@@ -71,6 +78,7 @@ int DevFS_AddDevice(tDevFS_Driver *Device)
        }
        SHORTREL( &glDevFS_ListLock );
        
+       LEAVE('i', ret);
        return ret;
 }
 
@@ -112,6 +120,11 @@ tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options)
        return &gDevFS_RootNode;
 }
 
+void DevFS_Unmount(tVFS_Node *RootNode)
+{
+       
+}
+
 /**
  * \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
  */
@@ -140,7 +153,7 @@ tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name)
 {
        tDevFS_Driver   *dev;
        
-       //ENTER("pNode sName", Node, Name);
+       ENTER("pNode sName", Node, Name);
        
        for(dev = gDevFS_Drivers;
                dev;
@@ -148,14 +161,14 @@ tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name)
                )
        {
                //LOG("dev = %p", dev);
-               //LOG("dev->Name = '%s'", dev->Name);
+               LOG("dev->Name = '%s'", dev->Name);
                if(strcmp(dev->Name, Name) == 0) {
-                       //LEAVE('p', &dev->RootNode);
+                       LEAVE('p', &dev->RootNode);
                        return &dev->RootNode;
                }
        }
        
-       //LEAVE('n');
+       LEAVE('n');
        return NULL;
 }
 

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