Ejemplo n.º 1
0
Archivo: fs.c Proyecto: 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();
}
Ejemplo n.º 2
0
Archivo: fs.c Proyecto: amisharma/OSLAB
// 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();
}
Ejemplo n.º 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);
	}
}
Ejemplo n.º 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();
}
Ejemplo n.º 5
0
Archivo: fs.c Proyecto: 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();
}