FreeBSD/contrib/subversion/subversion/libsvn_fs_x/revprops.c
/* Read revprop generation as stored on disk for repository FS. The result is
 * returned in *CURRENT.  Call only for repos that support revprop caching.
 */
Read revprop generation as stored on disk for repository FS. The result is
returned in *CURRENT.  Call only for repos that support revprop caching.
Read revprop generation as stored on disk for repository FS . The result is returned in * CURRENT . Call only for repos that support revprop caching .
static svn_error_t *
read_revprop_generation_file(apr_int64_t *current,
                             svn_fs_t *fs,
                             apr_pool_t *scratch_pool)
{
  svn_fs_x__data_t *ffd = fs->fsap_data;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
  char buf[CHECKSUMMED_NUMBER_BUFFER_LEN];
  apr_size_t len;
  apr_off_t offset = 0;
  int i;
  svn_error_t *err = SVN_NO_ERROR;
  for (i = 0; i < GENERATION_READ_RETRY_COUNT; ++i)
    {
      svn_error_clear(err);
      svn_pool_clear(iterpool);
      SVN_ERR(open_revprop_generation_file(fs, TRUE, iterpool));
      SVN_ERR(svn_io_file_seek(ffd->revprop_generation_file, APR_SET, &offset,
                              iterpool));
      len = sizeof(buf);
      SVN_ERR(svn_io_read_length_line(ffd->revprop_generation_file, buf, &len,
                                      iterpool));
      err = verify_extract_number(current, buf, len, iterpool);
      if (!err)
        break;
      SVN_ERR(close_revprop_generation_file(fs, iterpool));
#if APR_HAS_THREADS
      apr_thread_yield();
#else
      apr_sleep(0);
#endif
    }
  svn_pool_destroy(iterpool);
  return svn_error_trace(err);
}
static svn_error_t * read_revprop_generation_file ( apr_int64_t * current , svn_fs_t * fs , apr_pool_t * scratch_pool ) { svn_fs_x__data_t * ffd = fs -> fsap_data ; apr_pool_t * iterpool = svn_pool_create ( scratch_pool ) ; char buf [ CHECKSUMMED_NUMBER_BUFFER_LEN ] ; apr_size_t len ; apr_off_t offset = 0 ; int i ; svn_error_t * err = SVN_NO_ERROR ; for ( i = 0 ; i < GENERATION_READ_RETRY_COUNT ; ++ i ) { svn_error_clear ( err ) ; svn_pool_clear ( iterpool ) ; SVN_ERR ( open_revprop_generation_file ( fs , TRUE , iterpool ) ) ; SVN_ERR ( svn_io_file_seek ( ffd -> revprop_generation_file , APR_SET , & offset , iterpool ) ) ; len = sizeof ( buf ) ; SVN_ERR ( svn_io_read_length_line ( ffd -> revprop_generation_file , buf , & len , iterpool ) ) ; err = verify_extract_number ( current , buf , len , iterpool ) ; if ( ! err ) break ; SVN_ERR ( close_revprop_generation_file ( fs , iterpool ) ) ; #if APR_HAS_THREADS apr_thread_yield ( ) ; #else apr_sleep ( 0 ) ; #endif } svn_pool_destroy ( iterpool ) ; return svn_error_trace ( err ) ; }
Read revprop generation as stored on disk for repository FS.
Read revprop generation as stored on disk for repository FS .
/* Retry in case of incomplete file buffer updates. */ /* If we can't even access the data, things are very wrong.
       * Don't retry in that case.
       */ /* Some data has been read.  It will most likely be complete and
       * consistent.  Extract and verify anyway. */ /* Got unlucky and data was invalid.  Retry. */ /* If we had to give up, propagate the error. */