aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2010-06-28 02:40:12 -0400
committerShao Miller <shao.miller@yrdsb.edu.on.ca>2010-07-10 01:03:06 -0400
commit6880951cdaadf554a7536859f1a001bed9fd9c34 (patch)
treeddb453adf58203d1814718ad5640d696ff0250aa
parent092b8884d54f6469dd401283d6fdc401a3481444 (diff)
downloadsyslinux-6880951cdaadf554a7536859f1a001bed9fd9c34.tar.gz
syslinux-6880951cdaadf554a7536859f1a001bed9fd9c34.tar.xz
syslinux-6880951cdaadf554a7536859f1a001bed9fd9c34.zip
chain.c32, libcom32: Move chs macros and chs typedef as disk_chs
Moving portions of chain.c32 into libcom32. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
-rw-r--r--com32/include/syslinux/disk.h11
-rw-r--r--com32/modules/chain.c15
2 files changed, 13 insertions, 13 deletions
diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
index e81bd3b7..d893d7f7 100644
--- a/com32/include/syslinux/disk.h
+++ b/com32/include/syslinux/disk.h
@@ -57,6 +57,17 @@ struct disk_ebios_dapa {
uint64_t lba;
};
+/**
+ * CHS (cylinder, head, sector) value extraction macros.
+ * Taken from WinVBlock. None expand to an lvalue.
+*/
+#define chs_head(chs) chs[0]
+#define chs_sector(chs) (chs[1] & 0x3F)
+#define chs_cyl_high(chs) (((uint16_t)(chs[1] & 0xC0)) << 2)
+#define chs_cyl_low(chs) ((uint16_t)chs[2])
+#define chs_cylinder(chs) (chs_cyl_high(chs) | chs_cyl_low(chs))
+typedef uint8_t disk_chs[3];
+
extern int disk_int13_retry(const com32sys_t * inreg, com32sys_t * outreg);
extern int disk_get_params(int disk, struct disk_info *const diskinfo);
extern void *disk_read_sectors(const struct disk_info *const diskinfo,
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 6bf8827e..f631d6e5 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -147,23 +147,12 @@ static inline void error(const char *msg)
static struct disk_info diskinfo;
-/*
- * CHS (cylinder, head, sector) value extraction macros.
- * Taken from WinVBlock. Does not expand to an lvalue
-*/
-#define chs_head(chs) chs[0]
-#define chs_sector(chs) (chs[1] & 0x3F)
-#define chs_cyl_high(chs) (((uint16_t)(chs[1] & 0xC0)) << 2)
-#define chs_cyl_low(chs) ((uint16_t)chs[2])
-#define chs_cylinder(chs) (chs_cyl_high(chs) | chs_cyl_low(chs))
-typedef uint8_t chs[3];
-
/* A DOS partition table entry */
struct part_entry {
uint8_t active_flag; /* 0x80 if "active" */
- chs start;
+ disk_chs start;
uint8_t ostype;
- chs end;
+ disk_chs end;
uint32_t start_lba;
uint32_t length;
} __attribute__ ((packed));