From: Shao Miller Date: Mon, 28 Jun 2010 06:40:12 +0000 (-0400) Subject: chain.c32, libcom32: Move chs macros and chs typedef as disk_chs X-Git-Tag: syslinux-4.06-pre3~3^2~92^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6880951cdaadf554a7536859f1a001bed9fd9c34;p=profile%2Fivi%2Fsyslinux.git chain.c32, libcom32: Move chs macros and chs typedef as disk_chs Moving portions of chain.c32 into libcom32. Signed-off-by: Shao Miller --- diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h index e81bd3b..d893d7f 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 6bf8827..f631d6e 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));