Пример #1
0
Файл: pfs.c Проект: TACC/t3pio
int t3pio_readStripes(MPI_Comm comm, int myProc, const char * fn)
{
  int count   = 0;
  int stripes = 4;
  int ierr;
#ifdef HAVE_LUSTRE
  const char* dir = path2dir(fn);
  
  if (myProc == 0 && t3pio_usingLustreFS(dir))
    {
      FILE* fp;
      char  line[MAXLINE];
      sprintf(&line[0],"lfs getstripe -q %s",fn);
      if ( (fp = popen(line, "r")) == NULL)
        {
          fprintf(stderr,"unable to popen\n");
          abort();
        }

      while (fgets(line, MAXLINE, fp) != NULL)
        {
          size_t k = strspn(&line[0], " \t");
          if (isdigit(line[k]))
            count++;
        }
      stripes = count;
    }
  ierr = MPI_Bcast(&stripes, 1, MPI_INTEGER, 0, comm);
#endif
  return stripes;
}
Пример #2
0
Файл: pfs.c Проект: TACC/t3pio
int t3pio_asklustre(MPI_Comm comm, int myProc, const char* path)
{
  int        ierr;
  int        stripes = 1;
  
#ifdef HAVE_LUSTRE
  const char * dir = path2dir(path);
  if (myProc == 0 && t3pio_usingLustreFS(dir))
    {
      char line[MAXLINE];
      int stripe_size        = 0;
      int stripe_offset      = -1;
      int stripe_pattern     = 0;
      int stripes_max        = -1;
      int flags              = (O_WRONLY | O_CREAT | O_EXCL);

      // Create a Lustre Striped Test File
      char fn[MAXLINE];

      sprintf(&fn[0], "%s/foo_%d.bar", dir, getpid());
      int rc = llapi_file_create(fn, stripe_size, stripe_offset, stripes_max,
                                 stripe_pattern);
      if (rc == 0)
        {
          flags |= O_LOV_DELAY_CREATE;
          flags &= ~O_EXCL;
          int fd = open(fn, flags, RW_USER);
          FILE* fp = fdopen(fd,"w");
          fprintf(fp, "foo.bar\n");
          fclose(fp);
          sprintf(&line[0],"lfs getstripe -q %s",fn);

          if ( (fp = popen(line, "r")) == NULL)
            {
              fprintf(stderr,"unable to popen\n");
              abort();
            }

          int count = 0;
          while (fgets(line, MAXLINE, fp) != NULL)
            {
              size_t k = strspn(&line[0], " \t");
              if (isdigit(line[k]))
                count++;
            }
          stripes = count;
          fclose(fp);
        }
      unlink(fn);
    }
  ierr = MPI_Bcast(&stripes, 1, MPI_INTEGER, 0, comm);
#endif
  return stripes;
}
Пример #3
0
void MyMainWindow::playByIndex(int idx)
{
    if((unsigned)idx >= (unsigned)m_mediaList.scrollArea().count())
        return;

    ListMenuItem *itm = (ListMenuItem*)m_mediaList.scrollArea().widgetItem(idx);

    m_currentPlayedItem->setIcon( &resource_manager->image("music_small") );
    itm->setIcon( &resource_manager->image("played") );
    m_currentPlayedItem = itm;


    m_mediaList.scrollArea().setItem(idx);
    //m_mediaList.scrollArea().fixupViewPosition();

    m_player->play( path2dir(m_playFile) + itm->text() );
    m_headText.setText(itm->text());
}
Пример #4
0
int sys_get_startupdir( char * path, int max_len )
{
	sys_get_path( path, MAX_PATH );
	path2dir( path );
}