Exemplo n.º 1
0
void init_fs(MS_AppInstance* inst, const std::vector<std::string>& persistent_dirs)
{
    nacl_io_init_ppapi(inst->pp_instance(), pp::Module::Get()->get_browser_interface());
    
    umount("/");
    mount("", "/", "memfs", 0, "");
    
    #if defined(MUTANTSPIDER_HAS_RESOURCES)
    nacl_io_register_fs_type("rez_fs", &rezfs_ops);
    mount("", "/resources", "rez_fs", 0, "");
    #endif
    
    if (persistent_dirs.empty())
    {
        inst->AsyncStartupComplete();
        inst->PostCommand("async_startup_complete:");
    }
    else
    {
        nacl_io_register_fs_type("persist_backed_mem_fs", &pbmemfs_ops);
        
        mount("", html5_shadow_name.c_str(), "html5fs", 0, "type=PERSISTENT,expected_size=1048576");
        
        #if defined(_do_clear_)
        std::thread(clear_all).detach();
        return;
        #endif
        
        mount("", persistent_name.c_str(), "persist_backed_mem_fs", 0, "");
        
        std::thread(std::bind(populate_memfs,inst,persistent_dirs)).detach();
    }
}
Exemplo n.º 2
0
void init_fs()
{
  nacl_io_init_ppapi(gGlobalPPInstance->pp_instance(), pp::Module::Get()->get_browser_interface());
    
  umount("/");
  mount("", "/", "memfs", 0, "");
  
  #if defined(MS_HAS_RESOURCES)
    nacl_io_register_fs_type("rez_fs", &rezfs_ops);
    mount("", "/resources", "rez_fs", 0, "");
  #endif
}
Exemplo n.º 3
0
void mount_fs(const std::vector<std::string>& persistent_dirs)
{
  if (persistent_dirs.empty()) {
    MS_AsyncStartupComplete();
    ms_async_startup_complete();
  } else {
    nacl_io_register_fs_type("persist_backed_mem_fs", &pbmemfs_ops);
        
    mount("", html5_shadow_name.c_str(), "html5fs", 0, "type=PERSISTENT,expected_size=1048576");
        
    #if defined(_do_clear_)
      std::thread(clear_all).detach();
      return;
    #endif
        
    mount("", persistent_name.c_str(), "persist_backed_mem_fs", 0, "");
        
    std::thread(std::bind(populate_memfs,persistent_dirs)).detach();
  }
}
Exemplo n.º 4
0
int nspawn_setup_anonymous_pipes(void) {
  const char fs_type[] = "anonymous_pipe";
  int result;

  anonymous_pipe_ops.open = apipe_open;
  anonymous_pipe_ops.read = apipe_read;
  anonymous_pipe_ops.write = apipe_write;
  anonymous_pipe_ops.release = apipe_release;
  anonymous_pipe_ops.fgetattr = apipe_fgetattr;

  result = nacl_io_register_fs_type(fs_type, &anonymous_pipe_ops);
  if (!result) {
    fprintf(stderr, "error: resigstering fstype '%s' failed.\n", fs_type);
    return 1;
  }
  mkdir("/apipe", 0777);
  result = mount("", "/apipe", fs_type, 0, NULL);
  if (result != 0) {
    fprintf(stderr, "error: mount of '%s' failed: %d.\n", fs_type, result);
    return 1;;
  }

  return 0;
}