subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1506036 - in /subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs: fs_fs.c transaction.c util.c util.h
Date Tue, 23 Jul 2013 13:24:38 GMT
Author: stefan2
Date: Tue Jul 23 13:24:37 2013
New Revision: 1506036

URL: http://svn.apache.org/r1506036
Log:
On the fsfs-improvements branch:  Make two more path construction
utilities part of our internal FSFS API.

* subversion/libsvn_fs_fs/util.h
  (svn_fs_fs__path_txn_proto_rev_lock,
   svn_fs_fs__path_node_origin): declare as private API

* subversion/libsvn_fs_fs/util.c
  (svn_fs_fs__path_txn_proto_rev_lock): implementation taken from transaction.c
  (svn_fs_fs__path_node_origin): implementation taken from fs_fs.c

* subversion/libsvn_fs_fs/fs_fs.c
  (path_node_origin): code moved to utils.c
  (svn_fs_fs__get_node_origin,
   svn_fs_fs__set_node_origin): update caller

* subversion/libsvn_fs_fs/transaction.c
  (path_txn_proto_rev_lock): code moved to transaction.c
  (get_writable_proto_rev_body,
   svn_fs_fs__create_txn,
   svn_fs_fs__purge_txn): update callers

Modified:
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c?rev=1506036&r1=1506035&r2=1506036&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c Tue Jul 23 13:24:37
2013
@@ -142,16 +142,6 @@ path_lock(svn_fs_t *fs, apr_pool_t *pool
   return svn_dirent_join(fs->path, PATH_LOCK_FILE, pool);
 }
 
-static APR_INLINE const char *
-path_node_origin(svn_fs_t *fs, const char *node_id, apr_pool_t *pool)
-{
-  size_t len = strlen(node_id);
-  const char *node_id_minus_last_char =
-    (len == 1) ? "0" : apr_pstrmemdup(pool, node_id, len - 1);
-  return svn_dirent_join_many(pool, fs->path, PATH_NODE_ORIGINS_DIR,
-                              node_id_minus_last_char, NULL);
-}
-
 
 
 /* Get a lock on empty file LOCK_FILENAME, creating it in POOL. */
