aboutsummaryrefslogtreecommitdiffstats
path: root/dos/syslinux.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-19 16:48:19 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-19 16:48:19 -0700
commit43b3ae31727836ef0e9c7348fa98c462a47b52aa (patch)
tree00ff02577f0e298c96bb523cbe755e0a99657aa2 /dos/syslinux.c
parent0fa4369624b4637a7e36ed22e89a759031f08327 (diff)
downloadsyslinux-devel-43b3ae31727836ef0e9c7348fa98c462a47b52aa.tar.gz
syslinux-devel-43b3ae31727836ef0e9c7348fa98c462a47b52aa.tar.xz
syslinux-devel-43b3ae31727836ef0e9c7348fa98c462a47b52aa.zip
Standardize the names SECTOR_SIZE and SECTOR_SHIFT
Use the names SECTOR_SIZE and SECTOR_SHIFT everywhere, instead of an odd mix of symbols and hard-coded constants. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'dos/syslinux.c')
-rw-r--r--dos/syslinux.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/dos/syslinux.c b/dos/syslinux.c
index 047dc8f8..ecb7c07e 100644
--- a/dos/syslinux.c
+++ b/dos/syslinux.c
@@ -462,7 +462,7 @@ struct mbr_entry {
static void adjust_mbr(int device, int writembr, int set_active)
{
- static unsigned char sectbuf[512];
+ static unsigned char sectbuf[SECTOR_SIZE];
int i;
if ( !writembr && !set_active )
@@ -502,7 +502,7 @@ static void adjust_mbr(int device, int writembr, int set_active)
int main(int argc, char *argv[])
{
- static unsigned char sectbuf[512];
+ static unsigned char sectbuf[SECTOR_SIZE];
int dev_fd, fd;
static char ldlinux_name[] = "@:\\ldlinux.sys";
char **argp, *opt;
@@ -614,7 +614,7 @@ int main(int argc, char *argv[])
* this is supposed to be a simple, privileged version
* of the installer.
*/
- ldlinux_sectors = (syslinux_ldlinux_len+SECTOR_SIZE-1) >> SECTOR_BITS;
+ ldlinux_sectors = (syslinux_ldlinux_len+SECTOR_SIZE-1) >> SECTOR_SHIFT;
sectors = calloc(ldlinux_sectors, sizeof *sectors);
lock_device(2);
fs = libfat_open(libfat_xpread, dev_fd);
@@ -676,7 +676,7 @@ int main(int argc, char *argv[])
* Patch ldlinux.sys and the boot sector
*/
i = syslinux_patch(sectors, nsectors, stupid, raid_mode);
- patch_sectors = (i + 511) >> 9;
+ patch_sectors = (i+SECTOR_SIZE-1) >> SECTOR_SHIFT;
/*
* Overwrite the now-patched ldlinux.sys
@@ -686,10 +686,10 @@ int main(int argc, char *argv[])
uint16_t si, di, cx;
si = 0;
di = (size_t)sectbuf;
- cx = 512 >> 2;
+ cx = SECTOR_SIZE >> 2;
asm volatile("movw %3,%%fs ; fs ; rep ; movsl"
: "+S" (si), "+D" (di), "+c" (cx)
- : "abd" ((uint16_t)(ldlinux_seg + (i << (9-4)))));
+ : "abd" ((uint16_t)(ldlinux_seg + (i << (SECTOR_SHIFT-4)))));
write_device(dev_fd, sectbuf, 1, sectors[i]);
}
@@ -712,7 +712,7 @@ int main(int argc, char *argv[])
if ( bootsecfile ) {
unlock_device(0);
fd = creat(bootsecfile, 0x20); /* ARCHIVE */
- write_file(fd, sectbuf, 512);
+ write_file(fd, sectbuf, SECTOR_SIZE);
close(fd);
} else {
write_device(dev_fd, sectbuf, 1, 0);