FreeBSD/contrib/subversion/subversion/libsvn_fs_x/revprops.c
/* In filesystem FS, read the packed revprops for revision REV into
 * *REVPROPS.  Use GENERATION to populate the revprop cache, if enabled.
 * If you want to modify revprop contents / update REVPROPS, READ_ALL
 * must be set.  Otherwise, only the properties of REV are being provided.
 *
 * Allocate *PROPERTIES in RESULT_POOL and temporaries in SCRATCH_POOL.
 */
In filesystem FS, read the packed revprops for revision REV into
*REVPROPS.  Use GENERATION to populate the revprop cache, if enabled.
If you want to modify revprop contents / update REVPROPS, READ_ALL
must be set.  Otherwise, only the properties of REV are being provided.

Allocate *PROPERTIES in RESULT_POOL and temporaries in SCRATCH_POOL.
In filesystem FS read the packed revprops for revision REV into * REVPROPS . Use GENERATION to populate the revprop cache if enabled . If you want to modify revprop contents / update REVPROPS READ_ALL must be set . Otherwise only the properties of REV are being provided . Allocate * PROPERTIES in RESULT_POOL and temporaries in SCRATCH_POOL .
static svn_error_t *
read_pack_revprop(packed_revprops_t **revprops,
                  svn_fs_t *fs,
                  svn_revnum_t rev,
                  apr_int64_t generation,
                  svn_boolean_t read_all,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
{
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
  svn_boolean_t missing = FALSE;
  svn_error_t *err;
  packed_revprops_t *result;
  int i;
  if (!svn_fs_x__is_packed_revprop(fs, rev))
     SVN_ERR(svn_fs_x__update_min_unpacked_rev(fs, iterpool));
  if (!svn_fs_x__is_packed_revprop(fs, rev))
    return svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
                              _("No such packed revision %ld"), rev);
  result = apr_pcalloc(result_pool, sizeof(*result));
  result->revision = rev;
  result->generation = generation;
  for (i = 0;
       i < SVN_FS_X__RECOVERABLE_RETRY_COUNT && !result->packed_revprops;
       ++i)
    {
      const char *file_path;
      svn_pool_clear(iterpool);
      SVN_ERR(get_revprop_packname(fs, result, result_pool, iterpool));
      file_path  = svn_dirent_join(result->folder,
                                   result->filename,
                                   iterpool);
      SVN_ERR(svn_fs_x__try_stringbuf_from_file(&result->packed_revprops,
                                &missing,
                                file_path,
                                i + 1 < SVN_FS_X__RECOVERABLE_RETRY_COUNT,
                                result_pool));
      if (missing && has_revprop_cache(fs, iterpool))
        SVN_ERR(read_revprop_generation(&result->generation, fs, iterpool));
    }
  if (!result->packed_revprops)
    return svn_error_createf(SVN_ERR_FS_PACKED_REVPROP_READ_FAILURE, NULL,
                  _("Failed to read revprop pack file for r%ld"), rev);
  err = parse_packed_revprops(fs, result, read_all, result_pool, iterpool);
  svn_pool_destroy(iterpool);
  if (err)
    return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
                  _("Revprop pack file for r%ld is corrupt"), rev);
  *revprops = result;
  return SVN_NO_ERROR;
}
static svn_error_t * read_pack_revprop ( packed_revprops_t * * revprops , svn_fs_t * fs , svn_revnum_t rev , apr_int64_t generation , svn_boolean_t read_all , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { apr_pool_t * iterpool = svn_pool_create ( scratch_pool ) ; svn_boolean_t missing = FALSE ; svn_error_t * err ; packed_revprops_t * result ; int i ; if ( ! svn_fs_x__is_packed_revprop ( fs , rev ) ) SVN_ERR ( svn_fs_x__update_min_unpacked_rev ( fs , iterpool ) ) ; if ( ! svn_fs_x__is_packed_revprop ( fs , rev ) ) return svn_error_createf ( SVN_ERR_FS_NO_SUCH_REVISION , NULL , _ ( " " ) , rev ) ; result = apr_pcalloc ( result_pool , sizeof ( * result ) ) ; result -> revision = rev ; result -> generation = generation ; for ( i = 0 ; i < SVN_FS_X__RECOVERABLE_RETRY_COUNT && ! result -> packed_revprops ; ++ i ) { const char * file_path ; svn_pool_clear ( iterpool ) ; SVN_ERR ( get_revprop_packname ( fs , result , result_pool , iterpool ) ) ; file_path = svn_dirent_join ( result -> folder , result -> filename , iterpool ) ; SVN_ERR ( svn_fs_x__try_stringbuf_from_file ( & result -> packed_revprops , & missing , file_path , i + 1 < SVN_FS_X__RECOVERABLE_RETRY_COUNT , result_pool ) ) ; if ( missing && has_revprop_cache ( fs , iterpool ) ) SVN_ERR ( read_revprop_generation ( & result -> generation , fs , iterpool ) ) ; } if ( ! result -> packed_revprops ) return svn_error_createf ( SVN_ERR_FS_PACKED_REVPROP_READ_FAILURE , NULL , _ ( " " ) , rev ) ; err = parse_packed_revprops ( fs , result , read_all , result_pool , iterpool ) ; svn_pool_destroy ( iterpool ) ; if ( err ) return svn_error_createf ( SVN_ERR_FS_CORRUPT , err , _ ( " " ) , rev ) ; * revprops = result ; return SVN_NO_ERROR ; }
In filesystem FS, read the packed revprops for revision REV into
 *REVPROPS.
In filesystem FS read the packed revprops for revision REV into * REVPROPS .
/* someone insisted that REV is packed. Double-check if necessary */ /* initialize the result data structure */ /* try to read the packed revprops. This may require retries if we have
   * concurrent writers. */ /* there might have been concurrent writes.
       * Re-read the manifest and the pack file.
       */ /* If we could not find the file, there was a write.
       * So, we should refresh our revprop generation info as well such
       * that others may find data we will put into the cache.  They would
       * consider it outdated, otherwise.
       */ /* the file content should be available now */ /* parse it. RESULT will be complete afterwards. */