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
Correctness in ATA driver
[tpg/acess2.git]
/
Kernel
/
drv
/
iocache.c
diff --git
a/Kernel/drv/iocache.c
b/Kernel/drv/iocache.c
index
8ea6929
..
f42957c
100644
(file)
--- a/
Kernel/drv/iocache.c
+++ b/
Kernel/drv/iocache.c
@@
-4,7
+4,8
@@
*
* By thePowersGang (John Hodge)
*/
*
* By thePowersGang (John Hodge)
*/
-#include <common.h>
+#define DEBUG 0
+#include <acess.h>
#include <iocache.h>
// === TYPES ===
#include <iocache.h>
// === TYPES ===
@@
-77,14
+78,19
@@
int IOCache_Read( tIOCache *Cache, Uint64 Sector, void *Buffer )
{
tIOCache_Ent *ent;
{
tIOCache_Ent *ent;
+ ENTER("pCache XSector pBuffer", Cache, Sector, Buffer);
+
// Sanity Check!
// Sanity Check!
- if(!Cache || !Buffer)
+ if(!Cache || !Buffer) {
+ LEAVE('i', -1);
return -1;
return -1;
+ }
// Lock
LOCK( &Cache->Lock );
if(Cache->CacheSize == 0) {
RELEASE( &Cache->Lock );
// Lock
LOCK( &Cache->Lock );
if(Cache->CacheSize == 0) {
RELEASE( &Cache->Lock );
+ LEAVE('i', -1);
return -1;
}
return -1;
}
@@
-96,6
+102,7
@@
int IOCache_Read( tIOCache *Cache, Uint64 Sector, void *Buffer )
memcpy(Buffer, ent->Data, Cache->SectorSize);
ent->LastAccess = now();
RELEASE( &Cache->Lock );
memcpy(Buffer, ent->Data, Cache->SectorSize);
ent->LastAccess = now();
RELEASE( &Cache->Lock );
+ LEAVE('i', 1);
return 1;
}
// It's a sorted list, so as soon as we go past `Sector` we know
return 1;
}
// It's a sorted list, so as soon as we go past `Sector` we know
@@
-104,6
+111,7
@@
int IOCache_Read( tIOCache *Cache, Uint64 Sector, void *Buffer )
}
RELEASE( &Cache->Lock );
}
RELEASE( &Cache->Lock );
+ LEAVE('i', 0);
return 0;
}
return 0;
}
UCC
git Repository :: git.ucc.asn.au