You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/01/20 18:52:21 UTC

svn commit: r1653314 [6/20] - in /subversion/branches/move-tracking-2: ./ notes/ subversion/ subversion/bindings/swig/ subversion/bindings/swig/include/ subversion/bindings/swig/perl/native/ subversion/bindings/swig/perl/native/t/ subversion/bindings/s...

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c?rev=1653314&r1=1653313&r2=1653314&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c Tue Jan 20 17:52:18 2015
@@ -59,14 +59,17 @@
 
 /* Initialize the part of FS that requires global serialization across all
    instances.  The caller is responsible of ensuring that serialization.
-   Use COMMON_POOL for process-wide and POOL for temporary allocations. */
+   Use COMMON_POOL for process-wide and SCRATCH_POOL for temporary
+   allocations. */
 static svn_error_t *
-x_serialized_init(svn_fs_t *fs, apr_pool_t *common_pool, apr_pool_t *pool)
+x_serialized_init(svn_fs_t *fs,
+                  apr_pool_t *common_pool,
+                  apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   const char *key;
   void *val;
-  fs_x_shared_data_t *ffsd;
+  svn_fs_x__shared_data_t *ffsd;
   apr_status_t status;
 
   /* Note that we are allocating a small amount of long-lived data for
@@ -93,7 +96,7 @@ x_serialized_init(svn_fs_t *fs, apr_pool
   SVN_ERR_ASSERT(fs->uuid);
   SVN_ERR_ASSERT(ffd->instance_id);
 
-  key = apr_pstrcat(pool, SVN_FSX_SHARED_USERDATA_PREFIX,
+  key = apr_pstrcat(scratch_pool, SVN_FSX_SHARED_USERDATA_PREFIX,
                     fs->uuid, ":", ffd->instance_id, SVN_VA_NULL);
   status = apr_pool_userdata_get(&val, key, common_pool);
   if (status)
@@ -147,34 +150,35 @@ x_set_errcall(svn_fs_t *fs,
   return SVN_NO_ERROR;
 }
 
-struct x_freeze_baton_t {
+typedef struct x_freeze_baton_t {
   svn_fs_t *fs;
   svn_fs_freeze_func_t freeze_func;
   void *freeze_baton;
-};
+} x_freeze_baton_t;
 
 static svn_error_t *
 x_freeze_body(void *baton,
-              apr_pool_t *pool)
+              apr_pool_t *scratch_pool)
 {
-  struct x_freeze_baton_t *b = baton;
+  x_freeze_baton_t *b = baton;
   svn_boolean_t exists;
 
-  SVN_ERR(svn_fs_x__exists_rep_cache(&exists, b->fs, pool));
+  SVN_ERR(svn_fs_x__exists_rep_cache(&exists, b->fs, scratch_pool));
   if (exists)
-    SVN_ERR(svn_fs_x__lock_rep_cache(b->fs, pool));
+    SVN_ERR(svn_fs_x__lock_rep_cache(b->fs, scratch_pool));
 
-  SVN_ERR(b->freeze_func(b->freeze_baton, pool));
+  SVN_ERR(b->freeze_func(b->freeze_baton, scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 x_freeze_body2(void *baton,
-               apr_pool_t *pool)
+               apr_pool_t *scratch_pool)
 {
-  struct x_freeze_baton_t *b = baton;
-  SVN_ERR(svn_fs_x__with_write_lock(b->fs, x_freeze_body, baton, pool));
+  x_freeze_baton_t *b = baton;
+  SVN_ERR(svn_fs_x__with_write_lock(b->fs, x_freeze_body, baton,
+                                    scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -183,16 +187,16 @@ static svn_error_t *
 x_freeze(svn_fs_t *fs,
          svn_fs_freeze_func_t freeze_func,
          void *freeze_baton,
-         apr_pool_t *pool)
+         apr_pool_t *scratch_pool)
 {
-  struct x_freeze_baton_t b;
+  x_freeze_baton_t b;
 
   b.fs = fs;
   b.freeze_func = freeze_func;
   b.freeze_baton = freeze_baton;
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
-  SVN_ERR(svn_fs_x__with_pack_lock(fs, x_freeze_body2, &b, pool));
+  SVN_ERR(svn_fs_x__with_pack_lock(fs, x_freeze_body2, &b, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -203,7 +207,7 @@ x_info(const void **fsx_info,
        apr_pool_t *result_pool,
        apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   svn_fs_fsx_info_t *info = apr_palloc(result_pool, sizeof(*info));
   info->fs_type = SVN_FS_TYPE_FSX;
   info->shard_size = ffd->max_files_per_dir;
@@ -230,11 +234,26 @@ x_revision_proplist(apr_hash_t **proplis
 static svn_error_t *
 x_set_uuid(svn_fs_t *fs,
            const char *uuid,
-           apr_pool_t *pool)
+           apr_pool_t *scratch_pool)
 {
   /* Whenever we set a new UUID, imply that FS will also be a different
    * instance (on formats that support this). */
-  return svn_error_trace(svn_fs_x__set_uuid(fs, uuid, NULL, pool));
+  return svn_error_trace(svn_fs_x__set_uuid(fs, uuid, NULL, scratch_pool));
+}
+
+/* Wrapper around svn_fs_x__begin_txn() providing the scratch pool. */
+static svn_error_t *
+x_begin_txn(svn_fs_txn_t **txn_p,
+            svn_fs_t *fs,
+            svn_revnum_t rev,
+            apr_uint32_t flags,
+            apr_pool_t *pool)
+{
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
+  SVN_ERR(svn_fs_x__begin_txn(txn_p, fs, rev, flags, pool, scratch_pool));
+  svn_pool_destroy(scratch_pool);
+
+  return SVN_NO_ERROR;
 }
 
 
