- Timestamp:
- Jun 3, 2012, 8:29:57 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/Image.cpp
r376 r430 112 112 } 113 113 114 if( p_useCHS ) 115 { 116 if( p_cyl ) 114 if( p_cyl ) 115 { 116 if( (p_sect > 255 || p_sect < 1) || (p_head > 16 || p_head < 1) || (p_cyl > 65536 || p_cyl < 1) ) 117 log( -1, "'%s', parts of the CHS geometry (%lu:%lu:%lu) are out of the range (1-65536:1-16:1-255)", name, p_cyl, p_head, p_sect ); 118 else if( totallba != (p_sect * p_head * p_cyl) ) 119 log( -1, "'%s', file size does not match geometry", name ); 120 sect = p_sect; 121 head = p_head; 122 cyl = p_cyl; 123 } 124 else 125 { 126 if( totallba > 65536*16*63 ) 117 127 { 118 if( p_sect > 63 || (p_head > 16 || p_head < 1) || (p_cyl > 1024 || p_cyl < 1) ) 119 log( -1, "'%s', parts of the CHS geometry (%lu:%lu:%lu) are out of the range (1-1024:1-16:1-63)", name, p_cyl, p_head, p_sect ); 120 else if( totallba != (p_sect * p_head * p_cyl) ) 121 log( -1, "'%s', file size does not match geometry", name ); 122 sect = p_sect; 123 head = p_head; 124 cyl = p_cyl; 128 log( 0, "'%s': Warning: Image size is greater than derived standard CHS maximum, limiting CHS to 65535:16:63, consider using -g to specify geometry", name ); 129 cyl = 65536; 130 head = 16; 131 sect = 63; 125 132 } 126 else 133 else if( (totallba % 16) != 0 || ((totallba/16) % 63) != 0 ) 127 134 { 128 if( (totallba % 16) != 0 || ((totallba/16) % 63) != 0 ) 129 log( -1, "'%s', file size does not match standard CHS geometry (x:16:63), please specify geometry explicitly with -g", name ); 130 else 135 log( -1, "'%s', file size does not match standard CHS geometry (x:16:63), please specify geometry explicitly with -g", name ); 136 } 137 else 138 { 139 sect = 63; 140 head = 16; 141 cyl = (totallba / sect / head); 142 if( cyl > 65536 ) 131 143 { 132 sect = 63; 133 head = 16; 134 cyl = (totallba / sect / head); 135 if( cyl > 1024 ) 136 log( -1, "'%s', CHS geometry of %lu:%lu:%lu is larger than maximum values 1024:16:63", name, cyl, head, sect ); 144 log( -1, "'%s', derived standard CHS geometry of %lu:16:63 is has more cylinders than 65536, please specify geometry explicitly with -g", name, cyl, head, sect ); 137 145 } 138 146 } 139 147 } 140 else 141 { 142 sect = 0; 143 head = 0; 144 cyl = 0; 145 } 148 146 149 useCHS = p_useCHS; 147 150 … … 157 160 name, (floppy ? "Floppy Disk" : "Hard Disk"), cyl, head, sect, sizef, sizeChar ); 158 161 else 159 log( 0, "%s: %s with total sectors %lu, size %.2lf %cB",160 name, (floppy ? "Floppy Disk" : "Hard Disk"), totallba, sizef, sizeChar );162 log( 0, "%s: %s with %lu LBA sectors, size %.2lf %cB (CHS geometry %u:%u:%u)", 163 name, (floppy ? "Floppy Disk" : "Hard Disk"), totallba, sizef, sizeChar, cyl, head, sect ); 161 164 } 162 165 … … 296 299 flipEndian( &buff[ATA_strFirmware], ATA_strFirmware_Length ); 297 300 298 if( useCHS ) 299 { 300 buff[ ATA_wCylCnt ] = cyl; 301 buff[ ATA_wHeadCnt ] = head; 302 buff[ ATA_wSPT ] = sect; 303 } 304 else 301 buff[ ATA_wCylCnt ] = cyl; 302 buff[ ATA_wHeadCnt ] = head; 303 buff[ ATA_wSPT ] = sect; 304 305 if( !useCHS ) 305 306 { 306 307 buff[ ATA_wCaps ] = ATA_wCaps_LBA;
Note:
See TracChangeset
for help on using the changeset viewer.