FreeBSD/contrib/subversion/subversion/libsvn_fs_x/hotcopy.c
/* Copy an un-packed revision or revprop file for revision REV from SRC_SUBDIR
 * to DST_SUBDIR. Assume a sharding layout based on MAX_FILES_PER_DIR.
 * Set *SKIPPED_P to FALSE only if the file was copied, do not change the
 * value in *SKIPPED_P otherwise. SKIPPED_P may be NULL if not required.
 * Use SCRATCH_POOL for temporary allocations. */
Copy an un-packed revision or revprop file for revision REV from SRC_SUBDIR
to DST_SUBDIR. Assume a sharding layout based on MAX_FILES_PER_DIR.
Set *SKIPPED_P to FALSE only if the file was copied, do not change the
value in *SKIPPED_P otherwise. SKIPPED_P may be NULL if not required.
Use SCRATCH_POOL for temporary allocations.
Copy an un - packed revision or revprop file for revision REV from SRC_SUBDIR to DST_SUBDIR . Assume a sharding layout based on MAX_FILES_PER_DIR . Set * SKIPPED_P to FALSE only if the file was copied do not change the value in * SKIPPED_P otherwise . SKIPPED_P may be NULL if not required . Use SCRATCH_POOL for temporary allocations .
static svn_error_t *
hotcopy_copy_shard_file(svn_boolean_t *skipped_p,
                        const char *src_subdir,
                        const char *dst_subdir,
                        svn_revnum_t rev,
                        int max_files_per_dir,
                        apr_pool_t *scratch_pool)
{
  const char *src_subdir_shard = src_subdir,
             *dst_subdir_shard = dst_subdir;
  const char *shard = apr_psprintf(scratch_pool, "%ld",
                                   rev / max_files_per_dir);
  src_subdir_shard = svn_dirent_join(src_subdir, shard, scratch_pool);
  dst_subdir_shard = svn_dirent_join(dst_subdir, shard, scratch_pool);
  if (rev % max_files_per_dir == 0)
    {
      SVN_ERR(svn_io_make_dir_recursively(dst_subdir_shard, scratch_pool));
      SVN_ERR(svn_io_copy_perms(dst_subdir, dst_subdir_shard,
                                scratch_pool));
    }
  SVN_ERR(hotcopy_io_dir_file_copy(skipped_p,
                                   src_subdir_shard, dst_subdir_shard,
                                   apr_psprintf(scratch_pool, "%ld", rev),
                                   scratch_pool));
  return SVN_NO_ERROR;
}
static svn_error_t * hotcopy_copy_shard_file ( svn_boolean_t * skipped_p , const char * src_subdir , const char * dst_subdir , svn_revnum_t rev , int max_files_per_dir , apr_pool_t * scratch_pool ) { const char * src_subdir_shard = src_subdir , * dst_subdir_shard = dst_subdir ; const char * shard = apr_psprintf ( scratch_pool , " " , rev / max_files_per_dir ) ; src_subdir_shard = svn_dirent_join ( src_subdir , shard , scratch_pool ) ; dst_subdir_shard = svn_dirent_join ( dst_subdir , shard , scratch_pool ) ; if ( rev % max_files_per_dir == 0 ) { SVN_ERR ( svn_io_make_dir_recursively ( dst_subdir_shard , scratch_pool ) ) ; SVN_ERR ( svn_io_copy_perms ( dst_subdir , dst_subdir_shard , scratch_pool ) ) ; } SVN_ERR ( hotcopy_io_dir_file_copy ( skipped_p , src_subdir_shard , dst_subdir_shard , apr_psprintf ( scratch_pool , " " , rev ) , scratch_pool ) ) ; return SVN_NO_ERROR ; }
Copy an un-packed revision or revprop file for revision REV from SRC_SUBDIR
 to DST_SUBDIR.
Copy an un - packed revision or revprop file for revision REV from SRC_SUBDIR to DST_SUBDIR .