@@ -247,7 +266,7 @@ static fs_vtable_t fs_vtable = {
   svn_fs_x__change_rev_prop,
   x_set_uuid,
   svn_fs_x__revision_root,
-  svn_fs_x__begin_txn,
+  x_begin_txn,
   svn_fs_x__open_txn,
   svn_fs_x__purge_txn,
   svn_fs_x__list_transactions,
@@ -272,7 +291,7 @@ static fs_vtable_t fs_vtable = {
 static svn_error_t *
 initialize_fs_struct(svn_fs_t *fs)
 {
-  fs_x_data_t *ffd = apr_pcalloc(fs->pool, sizeof(*ffd));
+  svn_fs_x__data_t *ffd = apr_pcalloc(fs->pool, sizeof(*ffd));
   fs->vtable = &fs_vtable;
   fs->fsap_data = ffd;
   return SVN_NO_ERROR;
@@ -289,24 +308,26 @@ uninitialize_fs_struct(svn_fs_t *fs)
 
 /* This implements the fs_library_vtable_t.create() API.  Create a new
    fsx-backed Subversion filesystem at path PATH and link it into
-   *FS.  Perform temporary allocations in POOL, and fs-global allocations
+   *FS.
+
+   Perform temporary allocations in SCRATCH_POOL, and fs-global allocations
    in COMMON_POOL.  The latter must be serialized using COMMON_POOL_LOCK. */
 static svn_error_t *
 x_create(svn_fs_t *fs,
          const char *path,
          svn_mutex__t *common_pool_lock,
-         apr_pool_t *pool,
+         apr_pool_t *scratch_pool,
          apr_pool_t *common_pool)
 {
   SVN_ERR(svn_fs__check_fs(fs, FALSE));
 
   SVN_ERR(initialize_fs_struct(fs));
 
-  SVN_ERR(svn_fs_x__create(fs, path, pool));
+  SVN_ERR(svn_fs_x__create(fs, path, scratch_pool));
 
-  SVN_ERR(svn_fs_x__initialize_caches(fs, pool));
+  SVN_ERR(svn_fs_x__initialize_caches(fs, scratch_pool));
   SVN_MUTEX__WITH_LOCK(common_pool_lock,
-                       x_serialized_init(fs, common_pool, pool));
+                       x_serialized_init(fs, common_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -317,17 +338,17 @@ x_create(svn_fs_t *fs,
 
 /* This implements the fs_library_vtable_t.open() API.  Open an FSX
    Subversion filesystem located at PATH, set *FS to point to the
-   correct vtable for the filesystem.  Use POOL for any temporary
+   correct vtable for the filesystem.  Use SCRATCH_POOL for any temporary
    allocations, and COMMON_POOL for fs-global allocations.
    The latter must be serialized using COMMON_POOL_LOCK.  */
 static svn_error_t *
 x_open(svn_fs_t *fs,
        const char *path,
        svn_mutex__t *common_pool_lock,
-       apr_pool_t *pool,
+       apr_pool_t *scratch_pool,
        apr_pool_t *common_pool)
 {
-  apr_pool_t *subpool = svn_pool_create(pool);
+  apr_pool_t *subpool = svn_pool_create(scratch_pool);
 
   SVN_ERR(svn_fs__check_fs(fs, FALSE));
 
@@ -351,12 +372,12 @@ static svn_error_t *
 x_open_for_recovery(svn_fs_t *fs,
                     const char *path,
                     svn_mutex__t *common_pool_lock,
-                    apr_pool_t *pool,
+                    apr_pool_t *scratch_pool,
                     apr_pool_t *common_pool)
 {
   svn_error_t * err;
   svn_revnum_t youngest_rev;
-  apr_pool_t * subpool = svn_pool_create(pool);
+  apr_pool_t * subpool = svn_pool_create(scratch_pool);
 
   /* Recovery for FSFS is currently limited to recreating the 'current'
      file from the latest revision. */
@@ -403,7 +424,7 @@ x_open_for_recovery(svn_fs_t *fs,
   svn_pool_destroy(subpool);
 
   /* Now open the filesystem properly by calling the vtable method directly. */
-  return x_open(fs, path, common_pool_lock, pool, common_pool);
+  return x_open(fs, path, common_pool_lock, scratch_pool, common_pool);
 }
 
 
@@ -417,16 +438,17 @@ x_upgrade(svn_fs_t *fs,
           svn_cancel_func_t cancel_func,
           void *cancel_baton,
           svn_mutex__t *common_pool_lock,
-          apr_pool_t *pool,
+          apr_pool_t *scratch_pool,
           apr_pool_t *common_pool)
 {
-  SVN_ERR(x_open(fs, path, common_pool_lock, pool, common_pool));
+  SVN_ERR(x_open(fs, path, common_pool_lock, scratch_pool, common_pool));
   return svn_fs_x__upgrade(fs, notify_func, notify_baton,
-                           cancel_func, cancel_baton, pool);
+                           cancel_func, cancel_baton, scratch_pool);
 }
 
 static svn_error_t *
-x_verify(svn_fs_t *fs, const char *path,
+x_verify(svn_fs_t *fs,
+         const char *path,
          svn_revnum_t start,
          svn_revnum_t end,
          svn_fs_progress_notify_func_t notify_func,
@@ -434,12 +456,12 @@ x_verify(svn_fs_t *fs, const char *path,
          svn_cancel_func_t cancel_func,
          void *cancel_baton,
          svn_mutex__t *common_pool_lock,
-         apr_pool_t *pool,
+         apr_pool_t *scratch_pool,
          apr_pool_t *common_pool)
 {
-  SVN_ERR(x_open(fs, path, common_pool_lock, pool, common_pool));
+  SVN_ERR(x_open(fs, path, common_pool_lock, scratch_pool, common_pool));
   return svn_fs_x__verify(fs, start, end, notify_func, notify_baton,
-                          cancel_func, cancel_baton, pool);
+                          cancel_func, cancel_baton, scratch_pool);
 }
 
 static svn_error_t *
@@ -450,12 +472,12 @@ x_pack(svn_fs_t *fs,
        svn_cancel_func_t cancel_func,
        void *cancel_baton,
        svn_mutex__t *common_pool_lock,
-       apr_pool_t *pool,
+       apr_pool_t *scratch_pool,
        apr_pool_t *common_pool)
 {
-  SVN_ERR(x_open(fs, path, common_pool_lock, pool, common_pool));
+  SVN_ERR(x_open(fs, path, common_pool_lock, scratch_pool, common_pool));
   return svn_fs_x__pack(fs, notify_func, notify_baton,
-                        cancel_func, cancel_baton, pool);
+                        cancel_func, cancel_baton, scratch_pool);
 }
 
 
@@ -467,7 +489,8 @@ x_pack(svn_fs_t *fs,
    re-copy data which already exists in DST_FS.
    The CLEAN_LOGS argument is ignored and included for Subversion
    1.0.x compatibility.  The NOTIFY_FUNC and NOTIFY_BATON arguments
-   are also currently ignored.  Perform all temporary allocations in POOL. */
+   are also currently ignored.
+   Perform all temporary allocations in SCRATCH_POOL. */
 static svn_error_t *
 x_hotcopy(svn_fs_t *src_fs,
           svn_fs_t *dst_fs,
@@ -480,11 +503,12 @@ x_hotcopy(svn_fs_t *src_fs,
           svn_cancel_func_t cancel_func,
           void *cancel_baton,
           svn_mutex__t *common_pool_lock,
-          apr_pool_t *pool,
+          apr_pool_t *scratch_pool,
           apr_pool_t *common_pool)
 {
   /* Open the source repo as usual. */
-  SVN_ERR(x_open(src_fs, src_path, common_pool_lock, pool, common_pool));
+  SVN_ERR(x_open(src_fs, src_path, common_pool_lock, scratch_pool,
+                 common_pool));
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
 
@@ -493,18 +517,19 @@ x_hotcopy(svn_fs_t *src_fs,
    * available. */
   SVN_ERR(initialize_fs_struct(dst_fs));
   SVN_ERR(svn_fs_x__hotcopy_prepare_target(src_fs, dst_fs, dst_path,
-                                           incremental, pool));
+                                           incremental, scratch_pool));
   uninitialize_fs_struct(dst_fs);
 
   /* Now, the destination repo should open just fine. */
-  SVN_ERR(x_open(dst_fs, dst_path, common_pool_lock, pool, common_pool));
+  SVN_ERR(x_open(dst_fs, dst_path, common_pool_lock, scratch_pool,
+                 common_pool));
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
 
   /* Now, we may copy data as needed ... */
   return svn_fs_x__hotcopy(src_fs, dst_fs, incremental,
                            notify_func, notify_baton,
-                           cancel_func, cancel_baton, pool);
+                           cancel_func, cancel_baton, scratch_pool);
 }
 
 
@@ -529,13 +554,14 @@ x_logfiles(apr_array_header_t **logfiles
 
 
 /* Delete the filesystem located at path PATH.  Perform any temporary
-   allocations in POOL. */
+   allocations in SCRATCH_POOL. */
 static svn_error_t *
 x_delete_fs(const char *path,
-            apr_pool_t *pool)
+            apr_pool_t *scratch_pool)
 {
   /* Remove everything. */
-  return svn_error_trace(svn_io_remove_dir2(path, FALSE, NULL, NULL, pool));
+  return svn_error_trace(svn_io_remove_dir2(path, FALSE, NULL, NULL,
+                                            scratch_pool));
 }
 
 static const svn_version_t *
@@ -558,7 +584,7 @@ x_set_svn_fs_open(svn_fs_t *fs,
                                                apr_pool_t *,
                                                apr_pool_t *))
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   ffd->svn_fs_open_ = svn_fs_open_;
   return SVN_NO_ERROR;
 }
@@ -595,12 +621,14 @@ static fs_library_vtable_t library_vtabl
 
 svn_error_t *
 svn_fs_x__init(const svn_version_t *loader_version,
-               fs_library_vtable_t **vtable, apr_pool_t* common_pool)
+               fs_library_vtable_t **vtable,
+               apr_pool_t* common_pool)
 {
   static const svn_version_checklist_t checklist[] =
     {
       { "svn_subr",  svn_subr_version },
       { "svn_delta", svn_delta_version },
+      { "svn_fs_util", svn_fs_util__version },
       { NULL, NULL }
     };
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h?rev=1653314&r1=1653313&r2=1653314&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h Tue Jan 20 17:52:18 2015
@@ -140,11 +140,11 @@ extern "C" {
    relate to a particular transaction in a filesystem (as identified
    by transaction id and filesystem UUID).  Objects of this type are
    allocated in their own subpool of the common pool. */
-typedef struct fs_x_shared_txn_data_t
+typedef struct svn_fs_x__shared_txn_data_t
 {
   /* The next transaction in the list, or NULL if there is no following
      transaction. */
-  struct fs_x_shared_txn_data_t *next;
+  struct svn_fs_x__shared_txn_data_t *next;
 
   /* ID of this transaction. */
   svn_fs_x__txn_id_t txn_id;
@@ -158,22 +158,22 @@ typedef struct fs_x_shared_txn_data_t
   /* The pool in which this object has been allocated; a subpool of the
      common pool. */
   apr_pool_t *pool;
-} fs_x_shared_txn_data_t;
+} svn_fs_x__shared_txn_data_t;
 
 /* Private FSX-specific data shared between all svn_fs_t objects that
    relate to a particular filesystem, as identified by filesystem UUID.
    Objects of this type are allocated in the common pool. */
-typedef struct fs_x_shared_data_t
+typedef struct svn_fs_x__shared_data_t
 {
   /* A list of shared transaction objects for each transaction that is
      currently active, or NULL if none are.  All access to this list,
      including the contents of the objects stored in it, is synchronised
      under TXN_LIST_LOCK. */
-  fs_x_shared_txn_data_t *txns;
+  svn_fs_x__shared_txn_data_t *txns;
 
   /* A free transaction object, or NULL if there is no free object.
      Access to this object is synchronised under TXN_LIST_LOCK. */
-  fs_x_shared_txn_data_t *free_txn;
+  svn_fs_x__shared_txn_data_t *free_txn;
 
   /* The following lock must be taken out in reverse order of their
      declaration here.  Any subset may be acquired and held at any given
@@ -199,41 +199,43 @@ typedef struct fs_x_shared_data_t
   /* The common pool, under which this object is allocated, subpools
      of which are used to allocate the transaction objects. */
   apr_pool_t *common_pool;
-} fs_x_shared_data_t;
+} svn_fs_x__shared_data_t;
 
 /* Data structure for the 1st level DAG node cache. */
-typedef struct fs_x_dag_cache_t fs_x_dag_cache_t;
+typedef struct svn_fs_x__dag_cache_t svn_fs_x__dag_cache_t;
 
 /* Key type for all caches that use revision + offset / counter as key.
 
    Note: Cache keys should be 16 bytes for best performance and there
          should be no padding. */
-typedef struct pair_cache_key_t
+typedef struct svn_fs_x__pair_cache_key_t
 {
   /* The object's revision.  Use the 64 data type to prevent padding. */
   apr_int64_t revision;
 
   /* Sub-address: item index, revprop generation, packed flag, etc. */
   apr_int64_t second;
-} pair_cache_key_t;
+} svn_fs_x__pair_cache_key_t;
 
-/* Key type that identifies a representation / rep header. */
-typedef struct representation_cache_key_t
+/* Key type that identifies a representation / rep header.
+
+   Note: Cache keys should require no padding. */
+typedef struct svn_fs_x__representation_cache_key_t
 {
   /* Revision that contains the representation */
-  svn_revnum_t revision;
+  apr_int64_t revision;
 
-  /* Packed or non-packed representation? */
-  svn_boolean_t is_packed;
+  /* Packed or non-packed representation (boolean)? */
+  apr_int64_t is_packed;
 
   /* Item index of the representation */
   apr_uint64_t item_index;
-} representation_cache_key_t;
+} svn_fs_x__representation_cache_key_t;
 
 /* Key type that identifies a txdelta window.
 
    Note: Cache keys should require no padding. */
-typedef struct window_cache_key_t
+typedef struct svn_fs_x__window_cache_key_t
 {
   /* The object's revision.  Use the 64 data type to prevent padding. */
   apr_int64_t revision;
@@ -243,11 +245,11 @@ typedef struct window_cache_key_t
 
   /* Item index of the representation */
   apr_uint64_t item_index;
-} window_cache_key_t;
+} svn_fs_x__window_cache_key_t;
 
 /* Private (non-shared) FSX-specific data for each svn_fs_t object.
    Any caches in here may be NULL. */
-typedef struct fs_x_data_t
+typedef struct svn_fs_x__data_t
 {
   /* The format number of this FS. */
   int format;
@@ -279,12 +281,8 @@ typedef struct fs_x_data_t
      e.g. memcached may be ignored as caching is an optional feature. */
   svn_boolean_t fail_stop;
 
-  /* A cache of revision root IDs, mapping from (svn_revnum_t *) to
-     (svn_fs_id_t *).  (Not threadsafe.) */
-  svn_cache__t *rev_root_id_cache;
-
   /* Caches native dag_node_t* instances and acts as a 1st level cache */
-  fs_x_dag_cache_t *dag_node_cache;
+  svn_fs_x__dag_cache_t *dag_node_cache;
 
   /* DAG node cache for immutable nodes.  Maps (revision, fspath)
      to (dag_node_t *). This is the 2nd level cache for DAG nodes. */
@@ -292,7 +290,7 @@ typedef struct fs_x_data_t
 
   /* A cache of the contents of immutable directories; maps from
      unparsed FS ID to a apr_hash_t * mapping (const char *) dirent
-     names to (svn_fs_dirent_t *). */
+     names to (svn_fs_x__dirent_t *). */
   svn_cache__t *dir_cache;
 
   /* Fulltext cache; currently only used with memcached.  Maps from
@@ -315,11 +313,12 @@ typedef struct fs_x_data_t
      respective pack file. */
   svn_cache__t *packed_offset_cache;
 
-  /* Cache for txdelta_window_t objects; the key is window_cache_key_t */
+  /* Cache for txdelta_window_t objects;
+   * the key is svn_fs_x__window_cache_key_t */
   svn_cache__t *txdelta_window_cache;
 
   /* Cache for combined windows as svn_stringbuf_t objects;
-     the key is window_cache_key_t */
+     the key is svn_fs_x__window_cache_key_t */
   svn_cache__t *combined_window_cache;
 
   /* Cache for svn_fs_x__rep_header_t objects;
@@ -330,8 +329,8 @@ typedef struct fs_x_data_t
      the key is a (pack file revision, file offset) pair */
   svn_cache__t *noderevs_container_cache;
 
-  /* Cache for change lists as APR arrays of change_t * objects; the key
-     is the revision */
+  /* Cache for change lists as APR arrays of svn_fs_x__change_t * objects;
+     the key is the revision */
   svn_cache__t *changes_cache;
 
   /* Cache for change_list_t containers;
@@ -376,7 +375,7 @@ typedef struct fs_x_data_t
   svn_boolean_t has_write_lock;
 
   /* Data shared between all svn_fs_t objects for a given filesystem. */
-  fs_x_shared_data_t *shared;
+  svn_fs_x__shared_data_t *shared;
 
   /* The sqlite database used for rep caching. */
   svn_sqlite__db_t *rep_cache_db;
@@ -421,34 +420,30 @@ typedef struct fs_x_data_t
   /* Pointer to svn_fs_open. */
   svn_error_t *(*svn_fs_open_)(svn_fs_t **, const char *, apr_hash_t *,
                                apr_pool_t *, apr_pool_t *);
-} fs_x_data_t;
+} svn_fs_x__data_t;
 
 
 /*** Filesystem Transaction ***/
