[syslinux:master] diskio: fix name for secpercyl field, remove unused type field

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sat Jul 17 12:42:24 PDT 2010


Commit-ID:  8cca6fd29bb7613f5ba6acb1b740d13f5b6ac01d
Gitweb:     http://syslinux.zytor.com/commit/8cca6fd29bb7613f5ba6acb1b740d13f5b6ac01d
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sat, 17 Jul 2010 12:36:26 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sat, 17 Jul 2010 12:36:26 -0700

diskio: fix name for secpercyl field, remove unused type field

Fix the name for the incorrectly named "t" (track) field; it is in
fact the sectors/cylinder (secpercyl) field.  Furthermore, remove the
completely unused "type" field... right now the pointer to the
rdwr_sectors field acts as a proxy, and if we need more complex stuff
in the future it is probably better handled by pointing to an ops
structure.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/fs/diskio.c    |    7 +++----
 core/include/disk.h |   12 ++++++------
 core/include/fs.h   |    2 --
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/core/fs/diskio.c b/core/fs/diskio.c
index b6722e7..449e12c 100644
--- a/core/fs/diskio.c
+++ b/core/fs/diskio.c
@@ -12,7 +12,7 @@
 
 static inline sector_t chs_max(const struct disk *disk)
 {
-    return disk->t << 10;
+    return disk->secpercyl << 10;
 }
 
 static int chs_rdwr_sectors(struct disk *disk, void *buf,
@@ -24,7 +24,7 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
     int sector_shift = disk->sector_shift;
     uint32_t xlba = lba + disk->part_start; /* Truncated LBA (CHS is << 2 TB) */
     uint32_t t;
-    uint16_t c, h, s;
+    uint32_t c, h, s;
     com32sys_t ireg, oreg;
     size_t done = 0;
     size_t bytes;
@@ -377,11 +377,10 @@ struct disk *disk_init(uint8_t devno, bool cdrom, sector_t part_start,
     }
 
     disk.disk_number   = devno;
-    disk.type          = ebios;
     disk.sector_size   = sector_size;
     disk.sector_shift  = ilog2(sector_size);
     disk.part_start    = part_start;
-    disk.t             = disk.h * disk.s;
+    disk.secpercyl     = disk.h * disk.s;
     disk.rdwr_sectors  = ebios ? edd_rdwr_sectors : chs_rdwr_sectors;
 
     if (!MaxTransfer || MaxTransfer > hard_max_transfer)
diff --git a/core/include/disk.h b/core/include/disk.h
index f433fa9..ac23e92 100644
--- a/core/include/disk.h
+++ b/core/include/disk.h
@@ -13,14 +13,14 @@ typedef uint64_t block_t;
  * contains the I/O function.
  */
 struct disk {
-    unsigned int disk_number;  /* in BIOS style */
-    unsigned int type;         /* CHS or EDD */
-    unsigned int sector_size;  /* gener512B or 2048B */
+    unsigned int disk_number;	/* in BIOS style */
+    unsigned int sector_size;	/* gener512B or 2048B */
     unsigned int sector_shift;
+    unsigned int maxtransfer;	/* Max sectors per transfer */
     
-    unsigned int h, s;         /* CHS geometry */
-    unsigned int t;	       /* h*s */
-    uint32_t maxtransfer;      /* Max sectors per transfer */
+    unsigned int h, s;		/* CHS geometry */
+    unsigned int secpercyl;	/* h*s */
+    unsigned int _pad;
 
     sector_t part_start;   /* the start address of this partition(in sectors) */
 
diff --git a/core/include/fs.h b/core/include/fs.h
index da247a9..ecd148d 100644
--- a/core/include/fs.h
+++ b/core/include/fs.h
@@ -116,8 +116,6 @@ struct file {
     struct inode *inode;        /* The file-specific information */
 };
 
-enum dev_type {CHS, EDD};
-
 /*
  * Struct device contains:
  *     the pointer points to the disk structure,



More information about the Syslinux-commits mailing list