Esempio n. 1
0
File: sim.c Progetto: seth4618/bbsim
void
vmStarted()
{
  // tell vm what mode we are in, if necessary

  // get blocks started
  Block *block;

  Q_FOREACH(block, getBlockList(), blockLink) {
    startBlock(block);
  }
Esempio n. 2
0
Block* 
processHits (GLint hits, GLuint buffer[], int *face)
{
	GLuint depth;
	GLint choose, bIndex;
	int index;
	Block *block;

	if (hits == 0)
		return NULL;

	depth  = (GLuint)buffer[1];
	choose = (GLint)buffer[3];

	for (index = 1; index < hits; index++)
	{
		if (buffer[index*4+1] < depth)
		{
			choose = (GLint)buffer[index*4+3];
			depth  = (GLuint)buffer[index*4+1];
		}
	}
	
	bIndex = DECODE_INDEX(choose);
	if (face != NULL)
		*face = DECODE_FACE(choose);
	
	// TODO: we can do this by embedding the pointer in the name
	// instead of naively searching through all blocks
	Q_FOREACH(block, getBlockList(), blockLink)
	{
		if (block->id == bIndex)
			return block;
	}
	Q_ENDFOREACH(getBlockList());

	return NULL;
}
Esempio n. 3
0
void FileSystem::initBlocks() // 각 블럭 클래스랑 blockList[409600] 포인터 연결
{
	superBlock.initSuperBlock( getBlockList(0) ); // 슈퍼 블럭 초기화
	blockDescriptorTable.initBlockDescriptorTable( getBlockList(1) ); // BDT 초기화
	
	blockBitmap = getBlockList(2);
	inodeBitmap = getBlockList(3);

	inodeBlock[0].initInodeBlock( getBlockList(4) ); // 아이노드 블럭1 초기화
	inodeBlock[1].initInodeBlock( getBlockList(5) ); // 아이노드 블럭2 초기화

	for ( int i = 0; i < 94; i++ ) // 데이터블럭 초기화
		dataBlocks[i].initDataBlock( getBlockList( i + 6 ) );
}