Guest User

Untitled

a guest
Nov 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. Index: subversion/libsvn_fs_fs/fs_fs.c
  2. ===================================================================
  3. --- subversion/libsvn_fs_fs/fs_fs.c (revision 1165778)
  4. +++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
  5. @@ -5842,6 +5842,37 @@ copy_file_partially(apr_file_t *source_file,
  6. }
  7.  
  8. static svn_error_t *
  9. +read_successor_revisions_file_entry(apr_uint64_t *revision_offset,
  10. + svn_fs_t *fs,
  11. + svn_revnum_t revision,
  12. + apr_pool_t *pool)
  13. +{
  14. + apr_off_t offset_offset;
  15. + apr_size_t size;
  16. + apr_file_t *revs_file;
  17. + apr_uint32_t m, n;
  18. + const char *revs_abspath = path_successor_revisions(fs, revision, pool);
  19. +
  20. + SVN_ERR(svn_io_file_open(&revs_file, revs_abspath, APR_READ,
  21. + APR_OS_DEFAULT, pool));
  22. + offset_offset = FSFS_SUCCESSORS_REV_OFFSET(revision - 1);
  23. + SVN_ERR(svn_io_file_seek(revs_file, APR_SET, &offset_offset, pool));
  24. +
  25. + /* Read a 64 bit big endian integer in two passes.
  26. + * The most significant 4 bytes come first. */
  27. + size = 4;
  28. + SVN_ERR(svn_io_file_read(revs_file, &n, &size, pool));
  29. + SVN_ERR_ASSERT(size == 4); /* ### TODO(sid): normal error */
  30. + SVN_ERR(svn_io_file_read(revs_file, &m, &size, pool));
  31. + SVN_ERR_ASSERT(size == 4);
  32. + *revision_offset = ((apr_uint64_t)(ntohl(n)) << 32) | ntohl(m);
  33. +
  34. + SVN_ERR(svn_io_file_close(revs_file, pool));
  35. +
  36. + return SVN_NO_ERROR;
  37. +}
  38. +
  39. +static svn_error_t *
  40. update_successor_ids_file(const char **successor_ids_temp_abspath,
  41. apr_off_t *new_successor_ids_offset,
  42. svn_fs_t *fs,
  43. @@ -5851,12 +5882,7 @@ update_successor_ids_file(const char **successor_i
  44. {
  45. apr_file_t *successor_ids_file;
  46. const char *successor_ids_abspath = path_successor_ids(fs, new_rev, pool);
  47. - const char *revs_abspath = path_successor_revisions(fs, new_rev, pool);
  48. apr_file_t *successor_ids_temp_file;
  49. - apr_file_t *revs_file;
  50. - apr_off_t offset;
  51. - apr_size_t size;
  52. - apr_uint32_t n; /* ### TODO(sid): move to loop scope */
  53. apr_pool_t *iterpool = NULL;
  54. apr_hash_index_t *hi;
  55.  
  56. @@ -5869,24 +5895,11 @@ update_successor_ids_file(const char **successor_i
  57. /* ### TODO(sid): loop condition */
  58. if (new_rev > 1 && new_rev % FSFS_SUCCESSORS_MAX_FILES_PER_DIR != 0)
  59. {
  60. - /* Figure out the offset of successor data for the previous revision. */
  61. apr_uint64_t prev_successor_ids_offset;
  62. - apr_uint32_t m;
  63.  
  64. - SVN_ERR(svn_io_file_open(&revs_file, revs_abspath, APR_READ,
  65. - APR_OS_DEFAULT, pool));
  66. - SVN_ERR_ASSERT(new_rev >= 1); /* ### TODO(sid): redundant */
  67. - offset = FSFS_SUCCESSORS_REV_OFFSET(new_rev - 1);
  68. - SVN_ERR(svn_io_file_seek(revs_file, APR_SET, &offset, pool));
  69. -
  70. - /* Read a 64 bit big endian integer in two passes.
  71. - * The most significant 4 bytes come first. */
  72. - size = 4;
  73. - SVN_ERR(svn_io_file_read(revs_file, &n, &size, pool));
  74. - SVN_ERR_ASSERT(size == 4); /* ### TODO(sid): normal error */
  75. - SVN_ERR(svn_io_file_read(revs_file, &m, &size, pool));
  76. - SVN_ERR_ASSERT(size == 4);
  77. - prev_successor_ids_offset = ((apr_uint64_t)(ntohl(n)) << 32) | ntohl(m);
  78. + /* Figure out the offset of successor data for the previous revision. */
  79. + SVN_ERR(read_successor_revisions_file_entry(&prev_successor_ids_offset,
  80. + fs, new_rev, pool));
  81.  
  82. /* Check for offset overflow.
  83. * This gives a "will never be executed" warning on some platforms. */
  84. @@ -5898,8 +5911,6 @@ update_successor_ids_file(const char **successor_i
  85. "large files; this repository can only "
  86. "be used on platforms which support "
  87. "large files"), prev_successor_ids_offset);
  88. -
  89. - SVN_ERR(svn_io_file_close(revs_file, pool));
  90.  
  91. /* Copy successor data for revisions older than the previous revision
  92. * into the temporary successor data file. */
Add Comment
Please, Sign In to add comment