@@ -1219,7 +1209,8 @@ svn_fs_fs__get_node_origin(const svn_fs_
 
   *origin_id = NULL;
   SVN_ERR(get_node_origins_from_file(fs, &node_origins,
-                                     path_node_origin(fs, node_id, pool),
+                                     svn_fs_fs__path_node_origin(fs, node_id,
+                                                                 pool),
                                      pool));
   if (node_origins)
     {
@@ -1296,7 +1287,7 @@ svn_fs_fs__set_node_origin(svn_fs_t *fs,
                            apr_pool_t *pool)
 {
   svn_error_t *err;
-  const char *filename = path_node_origin(fs, node_id, pool);
+  const char *filename = svn_fs_fs__path_node_origin(fs, node_id, pool);
 
   err = set_node_origins_for_file(fs, filename,
                                   node_id,

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c?rev=1506036&r1=1506035&r2=1506036&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c Tue Jul 23
13:24:37 2013
@@ -76,20 +76,6 @@ path_txn_props(svn_fs_t *fs, const char 
 }
 
 static APR_INLINE const char *
-path_txn_proto_rev_lock(svn_fs_t *fs, const char *txn_id, apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  if (ffd->format >= SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
-    return svn_dirent_join_many(pool, fs->path, PATH_TXN_PROTOS_DIR,
-                                apr_pstrcat(pool, txn_id, PATH_EXT_REV_LOCK,
-                                            (char *)NULL),
-                                NULL);
-  else
-    return svn_dirent_join(svn_fs_fs__path_txn_dir(fs, txn_id, pool),
-                           PATH_REV_LOCK, pool);
-}
-
-static APR_INLINE const char *
 path_txn_next_ids(svn_fs_t *fs, const char *txn_id, apr_pool_t *pool)
 {
   return svn_dirent_join(svn_fs_fs__path_txn_dir(fs, txn_id, pool),
@@ -345,7 +331,7 @@ get_writable_proto_rev_body(svn_fs_t *fs
     apr_file_t *lockfile;
     apr_status_t apr_err;
     const char *lockfile_path
-      = path_txn_proto_rev_lock(fs, b->txn_id, pool);
+      = svn_fs_fs__path_txn_proto_rev_lock(fs, b->txn_id, pool);
 
     /* Open the proto-rev lockfile, creating it if necessary, as it may
        not exist if the transaction dates from before the lockfiles were
@@ -1039,8 +1025,9 @@ svn_fs_fs__create_txn(svn_fs_txn_t **txn
                                    pool));
 
   /* Create an empty rev-lock file. */
-  SVN_ERR(svn_io_file_create_empty(path_txn_proto_rev_lock(fs, txn->id, pool),
-                                   pool));
+  SVN_ERR(svn_io_file_create_empty(
+                    svn_fs_fs__path_txn_proto_rev_lock(fs, txn->id, pool),
+                    pool));
 
   /* Create an empty changes file. */
   SVN_ERR(svn_io_file_create_empty(path_txn_changes(fs, txn->id, pool), 
@@ -1332,8 +1319,9 @@ svn_fs_fs__purge_txn(svn_fs_t *fs,
       SVN_ERR(svn_io_remove_file2(
                   svn_fs_fs__path_txn_proto_rev(fs, txn_id, pool),
                   TRUE, pool));
-      SVN_ERR(svn_io_remove_file2(path_txn_proto_rev_lock(fs, txn_id, pool),
-                                  TRUE, pool));
+      SVN_ERR(svn_io_remove_file2(
+                  svn_fs_fs__path_txn_proto_rev_lock(fs, txn_id, pool),
+                  TRUE, pool));
     }
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c?rev=1506036&r1=1506035&r2=1506036&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c Tue Jul 23 13:24:37
2013
@@ -218,6 +218,22 @@ svn_fs_fs__path_txn_proto_rev(svn_fs_t *
 }
 
 const char *
+svn_fs_fs__path_txn_proto_rev_lock(svn_fs_t *fs,
+                                   const char *txn_id,
+                                   apr_pool_t *pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  if (ffd->format >= SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
+    return svn_dirent_join_many(pool, fs->path, PATH_TXN_PROTOS_DIR,
+                                apr_pstrcat(pool, txn_id, PATH_EXT_REV_LOCK,
+                                            (char *)NULL),
+                                NULL);
+  else
+    return svn_dirent_join(svn_fs_fs__path_txn_dir(fs, txn_id, pool),
+                           PATH_REV_LOCK, pool);
+}
+
+const char *
 svn_fs_fs__path_txn_node_rev(svn_fs_t *fs,
                              const svn_fs_id_t *id,
                              apr_pool_t *pool)
@@ -251,6 +267,15 @@ svn_fs_fs__path_txn_node_children(svn_fs
 }
 
 const char *
+svn_fs_fs__path_node_origin(svn_fs_t *fs,
+                            const char *node_id,
+                            apr_pool_t *pool)
+{
+  return svn_dirent_join_many(pool, fs->path, PATH_NODE_ORIGINS_DIR,
+                              node_id, NULL);
+}
+
+const char *
 svn_fs_fs__path_min_unpacked_rev(svn_fs_t *fs,
                                  apr_pool_t *pool)
 {

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h?rev=1506036&r1=1506035&r2=1506036&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h Tue Jul 23 13:24:37
2013
@@ -192,6 +192,14 @@ svn_fs_fs__path_txn_proto_rev(svn_fs_t *
                               const char *txn_id,
                               apr_pool_t *pool);
 
+/* Return the path of the proto-revision lock file for transaction TXN_ID
+ * in FS.  The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_txn_proto_rev_lock(svn_fs_t *fs,
+                                   const char *txn_id,
+                                   apr_pool_t *pool);
+
 /* Return the path of the file containing the in-transaction node revision
  * identified by ID in FS.  The result will be allocated in POOL.
  */
@@ -217,6 +225,14 @@ svn_fs_fs__path_txn_node_children(svn_fs
                                   const svn_fs_id_t *id,
                                   apr_pool_t *pool);
 
+/* Return the path of the file containing the node origins cachs for
+ * the given NODE_ID in FS.  The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_node_origin(svn_fs_t *fs,
+                            const char *node_id,
+                            apr_pool_t *pool);
+
 /* Set *MIN_UNPACKED_REV to the integer value read from the file returned
  * by #svn_fs_fs__path_min_unpacked_rev() for FS.
  * Use POOL for temporary allocations.



Mime
View raw message