aboutsummaryrefslogtreecommitdiffstats
path: root/libinstaller
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 /libinstaller
parent0fa4369624b4637a7e36ed22e89a759031f08327 (diff)
downloadlwip-43b3ae31727836ef0e9c7348fa98c462a47b52aa.tar.gz
lwip-43b3ae31727836ef0e9c7348fa98c462a47b52aa.tar.xz
lwip-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 'libinstaller')
-rw-r--r--libinstaller/syslinux.h4
-rw-r--r--libinstaller/syslxmod.c7
2 files changed, 6 insertions, 5 deletions
diff --git a/libinstaller/syslinux.h b/libinstaller/syslinux.h
index e0554255..902beaf9 100644
--- a/libinstaller/syslinux.h
+++ b/libinstaller/syslinux.h
@@ -30,8 +30,8 @@ extern const unsigned int syslinux_mbr_len;
extern const int syslinux_mbr_mtime;
/* Sector size assumptions... */
-#define SECTOR_BITS 9
-#define SECTOR_SIZE (1 << SECTOR_BITS)
+#define SECTOR_SHIFT 9
+#define SECTOR_SIZE (1 << SECTOR_SHIFT)
/* This takes a boot sector and merges in the syslinux fields */
void syslinux_make_bootsect(void *);
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index 78e226c4..969ce8b3 100644
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
@@ -56,10 +56,11 @@ const char *syslinux_check_bootsect(const void *bs)
goto invalid;
sectorsize = get_16(&sectbuf->bsBytesPerSec);
- if ( sectorsize == 512 )
+ if ( sectorsize == SECTOR_SIZE )
; /* ok */
- else if ( sectorsize == 1024 || sectorsize == 2048 || sectorsize == 4096 )
- return "only 512-byte sectors are supported";
+ else if ( sectorsize >= 512 && sectorsize <= 4096 &&
+ (sectorsize & (sectorsize-1)) == 0 )
+ return "unsupported sectors size";
else
goto invalid;