* ------------------------------------------------------------------------
*/
+#include <buffer.h>
#include <disk.h>
#include <fs.h>
#include <ide.h>
-#define BLOCK_BUFFER_HASH_TABLE_SIZE 37
-atomic_t hash_cnt;
-blk_buffer_t *block_buffer_hash_table[BLOCK_BUFFER_HASH_TABLE_SIZE] = {
- 0,
-};
-
-int hash(dev_t dev, uint32_t block) { return ((~dev) ^ block) % BLOCK_BUFFER_HASH_TABLE_SIZE; }
-
-blk_buffer_t *get_hash_block_buffer(dev_t dev, uint32_t block, uint16_t size) {}
-
-blk_buffer_t *block_read(dev_t dev, uint32_t block) {
- blk_buffer_t *bb = 0;
+bbuffer_t *block_read(dev_t dev, uint32_t block) {
+ bbuffer_t *bb = 0;
assert(DEV_MAJOR(dev) == DEV_MAJOR_DISK);
// assert(DEV_MINOR(dev) == 1);
const int size = offset + 1024;
const int block = 1;
- blk_buffer_t *bb = block_read(system.root_dev, block);
+ bbuffer_t *bb = block_read(system.root_dev, block);
ext2_sb_t *p = (ext2_sb_t *)(bb->data + offset);
printk("inodes count %u inodes per group %u free %u\n", p->s_inodes_count, p->s_inodes_per_group,
--- /dev/null
+/*
+ * ------------------------------------------------------------------------
+ * File Name: buffer.c
+ * Author: Zhao Yanbai
+ * 2023-06-20 19:30:33 Tuesday CST
+ * Description: none
+ * ------------------------------------------------------------------------
+ */
+
+#include <buffer.h>
+
+#define BLOCK_BUFFER_HASH_TABLE_SIZE 211
+// atomic_t hash_cnt;
+bbuffer_t *block_buffer_hash_table[BLOCK_BUFFER_HASH_TABLE_SIZE] = {
+ 0,
+};
+
+int hash(dev_t dev, uint32_t block) { return ((~dev) ^ block) % BLOCK_BUFFER_HASH_TABLE_SIZE; }
+
+bbuffer_t *get_hash_block_buffer(dev_t dev, uint32_t block, uint16_t size) {}
+
+void init_buffer() {}
*/
#pragma once
+
+#include <fs.h>
+
+typedef struct bbuffer {
+ uint32_t block; // block number
+ char *data; //
+ uint16_t block_size; // block size
+ dev_t dev;
+ page_t *page;
+ struct bbuffer *next;
+ struct bbuffer *hash_next;
+} bbuffer_t;
typedef uint32_t dev_t;
-typedef struct blk_buffer {
- uint32_t block; // block number
- char *data; //
- uint16_t block_size; // block size
- dev_t dev;
- page_t *page;
- struct blk_buffer *next;
- struct blk_buffer *hash_next;
-} blk_buffer_t;
-
#endif //_FS_H
+++ /dev/null
-/*
- * ------------------------------------------------------------------------
- * File Name: buffer.c
- * Author: Zhao Yanbai
- * 2023-06-20 19:30:33 Tuesday CST
- * Description: none
- * ------------------------------------------------------------------------
- */
-
-typedef struct buffer {
- //
-} buffer_t;
-
-void init_buffer() {}