-typedef struct transaction_t
+typedef struct svn_fs_x__transaction_t
 {
   /* property list (const char * name, svn_string_t * value).
      may be NULL if there are no properties.  */
   apr_hash_t *proplist;
 
-  /* node revision id of the root node.  */
-  const svn_fs_id_t *root_id;
-
-  /* node revision id of the node which is the root of the revision
-     upon which this txn is base.  (unfinished only) */
-  const svn_fs_id_t *base_id;
+  /* revision upon which this txn is base.  (unfinished only) */
+  svn_revnum_t base_rev;
 
   /* copies list (const char * copy_ids), or NULL if there have been
      no copies in this transaction.  */
   apr_array_header_t *copies;
 
-} transaction_t;
+} svn_fs_x__transaction_t;
 
 
 /*** Representation ***/
 /* If you add fields to this, check to see if you need to change
  * svn_fs_x__rep_copy. */
-typedef struct representation_t
+typedef struct svn_fs_x__representation_t
 {
   /* Checksums digests for the contents produced by this representation.
      This checksum is for the contents the rep shows to consumers,
@@ -466,7 +461,7 @@ typedef struct representation_t
   unsigned char md5_digest[APR_MD5_DIGESTSIZE];
 
   /* Change set and item number where this representation is located. */
-  svn_fs_x__id_part_t id;
+  svn_fs_x__id_t id;
 
   /* The size of the representation in bytes as seen in the revision
      file. */
@@ -475,23 +470,26 @@ typedef struct representation_t
   /* The size of the fulltext of the representation. */
   svn_filesize_t expanded_size;
 
-} representation_t;
+} svn_fs_x__representation_t;
 
 
 /*** Node-Revision ***/
 /* If you add fields to this, check to see if you need to change
  * copy_node_revision in dag.c. */
-typedef struct node_revision_t
+typedef struct svn_fs_x__noderev_t
 {
-  /* node kind */
-  svn_node_kind_t kind;
+  /* Predecessor node revision id.  Will be "unused" if there is no
+     predecessor for this node revision. */
+  svn_fs_x__id_t predecessor_id;
 
-  /* The node-id for this node-rev. */
-  const svn_fs_id_t *id;
+  /* The ID of this noderev */
+  svn_fs_x__id_t noderev_id;
 
-  /* predecessor node revision id, or NULL if there is no predecessor
-     for this node revision */
-  const svn_fs_id_t *predecessor_id;
+  /* Identifier of the node that this noderev belongs to. */
+  svn_fs_x__id_t node_id;
+
+  /* Copy identifier of this line of history. */
+  svn_fs_x__id_t copy_id;
 
   /* If this node-rev is a copy, where was it copied from? */
   const char *copyfrom_path;
@@ -502,17 +500,19 @@ typedef struct node_revision_t
   svn_revnum_t copyroot_rev;
   const char *copyroot_path;
 
-  /* number of predecessors this node revision has (recursively), or
-     -1 if not known (for backward compatibility). */
+  /* node kind */
+  svn_node_kind_t kind;
+
+  /* number of predecessors this node revision has (recursively). */
   int predecessor_count;
 
   /* representation key for this node's properties.  may be NULL if
      there are no properties.  */
-  representation_t *prop_rep;
+  svn_fs_x__representation_t *prop_rep;
 
   /* representation for this node's data.  may be NULL if there is
      no data. */
-  representation_t *data_rep;
+  svn_fs_x__representation_t *data_rep;
 
   /* path at which this node first came into existence.  */
   const char *created_path;
@@ -520,25 +520,54 @@ typedef struct node_revision_t
   /* is this the unmodified root of a transaction? */
   svn_boolean_t is_fresh_txn_root;
 
+  /* Does this node itself have svn:mergeinfo? */
+  svn_boolean_t has_mergeinfo;
+
   /* Number of nodes with svn:mergeinfo properties that are
      descendants of this node (including it itself) */
   apr_int64_t mergeinfo_count;
 
-  /* Does this node itself have svn:mergeinfo? */
-  svn_boolean_t has_mergeinfo;
+} svn_fs_x__noderev_t;
 
