All pastes #274501 Raw Edit

Miscellany

public c v1 · immutable
·published 2006-12-10 19:31 UTC
rendered paste body
static void get_block (uint16 block, char *buf){  register uint16 linear_sector;  register uint16 cylinder, head, sector;  linear_sector = block * 2;  cylinder = linear_sector / 36;  head = (linear_sector % 36) / 18;  sector = ((linear_sector % 36) % 18) + 1;  diskr (cylinder, head, sector, buf);}static ext2_inode *get_inode (uint16 i_num){  static uint8 buffer[1024];  register uint16 inode_per_block = 8;  get_block(BLOCK_INODE_TABLE + (i_num / inode_per_block), buffer);  return ((ext2_inode *) buffer) + (i_num % inode_per_block) - 1;}