summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-16 12:01:19 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-16 12:01:19 -0800
commitff2842a13dd157691dbe9f0b1498c891bef76554 (patch)
tree45a1caf97130391df4eab6f381643afbebd1be6a /core/include
parent51933ae32e742a5a81b4b880c1e96a6faa1b3380 (diff)
downloadsyslinux-ff2842a13dd157691dbe9f0b1498c891bef76554.tar.gz
cache: update the metadata cache design
- instead of get_cache_block() returning a descriptor, have get_cache() returning const void *. - have a subfunction to allow getting a block without reading it from disk, and returning the cache descriptor. This will be used in ext2 to pre-seed block 0 with all zero. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/include')
-rw-r--r--core/include/cache.h17
-rw-r--r--core/include/fs.h6
2 files changed, 11 insertions, 12 deletions
diff --git a/core/include/cache.h b/core/include/cache.h
index 7518bc84..0cf399af 100644
--- a/core/include/cache.h
+++ b/core/include/cache.h
@@ -6,20 +6,17 @@
#include "disk.h"
#include "fs.h"
-#define MAX_CACHE_ENTRIES 0x10 /* I find even this is enough:) */
-
/* The cache structure */
-struct cache_struct {
- block_t block;
- struct cache_struct *prev;
- struct cache_struct *next;
- void *data;
+struct cache {
+ block_t block;
+ struct cache *prev;
+ struct cache *next;
+ void *data;
};
-
/* functions defined in cache.c */
void cache_init(struct device *, int);
-struct cache_struct* get_cache_block(struct device *, block_t);
-void print_cache(struct device *);
+const void *get_cache(struct device *, block_t);
+struct cache *_get_cache_block(struct device *, block_t);
#endif /* cache.h */
diff --git a/core/include/fs.h b/core/include/fs.h
index cc9d21c4..8a173d9f 100644
--- a/core/include/fs.h
+++ b/core/include/fs.h
@@ -119,12 +119,14 @@ enum dev_type {CHS, EDD};
* the pointer points to the disk structure,
* the cache stuff.
*/
+struct cache;
+
struct device {
struct disk *disk;
/* the cache stuff */
- char* cache_data;
- void* cache_head;
+ char *cache_data;
+ struct cache *cache_head;
uint16_t cache_block_size;
uint16_t cache_entries;
uint32_t cache_size;