-} node_revision_t;
+
+/** The type of a directory entry.  */
+typedef struct svn_fs_x__dirent_t
+{
+
+  /** The name of this directory entry.  */
+  const char *name;
+
+  /** The node revision ID it names.  */
+  svn_fs_x__id_t id;
+
+  /** The node kind. */
+  svn_node_kind_t kind;
+} svn_fs_x__dirent_t;
 
 
 /*** Change ***/
-typedef struct change_t
+typedef struct svn_fs_x__change_t
 {
   /* Path of the change. */
   svn_string_t path;
 
-  /* API compatible change description */
-  svn_fs_path_change2_t info;
-} change_t;
+  /* node revision id of changed path */
+  svn_fs_x__id_t noderev_id;
+
+  /* See svn_fs_path_change2_t for a description for the remaining elements.
+   */
+  svn_fs_path_change_kind_t change_kind;
+
+  svn_boolean_t text_mod;
+  svn_boolean_t prop_mod;
+  svn_node_kind_t node_kind;
+
+  svn_boolean_t copyfrom_known;
+  svn_revnum_t copyfrom_rev;
+  const char *copyfrom_path;
+
+  svn_tristate_t mergeinfo_mod;
+} svn_fs_x__change_t;
 
 
 #ifdef __cplusplus

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c?rev=1653314&r1=1653313&r2=1653314&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c Tue Jan 20 17:52:18 2015
@@ -76,13 +76,15 @@
 /* Check that BUF, a nul-terminated buffer of text from format file PATH,
    contains only digits at OFFSET and beyond, raising an error if not.
 
-   Uses POOL for temporary allocation. */
+   Uses SCRATCH_POOL for temporary allocation. */
 static svn_error_t *
-check_format_file_buffer_numeric(const char *buf, apr_off_t offset,
-                                 const char *path, apr_pool_t *pool)
+check_format_file_buffer_numeric(const char *buf,
+                                 apr_off_t offset,
+                                 const char *path,
+                                 apr_pool_t *scratch_pool)
 {
   return svn_fs_x__check_file_buffer_numeric(buf, offset, path, "Format",
-                                             pool);
+                                             scratch_pool);
 }
 
 /* Return the error SVN_ERR_FS_UNSUPPORTED_FORMAT if FS's format
@@ -102,45 +104,51 @@ check_format(int format)
      SVN_FS_X__FORMAT_NUMBER, format);
 }
 
+/* Read the format file at PATH and set *PFORMAT to the format version found
+ * and *MAX_FILES_PER_DIR to the shard size.  Use SCRATCH_POOL for temporary
+ * allocations. */
 static svn_error_t *
-read_format(int *pformat, int *max_files_per_dir,
-            const char *path, apr_pool_t *pool)
+read_format(int *pformat,
+            int *max_files_per_dir,
+            const char *path,
+            apr_pool_t *scratch_pool)
 {
   svn_stream_t *stream;
   svn_stringbuf_t *content;
   svn_stringbuf_t *buf;
   svn_boolean_t eos = FALSE;
 
-  SVN_ERR(svn_stringbuf_from_file2(&content, path, pool));
-  stream = svn_stream_from_stringbuf(content, pool);
-  SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, pool));
+  SVN_ERR(svn_stringbuf_from_file2(&content, path, scratch_pool));
+  stream = svn_stream_from_stringbuf(content, scratch_pool);
+  SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, scratch_pool));
   if (buf->len == 0 && eos)
     {
       /* Return a more useful error message. */
       return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
                                _("Can't read first line of format file '%s'"),
-                               svn_dirent_local_style(path, pool));
+                               svn_dirent_local_style(path, scratch_pool));
     }
 
   /* Check that the first line contains only digits. */
-  SVN_ERR(check_format_file_buffer_numeric(buf->data, 0, path, pool));
+  SVN_ERR(check_format_file_buffer_numeric(buf->data, 0, path, scratch_pool));
   SVN_ERR(svn_cstring_atoi(pformat, buf->data));
 
   /* Check that we support this format at all */
   SVN_ERR(check_format(*pformat));
 
   /* Read any options. */
-  SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, pool));
+  SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eos, scratch_pool));
   if (!eos && strncmp(buf->data, "layout sharded ", 15) == 0)
     {
       /* Check that the argument is numeric. */
-      SVN_ERR(check_format_file_buffer_numeric(buf->data, 15, path, pool));
+      SVN_ERR(check_format_file_buffer_numeric(buf->data, 15, path,
+                                               scratch_pool));
       SVN_ERR(svn_cstring_atoi(max_files_per_dir, buf->data + 15));
     }
   else
     return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
                   _("'%s' contains invalid filesystem format option '%s'"),
-                  svn_dirent_local_style(path, pool), buf->data);
+                  svn_dirent_local_style(path, scratch_pool), buf->data);
 
   return SVN_NO_ERROR;
 }
@@ -149,20 +157,21 @@ read_format(int *pformat, int *max_files
    to a new format file in PATH, possibly expecting to overwrite a
    previously existing file.
 
-   Use POOL for temporary allocation. */
+   Use SCRATCH_POOL for temporary allocation. */
 svn_error_t *
 svn_fs_x__write_format(svn_fs_t *fs,
                        svn_boolean_t overwrite,
-                       apr_pool_t *pool)
+                       apr_pool_t *scratch_pool)
 {
   svn_stringbuf_t *sb;
-  const char *path = svn_fs_x__path_format(fs, pool);
-  fs_x_data_t *ffd = fs->fsap_data;
+  const char *path = svn_fs_x__path_format(fs, scratch_pool);
+  svn_fs_x__data_t *ffd = fs->fsap_data;
 
   SVN_ERR_ASSERT(1 <= ffd->format && ffd->format <= SVN_FS_X__FORMAT_NUMBER);
 
-  sb = svn_stringbuf_createf(pool, "%d\n", ffd->format);
-  svn_stringbuf_appendcstr(sb, apr_psprintf(pool, "layout sharded %d\n",
+  sb = svn_stringbuf_createf(scratch_pool, "%d\n", ffd->format);
+  svn_stringbuf_appendcstr(sb, apr_psprintf(scratch_pool,
+                                            "layout sharded %d\n",
                                             ffd->max_files_per_dir));
 
   /* svn_io_write_version_file() does a load of magic to allow it to
@@ -171,16 +180,16 @@ svn_fs_x__write_format(svn_fs_t *fs,
   if (! overwrite)
     {
       /* Create the file */
-      SVN_ERR(svn_io_file_create(path, sb->data, pool));
+      SVN_ERR(svn_io_file_create(path, sb->data, scratch_pool));
     }
   else
     {
       SVN_ERR(svn_io_write_atomic(path, sb->data, sb->len,
-                                  NULL /* copy_perms_path */, pool));
+                                  NULL /* copy_perms_path */, scratch_pool));
     }
 
   /* And set the perms to make it read only */
-  return svn_io_set_file_read_only(path, FALSE, pool);
+  return svn_io_set_file_read_only(path, FALSE, scratch_pool);
 }
 
 /* Check that BLOCK_SIZE is a valid block / page size, i.e. it is within
@@ -192,8 +201,7 @@ static svn_error_t *
 verify_block_size(apr_int64_t block_size,
                   apr_size_t item_size,
                   const char *name,
-                  apr_pool_t *scratch_pool
-                 )
+                  apr_pool_t *scratch_pool)
 {
   /* Limit range. */
   if (block_size <= 0)
