Core: add two new data types, sector_t and block_t
authorLiu Aleaxander <Aleaxander@gmail.com>
Wed, 3 Jun 2009 21:20:05 +0000 (05:20 +0800)
committerLiu Aleaxander <Aleaxander@gmail.com>
Wed, 3 Jun 2009 21:20:05 +0000 (05:20 +0800)
and fixed some errors.

core/cache.c
core/cache.h
core/disk.c
core/include/core.h
core/include/disk.h

index debd5b5..2e65172 100644 (file)
@@ -1,6 +1,5 @@
 #include "core.h"
 #include "cache.h"
-#include "disk.h"
 #include <stdio.h>
 #include <string.h>
 
@@ -80,7 +79,7 @@ void get_cache_block(com32sys_t * regs)
     /* let's find it from the end, 'cause the endest is the freshest */
     struct cache_struct *cs = cache_head.prev;
     struct cache_struct *head,  *last;
-    uint32_t block = regs->eax.l;
+    block_t block = regs->eax.l;
     int i;
 
     static int total_read;
index 666863d..b47cc5c 100644 (file)
@@ -3,22 +3,19 @@
 
 #include <stdint.h>
 #include <com32.h>
-
+#include "disk.h"
 
 #define MAX_CACHE_ENTRIES  0x064 /* I'm not sure it's the max */
 
-
-
 /* The cache structure */
 struct cache_struct {
-        uint32_t block;
+        block_t block;
         struct cache_struct *prev;
         struct cache_struct *next;
         void  *data;
 };
 
 
-
 /* functions defined in cache.c */
 void cache_init(com32sys_t *regs);
 
index 1a25d87..71c5147 100644 (file)
@@ -3,7 +3,7 @@
 #include "core.h"
 #include "disk.h"
 
-void read_sectors(char *buf, int sector_num, int sectors)
+void read_sectors(char *buf, sector_t sector_num, int sectors)
 {
     com32sys_t regs;
         
@@ -18,7 +18,7 @@ void read_sectors(char *buf, int sector_num, int sectors)
 }
 
 
-void getoneblk(char *buf, uint32_t block, int block_size)
+void getoneblk(char *buf, block_t block, int block_size)
 {
     int sec_per_block = block_size >> SECTOR_SHIFT;
         
index b7f7edd..574fd7a 100644 (file)
@@ -20,10 +20,6 @@ extern void core_open(void);
 /* hello.c */
 extern void myputs(const char*);
 
-/* cache.c */
-extern void read_sectors(char *, int, int);
-extern void get_cache_block(com32sys_t *);
-
 
 void __cdecl core_intcall(uint8_t, const com32sys_t *, com32sys_t *);
 void __cdecl core_farcall(uint32_t, const com32sys_t *, com32sys_t *);
index e99e3cb..44a425f 100644 (file)
@@ -4,8 +4,10 @@
 #define SECTOR_SHIFT     9
 #define SECTOR_SIZE      (1 << SECTOR_SHIFT)
 
+typedef unsigned int sector_t;
+typedef unsigned int block_t;
 
-extern void read_sectors(char *, int, int);
-extern void get_cache_block(com32sys_t *);
+extern void read_sectors(char *, sector_t, int);
+extern void getoneblk(char *, block_t, int);
 
 #endif /* DISK_H */