示例#1
0
int main(int argc, char * const argv[])
{
	if (initial_check(argc, argv))
		return 1;

	node = argv[1];

	libubi = libubi_open();
	if (libubi == NULL) {
		failed("libubi_open");
		return 1;
	}

	if (ubi_get_dev_info(libubi, node, &dev_info)) {
		failed("ubi_get_dev_info");
		goto close;
	}

	if (mkvol_basic())
		goto close;

	if (mkvol_alignment())
		goto close;

	if (mkvol_multiple())
		goto close;

	libubi_close(libubi);
	return 0;

close:
	libubi_close(libubi);
	return 1;
}
示例#2
0
int main(int argc, char * const argv[])
{
	if (initial_check(argc, argv))
		return 1;

	node = argv[1];

	libubi = libubi_open();
	if (libubi == NULL) {
		failed("libubi_open");
		return 1;
	}

	if (ubi_get_dev_info(libubi, node, &dev_info)) {
		failed("ubi_get_dev_info");
		goto close;
	}

	if (test_basic(UBI_DYNAMIC_VOLUME))
		goto close;
	if (test_basic(UBI_STATIC_VOLUME))
		goto close;
	if (test_rsvol(UBI_DYNAMIC_VOLUME))
		goto close;
	if (test_rsvol(UBI_STATIC_VOLUME))
		goto close;

	libubi_close(libubi);
	return 0;

close:
	libubi_close(libubi);
	return 1;
}
示例#3
0
int main(int argc, char** argv){
  setlocale(LC_ALL, "en_US.utf8");  
  initial_check();
  get_files_list();

  ESCDELAY = 1;
  menu_index = 0;
  previous_index = -1;
  
  initscr();
  noecho();
  keypad(stdscr, TRUE);
  getmaxyx(stdscr,rows,cols);
  diff_col_width = cols/2-1;
  start_color();
  use_default_colors();
  init_pair(1, COLOR_RED,     -1);
  init_pair(2, COLOR_GREEN,   -1);
  init_pair(3, COLOR_CYAN,    -1);
  refresh();

  print_files_menu();
  show_git_diff();

  ch = getch();  
  while(ch != 27 && ch != 'q'){
    switch(ch){
      case KEY_UP: 
        move_menu(-1);
        break;
      case KEY_DOWN: 
        move_menu(1);
        break;
      case 'h':
        show_help();
        break;
      case '?':
        show_help();
        break;
      case ' ':
        check_row();
        break;
      case 'a':
        check_all();
        break;
      case 'c':
        open_system_index_add_window();
        break;
    }
    ch = getch();  
  }
  
  endwin();
  git_threads_shutdown();
  return(EXIT_SUCCESS);
}
示例#4
0
void Sudoku::solve() {
   int i, result = 0;
   int test = nextBlank(-1);

   if(initial_check()==false) test=sudokuSize;
   else
      if(test==sudokuSize){
            result = 1;
            for(i=0; i<sudokuSize; ++i) ans[i] = map[i];
      }

   while(test>=0 && test<sudokuSize && result<2){
      map[test]++;
      if(map[test]>9){
         map[test] = 0;
         test = pop();
      }
      else{
         if(check(test)==true){
            blankNum[fillPoint++] = test;
            test=nextBlank(test);
            if(test==sudokuSize){
               result++;
               for(i=0; i<sudokuSize; ++i) ans[i] = map[i];
               test = pop();
            }
         }
      }
   }

   if(result==1){
        cout << "1" << endl;
        printOut(true);
   }
   else if(result>1) cout << "2";
   else
        cout << "0";

}
示例#5
0
int main(int argc, char * const argv[])
{
	int i, ret;
	pthread_t threads[THREADS_NUM];

	if (initial_check(argc, argv))
		return 1;

	node = argv[1];

	libubi = libubi_open();
	if (libubi == NULL) {
		failed("libubi_open");
		return 1;
	}

	if (ubi_get_dev_info(libubi, node, &dev_info)) {
		failed("ubi_get_dev_info");
		goto close;
	}

	for (i = 0; i < THREADS_NUM; i++) {
		ret = pthread_create(&threads[i], NULL, &the_thread, (void*)(long)i);
		if (ret) {
			failed("pthread_create");
			goto close;
		}
	}

	for (i = 0; i < THREADS_NUM; i++)
		pthread_join(threads[i], NULL);

	libubi_close(libubi);
	return 0;

close:
	libubi_close(libubi);
	return 1;
}
示例#6
0
文件: io_paral.c 项目: mobilipia/iods
int main(int argc, char * const argv[])
{
	int i, ret;
	pthread_t threads[THREADS_NUM];
	struct ubi_mkvol_request req;
	long long mem_limit;

	if (initial_check(argc, argv))
		return 1;

	node = argv[1];

	libubi = libubi_open();
	if (libubi == NULL) {
		failed("libubi_open");
		return 1;
	}

	if (ubi_get_dev_info(libubi, node, &dev_info)) {
		failed("ubi_get_dev_info");
		goto close;
	}

	req.alignment = 1;
	mem_limit = memory_limit();
	if (mem_limit && mem_limit < dev_info.avail_bytes)
		total_bytes = req.bytes =
				(mem_limit / dev_info.eb_size / THREADS_NUM)
				* dev_info.eb_size;
	else
		total_bytes = req.bytes =
				((dev_info.avail_ebs - 3) / THREADS_NUM)
				* dev_info.eb_size;
	for (i = 0; i < THREADS_NUM; i++) {
		char name[100];

		req.vol_id = i;
		sprintf(&name[0], TESTNAME":%d", i);
		req.name = &name[0];
		req.vol_type = (i & 1) ? UBI_STATIC_VOLUME : UBI_DYNAMIC_VOLUME;

		if (ubi_mkvol(libubi, node, &req)) {
			failed("ubi_mkvol");
			goto remove;
		}
	}

	/* Create one volume with static data to make WL work more */
	req.vol_id = THREADS_NUM;
	req.name = TESTNAME ":static";
	req.vol_type = UBI_DYNAMIC_VOLUME;
	req.bytes = 3*dev_info.eb_size;
	if (ubi_mkvol(libubi, node, &req)) {
		failed("ubi_mkvol");
		goto remove;
	}

	for (i = 0; i < THREADS_NUM; i++) {
		ret = pthread_create(&threads[i], NULL, &the_thread, (void*)i);
		if (ret) {
			failed("pthread_create");
			goto remove;
		}
	}

	for (i = 0; i < THREADS_NUM; i++)
		pthread_join(threads[i], NULL);

	for (i = 0; i <= THREADS_NUM; i++) {
		if (ubi_rmvol(libubi, node, i)) {
			failed("ubi_rmvol");
			goto remove;
		}
	}

	libubi_close(libubi);
	return 0;

remove:
	for (i = 0; i <= THREADS_NUM; i++)
		ubi_rmvol(libubi, node, i);

close:
	libubi_close(libubi);
	return 1;
}