static PP_Bool Instance_DidCreate(PP_Instance instance, uint32_t argc, const char* argn[], const char* argv[]) { g_instance = instance; nacl_io_init_ppapi(instance, get_browser_interface); // By default, nacl_io mounts / to pass through to the original NaCl // filesystem (which doesn't do much). Let's remount it to a memfs // filesystem. umount("/"); mount("", "/", "memfs", 0, ""); mount("", /* source */ "/persistent", /* target */ "html5fs", /* filesystemtype */ 0, /* mountflags */ "type=PERSISTENT,expected_size=1048576"); /* data */ mount("", /* source. Use relative URL */ "/http", /* target */ "httpfs", /* filesystemtype */ 0, /* mountflags */ ""); /* data */ pthread_create(&g_handle_message_thread, NULL, &HandleMessageThread, NULL); InitializeMessageQueue(); return PP_TRUE; }
static PP_Bool Instance_DidCreate(PP_Instance instance, uint32_t argc, const char* argn[], const char* argv[]) { g_instance = instance; nacl_io_init_ppapi(instance, get_browser_interface); umount("/"); mount("", "/", "memfs", 0, ""); mount("", "/persistent", "html5fs", 0, "type=PERSISTENT,expected_size=1048576"); mount("", "/http", "httpfs", 0, ""); pthread_create(&g_handle_message_thread, NULL, &HandleMessageThread, NULL); InitializeMessageQueue(); return PP_TRUE; }
static PP_Bool Instance_DidCreate(PP_Instance instance,uint32_t argc,const char* argn[],const char* argv[]) { int nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface); static pthread_t g_handle_message_thread; static pthread_t iguana_thread; int64_t allocsize; g_instance = instance; // By default, nacl_io mounts / to pass through to the original NaCl // filesystem (which doesn't do much). Let's remount it to a memfs // filesystem. InitializeMessageQueue(); pthread_create(&g_handle_message_thread, NULL, &HandleMessageThread, NULL); pthread_create(&iguana_thread,NULL,&iguana,iguana_filestr(&allocsize,"iguana.conf")); nacl_io_init_ppapi(instance,g_get_browser_interface); umount("/"); mount("", "/memfs", "memfs", 0, ""); mount("", /* source */ "/", /* target */ "html5fs", /* filesystemtype */ 0, /* mountflags */ "type=PERSISTENT,expected_size=10000000000"); /* data */ mount("", /* source. Use relative URL */ "/http", /* target */ "httpfs", /* filesystemtype */ 0, /* mountflags */ ""); /* data */ PostMessage("finished DidCreate\n"); return PP_TRUE; }
// Initialize the module, staring a worker thread to load the shared object. virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { nacl_io_init_ppapi( pp_instance(), pp::Module::Get()->get_browser_interface()); // printf( "Constructor thread id '%p'\n", pthread_self()); // printf( "createFS thread id '%p'\n", pthread_self()); umount("/"); int res = mount("", "/", "memfs", 0, ""); // int res = mount("", "/web", "httpfs", 0, ""); if (res) { // std::cout << "unable to mount httpfs file system!" << std::endl; bCreatedFS_ = true; return false; } // std::cout << "mount res: " << res << std::endl; if (pthread_create( &message_thread_, NULL, &LASzipInstance::HandleMessageThread, this)) { PostError("Init", "Unable to initialize thread!", "null"); return false; } InitializeMessageQueue(); return true; }