@@ -231,7 +239,7 @@ verify_block_size(apr_int64_t block_size
  * and set the respective values in FFD.  Use pools as usual.
  */
 static svn_error_t *
-read_config(fs_x_data_t *ffd,
+read_config(svn_fs_x__data_t *ffd,
             const char *fs_path,
             apr_pool_t *result_pool,
             apr_pool_t *scratch_pool)
@@ -325,9 +333,11 @@ read_config(fs_x_data_t *ffd,
   return SVN_NO_ERROR;
 }
 
+/* Write FS' initial configuration file.
+ * Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
 write_config(svn_fs_t *fs,
-             apr_pool_t *pool)
+             apr_pool_t *scratch_pool)
 {
 #define NL APR_EOL_STR
   static const char * const fsx_conf_contents =
@@ -504,8 +514,9 @@ write_config(svn_fs_t *fs,
 "# " CONFIG_OPTION_P2L_PAGE_SIZE " = 1024"                                   NL
 ;
 #undef NL
-  return svn_io_file_create(svn_dirent_join(fs->path, PATH_CONFIG, pool),
-                            fsx_conf_contents, pool);
+  return svn_io_file_create(svn_dirent_join(fs->path, PATH_CONFIG,
+                                            scratch_pool),
+                            fsx_conf_contents, scratch_pool);
 }
 
 /* Read FS's UUID file and store the data in the FS struct. */
@@ -513,7 +524,7 @@ static svn_error_t *
 read_uuid(svn_fs_t *fs,
           apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   apr_file_t *uuid_file;
   char buf[APR_UUID_FORMATTED_LENGTH + 2];
   apr_size_t limit;
@@ -542,7 +553,7 @@ svn_error_t *
 svn_fs_x__read_format_file(svn_fs_t *fs,
                            apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   int format, max_files_per_dir;
 
   /* Read info from format file. */
@@ -557,48 +568,59 @@ svn_fs_x__read_format_file(svn_fs_t *fs,
 }
 
 svn_error_t *
-svn_fs_x__open(svn_fs_t *fs, const char *path, apr_pool_t *pool)
+svn_fs_x__open(svn_fs_t *fs,
+               const char *path,
+               apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   fs->path = apr_pstrdup(fs->pool, path);
 
   /* Read the FS format file. */
-  SVN_ERR(svn_fs_x__read_format_file(fs, pool));
+  SVN_ERR(svn_fs_x__read_format_file(fs, scratch_pool));
 
   /* Read in and cache the repository uuid. */
-  SVN_ERR(read_uuid(fs, pool));
+  SVN_ERR(read_uuid(fs, scratch_pool));
 
   /* Read the min unpacked revision. */
-  SVN_ERR(svn_fs_x__update_min_unpacked_rev(fs, pool));
+  SVN_ERR(svn_fs_x__update_min_unpacked_rev(fs, scratch_pool));
 
   /* Read the configuration file. */
-  SVN_ERR(read_config(ffd, fs->path, fs->pool, pool));
+  SVN_ERR(read_config(ffd, fs->path, fs->pool, scratch_pool));
 
   return svn_error_trace(svn_fs_x__read_current(&ffd->youngest_rev_cache,
-                                                fs, pool));
+                                                fs, scratch_pool));
 }
 
 /* Baton type bridging svn_fs_x__upgrade and upgrade_body carrying 
  * parameters over between them. */
-struct upgrade_baton_t
+typedef struct upgrade_baton_t
 {
   svn_fs_t *fs;
   svn_fs_upgrade_notify_t notify_func;
   void *notify_baton;
   svn_cancel_func_t cancel_func;
   void *cancel_baton;
-};
+} upgrade_baton_t;
 
+/* Upgrade the FS given in upgrade_baton_t *)BATON to the latest format
+ * version.  Apply options an invoke callback from that BATON.
+ * Temporary allocations are to be made from SCRATCH_POOL.
+ *
+ * At the moment, this is a simple placeholder as we don't support upgrades
+ * from experimental FSX versions.
+ */
 static svn_error_t *
-upgrade_body(void *baton, apr_pool_t *pool)
+upgrade_body(void *baton,
+             apr_pool_t *scratch_pool)
 {
-  struct upgrade_baton_t *upgrade_baton = baton;
+  upgrade_baton_t *upgrade_baton = baton;
   svn_fs_t *fs = upgrade_baton->fs;
   int format, max_files_per_dir;
-  const char *format_path = svn_fs_x__path_format(fs, pool);
+  const char *format_path = svn_fs_x__path_format(fs, scratch_pool);
 
   /* Read the FS format number and max-files-per-dir setting. */
-  SVN_ERR(read_format(&format, &max_files_per_dir, format_path, pool));
+  SVN_ERR(read_format(&format, &max_files_per_dir, format_path,
+                      scratch_pool));
 
   /* If we're already up-to-date, there's nothing else to be done here. */
   if (format == SVN_FS_X__FORMAT_NUMBER)
@@ -615,26 +637,27 @@ svn_fs_x__upgrade(svn_fs_t *fs,
                   void *notify_baton,
                   svn_cancel_func_t cancel_func,
                   void *cancel_baton,
-                  apr_pool_t *pool)
+                  apr_pool_t *scratch_pool)
 {
-  struct upgrade_baton_t baton;
+  upgrade_baton_t baton;
   baton.fs = fs;
   baton.notify_func = notify_func;
   baton.notify_baton = notify_baton;
   baton.cancel_func = cancel_func;
   baton.cancel_baton = cancel_baton;
   
-  return svn_fs_x__with_all_locks(fs, upgrade_body, (void *)&baton, pool);
+  return svn_fs_x__with_all_locks(fs, upgrade_body, (void *)&baton,
+                                  scratch_pool);
 }
 
 
 svn_error_t *
 svn_fs_x__youngest_rev(svn_revnum_t *youngest_p,
                        svn_fs_t *fs,
-                       apr_pool_t *pool)
+                       apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
-  SVN_ERR(svn_fs_x__read_current(youngest_p, fs, pool));
+  svn_fs_x__data_t *ffd = fs->fsap_data;
+  SVN_ERR(svn_fs_x__read_current(youngest_p, fs, scratch_pool));
   ffd->youngest_rev_cache = *youngest_p;
 
   return SVN_NO_ERROR;
@@ -643,9 +666,9 @@ svn_fs_x__youngest_rev(svn_revnum_t *you
 svn_error_t *
 svn_fs_x__ensure_revision_exists(svn_revnum_t rev,
                                  svn_fs_t *fs,
-                                 apr_pool_t *pool)
+                                 apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
 
   if (! SVN_IS_VALID_REVNUM(rev))
     return svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
@@ -657,7 +680,7 @@ svn_fs_x__ensure_revision_exists(svn_rev
   if (rev <= ffd->youngest_rev_cache)
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_fs_x__read_current(&ffd->youngest_rev_cache, fs, pool));
+  SVN_ERR(svn_fs_x__read_current(&ffd->youngest_rev_cache, fs, scratch_pool));
 
   /* Check again. */
   if (rev <= ffd->youngest_rev_cache)
@@ -681,8 +704,7 @@ svn_fs_x__revision_proplist(apr_hash_t *
 
 svn_error_t *
 svn_fs_x__file_length(svn_filesize_t *length,
-                      node_revision_t *noderev,
-                      apr_pool_t *pool)
+                      svn_fs_x__noderev_t *noderev)
 {
   if (noderev->data_rep)
     *length = noderev->data_rep->expanded_size;
@@ -693,8 +715,8 @@ svn_fs_x__file_length(svn_filesize_t *le
 }
 
 svn_boolean_t
-svn_fs_x__file_text_rep_equal(representation_t *a,
-                              representation_t *b)
+svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a,
+                              svn_fs_x__representation_t *b)
 {
   svn_boolean_t a_empty = a == NULL || a->expanded_size == 0;
   svn_boolean_t b_empty = b == NULL || b->expanded_size == 0;
@@ -708,7 +730,7 @@ svn_fs_x__file_text_rep_equal(representa
 
   /* Same physical representation?  Note that these IDs are always up-to-date
      instead of e.g. being set lazily. */
-  if (svn_fs_x__id_part_eq(&a->id, &b->id))
+  if (svn_fs_x__id_eq(&a->id, &b->id))
     return TRUE;
 
   /* Contents are equal if the checksums match.  These are also always known.
@@ -720,13 +742,13 @@ svn_fs_x__file_text_rep_equal(representa
 svn_error_t *
 svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
                          svn_fs_t *fs,
-                         node_revision_t *a,
-                         node_revision_t *b,
+                         svn_fs_x__noderev_t *a,
+                         svn_fs_x__noderev_t *b,
                          svn_boolean_t strict,
                          apr_pool_t *scratch_pool)
 {
-  representation_t *rep_a = a->prop_rep;
-  representation_t *rep_b = b->prop_rep;
+  svn_fs_x__representation_t *rep_a = a->prop_rep;
+  svn_fs_x__representation_t *rep_b = b->prop_rep;
   apr_hash_t *proplist_a;
   apr_hash_t *proplist_b;
 
@@ -750,7 +772,7 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
     }
 
   /* Same path in same txn? */
-  if (svn_fs_x__id_eq(a->id, b->id))
+  if (svn_fs_x__id_eq(&a->noderev_id, &b->noderev_id))
     {
       *equal = TRUE;
       return SVN_NO_ERROR;
@@ -766,8 +788,10 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
 
   /* At least one of the reps has been modified in a txn.
      Fetch and compare them. */
-  SVN_ERR(svn_fs_x__get_proplist(&proplist_a, fs, a, scratch_pool));
-  SVN_ERR(svn_fs_x__get_proplist(&proplist_b, fs, b, scratch_pool));
+  SVN_ERR(svn_fs_x__get_proplist(&proplist_a, fs, a, scratch_pool,
+                                 scratch_pool));
+  SVN_ERR(svn_fs_x__get_proplist(&proplist_b, fs, b, scratch_pool,
+                                 scratch_pool));
 
   *equal = svn_fs__prop_lists_equal(proplist_a, proplist_b, scratch_pool);
   return SVN_NO_ERROR;
@@ -776,9 +800,9 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
 
 svn_error_t *
 svn_fs_x__file_checksum(svn_checksum_t **checksum,
-                        node_revision_t *noderev,
+                        svn_fs_x__noderev_t *noderev,
                         svn_checksum_kind_t kind,
-                        apr_pool_t *pool)
+                        apr_pool_t *result_pool)
 {
   *checksum = NULL;
 
@@ -804,26 +828,20 @@ svn_fs_x__file_checksum(svn_checksum_t *
             return SVN_NO_ERROR;
         }
 
-      *checksum = svn_checksum_dup(&temp, pool);
+      *checksum = svn_checksum_dup(&temp, result_pool);
     }
 
   return SVN_NO_ERROR;
 }
 
-representation_t *
-svn_fs_x__rep_copy(representation_t *rep,
-                   apr_pool_t *pool)
+svn_fs_x__representation_t *
+svn_fs_x__rep_copy(svn_fs_x__representation_t *rep,
+                   apr_pool_t *result_pool)
 {
-  representation_t *rep_new;
-
   if (rep == NULL)
     return NULL;
 
-  rep_new = apr_palloc(pool, sizeof(*rep_new));
-
-  memcpy(rep_new, rep, sizeof(*rep_new));
-
-  return rep_new;
+  return apr_pmemdup(result_pool, rep, sizeof(*rep));
 }
 
 
@@ -845,41 +863,31 @@ write_revision_zero(svn_fs_t *fs,
   svn_fs_x__revision_file_t *rev_file;
   const char *l2p_proto_index, *p2l_proto_index;
 
-  /* Write a skeleton r0 with no indexes. */
-  SVN_ERR(svn_io_file_create_binary
-              (path_revision_zero,
-               "DELTA\nSVN\1" /* txdelta v1 */
-                 "\0\0\4\2\5" /* sview offset, sview len,
-                                 tview len, instr len, newlen */
-                 "\1\x84"     /* 1 instr byte, new 4 bytes */
-                 "\4END\n"    /* 4 new bytes, E, N, D, \n */
-                 "ENDREP\n"
-               "id: 0+0.0+0.2+0\n"
-               "type: dir\n"
-               "count: 0\n"
-               "text: 0 3 16 4 "
-               "2d2977d1c96f487abe4a1e202dd03b4e\n"
-               "cpath: /\n"
-               "\n\n",
-               0x7b, subpool));
+  /* Construct a skeleton r0 with no indexes. */
+  svn_string_t *noderev_str = svn_string_create("id: 2+0\n"
+                                                "node: 0+0\n"
+                                                "copy: 0+0\n"
+                                                "type: dir\n"
+                                                "count: 0\n"
+                                                "cpath: /\n"
+                                                "\n",
+                                                subpool);
+  svn_string_t *changes_str = svn_string_create("\n",
+                                                subpool);
+  svn_string_t *r0 = svn_string_createf(subpool, "%s%s",
+                                        noderev_str->data,
+                                        changes_str->data);
+
+  /* Write skeleton r0 to disk. */
+  SVN_ERR(svn_io_file_create(path_revision_zero, r0->data, subpool));
 
-  /* Construct the index P2L contents: describe the 3 items we have.
+  /* Construct the index P2L contents: describe the 2 items we have.
      Be sure to create them in on-disk order. */
-  index_entries = apr_array_make(subpool, 3, sizeof(entry));
+  index_entries = apr_array_make(subpool, 2, sizeof(entry));
 
   entry = apr_pcalloc(subpool, sizeof(*entry));
   entry->offset = 0;
-  entry->size = 0x1d;
-  entry->type = SVN_FS_X__ITEM_TYPE_DIR_REP;
-  entry->item_count = 1;
-  entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
-  entry->items[0].change_set = 0;
-  entry->items[0].number = SVN_FS_X__ITEM_INDEX_FIRST_USER;
-  APR_ARRAY_PUSH(index_entries, svn_fs_x__p2l_entry_t *) = entry;
-
-  entry = apr_pcalloc(subpool, sizeof(*entry));
-  entry->offset = 0x1d;
-  entry->size = 0x5d;
+  entry->size = (apr_off_t)noderev_str->len;
   entry->type = SVN_FS_X__ITEM_TYPE_NODEREV;
   entry->item_count = 1;
   entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
@@ -888,8 +896,8 @@ write_revision_zero(svn_fs_t *fs,
   APR_ARRAY_PUSH(index_entries, svn_fs_x__p2l_entry_t *) = entry;
 
   entry = apr_pcalloc(subpool, sizeof(*entry));
-  entry->offset = 0x1d + 0x5d;
-  entry->size = 1;
+  entry->offset = (apr_off_t)noderev_str->len;
+  entry->size = (apr_off_t)changes_str->len;
   entry->type = SVN_FS_X__ITEM_TYPE_CHANGES;
   entry->item_count = 1;
   entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
@@ -926,9 +934,9 @@ svn_fs_x__create_file_tree(svn_fs_t *fs,
                            const char *path,
                            int format,
                            int shard_size,
-                           apr_pool_t *pool)
+                           apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
 
   fs->path = apr_pstrdup(fs->pool, path);
   ffd->format = format;
@@ -937,50 +945,57 @@ svn_fs_x__create_file_tree(svn_fs_t *fs,
   ffd->max_files_per_dir = shard_size;
 
   /* Create the revision data directories. */
-  SVN_ERR(svn_io_make_dir_recursively(svn_fs_x__path_rev_shard(fs, 0, pool),
-                                      pool));
+  SVN_ERR(svn_io_make_dir_recursively(
+                              svn_fs_x__path_rev_shard(fs, 0, scratch_pool),
+                              scratch_pool));
 
   /* Create the revprops directory. */
-  SVN_ERR(svn_io_make_dir_recursively(svn_fs_x__path_revprops_shard(fs, 0,
-                                                                    pool),
-                                      pool));
+  SVN_ERR(svn_io_make_dir_recursively(
+                         svn_fs_x__path_revprops_shard(fs, 0, scratch_pool),
+                         scratch_pool));
 
   /* Create the transaction directory. */
-  SVN_ERR(svn_io_make_dir_recursively(svn_fs_x__path_txns_dir(fs, pool),
-                                      pool));
+  SVN_ERR(svn_io_make_dir_recursively(
+                                  svn_fs_x__path_txns_dir(fs, scratch_pool),
+                                  scratch_pool));
 
   /* Create the protorevs directory. */
-  SVN_ERR(svn_io_make_dir_recursively(svn_fs_x__path_txn_proto_revs(fs, pool),
-                                      pool));
+  SVN_ERR(svn_io_make_dir_recursively(
+                            svn_fs_x__path_txn_proto_revs(fs, scratch_pool),
+                            scratch_pool));
 
   /* Create the 'current' file. */
-  SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_current(fs, pool), pool));
-  SVN_ERR(svn_fs_x__write_current(fs, 0, pool));
+  SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_current(fs, scratch_pool),
+                                   scratch_pool));
+  SVN_ERR(svn_fs_x__write_current(fs, 0, scratch_pool));
 
   /* Create the 'uuid' file. */
-  SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_lock(fs, pool), pool));
-  SVN_ERR(svn_fs_x__set_uuid(fs, NULL, NULL, pool));
+  SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_lock(fs, scratch_pool),
+                                   scratch_pool));
+  SVN_ERR(svn_fs_x__set_uuid(fs, NULL, NULL, scratch_pool));
 
   /* Create the fsfs.conf file. */
