From: Liu Aleaxander Date: Mon, 15 Jun 2009 23:42:07 +0000 (+0800) Subject: core: new diskio library X-Git-Tag: syslinux-4.00-pre1~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a0cf5f86ec1efd9ea05e6449f7ec0f97d28c594;p=platform%2Fupstream%2Fsyslinux.git core: new diskio library 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 --- diff --git a/core/fs.c b/core/fs.c index 617e3e5..d2a82c3 100644 --- a/core/fs.c +++ b/core/fs.c @@ -126,9 +126,6 @@ void device_init(struct device *dev, uint8_t device_num, sector_t offset) 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; } diff --git a/core/include/disk.h b/core/include/disk.h index 44a425f..1eb9f03 100644 --- a/core/include/disk.h +++ b/core/include/disk.h @@ -1,11 +1,13 @@ #ifndef DISK_H #define DISK_H +#include + #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); diff --git a/core/include/fs.h b/core/include/fs.h index 0cb1bfc..0c837bd 100644 --- a/core/include/fs.h +++ b/core/include/fs.h @@ -1,6 +1,8 @@ #ifndef FS_H #define FS_H +#include +#include #include #include "core.h" #include "disk.h" @@ -15,7 +17,7 @@ struct fs_info { 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; @@ -58,11 +60,16 @@ struct device { /* 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 @@ -76,6 +83,4 @@ struct device { uint32_t cache_size; }; - - #endif /* FS_H */