FreeBSD/contrib/subversion/subversion/libsvn_fs_x/index.c
/* Using the log-to-phys proto index in transaction TXN_ID in FS, find the
 * absolute offset in the proto rev file for the given ITEM_INDEX and return
 * it in *OFFSET.  Use SCRATCH_POOL for temporary allocations.
 */
Using the log-to-phys proto index in transaction TXN_ID in FS, find the
absolute offset in the proto rev file for the given ITEM_INDEX and return
it in *OFFSET.  Use SCRATCH_POOL for temporary allocations.
Using the log - to - phys proto index in transaction TXN_ID in FS find the absolute offset in the proto rev file for the given ITEM_INDEX and return it in * OFFSET . Use SCRATCH_POOL for temporary allocations .
static svn_error_t *
l2p_proto_index_lookup(apr_off_t *offset,
                       apr_uint32_t *sub_item,
                       svn_fs_t *fs,
                       svn_fs_x__txn_id_t txn_id,
                       apr_uint64_t item_index,
                       apr_pool_t *scratch_pool)
{
  svn_boolean_t eof = FALSE;
  apr_file_t *file = NULL;
  SVN_ERR(svn_io_file_open(&file,
                           svn_fs_x__path_l2p_proto_index(fs, txn_id,
                                                          scratch_pool),
                           APR_READ | APR_BUFFERED, APR_OS_DEFAULT,
                           scratch_pool));
  *offset = -1;
  while (!eof)
    {
      l2p_proto_entry_t entry;
      SVN_ERR(read_l2p_entry_from_proto_index(file, &entry, &eof,
                                              scratch_pool));
      if (!eof && entry.item_index == item_index)
        {
          *offset = (apr_off_t)entry.offset - 1;
          *sub_item = entry.sub_item;
          break;
        }
    }
  SVN_ERR(svn_io_file_close(file, scratch_pool));
  return SVN_NO_ERROR;
}
static svn_error_t * l2p_proto_index_lookup ( apr_off_t * offset , apr_uint32_t * sub_item , svn_fs_t * fs , svn_fs_x__txn_id_t txn_id , apr_uint64_t item_index , apr_pool_t * scratch_pool ) { svn_boolean_t eof = FALSE ; apr_file_t * file = NULL ; SVN_ERR ( svn_io_file_open ( & file , svn_fs_x__path_l2p_proto_index ( fs , txn_id , scratch_pool ) , APR_READ | APR_BUFFERED , APR_OS_DEFAULT , scratch_pool ) ) ; * offset = -1 ; while ( ! eof ) { l2p_proto_entry_t entry ; SVN_ERR ( read_l2p_entry_from_proto_index ( file , & entry , & eof , scratch_pool ) ) ; if ( ! eof && entry . item_index == item_index ) { * offset = ( apr_off_t ) entry . offset - 1 ; * sub_item = entry . sub_item ; break ; } } SVN_ERR ( svn_io_file_close ( file , scratch_pool ) ) ; return SVN_NO_ERROR ; }
Using the log-to-phys proto index in transaction TXN_ID in FS, find the
 absolute offset in the proto rev file for the given ITEM_INDEX and return
 it in *OFFSET.
Using the log - to - phys proto index in transaction TXN_ID in FS find the absolute offset in the proto rev file for the given ITEM_INDEX and return it in * OFFSET .
/* process all entries until we fail due to EOF */ /* (attempt to) read the next entry from the source */ /* handle new revision */