You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/10/30 01:20:55 UTC
svn commit: r1711391 - in /subversion/trunk/subversion/libsvn_fs_x: util.c
util.h
Author: stefan2
Date: Fri Oct 30 00:20:55 2015
New Revision: 1711391
URL: http://svn.apache.org/viewvc?rev=1711391&view=rev
Log:
Get rid of svn_fs_x__move_into_place.
* subversion/libsvn_fs_x/util.h
(svn_fs_x__move_into_place): Remove.
(svn_fs_x__move_into_place2): Update commentary since we can't refer to
the previous function anymore.
* subversion/libsvn_fs_x/util.c
(svn_fs_x__write_current): Because NAME and TMP_NAME are within the same
folder, we can trivially inline the necessary
code from svn_fs_x__move_into_place.
Modified:
subversion/trunk/subversion/libsvn_fs_x/util.c
subversion/trunk/subversion/libsvn_fs_x/util.h
Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1711391&r1=1711390&r2=1711391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Fri Oct 30 00:20:55 2015
@@ -598,7 +598,13 @@ svn_fs_x__write_current(svn_fs_t *fs,
scratch_pool));
SVN_ERR(svn_io_file_close(file, scratch_pool));
- return svn_fs_x__move_into_place(tmp_name, name, name, scratch_pool);
+ /* Copying permissions is a no-op on WIN32. */
+ SVN_ERR(svn_io_copy_perms(name, tmp_name, scratch_pool));
+
+ /* Move the file into place. */
+ SVN_ERR(svn_io_file_rename2(tmp_name, name, TRUE, scratch_pool));
+
+ return SVN_NO_ERROR;
}
@@ -737,55 +743,3 @@ svn_fs_x__move_into_place2(const char *o
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_fs_x__move_into_place(const char *old_filename,
- const char *new_filename,
- const char *perms_reference,
- apr_pool_t *scratch_pool)
-{
- svn_error_t *err;
- apr_file_t *file;
-
- /* Copying permissions is a no-op on WIN32. */
- SVN_ERR(svn_io_copy_perms(perms_reference, old_filename, scratch_pool));
-
- /* Move the file into place. */
- err = svn_io_file_rename2(old_filename, new_filename, TRUE, scratch_pool);
- if (err && APR_STATUS_IS_EXDEV(err->apr_err))
- {
- /* Can't rename across devices; fall back to copying. */
- svn_error_clear(err);
- SVN_ERR(svn_io_copy_file(old_filename, new_filename, TRUE,
- scratch_pool));
-
- /* Flush the target of the copy to disk.
- ### The code below is duplicates svn_io_file_rename2(), because
- currently we don't have the svn_io_copy_file2() function with
- a flush_to_disk argument. */
- SVN_ERR(svn_io_file_open(&file, new_filename, APR_WRITE,
- APR_OS_DEFAULT, scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
-
-#ifdef SVN_ON_POSIX
- {
- /* On POSIX, the file name is stored in the file's directory entry.
- Hence, we need to fsync() that directory as well.
- On other operating systems, we'd only be asking for trouble
- by trying to open and fsync a directory. */
- const char *dirname;
-
- dirname = svn_dirent_dirname(new_filename, scratch_pool);
- SVN_ERR(svn_io_file_open(&file, dirname, APR_READ, APR_OS_DEFAULT,
- scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
- }
-#endif
- }
- else if (err)
- return svn_error_trace(err);
-
- return SVN_NO_ERROR;
-}
Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1711391&r1=1711390&r2=1711391&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Fri Oct 30 00:20:55 2015
@@ -455,22 +455,16 @@ svn_fs_x__read_number_from_stream(apr_in
svn_stream_t *stream,
apr_pool_t *scratch_pool);
-/* Move a file into place from OLD_FILENAME in the transactions
- directory to its final location NEW_FILENAME in the repository. On
- Unix, match the permissions of the new file to the permissions of
- PERMS_REFERENCE. Temporary allocations are from SCRATCH_POOL.
+/* Move a file into place from temporary OLD_FILENAME to its final
+ location NEW_FILENAME, which must be on to the same volume. Schedule
+ any necessary fsync calls in BATCH. On Unix, match the permissions
+ of the new file to the permissions of PERMS_REFERENCE.
+
+ Temporary allocations are from SCRATCH_POOL.
This function almost duplicates svn_io_file_move(), but it tries to
guarantee a flush. */
svn_error_t *
-svn_fs_x__move_into_place(const char *old_filename,
- const char *new_filename,
- const char *perms_reference,
- apr_pool_t *scratch_pool);
-
-/* Like svn_fs_x__move_into_place but schedules fsync operations in BATCH.
- Also, OLD_FILENAME and NEW_FILENAME must point to the same volume. */
-svn_error_t *
svn_fs_x__move_into_place2(const char *old_filename,
const char *new_filename,
const char *perms_reference,