[syslinux] port syslinux isohybrid perl script to C
P J P
pj.pandit at yahoo.co.in
Sat May 1 04:52:10 PDT 2010
--- On Sat, 1/5/10, H. Peter Anvin <hpa at zytor.com> wrote:
> > The function get_hex_data() will ALLWAYS return MBRSIZE,
> > there will be NEVER 'errx(1, "bad MBR code: %d", tmp);'
> Not to mention that it is just a glorified memcpy()...
Hmmn..okay, just a small clarification...why is the for loop there?
===
uint8_t hd0 = 0; /* 0 <= hd0 <= 2 */
uint8_t partok = 0; /* 0 <= partok <= 1 */
for (i = 0; i <= (hd0 + 3 * partok); i++)
if ((tmp = get_hex_data(mbr)) > MBRSIZE)
errx(1, "bad MBR code: %d", tmp);
===
with the possible values of hd0 & partok, the loop would run ones or maximum 6 times from i = 0..5, so depending on the values of hd0 & partok, mbr will be initialised with different MBR bytes, right?
How are these 6 master boot records different from one another?
Does the following change look good?
===
for (i = 0; i <= (hd0 + 3 * partok); i++)
memcpy(mbr, hexdata[i * MBRSIZE], MBRSIZE);
===
Thanks.
---
Regards
-P J P
PS: Please don't send me html/attachment/Fwd mails
More information about the Syslinux
mailing list