Beginnings of a diskio library capable of reading and writing, and
with proper handling of bounce buffers and segment boundaries.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
dev->cache_size = sizeof core_cache_buf;
} else
dev->cache_data = NULL;
-
- /* I just considered the floppy and disk now */
- dev->read_sectors = read_sectors;
}
#ifndef DISK_H
#define DISK_H
+#include <stdint.h>
+
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
-typedef unsigned int sector_t;
-typedef unsigned int block_t;
+typedef uint64_t sector_t;
+typedef uint32_t block_t;
extern void read_sectors(char *, sector_t, int);
extern void getoneblk(char *, block_t, int);
#ifndef FS_H
#define FS_H
+#include <stddef.h>
+#include <stdbool.h>
#include <com32.h>
#include "core.h"
#include "disk.h"
struct device *fs_dev;
};
-struct file{
+struct file {
void* open_file; /* points to the fs-specific open_file_t */
struct fs_info *fs;
uint32_t file_len;
/* the sector size, 512B for disk and floppy, 2048B for CD */
uint16_t sector_size;
+ uint8_t sector_shift;
+
+ /* CHS geometry */
+ uint8_t h, s;
+ uint8_t pad1;
/* the start address of this partition(in sectors) */
sector_t part_start;
- void (*read_sectors)(char *, sector_t, int );
+ int (*rdwr_sectors)(struct device *, void *, sector_t, size_t, bool);
/*
* I think we still need the cache_data filed here, 'cause hpa said
uint32_t cache_size;
};
-
-
#endif /* FS_H */