git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
vfs
/
fs
/
devfs.c
diff --git
a/KernelLand/Kernel/vfs/fs/devfs.c
b/KernelLand/Kernel/vfs/fs/devfs.c
index
b3f4a57
..
9389822
100644
(file)
--- a/
KernelLand/Kernel/vfs/fs/devfs.c
+++ b/
KernelLand/Kernel/vfs/fs/devfs.c
@@
-3,6
+3,7
@@
* Device Filesystem (DevFS)
* - vfs/fs/devfs.c
*/
* Device Filesystem (DevFS)
* - vfs/fs/devfs.c
*/
+#define DEBUG 0
#include <acess.h>
#include <vfs.h>
#include <fs_devfs.h>
#include <acess.h>
#include <vfs.h>
#include <fs_devfs.h>
@@
-13,12
+14,15
@@
void DevFS_DelDevice(tDevFS_Driver *Device);
#endif
tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options);
void DevFS_DelDevice(tDevFS_Driver *Device);
#endif
tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options);
-char *DevFS_ReadDir(tVFS_Node *Node, int Pos);
+void DevFS_Unmount(tVFS_Node *RootNode);
+ int DevFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]);
tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name);
// === GLOBALS ===
tVFS_Driver gDevFS_Info = {
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",
};
tVFS_NodeType gDevFS_DirType = {
.TypeName = "DevFS-Dir",
@@
-44,6
+48,9
@@
int DevFS_AddDevice(tDevFS_Driver *Device)
{
int ret = 0;
tDevFS_Driver *dev;
{
int ret = 0;
tDevFS_Driver *dev;
+
+ ENTER("pDevice", Device);
+ LOG("Device->Name = '%s'", Device->Name);
SHORTLOCK( &glDevFS_ListLock );
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);
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;
}
else {
Device->Next = gDevFS_Drivers;
@@
-71,6
+78,7
@@
int DevFS_AddDevice(tDevFS_Driver *Device)
}
SHORTREL( &glDevFS_ListLock );
}
SHORTREL( &glDevFS_ListLock );
+ LEAVE('i', ret);
return ret;
}
return ret;
}
@@
-112,24
+120,32
@@
tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options)
return &gDevFS_RootNode;
}
return &gDevFS_RootNode;
}
+void DevFS_Unmount(tVFS_Node *RootNode)
+{
+
+}
+
/**
* \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
*/
/**
* \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
*/
-
char *DevFS_ReadDir(tVFS_Node *Node, int Pos
)
+
int DevFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]
)
{
tDevFS_Driver *dev;
{
tDevFS_Driver *dev;
- if(Pos < 0) return
NUL
L;
+ if(Pos < 0) return
-EINVA
L;
for(dev = gDevFS_Drivers;
dev && Pos--;
dev = dev->Next
);
for(dev = gDevFS_Drivers;
dev && Pos--;
dev = dev->Next
);
- if(dev)
- return strdup(dev->Name);
- else
- return NULL;
+ if(dev) {
+ strncpy(Dest, dev->Name, FILENAME_MAX);
+ return 0;
+ }
+ else {
+ return -ENOENT;
+ }
}
/**
}
/**
@@
-140,7
+156,7
@@
tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name)
{
tDevFS_Driver *dev;
{
tDevFS_Driver *dev;
-
//
ENTER("pNode sName", Node, Name);
+ ENTER("pNode sName", Node, Name);
for(dev = gDevFS_Drivers;
dev;
for(dev = gDevFS_Drivers;
dev;
@@
-148,14
+164,14
@@
tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name)
)
{
//LOG("dev = %p", dev);
)
{
//LOG("dev = %p", dev);
-
//
LOG("dev->Name = '%s'", dev->Name);
+ LOG("dev->Name = '%s'", dev->Name);
if(strcmp(dev->Name, Name) == 0) {
if(strcmp(dev->Name, Name) == 0) {
-
//
LEAVE('p', &dev->RootNode);
+ LEAVE('p', &dev->RootNode);
return &dev->RootNode;
}
}
return &dev->RootNode;
}
}
-
//
LEAVE('n');
+ LEAVE('n');
return NULL;
}
return NULL;
}
UCC
git Repository :: git.ucc.asn.au