persistent/util.hpp
// verify the existence of a sparse file
// Check if directory exists or not. Create it on absence.
// return error if creating failed
verify the existence of a sparse file
Check if directory exists or not. Create it on absence.
return error if creating failed
verify the existence of a sparse file Check if directory exists or not . Create it on absence . return error if creating failed
inline bool checkOrCreateFileWithSize(const std::string & file, uint64_t size)
noexcept(false) {
  bool bCreate = false;
  int fd;
  bCreate = !checkRegularFile(file);
  fd = open(file.c_str(), O_RDWR|O_CREAT,S_IWUSR|S_IRUSR|S_IRGRP|S_IWGRP|S_IROTH);
  if (fd < 0) {
    throw PERSIST_EXP_CREATE_FILE(errno);
  }
  if (ftruncate(fd,size) != 0) {
    throw PERSIST_EXP_TRUNCATE_FILE(errno);
  }
  close(fd);
  return bCreate;
}
inline bool checkOrCreateFileWithSize ( const std :: string & file , uint64_t size ) noexcept ( false ) { bool bCreate = false ; int fd ; bCreate = ! checkRegularFile ( file ) ; fd = open ( file . c_str ( ) , O_RDWR | O_CREAT , S_IWUSR | S_IRUSR | S_IRGRP | S_IWGRP | S_IROTH ) ; if ( fd < 0 ) { throw PERSIST_EXP_CREATE_FILE ( errno ) ; } if ( ftruncate ( fd , size ) != 0 ) { throw PERSIST_EXP_TRUNCATE_FILE ( errno ) ; } close ( fd ) ; return bCreate ; }
verify the existence of a sparse file
Check if directory exists or not.
verify the existence of a sparse file Check if directory exists or not .