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://cadel.mutabah.net/acess2
[tpg/acess2.git]
/
KernelLand
/
Modules
/
Filesystems
/
Ext2
/
read.c
diff --git
a/KernelLand/Modules/Filesystems/Ext2/read.c
b/KernelLand/Modules/Filesystems/Ext2/read.c
index
81f5ee6
..
76ee993
100644
(file)
--- a/
KernelLand/Modules/Filesystems/Ext2/read.c
+++ b/
KernelLand/Modules/Filesystems/Ext2/read.c
@@
-7,44
+7,37
@@
* \brief Second Extended Filesystem Driver
* \todo Implement file full write support
*/
* \brief Second Extended Filesystem Driver
* \todo Implement file full write support
*/
-#define DEBUG
1
+#define DEBUG
0
#define VERBOSE 0
#include "ext2_common.h"
#define VERBOSE 0
#include "ext2_common.h"
-// === PROTOTYPES ===
-Uint64 Ext2_Read(tVFS_Node *node, Uint64 offset, Uint64 length, void *buffer);
-
// === CODE ===
/**
// === CODE ===
/**
- * \fn Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
* \brief Read from a file
*/
* \brief Read from a file
*/
-
Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer
)
+
size_t Ext2_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags
)
{
tExt2_Disk *disk = Node->ImplPtr;
{
tExt2_Disk *disk = Node->ImplPtr;
- tExt2_Inode
inode
;
+ tExt2_Inode
*inode = (void*)(Node+1)
;
Uint64 base;
Uint block;
Uint64 remLen;
Uint64 base;
Uint block;
Uint64 remLen;
- ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
-
- // Get Inode
- Ext2_int_ReadInode(disk, Node->Inode, &inode);
+ ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);
// Sanity Checks
// Sanity Checks
- if(Offset >= inode
.
i_size) {
+ if(Offset >= inode
->
i_size) {
LEAVE('i', 0);
return 0;
}
LEAVE('i', 0);
return 0;
}
- if(Offset + Length > inode
.
i_size)
- Length = inode
.
i_size - Offset;
+ if(Offset + Length > inode
->
i_size)
+ Length = inode
->
i_size - Offset;
block = Offset / disk->BlockSize;
block = Offset / disk->BlockSize;
- Offset = Offset
/
disk->BlockSize;
- base = Ext2_int_GetBlockAddr(disk, inode
.
i_block, block);
+ Offset = Offset
%
disk->BlockSize;
+ base = Ext2_int_GetBlockAddr(disk, inode
->
i_block, block);
if(base == 0) {
if(base == 0) {
-
Warning("[EXT2 ] NULL Block Detected in INode 0x%llx", Node->Inode
);
+
Log_Warning("EXT2", "NULL Block Detected in INode 0x%llx (Block %i)", Node->Inode, block
);
LEAVE('i', 0);
return 0;
}
LEAVE('i', 0);
return 0;
}
@@
-58,6
+51,7
@@
Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
}
// Read first block
}
// Read first block
+ // TODO: If (Flags & VFS_IOFLAG_NOBLOCK) trigger read and return EWOULDBLOCK?
remLen = Length;
VFS_ReadAt( disk->FD, base + Offset, disk->BlockSize - Offset, Buffer);
remLen -= disk->BlockSize - Offset;
remLen = Length;
VFS_ReadAt( disk->FD, base + Offset, disk->BlockSize - Offset, Buffer);
remLen -= disk->BlockSize - Offset;
@@
-67,9
+61,9
@@
Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
// Read middle blocks
while(remLen > disk->BlockSize)
{
// Read middle blocks
while(remLen > disk->BlockSize)
{
- base = Ext2_int_GetBlockAddr(disk, inode
.
i_block, block);
+ base = Ext2_int_GetBlockAddr(disk, inode
->
i_block, block);
if(base == 0) {
if(base == 0) {
-
Warning("[EXT2 ]
NULL Block Detected in INode 0x%llx", Node->Inode);
+
Log_Warning("EXT2", "
NULL Block Detected in INode 0x%llx", Node->Inode);
LEAVE('i', 0);
return 0;
}
LEAVE('i', 0);
return 0;
}
@@
-80,7
+74,7
@@
Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
}
// Read last block
}
// Read last block
- base = Ext2_int_GetBlockAddr(disk, inode
.
i_block, block);
+ base = Ext2_int_GetBlockAddr(disk, inode
->
i_block, block);
VFS_ReadAt( disk->FD, base, remLen, Buffer);
LEAVE('X', Length);
VFS_ReadAt( disk->FD, base, remLen, Buffer);
LEAVE('X', Length);
UCC
git Repository :: git.ucc.asn.au