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
Kernel/VFS - Update to node cache to support extra allocated data
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
vfs
/
nodecache.c
diff --git
a/KernelLand/Kernel/vfs/nodecache.c
b/KernelLand/Kernel/vfs/nodecache.c
index
0d23894
..
aee1826
100644
(file)
--- a/
KernelLand/Kernel/vfs/nodecache.c
+++ b/
KernelLand/Kernel/vfs/nodecache.c
@@
-83,10
+83,17
@@
tVFS_Node *Inode_GetCache(int Handle, Uint64 Inode)
* \fn tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
*/
tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
* \fn tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
*/
tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
+{
+ return Inode_CacheNodeEx(Handle, Node, sizeof(*Node));
+}
+
+tVFS_Node *Inode_CacheNodeEx(int Handle, tVFS_Node *Node, size_t Size)
{
tInodeCache *cache;
{
tInodeCache *cache;
- tCachedInode *newEnt, *ent, *prev;
-
+ tCachedInode *newEnt, *ent, *prev = NULL;
+
+ ASSERT(Size >= sizeof(tVFS_Node));
+
cache = Inode_int_GetFSCache(Handle);
if(!cache) return NULL;
cache = Inode_int_GetFSCache(Handle);
if(!cache) return NULL;
@@
-95,7
+102,6
@@
tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
// Search Cache
ent = cache->FirstNode;
// Search Cache
ent = cache->FirstNode;
- prev = (tCachedInode*) &cache->FirstNode;
for( ; ent; prev = ent, ent = ent->Next )
{
if(ent->Node.Inode < Node->Inode) continue;
for( ; ent; prev = ent, ent = ent->Next )
{
if(ent->Node.Inode < Node->Inode) continue;
@@
-107,10
+113,13
@@
tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
}
// Create new entity
}
// Create new entity
- newEnt = malloc(sizeof(tCachedInode));
+ newEnt = malloc(sizeof(tCachedInode)
+ (Size - sizeof(tVFS_Node))
);
newEnt->Next = ent;
newEnt->Next = ent;
- memcpy(&newEnt->Node, Node, sizeof(tVFS_Node));
- prev->Next = newEnt;
+ memcpy(&newEnt->Node, Node, Size);
+ if( prev )
+ prev->Next = newEnt;
+ else
+ cache->FirstNode = newEnt;
newEnt->Node.ReferenceCount = 1;
LOG("Cached %llx as %p", Node->Inode, &newEnt->Node);
newEnt->Node.ReferenceCount = 1;
LOG("Cached %llx as %p", Node->Inode, &newEnt->Node);
UCC
git Repository :: git.ucc.asn.au