int main(int argc, char** argv)
{
	if (argc != 2)
	{
		printf("Usage\n\t%s kernel_base\n", argv[0]);
		return -1;
	}
    uint64_t kernel_base = strtoull(argv[1], NULL, 0x10);

    // THIS IS BOILERPLATE TO PROPERLY GAIN TFP0 AND INITIALIZE INTERNALS
    offsets_init();
    task_t kernel_task;
    host_get_special_port(mach_host_self(), HOST_LOCAL_NODE, 4, &kernel_task);
    task_self_addr();
    kernel_task_port = kernel_task;
    tfp0 = kernel_task;
    // THIS IS BOILERPLATE TO PROPERLY GAIN TFP0 AND INITIALIZE INTERNALS
    
    printf("Using kernel base 0x%llx\n", kernel_base);
    printf("Kernel base * == 0x%llx\n", rk64(kernel_base));
    
    init_ws(kernel_task, kernel_base);
    wsmain(0);
}
Exemple #2
0
int main(int argc, char *argv[])
{
  int i;
  int fuse_stat;
  struct atmos_state *atmos_data;
  ws_result wsr;
  static int opt_binary= 0;
  //setup memcaceh
  atmos_data = calloc(sizeof(struct atmos_state), 1);
  
  atmos_data->attr_cache = memcached_create(NULL);
    
    memcached_server_st *servers= memcached_servers_parse("localhost");
    memcached_server_push(atmos_data->attr_cache, servers);
    memcached_server_list_free(servers);
    memcached_behavior_set(atmos_data->attr_cache, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
			   (uint64_t)opt_binary);
  

  if (atmos_data == NULL) {
    perror("main calloc");
    abort();
  }
    
  atmos_data->logfile = log_open();

  // libfuse is able to do most of the command line parsing; all I
  // need to do is to extract the rootdir; this will be the first
  // non-option passed in.  I'm using the GNU non-standard extension
  // and having realpath malloc the space for the path
  // the string.
  for (i = 1; (i < argc) && (argv[i][0] == '-'); i++);
  if (i == argc)
    atmos_usage();
    
  atmos_data->rootdir = "/FUSETEST";

  
  for (; i < argc; i++)
    argv[i] = argv[i+1];
  argc--;

  
  static const char *user_id = "mail";
  static const char *key = "w7mxRvPlDYUkA4J6uTuItfUS1u4=";
  static const char *endpoint = "10.241.38.90";  //*/
  /*  static const char *user_id = "0e069767430c4d37997853b058eb0af8/EMC007A49DEEA84C837E";
  static const char *key ="YlVdJFb03nYtXZk0lk0KjQplVcI=";
  static const char *endpoint ="accesspoint.emccis.com";//*/


  atmos_data->c = init_ws(user_id, key, endpoint);

  create_ns(atmos_data->c, "/FUSETEST/",NULL, NULL, NULL, &wsr);
  fprintf(stderr, "atmos setup to receive fuse %d\n", wsr.return_code);  
  result_deinit(&wsr);


  fprintf(stderr, "about to call fuse_main\n");
  fuse_stat = fuse_main(argc, argv, &atmos_oper, atmos_data);
  fprintf(stderr, "fuse_main returned %d\n", fuse_stat);
    
  return fuse_stat;
}