FreeBSD/contrib/subversion/subversion/libsvn_fs_x/revprops.c
/* Read the current revprop generation and return it in *GENERATION.
   Also, detect aborted / crashed writers and recover from that.
   Use the access object in FS to set the shared mem values. */
Read the current revprop generation and return it in *GENERATION.
Also, detect aborted / crashed writers and recover from that.
Use the access object in FS to set the shared mem values.
Read the current revprop generation and return it in * GENERATION . Also detect aborted / crashed writers and recover from that . Use the access object in FS to set the shared mem values .
static svn_error_t *
read_revprop_generation(apr_int64_t *generation,
                        svn_fs_t *fs,
                        apr_pool_t *scratch_pool)
{
  apr_int64_t current = 0;
  svn_fs_x__data_t *ffd = fs->fsap_data;
  SVN_ERR(read_revprop_generation_file(&current, fs, scratch_pool));
  if (current % 2)
    {
      svn_boolean_t timeout = FALSE;
      if (!ffd->has_write_lock)
        {
          apr_time_t mtime;
          SVN_ERR(svn_io_file_affected_time(&mtime,
                        svn_fs_x__path_revprop_generation(fs, scratch_pool),
                        scratch_pool));
          timeout = apr_time_now() > mtime + REVPROP_CHANGE_TIMEOUT;
        }
      if (ffd->has_write_lock || timeout)
        {
          revprop_generation_upgrade_t baton;
          baton.generation = &current;
          baton.fs = fs;
          if (ffd->has_write_lock)
            SVN_ERR(revprop_generation_fixup(&baton, scratch_pool));
          else
            SVN_ERR(svn_fs_x__with_write_lock(fs, revprop_generation_fixup,
                                              &baton, scratch_pool));
        }
    }
  *generation = current;
  return SVN_NO_ERROR;
}
static svn_error_t * read_revprop_generation ( apr_int64_t * generation , svn_fs_t * fs , apr_pool_t * scratch_pool ) { apr_int64_t current = 0 ; svn_fs_x__data_t * ffd = fs -> fsap_data ; SVN_ERR ( read_revprop_generation_file ( & current , fs , scratch_pool ) ) ; if ( current % 2 ) { svn_boolean_t timeout = FALSE ; if ( ! ffd -> has_write_lock ) { apr_time_t mtime ; SVN_ERR ( svn_io_file_affected_time ( & mtime , svn_fs_x__path_revprop_generation ( fs , scratch_pool ) , scratch_pool ) ) ; timeout = apr_time_now ( ) > mtime + REVPROP_CHANGE_TIMEOUT ; } if ( ffd -> has_write_lock || timeout ) { revprop_generation_upgrade_t baton ; baton . generation = & current ; baton . fs = fs ; if ( ffd -> has_write_lock ) SVN_ERR ( revprop_generation_fixup ( & baton , scratch_pool ) ) ; else SVN_ERR ( svn_fs_x__with_write_lock ( fs , revprop_generation_fixup , & baton , scratch_pool ) ) ; } } * generation = current ; return SVN_NO_ERROR ; }
Read the current revprop generation and return it in *GENERATION.
Read the current revprop generation and return it in * GENERATION .
/* read the current revprop generation number */ /* is an unfinished revprop write under the way? */ /* Has the writer process been aborted?
       * Either by timeout or by us being the writer now.
       */ /* Ensure that the original writer process no longer exists by
           * acquiring the write lock to this repository.  Then, fix up
           * the revprop generation.
           */ /* return the value we just got */