Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (int argc, char** argv) {
- int LBA, S , H; //LBA, Sectors on track, Heads count
- //verefy for valid block
- //
- LBA = atoll ( argv [1] );
- S = atoi ( argv[2] );
- H = atoi ( argv [3] );
- printf ( "\n LBA = %lld, Sectors = %d, Headers = %d\n", LBA, S, H );
- int sec_num = ( LBA % S ) + 1 ;
- int num_head = ( ( LBA - ( sec_num - 1 ) ) / S ) % H ;
- int c_num = ( LBA - ( s - 1 ) - h * S ) / ( H * S ) ;
- printf ("\ncyl = %d, num_head = %d, sec_num = %d\n", c_num, num_head, sec_num);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment