Ejemplo n.º 1
0
STATIC int __init
init_xfs_fs( void )
{
	int			error;
	struct sysinfo		si;
	static char		message[] __initdata =
		KERN_INFO "SGI XFS " XFS_VERSION_STRING " with "
		XFS_BUILD_OPTIONS " enabled\n";

	printk(message);

	si_meminfo(&si);
	xfs_physmem = si.totalram;

	error = init_inodecache();
	if (error < 0)
		goto undo_inodecache;

	error = pagebuf_init();
	if (error < 0)
		goto undo_pagebuf;

	vn_init();
	xfs_init();
	uuid_init();
	vfs_initdmapi();
	vfs_initquota();

	error = register_filesystem(&xfs_fs_type);
	if (error)
		goto undo_register;
	return 0;

undo_register:
	pagebuf_terminate();

undo_pagebuf:
	destroy_inodecache();

undo_inodecache:
	return error;
}
Ejemplo n.º 2
0
struct vm_t * vm_alloc(const char * path, int argc, char * argv[])
{
	struct vm_t * vm;
	int i;

	if(!xfs_init(path))
		return NULL;

	vm = malloc(sizeof(struct vm_t));
	if(!vm)
		return NULL;

	vm->lua = luaL_newstate();

	luaL_openlibs(vm->lua);
	luaopen_xboot(vm->lua);

	do {
		lua_newtable(vm->lua);

		if(argc > 0)
		{
			lua_pushstring(vm->lua, argv[0]);
			lua_rawseti(vm->lua, -2, -2);
		}

		lua_pushstring(vm->lua, "embedded boot.lua");
		lua_rawseti(vm->lua, -2, -1);

		for(i = 1; i < argc; i++)
		{
			lua_pushstring(vm->lua, argv[i]);
			lua_rawseti(vm->lua, -2, i);
		}

		lua_setglobal(vm->lua, "arg");
	} while(0);

	return vm;
}