-  SVN_ERR(write_config(fs, pool));
-  SVN_ERR(read_config(ffd, fs->path, fs->pool, pool));
+  SVN_ERR(write_config(fs, scratch_pool));
+  SVN_ERR(read_config(ffd, fs->path, fs->pool, scratch_pool));
 
   /* Add revision 0. */
-  SVN_ERR(write_revision_zero(fs, pool));
+  SVN_ERR(write_revision_zero(fs, scratch_pool));
 
   /* Create the min unpacked rev file. */
-  SVN_ERR(svn_io_file_create(svn_fs_x__path_min_unpacked_rev(fs, pool),
-                             "0\n", pool));
+  SVN_ERR(svn_io_file_create(
+                          svn_fs_x__path_min_unpacked_rev(fs, scratch_pool),
+                          "0\n", scratch_pool));
 
   /* Create the txn-current file if the repository supports
      the transaction sequence file. */
-  SVN_ERR(svn_io_file_create(svn_fs_x__path_txn_current(fs, pool),
-                             "0\n", pool));
-  SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_txn_current_lock(fs, pool),
-                                   pool));
+  SVN_ERR(svn_io_file_create(svn_fs_x__path_txn_current(fs, scratch_pool),
+                             "0\n", scratch_pool));
+  SVN_ERR(svn_io_file_create_empty(
+                          svn_fs_x__path_txn_current_lock(fs, scratch_pool),
+                          scratch_pool));
 
   /* Initialize the revprop caching info. */
-  SVN_ERR(svn_fs_x__reset_revprop_generation_file(fs, pool));
+  SVN_ERR(svn_fs_x__reset_revprop_generation_file(fs, scratch_pool));
 
   ffd->youngest_rev_cache = 0;
   return SVN_NO_ERROR;
@@ -989,10 +1004,10 @@ svn_fs_x__create_file_tree(svn_fs_t *fs,
 svn_error_t *
 svn_fs_x__create(svn_fs_t *fs,
                  const char *path,
-                 apr_pool_t *pool)
+                 apr_pool_t *scratch_pool)
 {
   int format = SVN_FS_X__FORMAT_NUMBER;
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
 
   fs->path = apr_pstrdup(fs->pool, path);
   /* See if compatibility with older versions was explicitly requested. */
@@ -1000,7 +1015,7 @@ svn_fs_x__create(svn_fs_t *fs,
     {
       svn_version_t *compatible_version;
       SVN_ERR(svn_fs__compatible_version(&compatible_version, fs->config,
-                                         pool));
+                                         scratch_pool));
 
       /* select format number */
       switch(compatible_version->minor)
@@ -1023,10 +1038,10 @@ svn_fs_x__create(svn_fs_t *fs,
   /* Actual FS creation. */
   SVN_ERR(svn_fs_x__create_file_tree(fs, path, format,
                                      SVN_FS_X_DEFAULT_MAX_FILES_PER_DIR,
-                                     pool));
+                                     scratch_pool));
 
   /* This filesystem is ready.  Stamp it with a format number. */
