Lines 72-78
char * guid_to_string( guid_t *id );
Link Here
|
72 |
#define MAX_HEADS 254 |
72 |
#define MAX_HEADS 254 |
73 |
#define MAX_SECTORS 63 |
73 |
#define MAX_SECTORS 63 |
74 |
|
74 |
|
|
|
75 |
/* we don't actually do cylinders anymore, align for 1MB boundary */ |
75 |
|
76 |
|
|
|
77 |
#define BOUNDARY_IN_SECTORS_512 2048 |
76 |
|
78 |
|
77 |
/* |
79 |
/* |
78 |
* Called to return the Logical Disk that a segment belongs to. |
80 |
* Called to return the Logical Disk that a segment belongs to. |
Lines 243-248
static inline int LBA_to_Ptable_CHS( LOGICALDISK *ld, lba_t lba, chs_t *chs )
Link Here
|
243 |
*/ |
245 |
*/ |
244 |
static inline boolean starts_on_cylinder_boundary( LOGICALDISK *ld, lba_t lba ) |
246 |
static inline boolean starts_on_cylinder_boundary( LOGICALDISK *ld, lba_t lba ) |
245 |
{ |
247 |
{ |
|
|
248 |
|
249 |
// just check against 2048s boundary |
250 |
if ( lba % BOUNDARY_IN_SECTORS_512 == 0 ) |
251 |
return TRUE; |
252 |
else |
253 |
return FALSE; |
254 |
|
246 |
chs_t chs; |
255 |
chs_t chs; |
247 |
|
256 |
|
248 |
if ( LBAtoCHS( ld, lba, &chs ) ) { |
257 |
if ( LBAtoCHS( ld, lba, &chs ) ) { |
Lines 266-271
static inline boolean starts_on_cylinder_boundary( LOGICALDISK *ld, lba_t lba )
Link Here
|
266 |
*/ |
275 |
*/ |
267 |
static inline boolean ends_on_cylinder_boundary( LOGICALDISK *ld, lba_t lba ) |
276 |
static inline boolean ends_on_cylinder_boundary( LOGICALDISK *ld, lba_t lba ) |
268 |
{ |
277 |
{ |
|
|
278 |
|
279 |
// just check against 2048s boundary |
280 |
if ( lba % BOUNDARY_IN_SECTORS_512 == BOUNDARY_IN_SECTORS_512 - 1 ) |
281 |
return TRUE; |
282 |
else |
283 |
return FALSE; |
284 |
|
269 |
chs_t chs; |
285 |
chs_t chs; |
270 |
DISK_PRIVATE_DATA *disk_pdata = get_gpt_disk_private_data( ld ); |
286 |
DISK_PRIVATE_DATA *disk_pdata = get_gpt_disk_private_data( ld ); |
271 |
|
287 |
|
Lines 300-305
static inline sector_count_t get_cylinder_size( storage_object_t *ld )
Link Here
|
300 |
sector_count_t sectors_per_cylinder=0; |
316 |
sector_count_t sectors_per_cylinder=0; |
301 |
DISK_PRIVATE_DATA *disk_pdata=NULL; |
317 |
DISK_PRIVATE_DATA *disk_pdata=NULL; |
302 |
|
318 |
|
|
|
319 |
// align to 1MB boundary, cylinders are long dead |
320 |
if (ld) |
321 |
return BOUNDARY_IN_SECTORS_512; |
322 |
else |
323 |
return 0; |
303 |
|
324 |
|
304 |
if (ld) { |
325 |
if (ld) { |
305 |
|
326 |
|
Lines 330-335
static inline lba_t roundup_to_track_boundary( LOGICALDISK *ld, lba_t lba )
Link Here
|
330 |
{ |
351 |
{ |
331 |
lba_t new_lba = lba; |
352 |
lba_t new_lba = lba; |
332 |
sector_count_t extra_sectors=0; |
353 |
sector_count_t extra_sectors=0; |
|
|
354 |
|
355 |
extra_sectors = lba % BOUNDARY_IN_SECTORS_512; |
356 |
|
357 |
if ( extra_sectors != 0) { |
358 |
new_lba = lba + ( BOUNDARY_IN_SECTORS_512 - extra_sectors); |
359 |
} |
360 |
|
361 |
LOG_DEBUG("ALT: Nearest upper boundary to %"PRIu64" is %"PRIu64"\n", lba, new_lba); |
362 |
|
363 |
return new_lba; |
364 |
|
365 |
|
333 |
sector_count_t sectors_per_track=0; |
366 |
sector_count_t sectors_per_track=0; |
334 |
DISK_PRIVATE_DATA *disk_pdata; |
367 |
DISK_PRIVATE_DATA *disk_pdata; |
335 |
|
368 |
|
Lines 363-368
static inline lba_t roundup_to_cylinder_boundary( LOGICALDISK *ld, lba_t lba )
Link Here
|
363 |
{ |
396 |
{ |
364 |
lba_t new_lba = lba; |
397 |
lba_t new_lba = lba; |
365 |
sector_count_t extra_sectors=0; |
398 |
sector_count_t extra_sectors=0; |
|
|
399 |
|
400 |
extra_sectors = lba % BOUNDARY_IN_SECTORS_512; |
401 |
|
402 |
if ( extra_sectors != 0) { |
403 |
new_lba = lba - extra_sectors; |
404 |
} |
405 |
|
406 |
LOG_DEBUG("ALT: Nearest down boundary to %"PRIu64" is %"PRIu64"\n", lba, new_lba); |
407 |
return new_lba; |
408 |
|
409 |
|
366 |
sector_count_t sectors_per_cylinder; |
410 |
sector_count_t sectors_per_cylinder; |
367 |
|
411 |
|
368 |
|
412 |
|