Kernel - VFS API Update - ReadDir caller provided buffer
[tpg/acess2.git] / KernelLand / Kernel / drv / pci.c
index 98acb99..702c9cc 100644 (file)
@@ -33,7 +33,7 @@ typedef struct sPCIDevice
  int   PCI_Install(char **Arguments);\r
  int   PCI_ScanBus(int ID, int bFill);\r
  \r
-char   *PCI_int_ReadDirRoot(tVFS_Node *node, int pos);\r
+ int   PCI_int_ReadDirRoot(tVFS_Node *node, int pos, char Dest[FILENAME_MAX]);\r
 tVFS_Node      *PCI_int_FindDirRoot(tVFS_Node *node, const char *filename);\r
 Uint32 PCI_int_GetBusAddr(Uint16 Bus, Uint16 Slot, Uint16 Fcn, Uint8 Offset);\r
 size_t PCI_int_ReadDevice(tVFS_Node *node, off_t Offset, size_t Length, void *buffer);\r
@@ -173,8 +173,9 @@ int PCI_ScanBus(int BusID, int bFill)
                        {\r
                                #if LIST_DEVICES\r
                                if( !bFill )\r
-                                       Log_Log("PCI", "Device %i,%i:%i %06x => 0x%04x:0x%04x",\r
-                                               BusID, dev, fcn, devInfo.class, devInfo.vendor, devInfo.device);\r
+                                       Log_Log("PCI", "Device %i,%i:%i %06x => 0x%04x:0x%04x Rev %i",\r
+                                               BusID, dev, fcn, devInfo.class,\r
+                                               devInfo.vendor, devInfo.device, devInfo.revision);\r
                                #endif\r
                        }\r
                        \r
@@ -196,16 +197,16 @@ int PCI_ScanBus(int BusID, int bFill)
 /**\r
  * \brief Read from Root of PCI Driver\r
 */\r
-char *PCI_int_ReadDirRoot(tVFS_Node *Node, int Pos)\r
+int PCI_int_ReadDirRoot(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX])\r
 {\r
        ENTER("pNode iPos", Node, Pos);\r
        if(Pos < 0 || Pos >= giPCI_DeviceCount) {\r
-               LEAVE('n');\r
-               return NULL;\r
+               LEAVE_RET('i', -EINVAL);\r
        }\r
        \r
-       LEAVE('s', gPCI_Devices[Pos].Name);\r
-       return strdup( gPCI_Devices[Pos].Name );\r
+       LOG("Name = %s", gPCI_Devices[Pos].Name);\r
+       strncpy(Dest, gPCI_Devices[Pos].Name, FILENAME_MAX);\r
+       LEAVE_RET('i', 0);\r
 }\r
 /**\r
  */\r
@@ -494,7 +495,7 @@ int PCI_int_EnumDevice(Uint16 bus, Uint16 slot, Uint16 fcn, tPCIDevice *info)
        info->Node.NumACLs = 1;\r
        info->Node.ACLs = &gVFS_ACL_EveryoneRO;\r
        \r
-       info->Node.Type = &gPCI_RootNodeType;\r
+       info->Node.Type = &gPCI_DevNodeType;\r
        \r
        return 1;\r
 }\r

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