예제 #1
0
wbfs_t *wbfs_try_open(char *disc,char *partition, int reset)
{
	wbfs_t *p = 0;
	if(partition)
		p = wbfs_try_open_partition(partition,reset);
	if (!p && !reset && disc)
		p = wbfs_try_open_hd(disc,0);
	else if(!p && !reset){
		char buffer[32];
		int i;
#ifdef __linux__
		for (i='b';i<'z';i++)
		{
			snprintf(buffer,32,"/dev/sd%c",i);
			p = wbfs_try_open_hd(buffer,0);
			if (p)
			{
				fprintf(stderr,"using %s\n",buffer);
				return p;
			}
			snprintf(buffer,32,"/dev/hd%c",i);
			p = wbfs_try_open_hd(buffer,0);
			if (p)
			{
				fprintf(stderr,"using %s\n",buffer);
				return p;
			}
		}			 
#else
		int j;
		for (i=0;i<10;i++)
			for (j=0;j<10;j++){
				snprintf(buffer,32,"/dev/disk%ds%d",i,j);
				p = wbfs_try_open_partition(buffer,0);
				if (p)
				{
					fprintf(stderr,"using %s\n",buffer);
					return p;
				}	    
			}
#endif
		wbfs_error("cannot find any wbfs partition (verify permissions))");
	}
	return p;
	
}
예제 #2
0
int op_init_partition(char *device)
{
  if (app_state.wbfs) {
    wbfs_close(app_state.wbfs);
    app_state.wbfs = NULL;
  }

  app_state.wbfs = wbfs_try_open_partition(device, 1);
  if (app_state.wbfs != NULL)
    return 0;
  return 1;
}
예제 #3
0
wbfs_t *wbfs_try_open(char *disc, char *partition, int reset)
{
	wbfs_t *p = 0;
	
	if (partition)
	{
		p = wbfs_try_open_partition(partition,reset);
	}
	
	if (!p && !reset && disc)
	{
		p = 0;
	}
	else if(!p && !reset)
	{
		p = 0;
	}

	return p;
}