-  SVN_ERR(svn_fs_x__write_format(fs, FALSE, pool));
+  SVN_ERR(svn_fs_x__write_format(fs, FALSE, scratch_pool));
 
   ffd->youngest_rev_cache = 0;
   return SVN_NO_ERROR;
@@ -1036,17 +1051,17 @@ svn_error_t *
 svn_fs_x__set_uuid(svn_fs_t *fs,
                    const char *uuid,
                    const char *instance_id,
-                   apr_pool_t *pool)
+                   apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
-  const char *uuid_path = svn_fs_x__path_uuid(fs, pool);
-  svn_stringbuf_t *contents = svn_stringbuf_create_empty(pool);
+  svn_fs_x__data_t *ffd = fs->fsap_data;
+  const char *uuid_path = svn_fs_x__path_uuid(fs, scratch_pool);
+  svn_stringbuf_t *contents = svn_stringbuf_create_empty(scratch_pool);
 
   if (! uuid)
-    uuid = svn_uuid_generate(pool);
+    uuid = svn_uuid_generate(scratch_pool);
 
   if (! instance_id)
-    instance_id = svn_uuid_generate(pool);
+    instance_id = svn_uuid_generate(scratch_pool);
 
   svn_stringbuf_appendcstr(contents, uuid);
   svn_stringbuf_appendcstr(contents, "\n");
@@ -1056,8 +1071,9 @@ svn_fs_x__set_uuid(svn_fs_t *fs,
   /* We use the permissions of the 'current' file, because the 'uuid'
      file does not exist during repository creation. */
   SVN_ERR(svn_io_write_atomic(uuid_path, contents->data, contents->len,
-                              svn_fs_x__path_current(fs, pool) /* perms */,
-                              pool));
+                              /* perms */
+                              svn_fs_x__path_current(fs, scratch_pool),
+                              scratch_pool));
 
   fs->uuid = apr_pstrdup(fs->pool, uuid);
   ffd->instance_id = apr_pstrdup(fs->pool, instance_id);
@@ -1072,9 +1088,9 @@ svn_fs_x__set_uuid(svn_fs_t *fs,
 svn_error_t *
 svn_fs_x__ensure_dir_exists(const char *path,
                             const char *fs_path,
-                            apr_pool_t *pool)
+                            apr_pool_t *scratch_pool)
 {
-  svn_error_t *err = svn_io_dir_make(path, APR_OS_DEFAULT, pool);
+  svn_error_t *err = svn_io_dir_make(path, APR_OS_DEFAULT, scratch_pool);
   if (err && APR_STATUS_IS_EEXIST(err->apr_err))
     {
       svn_error_clear(err);
@@ -1084,7 +1100,7 @@ svn_fs_x__ensure_dir_exists(const char *
 
   /* We successfully created a new directory.  Dup the permissions
      from FS->path. */
-  return svn_io_copy_perms(fs_path, path, pool);
+  return svn_io_copy_perms(fs_path, path, scratch_pool);
 }
 
 
@@ -1109,24 +1125,25 @@ svn_fs_x__revision_prop(svn_string_t **v
 
 
 /* Baton used for change_rev_prop_body below. */
-struct change_rev_prop_baton {
+typedef struct change_rev_prop_baton_t {
   svn_fs_t *fs;
   svn_revnum_t rev;
   const char *name;
   const svn_string_t *const *old_value_p;
   const svn_string_t *value;
-};
+} change_rev_prop_baton_t;
 
 /* The work-horse for svn_fs_x__change_rev_prop, called with the FS
    write lock.  This implements the svn_fs_x__with_write_lock()
-   'body' callback type.  BATON is a 'struct change_rev_prop_baton *'. */
+   'body' callback type.  BATON is a 'change_rev_prop_baton_t *'. */
 static svn_error_t *
-change_rev_prop_body(void *baton, apr_pool_t *pool)
+change_rev_prop_body(void *baton,
+                     apr_pool_t *scratch_pool)
 {
-  struct change_rev_prop_baton *cb = baton;
+  change_rev_prop_baton_t *cb = baton;
   apr_hash_t *table;
 
-  SVN_ERR(svn_fs_x__revision_proplist(&table, cb->fs, cb->rev, pool));
+  SVN_ERR(svn_fs_x__revision_proplist(&table, cb->fs, cb->rev, scratch_pool));
 
   if (cb->old_value_p)
     {
@@ -1146,7 +1163,8 @@ change_rev_prop_body(void *baton, apr_po
     }
   svn_hash_sets(table, cb->name, cb->value);
 
-  return svn_fs_x__set_revision_proplist(cb->fs, cb->rev, table, pool);
+  return svn_fs_x__set_revision_proplist(cb->fs, cb->rev, table,
+                                         scratch_pool);
 }
 
 svn_error_t *
@@ -1155,9 +1173,9 @@ svn_fs_x__change_rev_prop(svn_fs_t *fs,
                           const char *name,
                           const svn_string_t *const *old_value_p,
                           const svn_string_t *value,
-                          apr_pool_t *pool)
+                          apr_pool_t *scratch_pool)
 {
-  struct change_rev_prop_baton cb;
+  change_rev_prop_baton_t cb;
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
 
@@ -1167,7 +1185,8 @@ svn_fs_x__change_rev_prop(svn_fs_t *fs,
   cb.old_value_p = old_value_p;
   cb.value = value;
 
-  return svn_fs_x__with_write_lock(fs, change_rev_prop_body, &cb, pool);
+  return svn_fs_x__with_write_lock(fs, change_rev_prop_body, &cb,
+                                   scratch_pool);
 }
 
 
@@ -1178,7 +1197,7 @@ svn_fs_x__info_format(int *fs_format,
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
-  fs_x_data_t *ffd = fs->fsap_data;
+  svn_fs_x__data_t *ffd = fs->fsap_data;
   *fs_format = ffd->format;
   *supports_version = apr_palloc(result_pool, sizeof(svn_version_t));
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h?rev=1653314&r1=1653313&r2=1653314&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h Tue Jan 20 17:52:18 2015
@@ -28,91 +28,95 @@
 /* Read the 'format' file of fsx filesystem FS and store its info in FS.
  * Use SCRATCH_POOL for temporary allocations. */
 svn_error_t *
-svn_fs_x__read_format_file(svn_fs_t *fs, apr_pool_t *scratch_pool);
+svn_fs_x__read_format_file(svn_fs_t *fs,
+                           apr_pool_t *scratch_pool);
 
 /* Open the fsx filesystem pointed to by PATH and associate it with
-   filesystem object FS.  Use POOL for temporary allocations.
+   filesystem object FS.  Use SCRATCH_POOL for temporary allocations.
 
    ### Some parts of *FS must have been initialized beforehand; some parts
        (including FS->path) are initialized by this function. */
-svn_error_t *svn_fs_x__open(svn_fs_t *fs,
-                            const char *path,
-                            apr_pool_t *pool);
+svn_error_t *
+svn_fs_x__open(svn_fs_t *fs,
+               const char *path,
+               apr_pool_t *scratch_pool);
 
 /* Upgrade the fsx filesystem FS.  Indicate progress via the optional
  * NOTIFY_FUNC callback using NOTIFY_BATON.  The optional CANCEL_FUNC
  * will periodically be called with CANCEL_BATON to allow for preemption.
- * Use POOL for temporary allocations. */
-svn_error_t *svn_fs_x__upgrade(svn_fs_t *fs,
-                               svn_fs_upgrade_notify_t notify_func,
-                               void *notify_baton,
-                               svn_cancel_func_t cancel_func,
-                               void *cancel_baton,
-                               apr_pool_t *pool);
+ * Use SCRATCH_POOL for temporary allocations. */
+svn_error_t *
+svn_fs_x__upgrade(svn_fs_t *fs,
+                  svn_fs_upgrade_notify_t notify_func,
+                  void *notify_baton,
+                  svn_cancel_func_t cancel_func,
+                  void *cancel_baton,
+                  apr_pool_t *scratch_pool);
 
 /* Set *YOUNGEST to the youngest revision in filesystem FS.  Do any
-   temporary allocation in POOL. */
-svn_error_t *svn_fs_x__youngest_rev(svn_revnum_t *youngest,
-                                    svn_fs_t *fs,
-                                    apr_pool_t *pool);
+   temporary allocation in SCRATCH_POOL. */
+svn_error_t *
+svn_fs_x__youngest_rev(svn_revnum_t *youngest,
+                       svn_fs_t *fs,
+                       apr_pool_t *scratch_pool);
 
 /* Return SVN_ERR_FS_NO_SUCH_REVISION if the given revision REV is newer
    than the current youngest revision in FS or is simply not a valid
-   revision number, else return success. */
+   revision number, else return success.  Use SCRATCH_POOL for temporary
+   allocations. */
 svn_error_t *
 svn_fs_x__ensure_revision_exists(svn_revnum_t rev,
                                  svn_fs_t *fs,
-                                 apr_pool_t *pool);
-
-/* Return an error iff REV does not exist in FS. */
-svn_error_t *
-svn_fs_x__revision_exists(svn_revnum_t rev,
-                          svn_fs_t *fs,
-                          apr_pool_t *pool);
+                                 apr_pool_t *scratch_pool);
 
 /* Set *PROPLIST to be an apr_hash_t containing the property list of
    revision REV as seen in filesystem FS.  Use POOL for temporary
    allocations. */
-svn_error_t *svn_fs_x__revision_proplist(apr_hash_t **proplist,
-                                         svn_fs_t *fs,
-                                         svn_revnum_t rev,
-                                         apr_pool_t *pool);
+svn_error_t *
+svn_fs_x__revision_proplist(apr_hash_t **proplist,
+                            svn_fs_t *fs,
+                            svn_revnum_t rev,
+                            apr_pool_t *pool);
 
 /* Set *LENGTH to the be fulltext length of the node revision
-   specified by NODEREV.  Use POOL for temporary allocations. */
-svn_error_t *svn_fs_x__file_length(svn_filesize_t *length,
-                                   node_revision_t *noderev,
-                                   apr_pool_t *pool);
+   specified by NODEREV. */
+svn_error_t *
+svn_fs_x__file_length(svn_filesize_t *length,
+                      svn_fs_x__noderev_t *noderev);
 
 /* Return TRUE if the representations in A and B have equal contents, else
    return FALSE. */
-svn_boolean_t svn_fs_x__file_text_rep_equal(representation_t *a,
-                                            representation_t *b);
+svn_boolean_t
+svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a,
+                              svn_fs_x__representation_t *b);
 
 /* Set *EQUAL to TRUE if the property representations in A and B within FS
    have equal contents, else set it to FALSE.  If STRICT is not set, allow
    for false negatives.
    Use SCRATCH_POOL for temporary allocations. */
-svn_error_t *svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
-                                      svn_fs_t *fs,
-                                      node_revision_t *a,
-                                      node_revision_t *b,
-                                      svn_boolean_t strict,
-                                      apr_pool_t *scratch_pool);
+svn_error_t *
+svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
+                         svn_fs_t *fs,
+                         svn_fs_x__noderev_t *a,
+                         svn_fs_x__noderev_t *b,
+                         svn_boolean_t strict,
+                         apr_pool_t *scratch_pool);
 
 
-/* Return a copy of the representation REP allocated from POOL. */
-representation_t *svn_fs_x__rep_copy(representation_t *rep,
-                                     apr_pool_t *pool);
+/* Return a copy of the representation REP allocated from RESULT_POOL. */
+svn_fs_x__representation_t *
+svn_fs_x__rep_copy(svn_fs_x__representation_t *rep,
+                   apr_pool_t *result_pool);
 
 
 /* Return the recorded checksum of type KIND for the text representation
-   of NODREV into CHECKSUM, allocating from POOL.  If no stored checksum is
-   available, put all NULL into CHECKSUM. */
-svn_error_t *svn_fs_x__file_checksum(svn_checksum_t **checksum,
-                                     node_revision_t *noderev,
-                                     svn_checksum_kind_t kind,
-                                     apr_pool_t *pool);
+   of NODREV into CHECKSUM, allocating from RESULT_POOL.  If no stored
+   checksum is available, put all NULL into CHECKSUM. */
+svn_error_t *
+svn_fs_x__file_checksum(svn_checksum_t **checksum,
+                        svn_fs_x__noderev_t *noderev,
+                        svn_checksum_kind_t kind,
+                        apr_pool_t *result_pool);
 
 /* Under the repository db PATH, create a FSFS repository with FORMAT,
  * the given SHARD_SIZE.  If not supported by the respective format,
@@ -122,49 +126,33 @@ svn_error_t *svn_fs_x__file_checksum(svn
  * callers such as hotcopy to modify the contents before turning the
  * tree into an accessible repository.
  *
- * Use POOL for temporary allocations.
+ * Use SCRATCH_POOL for temporary allocations.
  */
 svn_error_t *
 svn_fs_x__create_file_tree(svn_fs_t *fs,
                            const char *path,
                            int format,
                            int shard_size,
-                           apr_pool_t *pool);
+                           apr_pool_t *scratch_pool);
 
 /* Create a fs_x fileysystem referenced by FS at path PATH.  Get any
-   temporary allocations from POOL.
+   temporary allocations from SCRATCH_POOL.
 
    ### Some parts of *FS must have been initialized beforehand; some parts
        (including FS->path) are initialized by this function. */
