Пример #1
0
Файл: fs.c Проект: ren85/jos2006
// Initialize the file system
void
fs_init(void)
{
	static_assert(sizeof(struct File) == 256);

	// Find a JOS disk.  Use the second IDE disk (number 1) if available.
	if (ide_probe_disk1())
		ide_set_disk(1);
	else
		ide_set_disk(0);
	
	read_super();
	check_write_block();
	read_bitmap();
}
Пример #2
0
// Initialize the file system
void
fs_init(void)
{
	static_assert(sizeof(struct File) == 256);

	// Find a JOS disk.  Use the second IDE disk (number 1) if available.
	if (ide_probe_disk1())
		ide_set_disk(1);
	else
		ide_set_disk(0);

	bc_init();

	// Set "super" to point to the super block.
	super = diskaddr(1);
	check_super();
}
Пример #3
0
void
umain(int argc, char **argv)
{
	int r;

	static_assert(sizeof(struct BlockInfo) == 64);
	static_assert(BLOCKINFOMAP + (DISKSIZE / BLKSIZE) * sizeof(struct BlockInfo) <= DISKMAP);
	assert(thisenv->env_id == ENVID_BUFCACHE);

	binaryname = "bufcache";
	cprintf("bufcache is running\n");

	// Check that we are able to do I/O

	// If it looks like I/O will definitely fail, then yield first to
	// other runnable, non-idle environments.
	// (This helps previous grading scripts: environment IDs are as
	// expected, but tests still complete quickly.)
	while (!(thisenv->env_tf.tf_eflags & FL_IOPL_MASK)
	       && another_runnable_environment_exists())
		sys_yield();

	outw(0x8A00, 0x8A00);
	cprintf("bufcache can do I/O\n");

	// Find a JOS disk.  Use the second IDE disk (number 1) if available.
	if (ide_probe_disk1())
		ide_set_disk(1);
	else
		ide_set_disk(0);

	// Set up the flush pipe
	if ((r = pipe(p)) < 0)
		panic("Error setting up pipe: %e\n", r);

	// Process incoming requests
	while (1) {
		int32_t breq;
		envid_t envid;

		breq = ipc_recv(&envid, 0, 0);
		handle_flush_queue();
		handle_breq(envid, breq);
	}
}
Пример #4
0
// Initialize the file system
void
fs_init(void)
{
	static_assert(sizeof(struct File) == 256);

	// Find a JOS disk.  Use the second IDE disk (number 1) if available.
	if (ide_probe_disk1())
		ide_set_disk(1);
	else
		ide_set_disk(0);
	
	bc_init();
	LOG(DEBUG_FS, "bc_init done\n");

	// Set "super" to point to the super block.
	super = diskaddr(1);
	// Set "bitmap" to the beginning of the first bitmap block.
	bitmap = diskaddr(2);

	check_super();
	check_bitmap();
}
Пример #5
0
Файл: fs.c Проект: scau/JOS
// Initialize the file system
void
fs_init(void)
{
	static_assert(sizeof(struct File) == 256);

#ifndef VMM_GUEST
	// Find a JOS disk.  Use the second IDE disk (number 1) if available.
	if (ide_probe_disk1())
		ide_set_disk(1);
	else
		ide_set_disk(0);
#else
	host_ipc_init();
#endif
	bc_init();

	// Set "super" to point to the super block.
	super = diskaddr(1);
	check_super();

	// Set "bitmap" to the beginning of the first bitmap block.
	bitmap = diskaddr(2);
	check_bitmap();
}