[syslinux] can't get write_sectors to work...

Robert Jordan
Sun, 19 Sep 2010 23:39:55 -0000

Hi,

Hopefully you someone can tell me what I'm doing wrong.  First, the code.  I
placed this at the bottom of the main loop in com32/modules/disk.c as a
simple test of writing to the disk:

printf("         Host bus: %s, Interface type: %s\n\n",

 d->edd_params.host_bus_type, d->edd_params.interface_type);

  zero_buf = calloc(1, d->edd_params.bytes_per_sector);

 for(int sector = 0; sector < d->edd_params.sectors; sector++){

 err = write_verify_sectors(d, sector,zero_buf,1);

 if (err == -1) {

  printf("sector: %d error: %d\n", sector, disk_errno); //disk_errno
is
always zero here

 }

 printf("sector: %d wrote:%d\r", sector, err);

 }

 if (zero_buf) {

 free(zero_buf);

 }

}


When run, the error case is always executed, but disk_errno is always zero.
 If I switch to write_sectors() the call succeeds (returns the same number
of sectors requested), but the disk is not written.  I can't find any
examples of using the disk write functions anywhere in the code.  Any
suggestions would be appreciated.


Thanks,

Robert Jordan