-svn_error_t *svn_fs_x__create(svn_fs_t *fs,
-                              const char *path,
-                              apr_pool_t *pool);
+svn_error_t *
+svn_fs_x__create(svn_fs_t *fs,
+                 const char *path,
+                 apr_pool_t *scratch_pool);
 
 /* Set the uuid of repository FS to UUID and the instance ID to INSTANCE_ID.
    If any of them is NULL, use a newly generated UUID / ID instead.
-   Perform temporary allocations in POOL. */
-svn_error_t *svn_fs_x__set_uuid(svn_fs_t *fs,
-                                const char *uuid,
-                                const char *instance_id,
-                                apr_pool_t *pool);
-
-/* Set *PATH to the path of REV in FS, whether in a pack file or not.
-   Allocate *PATH in POOL.
-
-   Note: If the caller does not have the write lock on FS, then the path is
-   not guaranteed to be correct or to remain correct after the function
-   returns, because the revision might become packed before or after this
-   call.  If a file exists at that path, then it is correct; if not, then
-   the caller should call update_min_unpacked_rev() and re-try once. */
-const char *
-svn_fs_x__path_rev_absolute(svn_fs_t *fs,
-                            svn_revnum_t rev,
-                            apr_pool_t *pool);
-
-/* Return the path to the 'current' file in FS.
-   Perform allocation in POOL. */
-const char *
-svn_fs_x__path_current(svn_fs_t *fs, apr_pool_t *pool);
+   Perform temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_fs_x__set_uuid(svn_fs_t *fs,
+                   const char *uuid,
+                   const char *instance_id,
+                   apr_pool_t *scratch_pool);
 
 /* Read the format number and maximum number of files per directory
    from PATH and return them in *PFORMAT and *MAX_FILES_PER_DIR
@@ -173,43 +161,50 @@ svn_fs_x__path_current(svn_fs_t *fs, apr
    *MAX_FILES_PER_DIR is obtained from the 'layout' format option, and
    will be set to zero if a linear scheme should be used.
 
-   Use POOL for temporary allocation. */
+   Use SCRATCH_POOL for temporary allocation. */
 svn_error_t *
 svn_fs_x__write_format(svn_fs_t *fs,
                        svn_boolean_t overwrite,
-                       apr_pool_t *pool);
+                       apr_pool_t *scratch_pool);
 
 /* Find the value of the property named PROPNAME in transaction TXN.
    Return the contents in *VALUE_P.  The contents will be allocated
    from POOL. */
-svn_error_t *svn_fs_x__revision_prop(svn_string_t **value_p, svn_fs_t *fs,
-                                     svn_revnum_t rev,
-                                     const char *propname,
-                                     apr_pool_t *pool);
+svn_error_t *
+svn_fs_x__revision_prop(svn_string_t **value_p,
+                        svn_fs_t *fs,
+                        svn_revnum_t rev,
+                        const char *propname,
+                        apr_pool_t *pool);
 
 /* Change, add, or delete a property on a revision REV in filesystem
    FS.  NAME gives the name of the property, and value, if non-NULL,
    gives the new contents of the property.  If value is NULL, then the
-   property will be deleted.  If OLD_VALUE_P is not NULL, do nothing unless the
-   preexisting value is *OLD_VALUE_P.  Do any temporary allocation in POOL.  */
-svn_error_t *svn_fs_x__change_rev_prop(svn_fs_t *fs, svn_revnum_t rev,
-                                       const char *name,
-                                       const svn_string_t *const *old_value_p,
-                                       const svn_string_t *value,
-                                       apr_pool_t *pool);
+   property will be deleted.  If OLD_VALUE_P is not NULL, do nothing unless
+   the preexisting value is *OLD_VALUE_P.
+   Do any temporary allocation in SCRATCH_POOL.  */
+svn_error_t *
+svn_fs_x__change_rev_prop(svn_fs_t *fs,
+                          svn_revnum_t rev,
+                          const char *name,
+                          const svn_string_t *const *old_value_p,
+                          const svn_string_t *value,
+                          apr_pool_t *scratch_pool);
 
 /* If directory PATH does not exist, create it and give it the same
-   permissions as FS_PATH.*/
-svn_error_t *svn_fs_x__ensure_dir_exists(const char *path,
-                                         const char *fs_path,
-                                         apr_pool_t *pool);
+   permissions as FS_PATH.  Do any temporary allocation in SCRATCH_POOL. */
+svn_error_t *
+svn_fs_x__ensure_dir_exists(const char *path,
+                            const char *fs_path,
+                            apr_pool_t *scratch_pool);
 
 /* Initialize all session-local caches in FS according to the global
-   cache settings. Use POOL for temporary allocations.
+   cache settings. Use SCRATCH_POOL for temporary allocations.
 
    Please note that it is permissible for this function to set some
    or all of these caches to NULL, regardless of any setting. */
 svn_error_t *
-svn_fs_x__initialize_caches(svn_fs_t *fs, apr_pool_t *pool);
+svn_fs_x__initialize_caches(svn_fs_t *fs,
+                            apr_pool_t *scratch_pool);
 
 #endif