[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-cvs
Subject:    svn commit: r9572 - in trunk: . build build/generator subversion/include subversion/libsvn_fs subver
From:       ghudson () tigris ! org
Date:       2004-04-29 23:17:35
Message-ID: 200404292317.i3TNHZx27558 () morbius ! ch ! collab ! net
[Download RAW message or body]

Author: ghudson
Date: Thu Apr 29 18:17:29 2004
New Revision: 9572

Added:
   trunk/subversion/libsvn_fs/   (props changed)
      - copied from r9489, branches/fs-abstraction/subversion/libsvn_fs/
   trunk/subversion/libsvn_fs/fs-loader.c   (props changed)
      - copied unchanged from r9571, \
branches/fs-abstraction/subversion/libsvn_fs/fs-loader.c  \
                trunk/subversion/libsvn_fs/fs-loader.h   (props changed)
      - copied unchanged from r9571, \
branches/fs-abstraction/subversion/libsvn_fs/fs-loader.h  \
                trunk/subversion/libsvn_fs/fs.h
      - copied unchanged from r9489, \
branches/fs-abstraction/subversion/libsvn_fs/fs.h  \
                trunk/subversion/libsvn_fs/fs_loader.c
      - copied unchanged from r9489, \
branches/fs-abstraction/subversion/libsvn_fs/fs_loader.c  \
                trunk/subversion/libsvn_fs_base/uuid.h
      - copied unchanged from r9571, \
branches/fs-abstraction/subversion/libsvn_fs_base/uuid.h Removed:
   trunk/subversion/libsvn_fs_base/id.c
   trunk/subversion/libsvn_fs_base/id.h
   trunk/subversion/libsvn_fs_fs/id.c
   trunk/subversion/libsvn_fs_fs/id.h
   trunk/subversion/libsvn_fs_fs/make-revs.c
   trunk/subversion/libsvn_fs_fs/uuid.c
Modified:
   trunk/Makefile.in
   trunk/build.conf
   trunk/build/generator/gen_base.py
   trunk/build/generator/gen_make.py
   trunk/build/run_tests.py
   trunk/configure.in
   trunk/subversion/include/svn_error_codes.h
   trunk/subversion/include/svn_fs.h
   trunk/subversion/libsvn_fs_base/bdb/bdb-err.c
   trunk/subversion/libsvn_fs_base/bdb/bdb-err.h
   trunk/subversion/libsvn_fs_base/bdb/bdb_compat.c
   trunk/subversion/libsvn_fs_base/bdb/bdb_compat.h
   trunk/subversion/libsvn_fs_base/bdb/changes-table.c
   trunk/subversion/libsvn_fs_base/bdb/changes-table.h
   trunk/subversion/libsvn_fs_base/bdb/copies-table.c
   trunk/subversion/libsvn_fs_base/bdb/copies-table.h
   trunk/subversion/libsvn_fs_base/bdb/dbt.c
   trunk/subversion/libsvn_fs_base/bdb/dbt.h
   trunk/subversion/libsvn_fs_base/bdb/nodes-table.c
   trunk/subversion/libsvn_fs_base/bdb/nodes-table.h
   trunk/subversion/libsvn_fs_base/bdb/reps-table.c
   trunk/subversion/libsvn_fs_base/bdb/reps-table.h
   trunk/subversion/libsvn_fs_base/bdb/rev-table.c
   trunk/subversion/libsvn_fs_base/bdb/rev-table.h
   trunk/subversion/libsvn_fs_base/bdb/strings-table.c
   trunk/subversion/libsvn_fs_base/bdb/strings-table.h
   trunk/subversion/libsvn_fs_base/bdb/txn-table.c
   trunk/subversion/libsvn_fs_base/bdb/txn-table.h
   trunk/subversion/libsvn_fs_base/bdb/uuids-table.c
   trunk/subversion/libsvn_fs_base/bdb/uuids-table.h
   trunk/subversion/libsvn_fs_base/dag.c
   trunk/subversion/libsvn_fs_base/dag.h
   trunk/subversion/libsvn_fs_base/err.c
   trunk/subversion/libsvn_fs_base/err.h
   trunk/subversion/libsvn_fs_base/fs.c
   trunk/subversion/libsvn_fs_base/fs.h
   trunk/subversion/libsvn_fs_base/key-gen.c
   trunk/subversion/libsvn_fs_base/key-gen.h
   trunk/subversion/libsvn_fs_base/node-rev.c
   trunk/subversion/libsvn_fs_base/node-rev.h
   trunk/subversion/libsvn_fs_base/reps-strings.c
   trunk/subversion/libsvn_fs_base/reps-strings.h
   trunk/subversion/libsvn_fs_base/revs-txns.c
   trunk/subversion/libsvn_fs_base/revs-txns.h
   trunk/subversion/libsvn_fs_base/trail.c
   trunk/subversion/libsvn_fs_base/trail.h
   trunk/subversion/libsvn_fs_base/tree.c
   trunk/subversion/libsvn_fs_base/tree.h
   trunk/subversion/libsvn_fs_base/util/fs_skels.c
   trunk/subversion/libsvn_fs_base/util/fs_skels.h
   trunk/subversion/libsvn_fs_base/util/skel.c
   trunk/subversion/libsvn_fs_base/util/skel.h
   trunk/subversion/libsvn_fs_base/uuid.c
   trunk/subversion/libsvn_fs_fs/   (props changed)
   trunk/subversion/libsvn_fs_fs/dag.c
   trunk/subversion/libsvn_fs_fs/dag.h
   trunk/subversion/libsvn_fs_fs/err.c
   trunk/subversion/libsvn_fs_fs/err.h
   trunk/subversion/libsvn_fs_fs/fs.c
   trunk/subversion/libsvn_fs_fs/fs.h
   trunk/subversion/libsvn_fs_fs/fs_fs.c   (contents, props changed)
   trunk/subversion/libsvn_fs_fs/fs_fs.h   (contents, props changed)
   trunk/subversion/libsvn_fs_fs/key-gen.c
   trunk/subversion/libsvn_fs_fs/key-gen.h
   trunk/subversion/libsvn_fs_fs/revs-txns.c
   trunk/subversion/libsvn_fs_fs/revs-txns.h
   trunk/subversion/libsvn_fs_fs/tree.c
   trunk/subversion/libsvn_fs_fs/tree.h
   trunk/subversion/libsvn_repos/repos.c
   trunk/subversion/svnadmin/main.c
   trunk/subversion/tests/clients/cmdline/svntest/main.py
   trunk/subversion/tests/fs-helpers.c
   trunk/subversion/tests/libsvn_fs_base/changes-test.c
   trunk/subversion/tests/libsvn_fs_base/fs-test.c
   trunk/subversion/tests/libsvn_fs_base/key-test.c
   trunk/subversion/tests/libsvn_fs_base/skel-test.c
   trunk/subversion/tests/libsvn_fs_base/strings-reps-test.c
   trunk/svn_private_config.hw
Log:
Merge the changes from the fs-abstraction branch.  This allows the
libsvn_fs_fs filesystem to sit alongside the old BDB filesystem in the
same executable.


Modified: trunk/Makefile.in
==============================================================================
--- trunk/Makefile.in	(original)
+++ trunk/Makefile.in	Thu Apr 29 18:17:29 2004
@@ -25,6 +25,9 @@
 SVN_RA_LIB_DEPS = @SVN_RA_LIB_DEPS@
 SVN_RA_LIB_LINK = @SVN_RA_LIB_LINK@
 
+SVN_FS_LIB_DEPS = @SVN_FS_LIB_DEPS@
+SVN_FS_LIB_LINK = @SVN_FS_LIB_LINK@
+
 DESIGN_DIR = doc/programmer/design
 BOOK_TOP = doc/book
 BOOK_DIR = ${BOOK_TOP}/book
@@ -48,9 +51,8 @@
 libdir = @libdir@
 base_libdir = @libdir@
 dav_libdir = @libdir@
-fs_libdir = @libdir@
+bdb_libdir = @libdir@
 bindir = @bindir@
-fs_bindir = @bindir@
 includedir = @includedir@
 mandir = @mandir@
 srcdir = @srcdir@
@@ -181,10 +183,9 @@
 INSTALL = @INSTALL@
 INSTALL_LIB = $(LIBTOOL) --mode=install $(INSTALL)
 INSTALL_BASE_LIB = $(INSTALL_LIB)
-INSTALL_FS_LIB = $(INSTALL_LIB)
+INSTALL_BDB_LIB = $(INSTALL_LIB)
 INSTALL_DAV_LIB = $(INSTALL_LIB)
 INSTALL_BIN = $(LIBTOOL) --mode=install $(INSTALL)
-INSTALL_FS_BIN = $(INSTALL_BIN)
 INSTALL_INCLUDE = $(INSTALL) -m 644
 INSTALL_MOD_SHARED = @APXS@ -i -S LIBEXECDIR="$(APACHE_LIBEXECDIR)" @MOD_ACTIVATION@
 INSTALL_MOD_STATIC = $(INSTALL) -m 644
@@ -246,7 +247,7 @@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 
-TESTS = $(TEST_PROGRAMS) @FS_TEST_PROGRAMS@
+TESTS = $(TEST_PROGRAMS) @BDB_TEST_PROGRAMS@
 
 all: external-all local-all
 clean: external-clean local-clean
@@ -323,7 +324,7 @@
 # "make check CLEANUP=true" will clean up directories for successful tests.
 # "make check TESTS=subversion/tests/clients/cmdline/basic_tests.py"
 #  will perform only basic tests (likewise for other tests).
-check: $(TEST_DEPS) @FS_TEST_DEPS@
+check: $(TEST_DEPS) @BDB_TEST_DEPS@
 	@$(PYTHON) $(top_srcdir)/build/pycheck.py;                         \
 	flags="--verbose";                                                 \
 	if test "$(CLEANUP)" != ""; then                                   \
@@ -332,6 +333,9 @@
 	if test "$(BASE_URL)" != ""; then                                  \
 	  flags="--url $(BASE_URL) $$flags";                               \
 	fi;                                                                \
+	if test "$(FS_TYPE)" != ""; then                                   \
+	  flags="--fs-type $(FS_TYPE) $$flags";                            \
+	fi;                                                                \
 	$(PYTHON) $(top_srcdir)/build/run_tests.py $$flags                 \
 		  '$(abs_srcdir)' '$(abs_builddir)' '$(PYTHON)' '$(SHELL)' \
 		  $(TESTS)
@@ -356,6 +360,9 @@
 svnsshcheck:
 	@$(MAKE) check \
 	  BASE_URL=svn+ssh://localhost`pwd`/subversion/tests/clients/cmdline
+
+fsfscheck:
+	@$(MAKE) check FS_TYPE=fsfs
 
 check-clean:
 	rm -rf subversion/tests/clients/cmdline/repositories   \

Modified: trunk/build.conf
==============================================================================
--- trunk/build.conf	(original)
+++ trunk/build.conf	Thu Apr 29 18:17:29 2004
@@ -35,11 +35,6 @@
 [test-scripts]
 paths =
 	subversion/tests/libsvn_subr/target-test.py
-
-[fs-test-scripts]
-paths =
-	subversion/tests/libsvn_fs/run-fs-tests.py
-	subversion/tests/libsvn_repos/run-repos-tests.py
         subversion/tests/clients/cmdline/getopt_tests.py
         subversion/tests/clients/cmdline/basic_tests.py
         subversion/tests/clients/cmdline/commit_tests.py
@@ -62,6 +57,11 @@
         subversion/tests/clients/cmdline/svnlook_tests.py
         subversion/tests/clients/cmdline/svnversion_tests.py
 
+[bdb-test-scripts]
+paths =
+	subversion/tests/libsvn_fs_base/run-fs-tests.py
+	subversion/tests/libsvn_repos/run-repos-tests.py
+
 [swig-dirs]
 paths =
         subversion/bindings/swig/python
@@ -88,7 +88,7 @@
 description = Subversion Repository Administrator
 type = exe
 path = subversion/svnadmin
-install = fs-bin
+install = bin
 manpages = subversion/svnadmin/svnadmin.1
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 
@@ -97,7 +97,7 @@
 description = Subversion Dumpfile Filter
 type = exe
 path = subversion/svndumpfilter
-install = fs-bin
+install = bin
 manpages = subversion/svndumpfilter/svndumpfilter.1
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 
@@ -106,7 +106,7 @@
 description = Subversion Repository Browser
 type = exe
 path = subversion/svnlook
-install = fs-bin
+install = bin
 manpages = subversion/svnlook/svnlook.1
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_diff libsvn_subr
        aprutil apriconv apr
@@ -140,11 +140,29 @@
 [libsvn_fs]
 type = lib
 path = subversion/libsvn_fs
+sources = *.c
+install = lib
+libs = libsvn_subr fs-libs apr
+# conditionally add more dependencies
+add-deps = $(SVN_FS_LIB_DEPS)
+msvc-static = yes
+
+[libsvn_fs_base]
+type = fs-module
+path = subversion/libsvn_fs_base
 sources = *.c bdb/*.c util/*.c
-install = fs-lib
+install = bdb-lib
 libs = libsvn_delta libsvn_subr aprutil apriconv bdb apr
 msvc-static = yes
 
+[libsvn_fs_fs]
+type = fs-module
+path = subversion/libsvn_fs_fs
+sources = *.c
+install = lib
+libs = libsvn_delta libsvn_subr aprutil apriconv apr
+msvc-static = yes
+
 # General API for accessing repositories
 [libsvn_ra]
 type = lib
@@ -175,7 +193,7 @@
 [libsvn_ra_local]
 type = ra-module
 path = subversion/libsvn_ra_local
-install = fs-lib
+install = lib
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 msvc-static = yes
 
@@ -183,7 +201,7 @@
 [libsvn_repos]
 type = lib
 path = subversion/libsvn_repos
-install = fs-lib
+install = lib
 libs = libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 msvc-static = yes
 
@@ -227,7 +245,7 @@
 description = Subversion Server
 type = exe
 path = subversion/svnserve
-install = fs-bin
+install = bin
 manpages = subversion/svnserve/svnserve.8 subversion/svnserve/svnserve.conf.5
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr libsvn_ra_svn
        aprutil apriconv apr
@@ -461,8 +479,9 @@
 type = lib
 path = subversion/tests
 sources = fs-helpers.c
-install = fs-test
-libs = libsvn_fs libsvn_repos libsvn_delta libsvn_subr libsvn_test apr
+install = bdb-test
+libs = libsvn_fs_base libsvn_fs libsvn_repos libsvn_delta libsvn_subr
+       libsvn_test apr
 msvc-static = yes
 # this lib does not actually have linktime undefined symbols, but as it depends
 # on libsvn_test, which does, and libtool refuses to link shared libs with 
@@ -474,53 +493,55 @@
 # tests for *public* fs API (svn_fs.h)
 [fs-test]
 type = exe
-path = subversion/tests/libsvn_fs
+path = subversion/tests/libsvn_fs_base
 sources = fs-test.c
-install = fs-test
-libs = libsvn_test libsvn_test_fs libsvn_fs libsvn_delta libsvn_subr
-	aprutil apriconv apr
+install = bdb-test
+libs = libsvn_test libsvn_test_fs libsvn_fs_base libsvn_fs libsvn_delta
+       libsvn_subr aprutil apriconv apr
 # run-fs-tests.py will run this for us
 testing = skip
 
-# test skels in libsvn_fs
+# test skels in libsvn_fs_base
 [skel-test]
 type = exe
-path = subversion/tests/libsvn_fs
+path = subversion/tests/libsvn_fs_base
 sources = skel-test.c
-install = fs-test
-libs = libsvn_test libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
+install = bdb-test
+libs = libsvn_test libsvn_fs_base libsvn_fs libsvn_delta libsvn_subr
+       aprutil apriconv apr
 # run-fs-tests.py will run this for us
 testing = skip
 
-# test keygen funcs in libsvn_fs
+# test keygen funcs in libsvn_fs_base
 [key-test]
 type = exe
-path = subversion/tests/libsvn_fs
+path = subversion/tests/libsvn_fs_base
 sources = key-test.c
-install = fs-test
-libs = libsvn_test libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr 
+install = bdb-test
+libs = libsvn_test libsvn_fs_base libsvn_fs libsvn_delta libsvn_subr
+       aprutil apriconv apr 
 # run-fs-tests.py will run this for us
 testing = skip
 
-# test strings/reps in libsvn_fs
+# test strings/reps in libsvn_fs_base
 [strings-reps-test]
 type = exe
-path = subversion/tests/libsvn_fs
+path = subversion/tests/libsvn_fs_base
 sources = strings-reps-test.c
-install = fs-test
-libs = libsvn_test libsvn_test_fs libsvn_fs libsvn_delta libsvn_subr
-       aprutil apriconv apr
+install = bdb-test
+libs = libsvn_test libsvn_test_fs libsvn_fs_base libsvn_fs libsvn_delta
+       libsvn_subr aprutil apriconv apr
 # run-fs-tests.sh will run this for us
 testing = skip
 
-# test strings/reps in libsvn_fs
+# test strings/reps in libsvn_fs_base
 [changes-test]
 type = exe
-path = subversion/tests/libsvn_fs
+path = subversion/tests/libsvn_fs_base
 sources = changes-test.c
-install = fs-test
-libs = libsvn_test libsvn_test_fs libsvn_fs libsvn_delta libsvn_subr
-       aprutil apriconv apr
+install = bdb-test
+libs = libsvn_test libsvn_test_fs libsvn_fs_base libsvn_fs libsvn_delta
+       libsvn_subr aprutil apriconv apr
 # run-fs-tests.sh will run this for us
 testing = skip
 
@@ -539,7 +560,7 @@
 type = exe
 path = subversion/tests/libsvn_repos
 sources = repos-test.c dir-delta-editor.c
-install = fs-test
+install = bdb-test
 libs = libsvn_test libsvn_test_fs libsvn_repos libsvn_fs libsvn_delta
 	libsvn_subr aprutil apriconv apr
 # run-repos-tests.py will run this for us
@@ -633,7 +654,7 @@
 type = exe
 path = subversion/tests/libsvn_ra_local
 sources = ra-local-test.c
-install = fs-test
+install = test
 libs = libsvn_test libsvn_ra libsvn_fs libsvn_delta libsvn_subr
 	aprutil apriconv apr neon
 # disabled for now, BROKEN.
@@ -795,6 +816,11 @@
 type = lib
 external-lib = $(SVN_RA_LIB_LINK)
 libs = libsvn_ra_dav libsvn_ra_local libsvn_ra_svn
+
+[fs-libs]
+type = lib
+external-lib = $(SVN_FS_LIB_LINK)
+libs = libsvn_fs_base libsvn_fs_fs
 
 [__ALL__]
 type = project

Modified: trunk/build/generator/gen_base.py
==============================================================================
--- trunk/build/generator/gen_base.py	(original)
+++ trunk/build/generator/gen_base.py	Thu Apr 29 18:17:29 2004
@@ -68,7 +68,7 @@
 
       target_class = _build_types.get(type)
       if not target_class:
-        raise GenError('ERROR: unknown build type: ' + type)
+        raise GenError('ERROR: unknown build type for ' + section_name)
 
       section = target_class.Section(options, target_class)
 
@@ -95,7 +95,7 @@
 
     # collect all the test scripts
     self.scripts = _collect_paths(parser.get('test-scripts', 'paths'))
-    self.fs_scripts = _collect_paths(parser.get('fs-test-scripts', 'paths'))
+    self.bdb_scripts = _collect_paths(parser.get('bdb-test-scripts', 'paths'))
 
     self.swig_dirs = string.split(parser.get('swig-dirs', 'paths'))
 
@@ -223,7 +223,7 @@
 
 # dependency types
 dep_types = [
-  'DT_INSTALL',  # install areas. e.g. 'lib', 'base-lib', 'fs-lib'
+  'DT_INSTALL',  # install areas. e.g. 'lib', 'base-lib'
   'DT_OBJECT',   # an object filename, depending upon .c filenames
   'DT_SWIG_C',   # a swig-generated .c file, depending upon .i filename(s)
   'DT_LINK',     # a libtool-linked filename, depending upon object fnames
@@ -233,13 +233,13 @@
   ]
 
 list_types = [
-  'LT_PROJECT',       # Visual C++ projects (TargetSpecial instances)
-  'LT_TEST_DEPS',     # Test programs to build
-  'LT_TEST_PROGS',    # Test programs to run (subset of LT_TEST_DEPS)
-  'LT_FS_TEST_DEPS',  # File system test programs to build
-  'LT_FS_TEST_PROGS', # File system test programs to run
-  'LT_TARGET_DIRS',   # directories where files are built
-  'LT_MANPAGES',      # manpages
+  'LT_PROJECT',        # Visual C++ projects (TargetSpecial instances)
+  'LT_TEST_DEPS',      # Test programs to build
+  'LT_TEST_PROGS',     # Test programs to run (subset of LT_TEST_DEPS)
+  'LT_BDB_TEST_DEPS',  # File system test programs to build
+  'LT_BDB_TEST_PROGS', # File system test programs to run
+  'LT_TARGET_DIRS',    # directories where files are built
+  'LT_MANPAGES',       # manpages
   ]
 
 # create some variables for these
@@ -444,10 +444,10 @@
       graph.add(DT_LIST, LT_TEST_DEPS, self.filename)
       if self.testing != 'skip':
         graph.add(DT_LIST, LT_TEST_PROGS, self.filename)
-    elif self.install == 'fs-test':
-      graph.add(DT_LIST, LT_FS_TEST_DEPS, self.filename)
+    elif self.install == 'bdb-test':
+      graph.add(DT_LIST, LT_BDB_TEST_DEPS, self.filename)
       if self.testing != 'skip':
-        graph.add(DT_LIST, LT_FS_TEST_PROGS, self.filename)
+        graph.add(DT_LIST, LT_BDB_TEST_PROGS, self.filename)
 
     graph.bulk_add(DT_LIST, LT_MANPAGES, string.split(self.manpages))
 
@@ -491,6 +491,9 @@
 class TargetRaModule(TargetLib):
   pass
 
+class TargetFsModule(TargetLib):
+  pass
+
 class TargetDoc(Target):
   pass
 
@@ -813,6 +816,7 @@
   'swig_lib' : TargetSWIGLib,
   'swig_project' : TargetSWIGProject,
   'ra-module': TargetRaModule,
+  'fs-module': TargetFsModule,
   'apache-mod': TargetApacheMod,
   'javah' : TargetJavaHeaders,
   'java' : TargetJavaClasses,
@@ -832,7 +836,7 @@
   'options',
   'static-apache',
   'test-scripts',
-  'fs-test-scripts',
+  'bdb-test-scripts',
   'swig-dirs',
   ]
 

Modified: trunk/build/generator/gen_make.py
==============================================================================
--- trunk/build/generator/gen_make.py	(original)
+++ trunk/build/generator/gen_make.py	Thu Apr 29 18:17:29 2004
@@ -250,7 +250,7 @@
                                          gen_base.LT_TARGET_DIRS)
 
     # get all the test scripts' directories
-    script_dirs = map(os.path.dirname, self.scripts + self.fs_scripts)
+    script_dirs = map(os.path.dirname, self.scripts + self.bdb_scripts)
 
     # remove duplicate directories between targets and tests
     build_dirs = gen_base.unique(target_dirs + script_dirs + self.swig_dirs)
@@ -264,16 +264,16 @@
     test_deps = self.graph.get_sources(gen_base.DT_LIST,
                                        gen_base.LT_TEST_DEPS)
 
-    fs_test_progs = self.graph.get_sources(gen_base.DT_LIST,
-                                           gen_base.LT_FS_TEST_PROGS)
+    bdb_test_progs = self.graph.get_sources(gen_base.DT_LIST,
+       	                                    gen_base.LT_BDB_TEST_PROGS)
 
-    fs_test_deps = self.graph.get_sources(gen_base.DT_LIST,
-                                          gen_base.LT_FS_TEST_DEPS)
+    bdb_test_deps = self.graph.get_sources(gen_base.DT_LIST,
+                                           gen_base.LT_BDB_TEST_DEPS)
 
-    self.ofile.write('FS_TEST_DEPS = %s\n\n' %
-                     string.join(fs_test_deps + self.fs_scripts))
-    self.ofile.write('FS_TEST_PROGRAMS = %s\n\n' %
-                     string.join(fs_test_progs + self.fs_scripts))
+    self.ofile.write('BDB_TEST_DEPS = %s\n\n' %
+                     string.join(bdb_test_deps + self.bdb_scripts))
+    self.ofile.write('BDB_TEST_PROGRAMS = %s\n\n' %
+                     string.join(bdb_test_progs + self.bdb_scripts))
     self.ofile.write('TEST_DEPS = %s\n\n' %
                      string.join(test_deps + self.scripts))
     self.ofile.write('TEST_PROGRAMS = %s\n\n' %
@@ -306,8 +306,9 @@
       wrappers[lang] = [ ]
 
     for target in self.graph.get_all_sources(gen_base.DT_INSTALL):
-      if isinstance(target, gen_base.TargetRaModule):
-        # name of the RA module: strip 'libsvn_' and upper-case it
+      if isinstance(target, gen_base.TargetRaModule) or \
+         isinstance(target, gen_base.TargetFsModule):
+        # name of the module: strip 'libsvn_' and upper-case it
         name = string.upper(target.name[7:])
 
         # construct a list of the other .la libs to link against

Modified: trunk/build/run_tests.py
==============================================================================
--- trunk/build/run_tests.py	(original)
+++ trunk/build/run_tests.py	Thu Apr 29 18:17:29 2004
@@ -10,7 +10,7 @@
   '''
 
   def __init__(self, abs_srcdir, abs_builddir, python, shell, logfile,
-               base_url=None, verbose=None, cleanup=None):
+               base_url=None, fs_type=None, verbose=None, cleanup=None):
     '''Construct a TestHarness instance.
 
     ABS_SRCDIR and ABS_BUILDDIR are the source and build directories.
@@ -18,6 +18,7 @@
     SHELL is the name of the shell.
     LOGFILE is the name of the log file.
     BASE_URL is the base url for DAV tests.
+    FS_TYPE is the FS type for repository creation.
     '''
     self.srcdir = abs_srcdir
     self.builddir = abs_builddir
@@ -25,6 +26,7 @@
     self.shell = shell
     self.logfile = logfile
     self.base_url = base_url
+    self.fs_type = fs_type
     self.verbose = verbose
     self.cleanup = cleanup
     self.log = None
@@ -84,6 +86,9 @@
       if self.base_url is not None:
         cmdline.append('--url')
         cmdline.append(quote(self.base_url))
+      if self.fs_type is not None:
+        cmdline.append('--fs-type')
+        cmdline.append(quote(self.fs_type))
     elif progbase[-3:] == '.sh':
       progname = self.shell
       cmdline = [quote(progname),
@@ -145,18 +150,19 @@
 
 
 def main():
-  '''Usage: run_tests.py [--url <base_url>] [--verbose] [--cleanup]
+  '''Usage: run_tests.py [--url <base-url>] [--fs-type <fs-type>]
+                      [--verbose] [--cleanup]
                       <abs_srcdir> <abs_builddir> <python> <shell>
                       <prog ...>
 
-  The optional base_url, verbose and cleanup options, and the first
-  four parameters are passed unchanged to the TestHarness constuctor.
-  All other parameters are names of test programs.
+  The optional base-url, fs-type, verbose, and cleanup options, and
+  the first four parameters are passed unchanged to the TestHarness
+  constuctor.  All other parameters are names of test programs.
   '''
 
   try:
     opts, args = getopt.getopt(sys.argv[1:], '',
-                               ['url=', 'verbose', 'cleanup'])
+                               ['url=', 'fs-type=', 'verbose', 'cleanup'])
   except getopt.GetoptError:
     args = []
 
@@ -164,10 +170,12 @@
     print __doc__
     sys.exit(2)
 
-  base_url, verbose, cleanup = None, None, None
+  base_url, fs_type, verbose, cleanup = None, None, None, None
   for opt, val in opts:
     if opt == '--url':
       base_url = val
+    elif opt == '--fs-type':
+      fs_type = val
     elif opt == '--verbose':
       verbose = 1
     elif opt == '--cleanup':
@@ -177,7 +185,7 @@
 
   th = TestHarness(args[0], args[1], args[2], args[3],
                    os.path.abspath('tests.log'),
-                   base_url, verbose, cleanup)
+                   base_url, fs_type, verbose, cleanup)
 
   failed = th.run(args[4:])
   if failed:

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Apr 29 18:17:29 2004
@@ -246,8 +246,8 @@
 # Berkeley DB on SCO OpenServer needs -lsocket
 AC_CHECK_LIB(socket, socket)
 
-# Build the filesystem library (and repository administration tool)
-# only if we have an appropriate version of Berkeley DB.
+# Build the BDB filesystem library only if we have an appropriate
+# version of Berkeley DB.
 case "$host" in
 powerpc-apple-darwin*)
     # Berkeley DB 4.0 does not work on OS X.
@@ -304,16 +304,17 @@
 #endif
 )
 
-# Only add *_APACHE_RULE if we also have db, since mod_dav_svn depends on it.
 INSTALL_STATIC_RULES="install-bin install-docs"
 INSTALL_RULES="install-base-lib install-lib install-include install-static"
-BUILD_RULES="base-lib lib bin test"
+INSTALL_RULES="$INSTALL_RULES $INSTALL_APACHE_RULE"
+BUILD_RULES="base-lib lib bin test $BUILD_APACHE_RULE"
+
 if test "$svn_lib_berkeley_db" = "yes"; then
-  BUILD_RULES="base-lib fs-lib lib bin fs-bin $BUILD_APACHE_RULE test fs-test"
-  INSTALL_STATIC_RULES="install-bin install-fs-bin install-docs"
-  INSTALL_RULES="install-base-lib install-fs-lib install-lib install-include \
                install-static $INSTALL_APACHE_RULE"
-  FS_TEST_DEPS="\$(FS_TEST_DEPS)"
-  FS_TEST_PROGRAMS="\$(FS_TEST_PROGRAMS)"
+  BUILD_RULES="$BUILD_RULES bdb-lib bdb-test"
+  INSTALL_RULES="$INSTALL_RULES install-bdb-lib"
+  INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-bdb-lib"
+  BDB_TEST_DEPS="\$(BDB_TEST_DEPS)"
+  BDB_TEST_PROGRAMS="\$(BDB_TEST_PROGRAMS)"
 fi
 
 if test "$svn_lib_neon" = "yes"; then
@@ -330,8 +331,8 @@
 AC_SUBST(BUILD_RULES)
 AC_SUBST(INSTALL_STATIC_RULES)
 AC_SUBST(INSTALL_RULES)
-AC_SUBST(FS_TEST_DEPS)
-AC_SUBST(FS_TEST_PROGRAMS)
+AC_SUBST(BDB_TEST_DEPS)
+AC_SUBST(BDB_TEST_PROGRAMS)
 
 AC_DEFINE_UNQUOTED(SVN_FS_WANT_DB_MAJOR, $SVN_FS_WANT_DB_MAJOR,
                    [The desired major version for the Berkeley DB])
@@ -535,35 +536,51 @@
 ])
 
 if test "$enable_shared" = "no" -o "$enable_dso" != "yes"; then
-  if test "$svn_lib_neon" = "yes"; then
-    AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_DAV, 1,
-          [Defined if libsvn_client should link against libsvn_ra_dav])
-    svn_ra_lib_deps="\$(RA_DAV_DEPS)"
-    svn_ra_lib_link="\$(RA_DAV_LINK)"
-  fi
+  ### We want ra_local first to handle the following scenario:
+  ### user has neon and db3 in /usr/local, and db4 in
+  ### /usr/local/BerkeleyDB.4.0.  If libsvn_ra_dav.la comes before 
+  ### libsvn_fs.la then libtool ends up linking libsvn_fs to the db3
+  ### in /usr/local/lib
+  AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL, 1,
+      [Defined if libsvn_client should link against libsvn_ra_local])
+  svn_ra_lib_deps="\$(RA_LOCAL_DEPS)"
+  svn_ra_lib_link="\$(RA_LOCAL_LINK)"
 
   AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_SVN, 1,
       [Defined if libsvn_client should link against libsvn_ra_svn])
   svn_ra_lib_deps="$svn_ra_lib_deps \$(RA_SVN_DEPS)"
   svn_ra_lib_link="$svn_ra_lib_link \$(RA_SVN_LINK)"
 
-  if test "$svn_lib_berkeley_db" = "yes"; then
-    AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL, 1,
-        [Defined if libsvn_client should link against libsvn_ra_local])
-    svn_ra_lib_deps="\$(RA_LOCAL_DEPS) $svn_ra_lib_deps"
-    ### We can't just append to SVN_RA_LIB_LINK because of the following
-    ### scenario: user has neon and db3 in /usr/local, and db4 in
-    ### /usr/local/BerkeleyDB.4.0.  If libsvn_ra_dav.la comes before 
-    ### libsvn_fs.la then libtool ends up linking libsvn_fs to the db3 in
-    ### /usr/local/lib
-    svn_ra_lib_link="\$(RA_LOCAL_LINK) $svn_ra_lib_link"
+  if test "$svn_lib_neon" = "yes"; then
+    AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_DAV, 1,
+          [Defined if libsvn_client should link against libsvn_ra_dav])
+    svn_ra_lib_deps="$svn_ra_lib_deps \$(RA_DAV_DEPS)"
+    svn_ra_lib_link="$svn_ra_lib_link \$(RA_DAV_LINK)"
   fi
+
   SVN_RA_LIB_DEPS=$svn_ra_lib_deps
   SVN_RA_LIB_LINK=$svn_ra_lib_link
+
+  AC_DEFINE(SVN_LIBSVN_FS_LINKS_FS_FS, 1,
+      [Defined if libsvn_fs should link against libsvn_fs_fs])
+  svn_fs_lib_deps="\$(FS_FS_DEPS)"
+  svn_fs_lib_link="\$(FS_FS_LINK)"
+
+  if test "$svn_lib_berkeley_db" = "yes"; then
+  AC_DEFINE(SVN_LIBSVN_FS_LINKS_FS_BASE, 1,
+      [Defined if libsvn_fs should link against libsvn_fs_base])
+    svn_fs_lib_deps="$svn_fs_lib_deps \$(FS_BASE_DEPS)"
+    svn_fs_lib_link="$svn_fs_lib_link \$(FS_BASE_LINK)"
+  fi
+
+  SVN_FS_LIB_DEPS=$svn_fs_lib_deps
+  SVN_FS_LIB_LINK=$svn_fs_lib_link
 fi
 
 AC_SUBST(SVN_RA_LIB_DEPS)
 AC_SUBST(SVN_RA_LIB_LINK)
+AC_SUBST(SVN_FS_LIB_DEPS)
+AC_SUBST(SVN_FS_LIB_LINK)
 
 
 dnl Possibly compile JavaHL (experimental)
@@ -656,15 +673,16 @@
 case "$svn_lib_berkeley_db" in
   "no" )
     db_version="$SVN_FS_WANT_DB_MAJOR.$SVN_FS_WANT_DB_MINOR.$SVN_FS_WANT_DB_PATCH"
-    AC_MSG_WARN([we have configured for a client-only build
+    AC_MSG_WARN([we have configured without BDB filesystem support
 
 
-The Subversion filesystem library, part of the server, requires
-Berkeley DB version $db_version or newer, which you don't seem to have
-installed and linked to APR-UTIL.  We have created makefiles which
-will build the Subversion client code only, and skip the server.  You
-can find latest version of Berkeley DB at http://www.sleepycat.com/.
-You can find the latest version of Berkeley DB here:
+The Subversion default filesystem back-end library requires Berkeley
+DB version $db_version or newer, which you don't seem to have
+installed and linked to APR-UTIL.  We have created Makefiles which
+will build without the default filesystem library; you will have to
+use "svnadmin create --fs-type=fsfs PATH" to create a repository using
+the alternative FSFS back-end.  You can find the latest version of
+Berkeley DB here:
   http://www.sleepycat.com/download/index.shtml
 ])
 ;;

Modified: trunk/subversion/include/svn_error_codes.h
==============================================================================
--- trunk/subversion/include/svn_error_codes.h	(original)
+++ trunk/subversion/include/svn_error_codes.h	Thu Apr 29 18:17:29 2004
@@ -491,6 +491,10 @@
               SVN_ERR_FS_CATEGORY_START + 32,
               "Transaction is not dead")
 
+  SVN_ERRDEF (SVN_ERR_FS_UNKNOWN_FS_TYPE,
+              SVN_ERR_FS_CATEGORY_START + 33,
+              "Unknown FS type")
+
   /* repos errors */
 
   SVN_ERRDEF (SVN_ERR_REPOS_LOCKED,

Modified: trunk/subversion/include/svn_fs.h
==============================================================================
--- trunk/subversion/include/svn_fs.h	(original)
+++ trunk/subversion/include/svn_fs.h	Thu Apr 29 18:17:29 2004
@@ -47,25 +47,10 @@
 /** Filesystem configuration options. */
 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC            "bdb-txn-nosync"
 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE        "bdb-log-autoremove"
+#define SVN_FS_CONFIG_FS_TYPE                   "fs-type"
 
-
-/** Create a new filesystem object in @a pool.
- *
- * It doesn't refer to any actual repository yet; you need to invoke
- * @c svn_fs_open_* or @c svn_fs_create_* on it for that to happen. If
- * @a fs_config is not @c NULL, the options it contains modify the
- * behaviour of the filesystem. The interpretation of @a fs_config is
- * specific to the filesystem back-end.
- *
- * @note The lifetime of @a fs_config must not be shorter than @a
- * pool's. It's a good idea to allocate @a fs_config from @a pool or
- * one of its ancestors.
- *
- * @note You probably don't want to use this directly, especially not
- * if it's followed immediately by a call to @c svn_fs_open_berkeley().
- * Take a look at @c svn_repos_open() instead.
- */
-svn_fs_t *svn_fs_new (apr_hash_t *fs_config, apr_pool_t *pool);
+#define SVN_FS_TYPE_BDB                         "bdb"
+#define SVN_FS_TYPE_FSFS                        "fsfs"
 
 
 /** The type of a warning callback function.  @a baton is the value specified
@@ -93,58 +78,79 @@
 
 
 
-/** Subversion filesystems based on Berkeley DB.
- * 
- * There are many possible ways to implement the Subversion filesystem
- * interface.  You could implement it directly using ordinary POSIX
- * filesystem operations; you could build it using an SQL server as a
- * back end; you could build it on RCS; and so on.
- *
- * The functions on this page create filesystem objects that use
- * Berkeley DB (http://www.sleepycat.com) to store their data.
- * Berkeley DB supports transactions and recoverability, making it
- * well-suited for Subversion.
- *
- * A Berkeley DB ``environment'' is a Unix directory containing
- * database files, log files, backing files for shared memory buffers,
- * and so on --- everything necessary for a complex database
- * application.  Each Subversion filesystem lives in a single Berkeley
- * DB environment.
- *
- * @defgroup svn_fs_bdb berkeley db filesystems
- * @{
- */
-
-/** Create a new, empty Subversion filesystem, stored in a Berkeley DB
- * environment under @a path, a utf8-encoded path.  Make @a fs refer to 
- * this new filesystem.  @a fs provides the memory pool, warning function,
- * etc.  If @a path exists, it must be an empty directory.
- */
-svn_error_t *svn_fs_create_berkeley (svn_fs_t *fs, const char *path);
 
-
-/** Make @a fs refer to the Berkeley DB-based Subversion filesystem at
- * @a path.  @a path is utf8-encoded, and must refer to a file or directory
- * created by @c svn_fs_create_berkeley.
+/** Create a new, empty Subversion filesystem, stored in the directory
+ * @a path, and return a pointer to it in @a *fs_p.  @a path must not
+ * currently exist, but its parent must exist.  If @a fs_config is not
+ * @c NULL, the options it contains modify the behavior of the
+ * filesystem.  The interpretation of @a fs_config is specific to the
+ * filesystem back-end.  The new filesystem may be closed by
+ * destroying @a pool.
+ *
+ * @note The lifetime of @a fs_config must not be shorter than @a
+ * pool's. It's a good idea to allocate @a fs_config from @a pool or
+ * one of its ancestors.
+ *
+ * If @a fs_config contains a value for @c SVN_FS_CONFIG_FS_TYPE, that
+ * value determines the filesystem type for the new filesystem.
+ * Currently defined values are:
+ *
+ *   SVN_FS_TYPE_BDB   Berkeley-DB implementation
+ *   SVN_FS_TYPE_FSFS  Native-filesystem implementation
+ *
+ * Otherwise, the BDB filesystem type is assumed.  Once the filesystem
+ * is created, its type will be recorded so that other functions will
+ * know how to operate on it.
+ */
+svn_error_t *svn_fs_create (svn_fs_t **fs_p, const char *path,
+                            apr_hash_t *fs_config, apr_pool_t *pool);
+
+/** Open a Subversion filesystem located in the directory @a path, and
+ * return a pointer to it in @a *fs_p.  If @a fs_config is not @c
+ * NULL, the options it contains modify the behavior of the
+ * filesystem.  The interpretation of @a fs_config is specific to the
+ * filesystem back-end.  The opened filesystem may be closed by
+ * destroying @a pool.
+ *
+ * @note The lifetime of @a fs_config must not be shorter than @a
+ * pool's. It's a good idea to allocate @a fs_config from @a pool or
+ * one of its ancestors.
  *
  * Only one thread may operate on any given filesystem object at once.
  * Two threads may access the same filesystem simultaneously only if
- * they open separate filesystem objects.  
+ * they open separate filesystem objects.
  *
- * NOTE: you probably don't want to use this directly, especially not
- * if it's immediately preceded by a call to @c svn_fs_new().  Take a
- * look at @c svn_repos_open() instead.
+ * NOTE: you probably don't want to use this directly.  Take a look at
+ * @c svn_repos_open() instead.
  */
-svn_error_t *svn_fs_open_berkeley (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_open (svn_fs_t **fs_p, const char *path,
+                          apr_hash_t *config, apr_pool_t *pool);
+
+/** Return the path to @a fs's repository, allocated in @a pool.
+ * Note: this is just what was passed to @c svn_fs_create() or
+ * @a svn_fs_open() -- might be absolute, might not.
+ */
+const char *svn_fs_path (svn_fs_t *fs, apr_pool_t *pool);
 
+/** Delete the filesystem at @a path. */
+svn_error_t *svn_fs_delete_fs (const char *path, apr_pool_t *pool);
 
-/** Return the utf8-encoded path to @a fs's repository, allocated in
- * @a pool.  Note: this is just what was passed to
- * @c svn_fs_create_berkeley() or @a svn_fs_open_berkeley() -- might be
- * absolute, might not.
+/** Copy a possibly live Subversion filesystem from @a src_path to
+ * @a dest_path.  If @a clean is @c TRUE, perform cleanup on the
+ * source filesystem as part of the copy operation; currently, this
+ * means deleting copied, unused logfiles for a Berkeley DB source
+ * filesystem.
  */
-const char *svn_fs_berkeley_path (svn_fs_t *fs, apr_pool_t *pool);
+svn_error_t *svn_fs_hotcopy (const char *src_path, const char *dest_path,
+                             svn_boolean_t clean, apr_pool_t *pool);
 
+/** Subversion filesystems based on Berkeley DB.
+ *
+ * The following functions are specific to Berkeley DB filesystems.
+ *
+ * @defgroup svn_fs_bdb berkeley db filesystems
+ * @{
+ */
 
 /** Register an error handling function for Berkeley DB error messages.
  * If a Berkeley DB error occurs, the filesystem will call @a handler
@@ -164,23 +170,6 @@
                                           void (*handler) (const char *errpfx,
                                                            char *msg));
 
-/** Delete the Berkeley DB-based filesystem @a path.  This deletes the
- * database files, log files, shared memory segments, etc.  @a path should
- * refer to a file or directory created by @c svn_fs_create_berkeley.
- */
-svn_error_t *svn_fs_delete_berkeley (const char *path, apr_pool_t *pool);
-
-
-/** Hot copy Subversion filesystem, stored in a Berkeley DB environment under 
- * @a src_path to @a dest_path. If @a clean_logs is used is @c TRUE, 
- * delete copied, unused log files from source repository at @a src_path
- * Using @a pool for any necessary memory allocations.
- */
-svn_error_t *svn_fs_hotcopy_berkeley (const char *src_path, 
-                                      const char *dest_path, 
-                                      svn_boolean_t clean_logs,
-                                      apr_pool_t *pool);
-
 /** Perform any necessary non-catastrophic recovery on a Berkeley
  * DB-based Subversion filesystem, stored in the environment @a path.
  * Do any necessary allocation within @a pool.
@@ -224,6 +213,22 @@
                                        svn_boolean_t only_unused,
                                        apr_pool_t *pool);
 
+
+/**
+ * @deprecated Provided for backward compatibility with the 1.0.0 API.
+ *
+ * The following functions are similar to their generic counterparts,
+ * but only work on Berkeley DB filesystems.
+ */
+svn_fs_t *svn_fs_new (apr_hash_t *fs_config, apr_pool_t *pool);
+svn_error_t *svn_fs_create_berkeley (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_open_berkeley (svn_fs_t *fs, const char *path);
+const char *svn_fs_berkeley_path (svn_fs_t *fs, apr_pool_t *pool);
+svn_error_t *svn_fs_delete_berkeley (const char *path, apr_pool_t *pool);
+svn_error_t *svn_fs_hotcopy_berkeley (const char *src_path, 
+                                      const char *dest_path, 
+                                      svn_boolean_t clean_logs,
+                                      apr_pool_t *pool);
 
 /** @} */
 

Modified: trunk/subversion/libsvn_fs_base/bdb/bdb-err.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/bdb-err.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/bdb-err.c	Thu Apr 29 18:17:29 2004
@@ -29,6 +29,7 @@
 #include "svn_fs.h"
 #include "../fs.h"
 #include "../err.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 
 
@@ -43,18 +44,18 @@
   else
     return SVN_ERR_FS_BERKELEY_DB;
 }
- 
+
 
 svn_error_t *
-svn_fs__bdb_dberr (int db_err)
+svn_fs_bdb__dberr (int db_err)
 {
-  return svn_error_create (bdb_err_to_apr_err (db_err), 0, 
+  return svn_error_create (bdb_err_to_apr_err (db_err), 0,
                            db_strerror (db_err));
 }
 
 
 svn_error_t *
-svn_fs__bdb_dberrf (int db_err, const char *fmt, ...)
+svn_fs_bdb__dberrf (int db_err, const char *fmt, ...)
 {
   va_list ap;
   char *msg;
@@ -69,11 +70,11 @@
 
 
 svn_error_t *
-svn_fs__bdb_wrap_db (svn_fs_t *fs, const char *operation, int db_err)
+svn_fs_bdb__wrap_db (svn_fs_t *fs, const char *operation, int db_err)
 {
   if (! db_err)
     return SVN_NO_ERROR;
-  return svn_fs__bdb_dberrf (db_err, 
+  return svn_fs_bdb__dberrf (db_err,
                              "Berkeley DB error while %s for filesystem %s:\n",
                              operation, fs->path ? fs->path : "(none)");
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/bdb-err.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/bdb-err.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/bdb-err.h	Thu Apr 29 18:17:29 2004
@@ -34,7 +34,7 @@
 /* Return an svn_error_t object that reports a Berkeley DB error.
    BDB_ERR is the error value returned by the Berkeley DB routine.
    Allocate the error object from POOL.  */
-svn_error_t *svn_fs__bdb_dberr (int db_err);
+svn_error_t *svn_fs_bdb__dberr (int db_err);
 
 
 /* Allocate an error object for a Berkeley DB error, with a formatted message.
@@ -50,7 +50,7 @@
 
    There is no separator between the two messages; if you want one,
    you should include it in FMT.  */
-svn_error_t *svn_fs__bdb_dberrf (int db_err,
+svn_error_t *svn_fs_bdb__dberrf (int db_err,
                                  const char *fmt, ...);
 
 
@@ -60,23 +60,23 @@
    - FS is the Subversion filesystem we're operating on.
    - OPERATION is a gerund clause describing what we were trying to do.
    - BDB_ERR is the return status from the Berkeley DB function.  */
-svn_error_t *svn_fs__bdb_wrap_db (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__wrap_db (svn_fs_t *fs,
                                   const char *operation,
                                   int db_err);
 
 
-/* A terse wrapper for svn_fs__bdb_wrap_db.  */
-#define BDB_WRAP(fs, op, err) (svn_fs__bdb_wrap_db ((fs), (op), (err)))
+/* A terse wrapper for svn_fs_bdb__wrap_db.  */
+#define BDB_WRAP(fs, op, err) (svn_fs_bdb__wrap_db ((fs), (op), (err)))
 
 /* If EXPR returns a non-zero value, pass that value to
-   svn_fs__bdb_dberr and return that function's value.  This is like
+   svn_fs_bdb__dberr and return that function's value.  This is like
    SVN_ERR, but is used by functions that return a Subversion error
    and call other functions that return a Berkeley DB error code. */
 #define SVN_BDB_ERR(expr)                       \
   do {                                          \
     int db_err__temp = (expr);                  \
     if (db_err__temp)                           \
-      return svn_fs__bdb_dberr (expr);          \
+      return svn_fs_bdb__dberr (expr);          \
   } while (0)
 
 
@@ -92,7 +92,7 @@
 
 /* Verify that FS refers to an open database; return an appropriate
    error if this is not the case.  */
-svn_error_t *svn_fs__bdb_check_fs (svn_fs_t *fs);
+svn_error_t *svn_fs_bdb__check_fs (svn_fs_t *fs);
 
 #ifdef __cplusplus
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/bdb_compat.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/bdb_compat.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/bdb_compat.c	Thu Apr 29 18:17:29 2004
@@ -18,7 +18,7 @@
 #include "bdb_compat.h"
 
 int
-svn_fs__bdb_check_version (void)
+svn_fs_bdb__check_version (void)
 {
   int major, minor;
 

Modified: trunk/subversion/libsvn_fs_base/bdb/bdb_compat.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/bdb_compat.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/bdb_compat.h	Thu Apr 29 18:17:29 2004
@@ -56,7 +56,7 @@
    against, because the DB->open call is not binary compatible between
    BDB 4.0 and 4.1. This function returns DB_OLD_VERSION if the
    compile-time and run-time versions of BDB don't match. */
-int svn_fs__bdb_check_version (void);
+int svn_fs_bdb__check_version (void);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/bdb/changes-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/changes-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/changes-table.c	Thu Apr 29 18:17:29 2004
@@ -24,10 +24,10 @@
 #include "svn_pools.h"
 #include "svn_path.h"
 #include "../fs.h"
-#include "../id.h"
 #include "../err.h"
 #include "../trail.h"
 #include "../util/fs_skels.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "dbt.h"
 #include "changes-table.h"
@@ -37,14 +37,14 @@
 /*** Creating and opening the changes table. ***/
 
 int
-svn_fs__bdb_open_changes_table (DB **changes_p,
+svn_fs_bdb__open_changes_table (DB **changes_p,
                                 DB_ENV *env,
                                 svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *changes;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&changes, env, 0));
 
   /* Enable duplicate keys. This allows us to store the changes
@@ -65,40 +65,42 @@
 /*** Storing and retrieving changes.  ***/
 
 svn_error_t *
-svn_fs__bdb_changes_add (svn_fs_t *fs,
+svn_fs_bdb__changes_add (svn_fs_t *fs,
                          const char *key,
-                         svn_fs__change_t *change,
+                         change_t *change,
                          trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, value;
   skel_t *skel;
 
   /* Convert native type to skel. */
-  SVN_ERR (svn_fs__unparse_change_skel (&skel, change, trail->pool));
+  SVN_ERR (svn_fs_base__unparse_change_skel (&skel, change, trail->pool));
 
   /* Store a new record into the database. */
-  svn_fs__str_to_dbt (&query, key);
-  svn_fs__skel_to_dbt (&value, skel, trail->pool);
-  svn_fs__trail_debug (trail, "changes", "put");
-  SVN_ERR (BDB_WRAP (fs, "creating change", 
-                    fs->changes->put (fs->changes, trail->db_txn,
-                                      &query, &value, 0)));
+  svn_fs_base__str_to_dbt (&query, key);
+  svn_fs_base__skel_to_dbt (&value, skel, trail->pool);
+  svn_fs_base__trail_debug (trail, "changes", "put");
+  SVN_ERR (BDB_WRAP (fs, "creating change",
+                     bfd->changes->put (bfd->changes, trail->db_txn,
+                                        &query, &value, 0)));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_changes_delete (svn_fs_t *fs,
+svn_fs_bdb__changes_delete (svn_fs_t *fs,
                             const char *key,
                             trail_t *trail)
 {
   int db_err;
   DBT query;
-  
-  svn_fs__trail_debug (trail, "changes", "del");
-  db_err = fs->changes->del (fs->changes, trail->db_txn,
-                             svn_fs__str_to_dbt (&query, key), 0);
+  base_fs_data_t *bfd = fs->fsap_data;
+
+  svn_fs_base__trail_debug (trail, "changes", "del");
+  db_err = bfd->changes->del (bfd->changes, trail->db_txn,
+                              svn_fs_base__str_to_dbt (&query, key), 0);
 
   /* If there're no changes for KEY, that is acceptable.  Any other
      error should be propogated to the caller, though.  */
@@ -116,7 +118,7 @@
    single summarical (is that real word?) change per path. */
 static svn_error_t *
 fold_change (apr_hash_t *changes,
-             const svn_fs__change_t *change)
+             const change_t *change)
 {
   apr_pool_t *pool = apr_hash_pool_get (changes);
   svn_fs_path_change_t *old_change, *new_change;
@@ -126,7 +128,7 @@
     {
       /* This path already exists in the hash, so we have to merge
          this change into the already existing one. */
-      
+
       /* Since the path already exists in the hash, we don't have to
          dup the allocation for the path itself. */
       path = change->path;
@@ -134,27 +136,27 @@
       /* Sanity check:  only allow NULL node revision ID in the
          `reset' case. */
       if ((! change->noderev_id) && (change->kind != svn_fs_path_change_reset))
-        return svn_error_create 
+        return svn_error_create
           (SVN_ERR_FS_CORRUPT, NULL,
            "Missing required node revision ID");
-        
+
       /* Sanity check:  we should be talking about the same node
          revision ID as our last change except where the last change
          was a deletion. */
       if (change->noderev_id
           && (! svn_fs__id_eq (old_change->node_rev_id, change->noderev_id))
           && (old_change->change_kind != svn_fs_path_change_delete))
-        return svn_error_create 
+        return svn_error_create
           (SVN_ERR_FS_CORRUPT, NULL,
            "Invalid change ordering: new node revision ID without delete");
 
       /* Sanity check: an add, replacement, or reset must be the first
          thing to follow a deletion. */
       if ((old_change->change_kind == svn_fs_path_change_delete)
-          && (! ((change->kind == svn_fs_path_change_replace) 
+          && (! ((change->kind == svn_fs_path_change_replace)
                  || (change->kind == svn_fs_path_change_reset)
                  || (change->kind == svn_fs_path_change_add))))
-        return svn_error_create 
+        return svn_error_create
           (SVN_ERR_FS_CORRUPT, NULL,
            "Invalid change ordering: non-add change on deleted path");
 
@@ -227,11 +229,12 @@
 
 
 svn_error_t *
-svn_fs__bdb_changes_fetch (apr_hash_t **changes_p,
+svn_fs_bdb__changes_fetch (apr_hash_t **changes_p,
                            svn_fs_t *fs,
                            const char *key,
                            trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBC *cursor;
   DBT query, result;
   int db_err = 0, db_c_err = 0;
@@ -241,36 +244,37 @@
 
   /* Get a cursor on the first record matching KEY, and then loop over
      the records, adding them to the return array. */
-  svn_fs__trail_debug (trail, "changes", "cursor");
+  svn_fs_base__trail_debug (trail, "changes", "cursor");
   SVN_ERR (BDB_WRAP (fs, "creating cursor for reading changes",
-                    fs->changes->cursor (fs->changes, trail->db_txn,
-                                         &cursor, 0)));
+                     bfd->changes->cursor (bfd->changes, trail->db_txn,
+                                           &cursor, 0)));
 
   /* Advance the cursor to the key that we're looking for. */
-  svn_fs__str_to_dbt (&query, key);
-  svn_fs__result_dbt (&result);
+  svn_fs_base__str_to_dbt (&query, key);
+  svn_fs_base__result_dbt (&result);
   db_err = cursor->c_get (cursor, &query, &result, DB_SET);
   if (! db_err)
-    svn_fs__track_dbt (&result, trail->pool);
+    svn_fs_base__track_dbt (&result, trail->pool);
 
   while (! db_err)
     {
-      svn_fs__change_t *change;
+      change_t *change;
       skel_t *result_skel;
-      
+
       /* RESULT now contains a change record associated with KEY.  We
-         need to parse that skel into an svn_fs__change_t structure ...  */
-      result_skel = svn_fs__parse_skel (result.data, result.size, subpool);
+         need to parse that skel into an change_t structure ...  */
+      result_skel = svn_fs_base__parse_skel (result.data, result.size,
+                                             subpool);
       if (! result_skel)
         {
           err = svn_error_createf (SVN_ERR_FS_CORRUPT, NULL,
                                    "Error reading changes for key '%s'", key);
           goto cleanup;
         }
-      err = svn_fs__parse_change_skel (&change, result_skel, subpool);
+      err = svn_fs_base__parse_change_skel (&change, result_skel, subpool);
       if (err)
         goto cleanup;
-      
+
       /* ... and merge it with our return hash.  */
       err = fold_change (changes, change);
       if (err)
@@ -278,7 +282,7 @@
 
       /* Now, if our change was a deletion or replacement, we have to
          blow away any changes thus far on paths that are (or, were)
-         children of this path.   
+         children of this path.
          ### i won't bother with another iteration pool here -- at
              most we talking about a few extra dups of paths into what
              is already a temporary subpool.
@@ -288,15 +292,15 @@
         {
           apr_hash_index_t *hi;
 
-          for (hi = apr_hash_first (subpool, changes); 
-               hi; 
+          for (hi = apr_hash_first (subpool, changes);
+               hi;
                hi = apr_hash_next (hi))
             {
               /* KEY is the path. */
               const void *hashkey;
               apr_ssize_t klen;
               apr_hash_this (hi, &hashkey, &klen, NULL);
-              
+
               /* If we come across our own path, ignore it. */
               if (strcmp (change->path, hashkey) == 0)
                 continue;
@@ -309,11 +313,11 @@
 
       /* Advance the cursor to the next record with this same KEY, and
          fetch that record. */
-      svn_fs__result_dbt (&result);
+      svn_fs_base__result_dbt (&result);
       db_err = cursor->c_get (cursor, &query, &result, DB_NEXT_DUP);
       if (! db_err)
-        svn_fs__track_dbt (&result, trail->pool);
-      
+        svn_fs_base__track_dbt (&result, trail->pool);
+
       /* Clear the per-iteration subpool. */
       svn_pool_clear (subpool);
     }
@@ -334,7 +338,7 @@
   /* If we had an error prior to closing the cursor, return the error. */
   if (err)
     return err;
-  
+
   /* If our only error thus far was when we closed the cursor, return
      that error. */
   if (db_c_err)
@@ -347,59 +351,61 @@
 
 
 svn_error_t *
-svn_fs__bdb_changes_fetch_raw (apr_array_header_t **changes_p,
+svn_fs_bdb__changes_fetch_raw (apr_array_header_t **changes_p,
                                svn_fs_t *fs,
                                const char *key,
                                trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBC *cursor;
   DBT query, result;
   int db_err = 0, db_c_err = 0;
   svn_error_t *err = SVN_NO_ERROR;
-  svn_fs__change_t *change;
-  apr_array_header_t *changes = apr_array_make (trail->pool, 4, 
+  change_t *change;
+  apr_array_header_t *changes = apr_array_make (trail->pool, 4,
                                                 sizeof (change));
 
   /* Get a cursor on the first record matching KEY, and then loop over
      the records, adding them to the return array. */
-  svn_fs__trail_debug (trail, "changes", "cursor");
+  svn_fs_base__trail_debug (trail, "changes", "cursor");
   SVN_ERR (BDB_WRAP (fs, "creating cursor for reading changes",
-                    fs->changes->cursor (fs->changes, trail->db_txn,
-                                         &cursor, 0)));
+                     bfd->changes->cursor (bfd->changes, trail->db_txn,
+                                           &cursor, 0)));
 
   /* Advance the cursor to the key that we're looking for. */
-  svn_fs__str_to_dbt (&query, key);
-  svn_fs__result_dbt (&result);
+  svn_fs_base__str_to_dbt (&query, key);
+  svn_fs_base__result_dbt (&result);
   db_err = cursor->c_get (cursor, &query, &result, DB_SET);
   if (! db_err)
-    svn_fs__track_dbt (&result, trail->pool);
+    svn_fs_base__track_dbt (&result, trail->pool);
 
   while (! db_err)
     {
       skel_t *result_skel;
-      
+
       /* RESULT now contains a change record associated with KEY.  We
-         need to parse that skel into an svn_fs__change_t structure ...  */
-      result_skel = svn_fs__parse_skel (result.data, result.size, trail->pool);
+         need to parse that skel into an change_t structure ...  */
+      result_skel = svn_fs_base__parse_skel (result.data, result.size,
+                                             trail->pool);
       if (! result_skel)
         {
           err = svn_error_createf (SVN_ERR_FS_CORRUPT, NULL,
                                    "Error reading changes for key '%s'", key);
           goto cleanup;
         }
-      err = svn_fs__parse_change_skel (&change, result_skel, trail->pool);
+      err = svn_fs_base__parse_change_skel (&change, result_skel, trail->pool);
       if (err)
         goto cleanup;
-      
+
       /* ... and add it to our return array.  */
-      (*((svn_fs__change_t **) apr_array_push (changes))) = change;
+      (*((change_t **) apr_array_push (changes))) = change;
 
       /* Advance the cursor to the next record with this same KEY, and
          fetch that record. */
-      svn_fs__result_dbt (&result);
+      svn_fs_base__result_dbt (&result);
       db_err = cursor->c_get (cursor, &query, &result, DB_NEXT_DUP);
       if (! db_err)
-        svn_fs__track_dbt (&result, trail->pool);
+        svn_fs_base__track_dbt (&result, trail->pool);
     }
 
   /* If there are no (more) change records for this KEY, we're
@@ -415,7 +421,7 @@
   /* If we had an error prior to closing the cursor, return the error. */
   if (err)
     return err;
-  
+
   /* If our only error thus far was when we closed the cursor, return
      that error. */
   if (db_c_err)

Modified: trunk/subversion/libsvn_fs_base/bdb/changes-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/changes-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/changes-table.h	Thu Apr 29 18:17:29 2004
@@ -34,13 +34,13 @@
 /* Open a `changes' table in ENV.  If CREATE is non-zero, create one
    if it doesn't exist.  Set *CHANGES_P to the new table.  Return a
    Berkeley DB error code.  */
-int svn_fs__bdb_open_changes_table (DB **changes_p,
+int svn_fs_bdb__open_changes_table (DB **changes_p,
                                     DB_ENV *env,
                                     svn_boolean_t create);
 
 
 /* Add CHANGE as a record to the `changes' table in FS as part of
-   TRAIL, keyed on KEY.  
+   TRAIL, keyed on KEY.
 
    CHANGE->path is expected to be a canonicalized filesystem path (see
    svn_fs__canonicalize_abspath).
@@ -48,15 +48,15 @@
    Note that because the `changes' table uses duplicate keys, this
    function will not overwrite prior additions that have the KEY
    key, but simply adds this new record alongside previous ones.  */
-svn_error_t *svn_fs__bdb_changes_add (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__changes_add (svn_fs_t *fs,
                                       const char *key,
-                                      svn_fs__change_t *change,
+                                      change_t *change,
                                       trail_t *trail);
 
 
 /* Remove all changes associated with KEY from the `changes' table in
    FS, as part of TRAIL. */
-svn_error_t *svn_fs__bdb_changes_delete (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__changes_delete (svn_fs_t *fs,
                                          const char *key,
                                          trail_t *trail);
 
@@ -64,15 +64,15 @@
    containing svn_fs_path_change_t * values representing summarized
    changed records associated with KEY in FS, as part of TRAIL.
    Allocate the array and its items in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_changes_fetch (apr_hash_t **changes_p,
+svn_error_t *svn_fs_bdb__changes_fetch (apr_hash_t **changes_p,
                                         svn_fs_t *fs,
                                         const char *key,
                                         trail_t *trail);
 
-/* Return an array *CHANGES_P of svn_fs__change_t * items representing
+/* Return an array *CHANGES_P of change_t * items representing
    all the change records associated with KEY in FS, as part of TRAIL.
    Allocate the array and its items in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_changes_fetch_raw (apr_array_header_t **changes_p,
+svn_error_t *svn_fs_bdb__changes_fetch_raw (apr_array_header_t **changes_p,
                                             svn_fs_t *fs,
                                             const char *key,
                                             trail_t *trail);

Modified: trunk/subversion/libsvn_fs_base/bdb/copies-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/copies-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/copies-table.c	Thu Apr 29 18:17:29 2004
@@ -25,21 +25,21 @@
 #include "../util/skel.h"
 #include "../util/fs_skels.h"
 #include "../trail.h"
-#include "../id.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "copies-table.h"
 #include "rev-table.h"
 
 
 int
-svn_fs__bdb_open_copies_table (DB **copies_p,
+svn_fs_bdb__open_copies_table (DB **copies_p,
                                DB_ENV *env,
                                svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *copies;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&copies, env, 0));
   BDB_ERR (copies->open (SVN_BDB_OPEN_PARAMS(copies, NULL),
                         "copies", 0, DB_BTREE,
@@ -51,9 +51,9 @@
   {
     DBT key, value;
     BDB_ERR (copies->put (copies, 0,
-                         svn_fs__str_to_dbt (&key, svn_fs__next_key_key),
-                         svn_fs__str_to_dbt (&value, "0"),
-                         SVN_BDB_AUTO_COMMIT));
+                          svn_fs_base__str_to_dbt (&key, NEXT_KEY_KEY),
+                          svn_fs_base__str_to_dbt (&value, "0"),
+                          SVN_BDB_AUTO_COMMIT));
   }
 
   *copies_p = copies;
@@ -65,61 +65,63 @@
 /* ### only has one caller; might not need to be abstracted */
 static svn_error_t *
 put_copy (svn_fs_t *fs,
-          const svn_fs__copy_t *copy,
+          const copy_t *copy,
           const char *copy_id,
           trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   skel_t *copy_skel;
   DBT key, value;
 
   /* Convert native type to skel. */
-  SVN_ERR (svn_fs__unparse_copy_skel (&copy_skel, copy, trail->pool));
+  SVN_ERR (svn_fs_base__unparse_copy_skel (&copy_skel, copy, trail->pool));
 
   /* Only in the context of this function do we know that the DB call
      will not attempt to modify COPY_ID, so the cast belongs here.  */
-  svn_fs__str_to_dbt (&key, copy_id);
-  svn_fs__skel_to_dbt (&value, copy_skel, trail->pool);
-  svn_fs__trail_debug (trail, "copies", "put");
+  svn_fs_base__str_to_dbt (&key, copy_id);
+  svn_fs_base__skel_to_dbt (&value, copy_skel, trail->pool);
+  svn_fs_base__trail_debug (trail, "copies", "put");
   SVN_ERR (BDB_WRAP (fs, "storing copy record",
-                    fs->copies->put (fs->copies, trail->db_txn,
-                                     &key, &value, 0)));
+                     bfd->copies->put (bfd->copies, trail->db_txn,
+                                       &key, &value, 0)));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_reserve_copy_id (const char **id_p,
+svn_fs_bdb__reserve_copy_id (const char **id_p,
                              svn_fs_t *fs,
                              trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
   apr_size_t len;
-  char next_key[SVN_FS__MAX_KEY_SIZE];
+  char next_key[MAX_KEY_SIZE];
   int db_err;
 
-  svn_fs__str_to_dbt (&query, svn_fs__next_key_key);
+  svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY);
 
   /* Get the current value associated with the `next-id' key in the
      copies table.  */
-  svn_fs__trail_debug (trail, "copies", "get");
+  svn_fs_base__trail_debug (trail, "copies", "get");
   SVN_ERR (BDB_WRAP (fs, "allocating new copy ID (getting 'next-key')",
-                    fs->copies->get (fs->copies, trail->db_txn,
-                                     &query, svn_fs__result_dbt (&result), 
-                                     0)));
-  svn_fs__track_dbt (&result, trail->pool);
+                     bfd->copies->get (bfd->copies, trail->db_txn, &query,
+                                       svn_fs_base__result_dbt (&result),
+                                       0)));
+  svn_fs_base__track_dbt (&result, trail->pool);
 
   /* Set our return value. */
   *id_p = apr_pstrmemdup (trail->pool, result.data, result.size);
 
   /* Bump to future key. */
   len = result.size;
-  svn_fs__next_key (result.data, &len, next_key);
-  svn_fs__trail_debug (trail, "copies", "put");
-  db_err = fs->copies->put (fs->copies, trail->db_txn,
-                            svn_fs__str_to_dbt (&query, svn_fs__next_key_key),
-                            svn_fs__str_to_dbt (&result, next_key), 
-                            0);
+  svn_fs_base__next_key (result.data, &len, next_key);
+  svn_fs_base__trail_debug (trail, "copies", "put");
+  db_err = bfd->copies->put (bfd->copies, trail->db_txn,
+                             svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY),
+                             svn_fs_base__str_to_dbt (&result, next_key),
+                             0);
 
   SVN_ERR (BDB_WRAP (fs, "bumping next copy key", db_err));
   return SVN_NO_ERROR;
@@ -127,15 +129,15 @@
 
 
 svn_error_t *
-svn_fs__bdb_create_copy (svn_fs_t *fs,
+svn_fs_bdb__create_copy (svn_fs_t *fs,
                          const char *copy_id,
                          const char *src_path,
                          const char *src_txn_id,
                          const svn_fs_id_t *dst_noderev_id,
-                         svn_fs__copy_kind_t kind,
+                         copy_kind_t kind,
                          trail_t *trail)
 {
-  svn_fs__copy_t copy;
+  copy_t copy;
   copy.kind = kind;
   copy.src_path = src_path;
   copy.src_txn_id = src_txn_id;
@@ -145,53 +147,55 @@
 
 
 svn_error_t *
-svn_fs__bdb_delete_copy (svn_fs_t *fs,
+svn_fs_bdb__delete_copy (svn_fs_t *fs,
                          const char *copy_id,
                          trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT key;
   int db_err;
 
-  svn_fs__str_to_dbt (&key, copy_id);
-  svn_fs__trail_debug (trail, "copies", "del");
-  db_err = fs->copies->del (fs->copies, trail->db_txn, &key, 0);
+  svn_fs_base__str_to_dbt (&key, copy_id);
+  svn_fs_base__trail_debug (trail, "copies", "del");
+  db_err = bfd->copies->del (bfd->copies, trail->db_txn, &key, 0);
   if (db_err == DB_NOTFOUND)
-    return svn_fs__err_no_such_copy (fs, copy_id);
+    return svn_fs_base__err_no_such_copy (fs, copy_id);
   return BDB_WRAP (fs, "deleting entry from 'copies' table", db_err);
 }
 
 
 svn_error_t *
-svn_fs__bdb_get_copy (svn_fs__copy_t **copy_p,
+svn_fs_bdb__get_copy (copy_t **copy_p,
                       svn_fs_t *fs,
                       const char *copy_id,
                       trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT key, value;
   int db_err;
   skel_t *skel;
-  svn_fs__copy_t *copy;
+  copy_t *copy;
 
   /* Only in the context of this function do we know that the DB call
      will not attempt to modify copy_id, so the cast belongs here.  */
-  svn_fs__trail_debug (trail, "copies", "get");
-  db_err = fs->copies->get (fs->copies, trail->db_txn,
-                            svn_fs__str_to_dbt (&key, copy_id),
-                            svn_fs__result_dbt (&value),
-                            0);
-  svn_fs__track_dbt (&value, trail->pool);
+  svn_fs_base__trail_debug (trail, "copies", "get");
+  db_err = bfd->copies->get (bfd->copies, trail->db_txn,
+                             svn_fs_base__str_to_dbt (&key, copy_id),
+                             svn_fs_base__result_dbt (&value),
+                             0);
+  svn_fs_base__track_dbt (&value, trail->pool);
 
   if (db_err == DB_NOTFOUND)
-    return svn_fs__err_no_such_copy (fs, copy_id);
+    return svn_fs_base__err_no_such_copy (fs, copy_id);
   SVN_ERR (BDB_WRAP (fs, "reading copy", db_err));
 
   /* Unparse COPY skel */
-  skel = svn_fs__parse_skel (value.data, value.size, trail->pool);
+  skel = svn_fs_base__parse_skel (value.data, value.size, trail->pool);
   if (! skel)
-    return svn_fs__err_corrupt_copy (fs, copy_id);
+    return svn_fs_base__err_corrupt_copy (fs, copy_id);
 
   /* Convert skel to native type. */
-  SVN_ERR (svn_fs__parse_copy_skel (&copy, skel, trail->pool));
+  SVN_ERR (svn_fs_base__parse_copy_skel (&copy, skel, trail->pool));
   *copy_p = copy;
   return SVN_NO_ERROR;
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/copies-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/copies-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/copies-table.h	Thu Apr 29 18:17:29 2004
@@ -30,14 +30,14 @@
 /* Open a `copies' table in ENV.  If CREATE is non-zero, create
    one if it doesn't exist.  Set *COPIES_P to the new table.
    Return a Berkeley DB error code.  */
-int svn_fs__bdb_open_copies_table (DB **copies_p,
+int svn_fs_bdb__open_copies_table (DB **copies_p,
                                    DB_ENV *env,
                                    svn_boolean_t create);
 
 /* Reserve a slot in the `copies' table in FS for a new copy operation
    as part of TRAIL.  Return the slot's id in *COPY_ID_P, allocated in
    TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_reserve_copy_id (const char **copy_id_p,
+svn_error_t *svn_fs_bdb__reserve_copy_id (const char **copy_id_p,
                                           svn_fs_t *fs,
                                           trail_t *trail);
 
@@ -48,20 +48,21 @@
 
    SRC_PATH is expected to be a canonicalized filesystem path (see
    svn_fs__canonicalize_abspath).
-   
-   COPY_ID should generally come from a call to svn_fs__reserve_copy_id().  */
-svn_error_t *svn_fs__bdb_create_copy (svn_fs_t *fs,
+
+   COPY_ID should generally come from a call to
+   svn_fs_base__reserve_copy_id().  */
+svn_error_t *svn_fs_bdb__create_copy (svn_fs_t *fs,
                                       const char *copy_id,
                                       const char *src_path,
                                       const char *src_txn_id,
                                       const svn_fs_id_t *dst_noderev_id,
-                                      svn_fs__copy_kind_t kind,
+                                      copy_kind_t kind,
                                       trail_t *trail);
 
 /* Remove the copy whose name is COPY_ID from the `copies' table of
    FS, as part of TRAIL.  If there is no such copy,
    SVN_ERR_FS_NO_SUCH_COPY is the error returned.  */
-svn_error_t *svn_fs__bdb_delete_copy (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__delete_copy (svn_fs_t *fs,
                                       const char *copy_id,
                                       trail_t *trail);
 
@@ -69,7 +70,7 @@
    FS, as part of TRAIL.  Perform all allocations in TRAIL->pool.  If
    there is no such copy, SVN_ERR_FS_NO_SUCH_COPY is the error
    returned.  */
-svn_error_t *svn_fs__bdb_get_copy (svn_fs__copy_t **copy_p,
+svn_error_t *svn_fs_bdb__get_copy (copy_t **copy_p,
                                    svn_fs_t *fs,
                                    const char *copy_id,
                                    trail_t *trail);

Modified: trunk/subversion/libsvn_fs_base/bdb/dbt.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/dbt.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/dbt.c	Thu Apr 29 18:17:29 2004
@@ -26,7 +26,7 @@
 
 
 DBT *
-svn_fs__clear_dbt (DBT *dbt)
+svn_fs_base__clear_dbt (DBT *dbt)
 {
   memset (dbt, 0, sizeof (*dbt));
 
@@ -34,9 +34,9 @@
 }
 
 
-DBT *svn_fs__nodata_dbt (DBT *dbt)
+DBT *svn_fs_base__nodata_dbt (DBT *dbt)
 {
-  svn_fs__clear_dbt (dbt);
+  svn_fs_base__clear_dbt (dbt);
 
   /* A `nodata' dbt is one which retrieves zero bytes from offset zero,
      and stores them in a zero-byte buffer in user-allocated memory.  */
@@ -48,9 +48,9 @@
 
 
 DBT *
-svn_fs__set_dbt (DBT *dbt, const void *data, u_int32_t size)
+svn_fs_base__set_dbt (DBT *dbt, const void *data, u_int32_t size)
 {
-  svn_fs__clear_dbt (dbt);
+  svn_fs_base__clear_dbt (dbt);
 
   dbt->data = (void *) data;
   dbt->size = size;
@@ -60,9 +60,9 @@
 
 
 DBT *
-svn_fs__result_dbt (DBT *dbt)
+svn_fs_base__result_dbt (DBT *dbt)
 {
-  svn_fs__clear_dbt (dbt);
+  svn_fs_base__clear_dbt (dbt);
   dbt->flags |= DB_DBT_MALLOC;
 
   return dbt;
@@ -81,10 +81,10 @@
 
 
 DBT *
-svn_fs__track_dbt (DBT *dbt, apr_pool_t *pool)
+svn_fs_base__track_dbt (DBT *dbt, apr_pool_t *pool)
 {
   if (dbt->data)
-    apr_pool_cleanup_register (pool, dbt->data, apr_free_cleanup, 
+    apr_pool_cleanup_register (pool, dbt->data, apr_free_cleanup,
                                apr_pool_cleanup_null);
 
   return dbt;
@@ -92,9 +92,9 @@
 
 
 DBT *
-svn_fs__recno_dbt (DBT *dbt, db_recno_t *recno)
+svn_fs_base__recno_dbt (DBT *dbt, db_recno_t *recno)
 {
-  svn_fs__set_dbt (dbt, recno, sizeof (*recno));
+  svn_fs_base__set_dbt (dbt, recno, sizeof (*recno));
   dbt->ulen = dbt->size;
   dbt->flags |= DB_DBT_USERMEM;
 
@@ -103,7 +103,7 @@
 
 
 int
-svn_fs__compare_dbt (const DBT *a, const DBT *b)
+svn_fs_base__compare_dbt (const DBT *a, const DBT *b)
 {
   int common_size = a->size > b->size ? b->size : a->size;
   int cmp = memcmp (a->data, b->data, common_size);
@@ -119,27 +119,27 @@
 /* Building DBT's from interesting things.  */
 
 
-/* Set DBT to the unparsed form of ID; allocate memory from POOL. 
+/* Set DBT to the unparsed form of ID; allocate memory from POOL.
    Return DBT.  */
 DBT *
-svn_fs__id_to_dbt (DBT *dbt,
-                   const svn_fs_id_t *id,
-                   apr_pool_t *pool)
+svn_fs_base__id_to_dbt (DBT *dbt,
+                        const svn_fs_id_t *id,
+                        apr_pool_t *pool)
 {
   svn_string_t *unparsed_id = svn_fs_unparse_id (id, pool);
-  svn_fs__set_dbt (dbt, unparsed_id->data, unparsed_id->len);
+  svn_fs_base__set_dbt (dbt, unparsed_id->data, unparsed_id->len);
   return dbt;
 }
 
 
 /* Set DBT to the unparsed form of SKEL; allocate memory from POOL.  */
 DBT *
-svn_fs__skel_to_dbt (DBT *dbt,
-                     skel_t *skel,
-                     apr_pool_t *pool)
+svn_fs_base__skel_to_dbt (DBT *dbt,
+                          skel_t *skel,
+                          apr_pool_t *pool)
 {
-  svn_stringbuf_t *unparsed_skel = svn_fs__unparse_skel (skel, pool);
-  svn_fs__set_dbt (dbt, unparsed_skel->data, unparsed_skel->len);
+  svn_stringbuf_t *unparsed_skel = svn_fs_base__unparse_skel (skel, pool);
+  svn_fs_base__set_dbt (dbt, unparsed_skel->data, unparsed_skel->len);
   return dbt;
 }
 
@@ -147,8 +147,8 @@
 /* Set DBT to the text of the null-terminated string STR.  DBT will
    refer to STR's storage.  Return DBT.  */
 DBT *
-svn_fs__str_to_dbt (DBT *dbt, const char *str)
+svn_fs_base__str_to_dbt (DBT *dbt, const char *str)
 {
-  svn_fs__set_dbt (dbt, str, strlen (str));
+  svn_fs_base__set_dbt (dbt, str, strlen (str));
   return dbt;
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/dbt.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/dbt.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/dbt.h	Thu Apr 29 18:17:29 2004
@@ -32,17 +32,17 @@
 
 
 /* Set all fields of DBT to zero.  Return DBT.  */
-DBT *svn_fs__clear_dbt (DBT *dbt);
+DBT *svn_fs_base__clear_dbt (DBT *dbt);
 
 
 /* Set DBT to retrieve no data.  This is useful when you're just
    probing the table to see if an entry exists, or to find a key, but
    don't care what the value is.  Return DBT.  */
-DBT *svn_fs__nodata_dbt (DBT *dbt);
+DBT *svn_fs_base__nodata_dbt (DBT *dbt);
 
 
 /* Set DBT to refer to the SIZE bytes at DATA.  Return DBT.  */
-DBT *svn_fs__set_dbt (DBT *dbt, const void *data, u_int32_t size);
+DBT *svn_fs_base__set_dbt (DBT *dbt, const void *data, u_int32_t size);
 
 
 /* Prepare DBT to hold data returned from Berkeley DB.  Return DBT.
@@ -51,13 +51,13 @@
    requesting that Berkeley DB place the returned data in a freshly
    malloc'd block.  If the database operation succeeds, the caller
    then owns the data block, and is responsible for making sure it
-   gets freed.  
+   gets freed.
 
-   You can use this with svn_fs__track_dbt:
+   You can use this with svn_fs_base__track_dbt:
 
-       svn_fs__result_dbt (&foo);
+       svn_fs_base__result_dbt (&foo);
        ... some Berkeley DB operation that puts data in foo ...
-       svn_fs__track_dbt (&foo, pool);
+       svn_fs_base__track_dbt (&foo, pool);
 
    This arrangement is:
    - thread-safe --- the returned data is allocated via malloc, and
@@ -67,40 +67,41 @@
      type.
    - pool-friendly --- the data returned by Berkeley DB is now guaranteed
      to be freed when POOL is cleared.  */
-DBT *svn_fs__result_dbt (DBT *dbt);
+DBT *svn_fs_base__result_dbt (DBT *dbt);
 
 /* Arrange for POOL to `track' DBT's data: when POOL is cleared,
    DBT->data will be freed, using `free'.  If DBT->data is zero,
    do nothing.
 
-   This is meant for use with svn_fs__result_dbt; see the explanation
+   This is meant for use with svn_fs_base__result_dbt; see the explanation
    there.  */
-DBT *svn_fs__track_dbt (DBT *dbt, apr_pool_t *pool);
+DBT *svn_fs_base__track_dbt (DBT *dbt, apr_pool_t *pool);
 
 
 /* Prepare DBT for use as a key into a RECNO table.  This call makes
    DBT refer to the db_recno_t pointed to by RECNO as its buffer; the
    record number you assign to *RECNO will be the table key.  */
-DBT *svn_fs__recno_dbt (DBT *dbt, db_recno_t *recno);
+DBT *svn_fs_base__recno_dbt (DBT *dbt, db_recno_t *recno);
 
 
 /* Compare two DBT values in byte-by-byte lexicographic order.  */
-int svn_fs__compare_dbt (const DBT *a, const DBT *b);
+int svn_fs_base__compare_dbt (const DBT *a, const DBT *b);
 
 
 /* Set DBT to the unparsed form of ID; allocate memory from POOL.
    Return DBT.  */
-DBT *svn_fs__id_to_dbt (DBT *dbt, const svn_fs_id_t *id, apr_pool_t *pool);
+DBT *svn_fs_base__id_to_dbt (DBT *dbt, const svn_fs_id_t *id,
+                             apr_pool_t *pool);
 
 
 /* Set DBT to the unparsed form of SKEL; allocate memory from POOL.
    Return DBT.  */
-DBT *svn_fs__skel_to_dbt (DBT *dbt, skel_t *skel, apr_pool_t *pool);
+DBT *svn_fs_base__skel_to_dbt (DBT *dbt, skel_t *skel, apr_pool_t *pool);
 
 
 /* Set DBT to the text of the null-terminated string STR.  DBT will
    refer to STR's storage.  Return DBT.  */
-DBT *svn_fs__str_to_dbt (DBT *dbt, const char *str);
+DBT *svn_fs_base__str_to_dbt (DBT *dbt, const char *str);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/bdb/nodes-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/nodes-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/nodes-table.c	Thu Apr 29 18:17:29 2004
@@ -28,7 +28,7 @@
 #include "../util/fs_skels.h"
 #include "../trail.h"
 #include "../key-gen.h"
-#include "../id.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "nodes-table.h"
 
@@ -38,14 +38,14 @@
 
 
 int
-svn_fs__bdb_open_nodes_table (DB **nodes_p,
+svn_fs_bdb__open_nodes_table (DB **nodes_p,
                               DB_ENV *env,
                               svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *nodes;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&nodes, env, 0));
   BDB_ERR (nodes->open (SVN_BDB_OPEN_PARAMS(nodes, NULL),
                        "nodes", 0, DB_BTREE,
@@ -59,8 +59,8 @@
     DBT key, value;
 
     BDB_ERR (nodes->put (nodes, 0,
-                        svn_fs__str_to_dbt (&key, svn_fs__next_key_key),
-                        svn_fs__str_to_dbt (&value, "1"),
+                        svn_fs_base__str_to_dbt (&key, NEXT_KEY_KEY),
+                        svn_fs_base__str_to_dbt (&value, "1"),
                         SVN_BDB_AUTO_COMMIT));
   }
 
@@ -73,15 +73,16 @@
 /* Choosing node revision ID's.  */
 
 svn_error_t *
-svn_fs__bdb_new_node_id (svn_fs_id_t **id_p,
+svn_fs_bdb__new_node_id (svn_fs_id_t **id_p,
                          svn_fs_t *fs,
                          const char *copy_id,
                          const char *txn_id,
                          trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
   apr_size_t len;
-  char next_key[SVN_FS__MAX_KEY_SIZE];
+  char next_key[MAX_KEY_SIZE];
   int db_err;
   const char *next_node_id;
 
@@ -89,26 +90,26 @@
   assert (txn_id);
 
   /* Get the current value associated with the `next-key' key in the table.  */
-  svn_fs__str_to_dbt (&query, svn_fs__next_key_key);
-  svn_fs__trail_debug (trail, "nodes", "get");
+  svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY);
+  svn_fs_base__trail_debug (trail, "nodes", "get");
   SVN_ERR (BDB_WRAP (fs, "allocating new node ID (getting 'next-key')",
-                    fs->nodes->get (fs->nodes, trail->db_txn,
-                                    &query, 
-                                    svn_fs__result_dbt (&result), 
-                                    0)));
-  svn_fs__track_dbt (&result, trail->pool);
+                     bfd->nodes->get (bfd->nodes, trail->db_txn,
+                                      &query,
+                                      svn_fs_base__result_dbt (&result),
+                                      0)));
+  svn_fs_base__track_dbt (&result, trail->pool);
 
   /* Squirrel away our next node id value. */
   next_node_id = apr_pstrmemdup (trail->pool, result.data, result.size);
 
   /* Bump to future key. */
   len = result.size;
-  svn_fs__next_key (result.data, &len, next_key);
-  svn_fs__trail_debug (trail, "nodes", "put");
-  db_err = fs->nodes->put (fs->nodes, trail->db_txn,
-                           svn_fs__str_to_dbt (&query, svn_fs__next_key_key),
-                           svn_fs__str_to_dbt (&result, next_key), 
-                           0);
+  svn_fs_base__next_key (result.data, &len, next_key);
+  svn_fs_base__trail_debug (trail, "nodes", "put");
+  db_err = bfd->nodes->put (bfd->nodes, trail->db_txn,
+                            svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY),
+                            svn_fs_base__str_to_dbt (&result, next_key),
+                            0);
   SVN_ERR (BDB_WRAP (fs, "bumping next node ID key", db_err));
 
   /* Create and return the new node id. */
@@ -118,7 +119,7 @@
 
 
 svn_error_t *
-svn_fs__bdb_new_successor_id (svn_fs_id_t **successor_p,
+svn_fs_bdb__new_successor_id (svn_fs_id_t **successor_p,
                               svn_fs_t *fs,
                               const svn_fs_id_t *id,
                               const char *copy_id,
@@ -134,18 +135,18 @@
   /* Create and return the new successor ID.  */
   new_id = svn_fs__create_id (svn_fs__id_node_id (id),
                               copy_id ? copy_id : svn_fs__id_copy_id (id),
-                              txn_id, 
+                              txn_id,
                               trail->pool);
 
   /* Now, make sure this NEW_ID doesn't already exist in FS. */
-  err = svn_fs__bdb_get_node_revision (NULL, fs, new_id, trail);
+  err = svn_fs_bdb__get_node_revision (NULL, fs, new_id, trail);
   if ((! err) || (err->apr_err != SVN_ERR_FS_ID_NOT_FOUND))
     {
       svn_string_t *id_str = svn_fs_unparse_id (id, trail->pool);
       svn_string_t *new_id_str = svn_fs_unparse_id (new_id, trail->pool);
-      return svn_error_createf 
+      return svn_error_createf
         (SVN_ERR_FS_ALREADY_EXISTS, err,
-         "Successor id '%s' (for '%s') already exists in filesystem '%s'",  
+         "Successor id '%s' (for '%s') already exists in filesystem '%s'",
          new_id_str->data, id_str->data, fs->path);
     }
 
@@ -162,19 +163,21 @@
 
 /* Removing node revisions.  */
 svn_error_t *
-svn_fs__bdb_delete_nodes_entry (svn_fs_t *fs,
+svn_fs_bdb__delete_nodes_entry (svn_fs_t *fs,
                                 const svn_fs_id_t *id,
                                 trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT key;
-  
-  svn_fs__trail_debug (trail, "nodes", "del");
+
+  svn_fs_base__trail_debug (trail, "nodes", "del");
   SVN_ERR (BDB_WRAP (fs, "deleting entry from 'nodes' table",
-                    fs->nodes->del (fs->nodes,
-                                    trail->db_txn,
-                                    svn_fs__id_to_dbt (&key, id, trail->pool),
-                                    0)));
-  
+                     bfd->nodes->del (bfd->nodes,
+                                      trail->db_txn,
+                                      svn_fs_base__id_to_dbt (&key, id,
+                                                              trail->pool),
+                                      0)));
+
   return SVN_NO_ERROR;
 }
 
@@ -185,26 +188,27 @@
 
 
 svn_error_t *
-svn_fs__bdb_get_node_revision (svn_fs__node_revision_t **noderev_p,
+svn_fs_bdb__get_node_revision (node_revision_t **noderev_p,
                                svn_fs_t *fs,
                                const svn_fs_id_t *id,
                                trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  base_fs_data_t *bfd = fs->fsap_data;
+  node_revision_t *noderev;
   skel_t *skel;
   int db_err;
   DBT key, value;
 
-  svn_fs__trail_debug (trail, "nodes", "get");
-  db_err = fs->nodes->get (fs->nodes, trail->db_txn,
-                           svn_fs__id_to_dbt (&key, id, trail->pool),
-                           svn_fs__result_dbt (&value),
-                           0);
-  svn_fs__track_dbt (&value, trail->pool);
+  svn_fs_base__trail_debug (trail, "nodes", "get");
+  db_err = bfd->nodes->get (bfd->nodes, trail->db_txn,
+                            svn_fs_base__id_to_dbt (&key, id, trail->pool),
+                            svn_fs_base__result_dbt (&value),
+                            0);
+  svn_fs_base__track_dbt (&value, trail->pool);
 
   /* If there's no such node, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)
-    return svn_fs__err_dangling_id (fs, id);
+    return svn_fs_base__err_dangling_id (fs, id);
 
   /* Handle any other error conditions.  */
   SVN_ERR (BDB_WRAP (fs, "reading node revision", db_err));
@@ -215,32 +219,35 @@
     return SVN_NO_ERROR;
 
   /* Parse and the NODE-REVISION skel.  */
-  skel = svn_fs__parse_skel (value.data, value.size, trail->pool);
+  skel = svn_fs_base__parse_skel (value.data, value.size, trail->pool);
 
   /* Convert to a native FS type. */
-  SVN_ERR (svn_fs__parse_node_revision_skel (&noderev, skel, trail->pool));
+  SVN_ERR (svn_fs_base__parse_node_revision_skel (&noderev, skel,
+                                                  trail->pool));
   *noderev_p = noderev;
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_put_node_revision (svn_fs_t *fs,
+svn_fs_bdb__put_node_revision (svn_fs_t *fs,
                                const svn_fs_id_t *id,
-                               svn_fs__node_revision_t *noderev,
+                               node_revision_t *noderev,
                                trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DB_TXN *db_txn = trail->db_txn;
   apr_pool_t *pool = trail->pool;
   DBT key, value;
   skel_t *skel;
 
   /* Convert from native type into skel */
-  SVN_ERR (svn_fs__unparse_node_revision_skel (&skel, noderev, pool));
-  svn_fs__trail_debug (trail, "nodes", "put");
+  SVN_ERR (svn_fs_base__unparse_node_revision_skel (&skel, noderev, pool));
+  svn_fs_base__trail_debug (trail, "nodes", "put");
   return BDB_WRAP (fs, "storing node revision",
-                  fs->nodes->put (fs->nodes, db_txn,
-                                  svn_fs__id_to_dbt (&key, id, pool),
-                                  svn_fs__skel_to_dbt (&value, skel, pool),
-                                  0));
+                   bfd->nodes->put (bfd->nodes, db_txn,
+                                    svn_fs_base__id_to_dbt (&key, id, pool),
+                                    svn_fs_base__skel_to_dbt (&value, skel,
+                                                              pool),
+                                    0));
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/nodes-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/nodes-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/nodes-table.h	Thu Apr 29 18:17:29 2004
@@ -33,9 +33,9 @@
 
 
 /* Open a `nodes' table in ENV.  If CREATE is non-zero, create
-   one if it doesn't exist.  Set *NODES_P to the new table.  
+   one if it doesn't exist.  Set *NODES_P to the new table.
    Return a Berkeley DB error code.  */
-int svn_fs__bdb_open_nodes_table (DB **nodes_p,
+int svn_fs_bdb__open_nodes_table (DB **nodes_p,
                                   DB_ENV *env,
                                   svn_boolean_t create);
 
@@ -45,7 +45,7 @@
    FS, with copy_id COPY_ID, created in transaction TXN_ID, as part
    of TRAIL.  Allocate the new ID, and do all temporary allocation,
    in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_new_node_id (svn_fs_id_t **id_p,
+svn_error_t *svn_fs_bdb__new_node_id (svn_fs_id_t **id_p,
                                       svn_fs_t *fs,
                                       const char *copy_id,
                                       const char *txn_id,
@@ -62,7 +62,7 @@
    other hand, we'll need a way to delete even immutable nodes someday
    -- for example, someone accidentally commits NDA-protected data to
    a public repository and wants to remove it.  Thoughts?  */
-svn_error_t *svn_fs__bdb_delete_nodes_entry (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__delete_nodes_entry (svn_fs_t *fs,
                                              const svn_fs_id_t *id,
                                              trail_t *trail);
 
@@ -74,7 +74,7 @@
    Use the current Subversion transaction name TXN_ID, and optionally
    a copy id COPY_ID, in the determination of the new node revision
    ID.  */
-svn_error_t *svn_fs__bdb_new_successor_id (svn_fs_id_t **successor_p,
+svn_error_t *svn_fs_bdb__new_successor_id (svn_fs_id_t **successor_p,
                                            svn_fs_t *fs,
                                            const svn_fs_id_t *id,
                                            const char *copy_id,
@@ -86,7 +86,7 @@
    part of TRAIL.  Do any allocations in TRAIL->pool.  Allow NODEREV_P
    to be NULL, in which case it is not used, and this function acts as
    an existence check for ID in FS. */
-svn_error_t *svn_fs__bdb_get_node_revision (svn_fs__node_revision_t **noderev_p,
+svn_error_t *svn_fs_bdb__get_node_revision (node_revision_t **noderev_p,
                                             svn_fs_t *fs,
                                             const svn_fs_id_t *id,
                                             trail_t *trail);
@@ -98,9 +98,9 @@
 
    After this call, the node table manager assumes that NODE's
    contents will change frequently.  */
-svn_error_t *svn_fs__bdb_put_node_revision (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__put_node_revision (svn_fs_t *fs,
                                             const svn_fs_id_t *id,
-                                            svn_fs__node_revision_t *noderev,
+                                            node_revision_t *noderev,
                                             trail_t *trail);
 
 

Modified: trunk/subversion/libsvn_fs_base/bdb/reps-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/reps-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/reps-table.c	Thu Apr 29 18:17:29 2004
@@ -23,6 +23,7 @@
 #include "dbt.h"
 #include "../trail.h"
 #include "../key-gen.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "reps-table.h"
 #include "strings-table.h"
@@ -32,14 +33,14 @@
 /*** Creating and opening the representations table. ***/
 
 int
-svn_fs__bdb_open_reps_table (DB **reps_p,
+svn_fs_bdb__open_reps_table (DB **reps_p,
                              DB_ENV *env,
                              svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *reps;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&reps, env, 0));
   BDB_ERR (reps->open (SVN_BDB_OPEN_PARAMS(reps, NULL),
                       "representations", 0, DB_BTREE,
@@ -53,8 +54,8 @@
 
     BDB_ERR (reps->put
             (reps, 0,
-             svn_fs__str_to_dbt (&key, svn_fs__next_key_key),
-             svn_fs__str_to_dbt (&value, "0"),
+             svn_fs_base__str_to_dbt (&key, NEXT_KEY_KEY),
+             svn_fs_base__str_to_dbt (&value, "0"),
              SVN_BDB_AUTO_COMMIT));
   }
 
@@ -67,23 +68,24 @@
 /*** Storing and retrieving reps.  ***/
 
 svn_error_t *
-svn_fs__bdb_read_rep (svn_fs__representation_t **rep_p,
+svn_fs_bdb__read_rep (representation_t **rep_p,
                       svn_fs_t *fs,
                       const char *key,
                       trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   skel_t *skel;
   int db_err;
   DBT query, result;
 
-  svn_fs__trail_debug (trail, "representations", "get");
-  db_err = fs->representations->get
-    (fs->representations,
+  svn_fs_base__trail_debug (trail, "representations", "get");
+  db_err = bfd->representations->get
+    (bfd->representations,
      trail->db_txn,
-     svn_fs__str_to_dbt (&query, key),
-     svn_fs__result_dbt (&result), 0);
+     svn_fs_base__str_to_dbt (&query, key),
+     svn_fs_base__result_dbt (&result), 0);
 
-  svn_fs__track_dbt (&result, trail->pool);
+  svn_fs_base__track_dbt (&result, trail->pool);
 
   /* If there's no such node, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)
@@ -95,77 +97,78 @@
   SVN_ERR (BDB_WRAP (fs, "reading representation", db_err));
 
   /* Parse the REPRESENTATION skel.  */
-  skel = svn_fs__parse_skel (result.data, result.size, trail->pool);
+  skel = svn_fs_base__parse_skel (result.data, result.size, trail->pool);
 
   /* Convert to a native type.  */
-  SVN_ERR (svn_fs__parse_representation_skel (rep_p, skel, trail->pool));
+  SVN_ERR (svn_fs_base__parse_representation_skel (rep_p, skel, trail->pool));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_write_rep (svn_fs_t *fs,
+svn_fs_bdb__write_rep (svn_fs_t *fs,
                        const char *key,
-                       const svn_fs__representation_t *rep,
+                       const representation_t *rep,
                        trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
   skel_t *skel;
 
   /* Convert from native type to skel. */
-  SVN_ERR (svn_fs__unparse_representation_skel (&skel, rep, trail->pool));
+  SVN_ERR (svn_fs_base__unparse_representation_skel (&skel, rep, trail->pool));
 
   /* Now write the record. */
-  svn_fs__trail_debug (trail, "representations", "put");
+  svn_fs_base__trail_debug (trail, "representations", "put");
   SVN_ERR (BDB_WRAP (fs, "storing representation",
-                    fs->representations->put
-                    (fs->representations, trail->db_txn,
-                     svn_fs__str_to_dbt (&query, key),
-                     svn_fs__skel_to_dbt (&result, skel, trail->pool), 0)));
+                     bfd->representations->put
+                     (bfd->representations, trail->db_txn,
+                      svn_fs_base__str_to_dbt (&query, key),
+                      svn_fs_base__skel_to_dbt (&result, skel, trail->pool),
+                      0)));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_write_new_rep (const char **key,
+svn_fs_bdb__write_new_rep (const char **key,
                            svn_fs_t *fs,
-                           const svn_fs__representation_t *rep,
+                           const representation_t *rep,
                            trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
   int db_err;
   apr_size_t len;
-  char next_key[SVN_FS__MAX_KEY_SIZE];
-  
+  char next_key[MAX_KEY_SIZE];
+
   /* ### todo: see issue #409 for why bumping the key as part of this
      trail is problematic. */
 
   /* Get the current value associated with `next-key'.  */
-  svn_fs__str_to_dbt (&query, svn_fs__next_key_key);
-  svn_fs__trail_debug (trail, "representations", "get");
+  svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY);
+  svn_fs_base__trail_debug (trail, "representations", "get");
   SVN_ERR (BDB_WRAP (fs, "allocating new representation (getting next-key)",
-                    fs->representations->get (fs->representations,
-                                              trail->db_txn,
-                                              &query,
-                                              svn_fs__result_dbt (&result),
-                                              0)));
+                     bfd->representations->get
+                     (bfd->representations, trail->db_txn, &query,
+                      svn_fs_base__result_dbt (&result), 0)));
 
-  svn_fs__track_dbt (&result, trail->pool);
+  svn_fs_base__track_dbt (&result, trail->pool);
 
   /* Store the new rep. */
   *key = apr_pstrmemdup (trail->pool, result.data, result.size);
-  SVN_ERR (svn_fs__bdb_write_rep (fs, *key, rep, trail));
+  SVN_ERR (svn_fs_bdb__write_rep (fs, *key, rep, trail));
 
   /* Bump to future key. */
   len = result.size;
-  svn_fs__next_key (result.data, &len, next_key);
-  svn_fs__trail_debug (trail, "representations", "put");
-  db_err = fs->representations->put
-    (fs->representations, trail->db_txn,
-     svn_fs__str_to_dbt (&query, svn_fs__next_key_key),
-     svn_fs__str_to_dbt (&result, next_key),
+  svn_fs_base__next_key (result.data, &len, next_key);
+  svn_fs_base__trail_debug (trail, "representations", "put");
+  db_err = bfd->representations->put
+    (bfd->representations, trail->db_txn,
+     svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY),
+     svn_fs_base__str_to_dbt (&result, next_key),
      0);
 
   SVN_ERR (BDB_WRAP (fs, "bumping next representation key", db_err));
@@ -175,15 +178,16 @@
 
 
 svn_error_t *
-svn_fs__bdb_delete_rep (svn_fs_t *fs, const char *key, trail_t *trail)
+svn_fs_bdb__delete_rep (svn_fs_t *fs, const char *key, trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBT query;
 
-  svn_fs__trail_debug (trail, "representations", "del");
-  db_err = fs->representations->del
-    (fs->representations, trail->db_txn,
-     svn_fs__str_to_dbt (&query, key), 0);
+  svn_fs_base__trail_debug (trail, "representations", "del");
+  db_err = bfd->representations->del
+    (bfd->representations, trail->db_txn,
+     svn_fs_base__str_to_dbt (&query, key), 0);
 
   /* If there's no such node, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)

Modified: trunk/subversion/libsvn_fs_base/bdb/reps-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/reps-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/reps-table.h	Thu Apr 29 18:17:29 2004
@@ -36,8 +36,8 @@
 /* Open a `representations' table in ENV.  If CREATE is non-zero,
    create one if it doesn't exist.  Set *REPS_P to the new table.
    Return a Berkeley DB error code.  */
-int svn_fs__bdb_open_reps_table (DB **reps_p, 
-                                 DB_ENV *env, 
+int svn_fs_bdb__open_reps_table (DB **reps_p,
+                                 DB_ENV *env,
                                  svn_boolean_t create);
 
 
@@ -49,7 +49,7 @@
 
    If KEY is not a representation in FS, the error
    SVN_ERR_FS_NO_SUCH_REPRESENTATION is returned.  */
-svn_error_t *svn_fs__bdb_read_rep (svn_fs__representation_t **rep_p,
+svn_error_t *svn_fs_bdb__read_rep (representation_t **rep_p,
                                    svn_fs_t *fs,
                                    const char *key,
                                    trail_t *trail);
@@ -57,23 +57,23 @@
 
 /* Store REP as the representation for KEY in FS, as part of
    TRAIL.  Do any necessary temporary allocation in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_write_rep (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__write_rep (svn_fs_t *fs,
                                     const char *key,
-                                    const svn_fs__representation_t *rep,
+                                    const representation_t *rep,
                                     trail_t *trail);
 
 
 /* Store REP as a new representation in FS, and the new rep's key in
    *KEY, as part of trail.  The new key is allocated in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_write_new_rep (const char **key,
+svn_error_t *svn_fs_bdb__write_new_rep (const char **key,
                                         svn_fs_t *fs,
-                                        const svn_fs__representation_t *rep,
+                                        const representation_t *rep,
                                         trail_t *trail);
 
 /* Delete representation KEY from FS, as part of TRAIL.
    WARNING: This does not ensure that no one references this
    representation!  Callers should ensure that themselves.  */
-svn_error_t *svn_fs__bdb_delete_rep (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__delete_rep (svn_fs_t *fs,
                                      const char *key,
                                      trail_t *trail);
 

Modified: trunk/subversion/libsvn_fs_base/bdb/rev-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/rev-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/rev-table.c	Thu Apr 29 18:17:29 2004
@@ -21,6 +21,7 @@
 #include "../err.h"
 #include "../util/skel.h"
 #include "../util/fs_skels.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "dbt.h"
 #include "rev-table.h"
@@ -28,14 +29,14 @@
 
 /* Opening/creating the `revisions' table.  */
 
-int svn_fs__bdb_open_revisions_table (DB **revisions_p,
+int svn_fs_bdb__open_revisions_table (DB **revisions_p,
                                       DB_ENV *env,
                                       svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *revisions;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&revisions, env, 0));
   BDB_ERR (revisions->open (SVN_BDB_OPEN_PARAMS(revisions, NULL),
                            "revisions", 0, DB_RECNO,
@@ -52,42 +53,44 @@
 
 
 svn_error_t *
-svn_fs__bdb_get_rev (svn_fs__revision_t **revision_p,
+svn_fs_bdb__get_rev (revision_t **revision_p,
                      svn_fs_t *fs,
                      svn_revnum_t rev,
                      trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBT key, value;
   skel_t *skel;
-  svn_fs__revision_t *revision;
+  revision_t *revision;
 
   /* Turn the revision number into a Berkeley DB record number.
      Revisions are numbered starting with zero; Berkeley DB record
      numbers begin with one.  */
   db_recno_t recno = rev + 1;
 
-  svn_fs__trail_debug (trail, "revisions", "get");
-  db_err = fs->revisions->get (fs->revisions, trail->db_txn,
-                               svn_fs__set_dbt (&key, &recno, sizeof (recno)),
-                               svn_fs__result_dbt (&value),
-                               0);
-  svn_fs__track_dbt (&value, trail->pool);
+  svn_fs_base__trail_debug (trail, "revisions", "get");
+  db_err = bfd->revisions->get (bfd->revisions, trail->db_txn,
+                                svn_fs_base__set_dbt (&key, &recno,
+                                                      sizeof (recno)),
+                                svn_fs_base__result_dbt (&value),
+                                0);
+  svn_fs_base__track_dbt (&value, trail->pool);
 
   /* If there's no such revision, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)
-    return svn_fs__err_dangling_rev (fs, rev);
+    return svn_fs_base__err_dangling_rev (fs, rev);
 
   /* Handle any other error conditions.  */
   SVN_ERR (BDB_WRAP (fs, "reading filesystem revision", db_err));
 
   /* Parse REVISION skel.  */
-  skel = svn_fs__parse_skel (value.data, value.size, trail->pool);
+  skel = svn_fs_base__parse_skel (value.data, value.size, trail->pool);
   if (! skel)
-    return svn_fs__err_corrupt_fs_revision (fs, rev);
-    
+    return svn_fs_base__err_corrupt_fs_revision (fs, rev);
+
   /* Convert skel to native type. */
-  SVN_ERR (svn_fs__parse_revision_skel (&revision, skel, trail->pool));
+  SVN_ERR (svn_fs_base__parse_revision_skel (&revision, skel, trail->pool));
 
   *revision_p = revision;
   return SVN_NO_ERROR;
@@ -99,38 +102,40 @@
    write a new revision and return its newly created revision number
    in *REV.  */
 svn_error_t *
-svn_fs__bdb_put_rev (svn_revnum_t *rev,
+svn_fs_bdb__put_rev (svn_revnum_t *rev,
                      svn_fs_t *fs,
-                     const svn_fs__revision_t *revision,
+                     const revision_t *revision,
                      trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   db_recno_t recno = 0;
   skel_t *skel;
   DBT key, value;
 
   /* Convert native type to skel. */
-  SVN_ERR (svn_fs__unparse_revision_skel (&skel, revision, trail->pool));
+  SVN_ERR (svn_fs_base__unparse_revision_skel (&skel, revision, trail->pool));
 
   if (SVN_IS_VALID_REVNUM (*rev))
     {
       DBT query, result;
-      
+
       /* Update the filesystem revision with the new skel. */
       recno = *rev + 1;
-      svn_fs__trail_debug (trail, "revisions", "put");
-      db_err = fs->revisions->put 
-        (fs->revisions, trail->db_txn,
-         svn_fs__set_dbt (&query, &recno, sizeof (recno)),
-         svn_fs__skel_to_dbt (&result, skel, trail->pool), 0);
+      svn_fs_base__trail_debug (trail, "revisions", "put");
+      db_err = bfd->revisions->put
+        (bfd->revisions, trail->db_txn,
+         svn_fs_base__set_dbt (&query, &recno, sizeof (recno)),
+         svn_fs_base__skel_to_dbt (&result, skel, trail->pool), 0);
       return BDB_WRAP (fs, "updating filesystem revision", db_err);
     }
-      
-  svn_fs__trail_debug (trail, "revisions", "put");
-  db_err = fs->revisions->put (fs->revisions, trail->db_txn,
-                               svn_fs__recno_dbt(&key, &recno),
-                               svn_fs__skel_to_dbt (&value, skel, trail->pool),
-                               DB_APPEND);
+
+  svn_fs_base__trail_debug (trail, "revisions", "put");
+  db_err = bfd->revisions->put (bfd->revisions, trail->db_txn,
+                                svn_fs_base__recno_dbt(&key, &recno),
+                                svn_fs_base__skel_to_dbt (&value, skel,
+                                                     trail->pool),
+                                DB_APPEND);
   SVN_ERR (BDB_WRAP (fs, "storing filesystem revision", db_err));
 
   /* Turn the record number into a Subversion revision number.
@@ -146,27 +151,28 @@
 
 
 svn_error_t *
-svn_fs__bdb_youngest_rev (svn_revnum_t *youngest_p,
+svn_fs_bdb__youngest_rev (svn_revnum_t *youngest_p,
                           svn_fs_t *fs,
                           trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBC *cursor = 0;
   DBT key, value;
   db_recno_t recno;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   /* Create a database cursor.  */
-  svn_fs__trail_debug (trail, "revisions", "cursor");
+  svn_fs_base__trail_debug (trail, "revisions", "cursor");
   SVN_ERR (BDB_WRAP (fs, "getting youngest revision (creating cursor)",
-                    fs->revisions->cursor (fs->revisions, trail->db_txn,
-                                           &cursor, 0)));
+                     bfd->revisions->cursor (bfd->revisions, trail->db_txn,
+                                             &cursor, 0)));
 
   /* Find the last entry in the `revisions' table.  */
   db_err = cursor->c_get (cursor,
-                          svn_fs__recno_dbt (&key, &recno),
-                          svn_fs__nodata_dbt (&value),
+                          svn_fs_base__recno_dbt (&key, &recno),
+                          svn_fs_base__nodata_dbt (&value),
                           DB_LAST);
 
   if (db_err)
@@ -182,7 +188,7 @@
           (SVN_ERR_FS_CORRUPT, 0,
            "Corrupt DB: revision 0 missing from 'revisions' table, in "
            "filesystem '%s'", fs->path);
-      
+
       SVN_ERR (BDB_WRAP (fs, "getting youngest revision (finding last entry)",
                         db_err));
     }
@@ -190,7 +196,7 @@
   /* You can't commit a transaction with open cursors, because:
      1) key/value pairs don't get deleted until the cursors referring
      to them are closed, so closing a cursor can fail for various
-     reasons, and txn_commit shouldn't fail that way, and 
+     reasons, and txn_commit shouldn't fail that way, and
      2) using a cursor after committing its transaction can cause
      undetectable database corruption.  */
   SVN_ERR (BDB_WRAP (fs, "getting youngest revision (closing cursor)",

Modified: trunk/subversion/libsvn_fs_base/bdb/rev-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/rev-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/rev-table.h	Thu Apr 29 18:17:29 2004
@@ -36,7 +36,7 @@
 /* Open a `revisions' table in ENV.  If CREATE is non-zero, create one
    if it doesn't exist.  Set *REVS_P to the new table.  Return a
    Berkeley DB error code.  */
-int svn_fs__bdb_open_revisions_table (DB **revisions_p,
+int svn_fs_bdb__open_revisions_table (DB **revisions_p,
                                       DB_ENV *env,
                                       svn_boolean_t create);
 
@@ -48,7 +48,7 @@
 /* Set *REVISION_P to point to the revision structure for the
    filesystem revision REV in FS, as part of TRAIL.  Perform all
    allocations in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_get_rev (svn_fs__revision_t **revision_p,
+svn_error_t *svn_fs_bdb__get_rev (revision_t **revision_p,
                                   svn_fs_t *fs,
                                   svn_revnum_t rev,
                                   trail_t *trail);
@@ -57,15 +57,15 @@
    an invalid revision number, create a brand new revision and return
    its revision number as *REV to the caller.  Do any necessary
    temporary allocation in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_put_rev (svn_revnum_t *rev,
+svn_error_t *svn_fs_bdb__put_rev (svn_revnum_t *rev,
                                   svn_fs_t *fs,
-                                  const svn_fs__revision_t *revision,
+                                  const revision_t *revision,
                                   trail_t *trail);
 
 
 /* Set *YOUNGEST_P to the youngest revision in filesystem FS,
    as part of TRAIL.  Use TRAIL->pool for all temporary allocation. */
-svn_error_t *svn_fs__bdb_youngest_rev (svn_revnum_t *youngest_p,
+svn_error_t *svn_fs_bdb__youngest_rev (svn_revnum_t *youngest_p,
                                        svn_fs_t *fs,
                                        trail_t *trail);
 

Modified: trunk/subversion/libsvn_fs_base/bdb/strings-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/strings-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/strings-table.c	Thu Apr 29 18:17:29 2004
@@ -23,6 +23,7 @@
 #include "dbt.h"
 #include "../trail.h"
 #include "../key-gen.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "strings-table.h"
 
@@ -30,14 +31,14 @@
 /*** Creating and opening the strings table. ***/
 
 int
-svn_fs__bdb_open_strings_table (DB **strings_p,
+svn_fs_bdb__open_strings_table (DB **strings_p,
                                 DB_ENV *env,
                                 svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *strings;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&strings, env, 0));
 
   /* Enable duplicate keys. This allows the data to be spread out across
@@ -56,11 +57,11 @@
       /* Create the `next-key' table entry.  */
       BDB_ERR (strings->put
               (strings, 0,
-               svn_fs__str_to_dbt (&key, svn_fs__next_key_key),
-               svn_fs__str_to_dbt (&value, "0"),
+               svn_fs_base__str_to_dbt (&key, NEXT_KEY_KEY),
+               svn_fs_base__str_to_dbt (&value, "0"),
                SVN_BDB_AUTO_COMMIT));
     }
-  
+
   *strings_p = strings;
   return 0;
 }
@@ -79,23 +80,24 @@
             svn_fs_t *fs,
             trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBT result;
 
-  svn_fs__trail_debug (trail, "strings", "cursor");
+  svn_fs_base__trail_debug (trail, "strings", "cursor");
   SVN_ERR (BDB_WRAP (fs, "creating cursor for reading a string",
-                    fs->strings->cursor (fs->strings, trail->db_txn,
-                                         cursor, 0)));
+                     bfd->strings->cursor (bfd->strings, trail->db_txn,
+                                           cursor, 0)));
 
   /* Set up the DBT for reading the length of the record. */
-  svn_fs__clear_dbt (&result);
+  svn_fs_base__clear_dbt (&result);
   result.ulen = 0;
   result.flags |= DB_DBT_USERMEM;
 
   /* Advance the cursor to the key that we're looking for. */
   db_err = (*cursor)->c_get (*cursor, query, &result, DB_SET);
 
-  /* We don't need to svn_fs__track_dbt() the result, because nothing
+  /* We don't need to svn_fs_base__track_dbt() the result, because nothing
      was allocated in it. */
 
   /* If there's no such node, return an appropriately specific error.  */
@@ -118,7 +120,7 @@
 
       /* We got an ENOMEM (typical since we have a zero length buf), so
          we need to re-run the operation to make it happen. */
-      svn_fs__clear_dbt (&rerun);
+      svn_fs_base__clear_dbt (&rerun);
       rerun.flags |= DB_DBT_USERMEM | DB_DBT_PARTIAL;
       db_err = (*cursor)->c_get (*cursor, query, &rerun, DB_SET);
       if (db_err)
@@ -145,7 +147,7 @@
   int db_err;
 
   /* Set up the DBT for reading the length of the record. */
-  svn_fs__clear_dbt (&result);
+  svn_fs_base__clear_dbt (&result);
   result.ulen = 0;
   result.flags |= DB_DBT_USERMEM;
 
@@ -166,7 +168,7 @@
 
       /* We got an ENOMEM (typical since we have a zero length buf), so
          we need to re-run the operation to make it happen. */
-      svn_fs__clear_dbt (&rerun);
+      svn_fs_base__clear_dbt (&rerun);
       rerun.flags |= DB_DBT_USERMEM | DB_DBT_PARTIAL;
       db_err = cursor->c_get (cursor, query, &rerun, DB_NEXT_DUP);
       if (db_err)
@@ -180,7 +182,7 @@
 
 
 svn_error_t *
-svn_fs__bdb_string_read (svn_fs_t *fs,
+svn_fs_bdb__string_read (svn_fs_t *fs,
                          const char *key,
                          char *buf,
                          svn_filesize_t offset,
@@ -192,7 +194,7 @@
   DBC *cursor;
   apr_size_t length, bytes_read = 0;
 
-  svn_fs__str_to_dbt (&query, key);
+  svn_fs_base__str_to_dbt (&query, key);
 
   SVN_ERR (locate_key (&length, &cursor, &query, fs, trail));
 
@@ -221,7 +223,7 @@
      read successive records until we've filled the request.  */
   while (1)
     {
-      svn_fs__clear_dbt (&result);
+      svn_fs_base__clear_dbt (&result);
       result.data = buf + bytes_read;
       result.ulen = *len - bytes_read;
       result.doff = (u_int32_t)offset;
@@ -262,8 +264,9 @@
 static svn_error_t *
 get_key_and_bump (svn_fs_t *fs, const char **key, trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBC *cursor;
-  char next_key[SVN_FS__MAX_KEY_SIZE];
+  char next_key[MAX_KEY_SIZE];
   apr_size_t key_len;
   int db_err;
   DBT query;
@@ -277,16 +280,16 @@
      this database allows duplicates, we can't do an arbitrary 'put' to
      write the new value -- that would append, not overwrite.  */
 
-  svn_fs__trail_debug (trail, "strings", "cursor");
+  svn_fs_base__trail_debug (trail, "strings", "cursor");
   SVN_ERR (BDB_WRAP (fs, "creating cursor for reading a string",
-                    fs->strings->cursor (fs->strings, trail->db_txn,
-                                         &cursor, 0)));
+                     bfd->strings->cursor (bfd->strings, trail->db_txn,
+                                           &cursor, 0)));
 
   /* Advance the cursor to 'next-key' and read it. */
 
   db_err = cursor->c_get (cursor,
-                          svn_fs__str_to_dbt (&query, svn_fs__next_key_key),
-                          svn_fs__result_dbt (&result),
+                          svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY),
+                          svn_fs_base__result_dbt (&result),
                           DB_SET);
   if (db_err)
     {
@@ -294,16 +297,16 @@
       return BDB_WRAP (fs, "getting next-key value", db_err);
     }
 
-  svn_fs__track_dbt (&result, trail->pool);
+  svn_fs_base__track_dbt (&result, trail->pool);
   *key = apr_pstrmemdup (trail->pool, result.data, result.size);
 
   /* Bump to future key. */
   key_len = result.size;
-  svn_fs__next_key (result.data, &key_len, next_key);
+  svn_fs_base__next_key (result.data, &key_len, next_key);
 
   /* Shove the new key back into the database, at the cursor position. */
   db_err = cursor->c_put (cursor, &query,
-                          svn_fs__str_to_dbt (&result, next_key),
+                          svn_fs_base__str_to_dbt (&result, next_key),
                           DB_CURRENT);
   if (db_err)
     {
@@ -317,12 +320,13 @@
 }
 
 svn_error_t *
-svn_fs__bdb_string_append (svn_fs_t *fs,
+svn_fs_bdb__string_append (svn_fs_t *fs,
                            const char **key,
                            apr_size_t len,
                            const char *buf,
                            trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
 
   /* If the passed-in key is NULL, we graciously generate a new string
@@ -333,31 +337,32 @@
     }
 
   /* Store a new record into the database. */
-  svn_fs__trail_debug (trail, "strings", "put");
+  svn_fs_base__trail_debug (trail, "strings", "put");
   SVN_ERR (BDB_WRAP (fs, "appending string",
-                    fs->strings->put
-                    (fs->strings, trail->db_txn,
-                     svn_fs__str_to_dbt (&query, *key),
-                     svn_fs__set_dbt (&result, buf, len),
-                     0)));
+                     bfd->strings->put
+                     (bfd->strings, trail->db_txn,
+                      svn_fs_base__str_to_dbt (&query, *key),
+                      svn_fs_base__set_dbt (&result, buf, len),
+                      0)));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_string_clear (svn_fs_t *fs,
+svn_fs_bdb__string_clear (svn_fs_t *fs,
                           const char *key,
                           trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBT query, result;
 
-  svn_fs__str_to_dbt (&query, key);
+  svn_fs_base__str_to_dbt (&query, key);
 
   /* Torch the prior contents */
-  svn_fs__trail_debug (trail, "strings", "del");
-  db_err = fs->strings->del (fs->strings, trail->db_txn, &query, 0);
+  svn_fs_base__trail_debug (trail, "strings", "del");
+  db_err = bfd->strings->del (bfd->strings, trail->db_txn, &query, 0);
 
   /* If there's no such node, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)
@@ -369,20 +374,20 @@
   SVN_ERR (BDB_WRAP (fs, "clearing string", db_err));
 
   /* Shove empty data back in for this key. */
-  svn_fs__clear_dbt (&result);
+  svn_fs_base__clear_dbt (&result);
   result.data = 0;
   result.size = 0;
   result.flags |= DB_DBT_USERMEM;
 
-  svn_fs__trail_debug (trail, "strings", "put"); 
+  svn_fs_base__trail_debug (trail, "strings", "put");
   return BDB_WRAP (fs, "storing empty contents",
-                  fs->strings->put (fs->strings, trail->db_txn,
-                                    &query, &result, 0));
+                   bfd->strings->put (bfd->strings, trail->db_txn,
+                                      &query, &result, 0));
 }
 
 
 svn_error_t *
-svn_fs__bdb_string_size (svn_filesize_t *size,
+svn_fs_bdb__string_size (svn_filesize_t *size,
                          svn_fs_t *fs,
                          const char *key,
                          trail_t *trail)
@@ -393,7 +398,7 @@
   apr_size_t length;
   svn_filesize_t total;
 
-  svn_fs__str_to_dbt (&query, key);
+  svn_fs_base__str_to_dbt (&query, key);
 
   SVN_ERR (locate_key (&length, &cursor, &query, fs, trail));
 
@@ -419,16 +424,17 @@
 
 
 svn_error_t *
-svn_fs__bdb_string_delete (svn_fs_t *fs,
+svn_fs_bdb__string_delete (svn_fs_t *fs,
                            const char *key,
                            trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   int db_err;
   DBT query;
 
-  svn_fs__trail_debug (trail, "strings", "del");
-  db_err = fs->strings->del (fs->strings, trail->db_txn,
-                             svn_fs__str_to_dbt (&query, key), 0);
+  svn_fs_base__trail_debug (trail, "strings", "del");
+  db_err = bfd->strings->del (bfd->strings, trail->db_txn,
+                              svn_fs_base__str_to_dbt (&query, key), 0);
 
   /* If there's no such node, return an appropriately specific error.  */
   if (db_err == DB_NOTFOUND)
@@ -444,11 +450,12 @@
 
 
 svn_error_t *
-svn_fs__bdb_string_copy (svn_fs_t *fs,
+svn_fs_bdb__string_copy (svn_fs_t *fs,
                          const char **new_key,
                          const char *key,
                          trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query;
   DBT result;
   DBT copykey;
@@ -458,18 +465,18 @@
   /* Copy off the old key in case the caller is sharing storage
      between the old and new keys. */
   const char *old_key = apr_pstrdup (trail->pool, key);
-  
+
   SVN_ERR (get_key_and_bump (fs, new_key, trail));
 
-  svn_fs__trail_debug (trail, "strings", "cursor");
+  svn_fs_base__trail_debug (trail, "strings", "cursor");
   SVN_ERR (BDB_WRAP (fs, "creating cursor for reading a string",
-                    fs->strings->cursor (fs->strings, trail->db_txn,
-                                         &cursor, 0)));
+                     bfd->strings->cursor (bfd->strings, trail->db_txn,
+                                           &cursor, 0)));
 
-  svn_fs__str_to_dbt (&query, old_key);
-  svn_fs__str_to_dbt (&copykey, *new_key);
+  svn_fs_base__str_to_dbt (&query, old_key);
+  svn_fs_base__str_to_dbt (&copykey, *new_key);
 
-  svn_fs__clear_dbt (&result);
+  svn_fs_base__clear_dbt (&result);
 
   /* Move to the first record and fetch its data (under BDB's mem mgmt). */
   db_err = cursor->c_get (cursor, &query, &result, DB_SET);
@@ -489,9 +496,9 @@
       */
 
       /* Write the data to the database */
-      svn_fs__trail_debug (trail, "strings", "put");
-      db_err = fs->strings->put (fs->strings, trail->db_txn,
-                                 &copykey, &result, 0);
+      svn_fs_base__trail_debug (trail, "strings", "put");
+      db_err = bfd->strings->put (bfd->strings, trail->db_txn,
+                                  &copykey, &result, 0);
       if (db_err)
         {
           cursor->c_close (cursor);
@@ -499,7 +506,7 @@
         }
 
       /* Read the next chunk. Terminate loop if we're done. */
-      svn_fs__clear_dbt (&result);
+      svn_fs_base__clear_dbt (&result);
       db_err = cursor->c_get (cursor, &query, &result, DB_NEXT_DUP);
       if (db_err == DB_NOTFOUND)
         break;
@@ -510,6 +517,6 @@
         }
     }
 
-  return BDB_WRAP (fs, "closing string-reading cursor", 
+  return BDB_WRAP (fs, "closing string-reading cursor",
                   cursor->c_close (cursor));
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/strings-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/strings-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/strings-table.h	Thu Apr 29 18:17:29 2004
@@ -40,17 +40,17 @@
 
 
 /* Open a `strings' table in ENV.  If CREATE is non-zero, create
- * one if it doesn't exist.  Set *STRINGS_P to the new table.  
+ * one if it doesn't exist.  Set *STRINGS_P to the new table.
  * Return a Berkeley DB error code.
  */
-int svn_fs__bdb_open_strings_table (DB **strings_p,
+int svn_fs_bdb__open_strings_table (DB **strings_p,
                                     DB_ENV *env,
                                     svn_boolean_t create);
 
 
 /* Read *LEN bytes into BUF from OFFSET in string KEY in FS, as part
  * of TRAIL.
- * 
+ *
  * On return, *LEN is set to the number of bytes read.  If this value
  * is less than the number requested, the end of the string has been
  * reached (no error is returned on end-of-string).
@@ -59,11 +59,11 @@
  * zero. Callers which are advancing OFFSET as they read portions of
  * the string can terminate their loop when *LEN is returned as zero
  * (which will occur when OFFSET == length(the string)).
- * 
+ *
  * If string KEY does not exist, the error SVN_ERR_FS_NO_SUCH_STRING
  * is returned.
  */
-svn_error_t *svn_fs__bdb_string_read (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__string_read (svn_fs_t *fs,
                                       const char *key,
                                       char *buf,
                                       svn_filesize_t offset,
@@ -76,7 +76,7 @@
  *
  * If string KEY does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
  */
-svn_error_t *svn_fs__bdb_string_size (svn_filesize_t *size,
+svn_error_t *svn_fs_bdb__string_size (svn_filesize_t *size,
                                       svn_fs_t *fs,
                                       const char *key,
                                       trail_t *trail);
@@ -92,8 +92,8 @@
  * SVN_ERR_FS_NO_SUCH_STRING.
  *
  * Note: to overwrite the old contents of a string, call
- * svn_fs__bdb_string_clear() and then svn_fs__bdb_string_append().  */
-svn_error_t *svn_fs__bdb_string_append (svn_fs_t *fs,
+ * svn_fs_bdb__string_clear() and then svn_fs_bdb__string_append().  */
+svn_error_t *svn_fs_bdb__string_append (svn_fs_t *fs,
                                         const char **key,
                                         apr_size_t len,
                                         const char *buf,
@@ -103,7 +103,7 @@
 /* Make string KEY in FS zero length, as part of TRAIL.
  * If the string does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
  */
-svn_error_t *svn_fs__bdb_string_clear (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__string_clear (svn_fs_t *fs,
                                        const char *key,
                                        trail_t *trail);
 
@@ -114,8 +114,8 @@
  *
  * WARNING: Deleting a string renders unusable any representations
  * that refer to it.  Be careful.
- */ 
-svn_error_t *svn_fs__bdb_string_delete (svn_fs_t *fs,
+ */
+svn_error_t *svn_fs_bdb__string_delete (svn_fs_t *fs,
                                         const char *key,
                                         trail_t *trail);
 
@@ -123,7 +123,7 @@
 /* Copy the contents of the string referred to by KEY in FS into a new
  * record, returning the new record's key in *NEW_KEY.  All
  * allocations (including *NEW_KEY) occur in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_string_copy (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__string_copy (svn_fs_t *fs,
                                       const char **new_key,
                                       const char *key,
                                       trail_t *trail);

Modified: trunk/subversion/libsvn_fs_base/bdb/txn-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/txn-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/txn-table.c	Thu Apr 29 18:17:29 2004
@@ -27,27 +27,27 @@
 #include "../util/skel.h"
 #include "../util/fs_skels.h"
 #include "../trail.h"
-#include "../id.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "txn-table.h"
 
 
-static svn_boolean_t 
-is_committed (svn_fs__transaction_t *txn)
+static svn_boolean_t
+is_committed (transaction_t *txn)
 {
-  return (txn->kind == svn_fs__transaction_kind_committed) ? TRUE : FALSE;
+  return (txn->kind == transaction_kind_committed) ? TRUE : FALSE;
 }
 
 
 int
-svn_fs__bdb_open_transactions_table (DB **transactions_p,
+svn_fs_bdb__open_transactions_table (DB **transactions_p,
                                      DB_ENV *env,
                                      svn_boolean_t create)
 {
   const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
   DB *txns;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&txns, env, 0));
   BDB_ERR (txns->open (SVN_BDB_OPEN_PARAMS(txns, NULL),
                       "transactions", 0, DB_BTREE,
@@ -60,8 +60,8 @@
     DBT key, value;
 
     BDB_ERR (txns->put (txns, 0,
-                       svn_fs__str_to_dbt (&key, svn_fs__next_key_key),
-                       svn_fs__str_to_dbt (&value, "0"),
+                       svn_fs_base__str_to_dbt (&key, NEXT_KEY_KEY),
+                       svn_fs_base__str_to_dbt (&value, "0"),
                        SVN_BDB_AUTO_COMMIT));
   }
 
@@ -71,25 +71,27 @@
 
 
 svn_error_t *
-svn_fs__bdb_put_txn (svn_fs_t *fs,
-                     const svn_fs__transaction_t *txn,
+svn_fs_bdb__put_txn (svn_fs_t *fs,
+                     const transaction_t *txn,
                      const char *txn_name,
                      trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   skel_t *txn_skel;
   DBT key, value;
 
   /* Convert native type to skel. */
-  SVN_ERR (svn_fs__unparse_transaction_skel (&txn_skel, txn, trail->pool));
+  SVN_ERR (svn_fs_base__unparse_transaction_skel (&txn_skel, txn,
+                                                  trail->pool));
 
   /* Only in the context of this function do we know that the DB call
      will not attempt to modify txn_name, so the cast belongs here.  */
-  svn_fs__str_to_dbt (&key, txn_name);
-  svn_fs__skel_to_dbt (&value, txn_skel, trail->pool);
-  svn_fs__trail_debug (trail, "transactions", "put");
+  svn_fs_base__str_to_dbt (&key, txn_name);
+  svn_fs_base__skel_to_dbt (&value, txn_skel, trail->pool);
+  svn_fs_base__trail_debug (trail, "transactions", "put");
   SVN_ERR (BDB_WRAP (fs, "storing transaction record",
-                    fs->transactions->put (fs->transactions, trail->db_txn,
-                                           &key, &value, 0)));
+                     bfd->transactions->put (bfd->transactions, trail->db_txn,
+                                             &key, &value, 0)));
 
   return SVN_NO_ERROR;
 }
@@ -102,33 +104,34 @@
                  svn_fs_t *fs,
                  trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT query, result;
   apr_size_t len;
-  char next_key[SVN_FS__MAX_KEY_SIZE];
+  char next_key[MAX_KEY_SIZE];
   int db_err;
 
-  svn_fs__str_to_dbt (&query, svn_fs__next_key_key);
+  svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY);
 
   /* Get the current value associated with the `next-key' key in the table.  */
-  svn_fs__trail_debug (trail, "transactions", "get");
+  svn_fs_base__trail_debug (trail, "transactions", "get");
   SVN_ERR (BDB_WRAP (fs, "allocating new transaction ID (getting 'next-key')",
-                    fs->transactions->get (fs->transactions, trail->db_txn,
-                                           &query, 
-                                           svn_fs__result_dbt (&result), 
-                                           0)));
-  svn_fs__track_dbt (&result, trail->pool);
+                     bfd->transactions->get (bfd->transactions, trail->db_txn,
+                                             &query,
+                                             svn_fs_base__result_dbt (&result),
+                                             0)));
+  svn_fs_base__track_dbt (&result, trail->pool);
 
   /* Set our return value. */
   *id_p = apr_pstrmemdup (trail->pool, result.data, result.size);
 
   /* Bump to future key. */
   len = result.size;
-  svn_fs__next_key (result.data, &len, next_key);
-  svn_fs__str_to_dbt (&query, svn_fs__next_key_key);
-  svn_fs__str_to_dbt (&result, next_key);
-  svn_fs__trail_debug (trail, "transactions", "put");
-  db_err = fs->transactions->put (fs->transactions, trail->db_txn,
-                                  &query, &result, 0);
+  svn_fs_base__next_key (result.data, &len, next_key);
+  svn_fs_base__str_to_dbt (&query, NEXT_KEY_KEY);
+  svn_fs_base__str_to_dbt (&result, next_key);
+  svn_fs_base__trail_debug (trail, "transactions", "put");
+  db_err = bfd->transactions->put (bfd->transactions, trail->db_txn,
+                                   &query, &result, 0);
 
   SVN_ERR (BDB_WRAP (fs, "bumping next transaction key", db_err));
   return SVN_NO_ERROR;
@@ -136,95 +139,99 @@
 
 
 svn_error_t *
-svn_fs__bdb_create_txn (const char **txn_name_p,
+svn_fs_bdb__create_txn (const char **txn_name_p,
                         svn_fs_t *fs,
                         const svn_fs_id_t *root_id,
                         trail_t *trail)
 {
   const char *txn_name;
-  svn_fs__transaction_t txn;
+  transaction_t txn;
 
   SVN_ERR (allocate_txn_id (&txn_name, fs, trail));
-  txn.kind = svn_fs__transaction_kind_normal;
+  txn.kind = transaction_kind_normal;
   txn.root_id = root_id;
   txn.base_id = root_id;
   txn.proplist = NULL;
   txn.copies = NULL;
   txn.revision = SVN_INVALID_REVNUM;
-  SVN_ERR (svn_fs__bdb_put_txn (fs, &txn, txn_name, trail));
+  SVN_ERR (svn_fs_bdb__put_txn (fs, &txn, txn_name, trail));
 
-  *txn_name_p = txn_name; 
+  *txn_name_p = txn_name;
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_delete_txn (svn_fs_t *fs,
+svn_fs_bdb__delete_txn (svn_fs_t *fs,
                         const char *txn_name,
                         trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT key;
-  svn_fs__transaction_t *txn;
-  
+  transaction_t *txn;
+
   /* Make sure TXN is dead. */
-  SVN_ERR (svn_fs__bdb_get_txn (&txn, fs, txn_name, trail));
+  SVN_ERR (svn_fs_bdb__get_txn (&txn, fs, txn_name, trail));
   if (is_committed (txn))
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
-  
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
+
   /* Delete the transaction from the `transactions' table. */
-  svn_fs__str_to_dbt (&key, txn_name);
-  svn_fs__trail_debug (trail, "transactions", "del");
+  svn_fs_base__str_to_dbt (&key, txn_name);
+  svn_fs_base__trail_debug (trail, "transactions", "del");
   SVN_ERR (BDB_WRAP (fs, "deleting entry from 'transactions' table",
-                    fs->transactions->del (fs->transactions,
-                                           trail->db_txn, &key, 0)));
+                     bfd->transactions->del (bfd->transactions,
+                                             trail->db_txn, &key, 0)));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_get_txn (svn_fs__transaction_t **txn_p,
+svn_fs_bdb__get_txn (transaction_t **txn_p,
                      svn_fs_t *fs,
                      const char *txn_name,
                      trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DBT key, value;
   int db_err;
   skel_t *skel;
-  svn_fs__transaction_t *transaction;
+  transaction_t *transaction;
 
   /* Only in the context of this function do we know that the DB call
      will not attempt to modify txn_name, so the cast belongs here.  */
-  svn_fs__trail_debug (trail, "transactions", "get");
-  db_err = fs->transactions->get (fs->transactions, trail->db_txn,
-                                  svn_fs__str_to_dbt (&key, txn_name),
-                                  svn_fs__result_dbt (&value),
-                                  0);
-  svn_fs__track_dbt (&value, trail->pool);
+  svn_fs_base__trail_debug (trail, "transactions", "get");
+  db_err = bfd->transactions->get (bfd->transactions, trail->db_txn,
+                                   svn_fs_base__str_to_dbt (&key, txn_name),
+                                   svn_fs_base__result_dbt (&value),
+                                   0);
+  svn_fs_base__track_dbt (&value, trail->pool);
 
   if (db_err == DB_NOTFOUND)
-    return svn_fs__err_no_such_txn (fs, txn_name);
+    return svn_fs_base__err_no_such_txn (fs, txn_name);
   SVN_ERR (BDB_WRAP (fs, "reading transaction", db_err));
 
   /* Parse TRANSACTION skel */
-  skel = svn_fs__parse_skel (value.data, value.size, trail->pool);
+  skel = svn_fs_base__parse_skel (value.data, value.size, trail->pool);
   if (! skel)
-    return svn_fs__err_corrupt_txn (fs, txn_name);
+    return svn_fs_base__err_corrupt_txn (fs, txn_name);
 
   /* Convert skel to native type. */
-  SVN_ERR (svn_fs__parse_transaction_skel (&transaction, skel, trail->pool));
+  SVN_ERR (svn_fs_base__parse_transaction_skel (&transaction, skel,
+                                                trail->pool));
   *txn_p = transaction;
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__bdb_get_txn_list (apr_array_header_t **names_p,
+svn_fs_bdb__get_txn_list (apr_array_header_t **names_p,
                           svn_fs_t *fs,
                           apr_pool_t *pool,
                           trail_t *trail)
 {
-  apr_size_t const next_id_key_len = strlen (svn_fs__next_key_key);
+  base_fs_data_t *bfd = fs->fsap_data;
+  apr_size_t const next_id_key_len = strlen (NEXT_KEY_KEY);
   apr_pool_t *subpool = svn_pool_create (trail->pool);
   apr_array_header_t *names;
 
@@ -236,23 +243,23 @@
   names = apr_array_make (pool, 4, sizeof (const char *));
 
   /* Create a database cursor to list the transaction names. */
-  svn_fs__trail_debug (trail, "transactions", "cursor");
+  svn_fs_base__trail_debug (trail, "transactions", "cursor");
   SVN_ERR (BDB_WRAP (fs, "reading transaction list (opening cursor)",
-                    fs->transactions->cursor (fs->transactions, trail->db_txn,
-                                              &cursor, 0)));
+                     bfd->transactions->cursor (bfd->transactions,
+                                                trail->db_txn, &cursor, 0)));
 
   /* Build a null-terminated array of keys in the transactions table. */
   for (db_err = cursor->c_get (cursor,
-                               svn_fs__result_dbt (&key),
-                               svn_fs__result_dbt (&value),
+                               svn_fs_base__result_dbt (&key),
+                               svn_fs_base__result_dbt (&value),
                                DB_FIRST);
        db_err == 0;
        db_err = cursor->c_get (cursor,
-                               svn_fs__result_dbt (&key),
-                               svn_fs__result_dbt (&value),
+                               svn_fs_base__result_dbt (&key),
+                               svn_fs_base__result_dbt (&value),
                                DB_NEXT))
     {
-      svn_fs__transaction_t *txn;
+      transaction_t *txn;
       skel_t *txn_skel;
       svn_error_t *err;
 
@@ -262,25 +269,26 @@
       /* Track the memory alloc'd for fetching the key and value here
          so that when the containing pool is cleared, this memory is
          freed. */
-      svn_fs__track_dbt (&key, subpool);
-      svn_fs__track_dbt (&value, subpool);
+      svn_fs_base__track_dbt (&key, subpool);
+      svn_fs_base__track_dbt (&value, subpool);
 
       /* Ignore the "next-id" key. */
       if (key.size == next_id_key_len
-          && 0 == memcmp (key.data, svn_fs__next_key_key, next_id_key_len))
+          && 0 == memcmp (key.data, NEXT_KEY_KEY, next_id_key_len))
         continue;
 
       /* Parse TRANSACTION skel */
-      txn_skel = svn_fs__parse_skel (value.data, value.size, subpool);
+      txn_skel = svn_fs_base__parse_skel (value.data, value.size, subpool);
       if (! txn_skel)
         {
           cursor->c_close (cursor);
-          return svn_fs__err_corrupt_txn 
+          return svn_fs_base__err_corrupt_txn
             (fs, apr_pstrmemdup (trail->pool, key.data, key.size));
         }
 
       /* Convert skel to native type. */
-      if ((err = svn_fs__parse_transaction_skel (&txn, txn_skel, subpool)))
+      if ((err = svn_fs_base__parse_transaction_skel (&txn, txn_skel,
+                                                      subpool)))
         {
           cursor->c_close (cursor);
           return err;
@@ -300,10 +308,10 @@
   if (db_err != DB_NOTFOUND)
     {
       SVN_ERR (BDB_WRAP (fs, "reading transaction list (listing keys)",
-                        db_err));
+                         db_err));
     }
   SVN_ERR (BDB_WRAP (fs, "reading transaction list (closing cursor)",
-                    db_c_err));
+                     db_c_err));
 
   /* Destroy the per-iteration subpool */
   svn_pool_destroy (subpool);

Modified: trunk/subversion/libsvn_fs_base/bdb/txn-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/txn-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/txn-table.h	Thu Apr 29 18:17:29 2004
@@ -31,7 +31,7 @@
 /* Open a `transactions' table in ENV.  If CREATE is non-zero, create
    one if it doesn't exist.  Set *TRANSACTIONS_P to the new table.
    Return a Berkeley DB error code.  */
-int svn_fs__bdb_open_transactions_table (DB **transactions_p,
+int svn_fs_bdb__open_transactions_table (DB **transactions_p,
                                          DB_ENV *env,
                                          svn_boolean_t create);
 
@@ -39,29 +39,29 @@
 /* Create a new transaction in FS as part of TRAIL, with an initial
    root and base root ID of ROOT_ID.  Set *TXN_NAME_P to the name of the
    new transaction, allocated in TRAIL->pool.  */
-svn_error_t *svn_fs__bdb_create_txn (const char **txn_name_p,
+svn_error_t *svn_fs_bdb__create_txn (const char **txn_name_p,
                                      svn_fs_t *fs,
                                      const svn_fs_id_t *root_id,
                                      trail_t *trail);
 
 
 /* Remove the transaction whose name is TXN_NAME from the `transactions'
-   table of FS, as part of TRAIL.  
+   table of FS, as part of TRAIL.
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__bdb_delete_txn (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__delete_txn (svn_fs_t *fs,
                                      const char *txn_name,
                                      trail_t *trail);
 
- 
+
 /* Retrieve the transaction *TXN_P for the Subversion transaction
    named TXN_NAME from the `transactions' table of FS, as part of
    TRAIL.  Perform all allocations in TRAIL->pool.
-   
+
    If there is no such transaction, SVN_ERR_FS_NO_SUCH_TRANSACTION is
    the error returned.  */
-svn_error_t *svn_fs__bdb_get_txn (svn_fs__transaction_t **txn_p,
+svn_error_t *svn_fs_bdb__get_txn (transaction_t **txn_p,
                                   svn_fs_t *fs,
                                   const char *txn_name,
                                   trail_t *trail);
@@ -69,16 +69,16 @@
 
 /* Store the Suversion transaction TXN in FS with an ID of TXN_NAME as
    part of TRAIL. */
-svn_error_t *svn_fs__bdb_put_txn (svn_fs_t *fs,
-                                  const svn_fs__transaction_t *txn,
-                                  const char *txn_name, 
+svn_error_t *svn_fs_bdb__put_txn (svn_fs_t *fs,
+                                  const transaction_t *txn,
+                                  const char *txn_name,
                                   trail_t *trail);
 
 
 /* Set *NAMES_P to an array of const char * IDs (unfinished
    transactions in FS) as part of TRAIL.  Allocate the array and the
    names in POOL, and use TRAIL->pool for any temporary allocations.  */
-svn_error_t *svn_fs__bdb_get_txn_list (apr_array_header_t **names_p,
+svn_error_t *svn_fs_bdb__get_txn_list (apr_array_header_t **names_p,
                                        svn_fs_t *fs,
                                        apr_pool_t *pool,
                                        trail_t *trail);

Modified: trunk/subversion/libsvn_fs_base/bdb/uuids-table.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/uuids-table.c	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/uuids-table.c	Thu Apr 29 18:17:29 2004
@@ -23,6 +23,7 @@
 #include "../err.h"
 #include "dbt.h"
 #include "../trail.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "bdb-err.h"
 #include "uuids-table.h"
 
@@ -32,7 +33,7 @@
      generated and stored as record #1. ***/
 
 int
-svn_fs__bdb_open_uuids_table (DB **uuids_p,
+svn_fs_bdb__open_uuids_table (DB **uuids_p,
                               DB_ENV *env,
                               svn_boolean_t create)
 {
@@ -40,24 +41,24 @@
   DB *uuids;
   int error;
 
-  BDB_ERR (svn_fs__bdb_check_version());
+  BDB_ERR (svn_fs_bdb__check_version());
   BDB_ERR (db_create (&uuids, env, 0));
   BDB_ERR (uuids->set_re_len (uuids, APR_UUID_FORMATTED_LENGTH));
-  
+
   error = uuids->open (SVN_BDB_OPEN_PARAMS (uuids, NULL),
                        "uuids", 0, DB_RECNO,
                        open_flags | SVN_BDB_AUTO_COMMIT,
                        0666);
-  
+
   /* This is a temporary compatibility check; it creates the
      UUIDs table if one does not already exist. */
   if (error == ENOENT && (! create))
     {
       BDB_ERR (uuids->close (uuids, 0));
-      return svn_fs__bdb_open_uuids_table (uuids_p, env, TRUE);
+      return svn_fs_bdb__open_uuids_table (uuids_p, env, TRUE);
     }
 
-  BDB_ERR (error);    
+  BDB_ERR (error);
 
   if (create)
     {
@@ -66,72 +67,74 @@
       apr_uuid_t uuid;
       int recno = 0;
 
-      svn_fs__clear_dbt (&key);
+      svn_fs_base__clear_dbt (&key);
       key.data = &recno;
       key.size = sizeof (recno);
 
-      svn_fs__clear_dbt (&value);
+      svn_fs_base__clear_dbt (&value);
       value.data = buffer;
       value.size = sizeof (buffer) - 1;
 
       apr_uuid_get (&uuid);
       apr_uuid_format (buffer, &uuid);
 
-      BDB_ERR (uuids->put (uuids, 0, &key, &value, 
+      BDB_ERR (uuids->put (uuids, 0, &key, &value,
                            DB_APPEND | SVN_BDB_AUTO_COMMIT));
     }
-  
+
   *uuids_p = uuids;
   return 0;
 }
 
-svn_error_t *svn_fs__bdb_get_uuid (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__get_uuid (svn_fs_t *fs,
                                    int idx,
                                    const char **uuid,
                                    trail_t *trail)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   char buffer[APR_UUID_FORMATTED_LENGTH + 1];
-  DB *uuids = fs->uuids;
+  DB *uuids = bfd->uuids;
   DBT key;
   DBT value;
 
-  svn_fs__clear_dbt (&key);
+  svn_fs_base__clear_dbt (&key);
   key.data = &idx;
   key.size = sizeof (idx);
-  
-  svn_fs__clear_dbt (&value);
+
+  svn_fs_base__clear_dbt (&value);
   value.data = buffer;
   value.size = sizeof (buffer) - 1;
 
-  svn_fs__trail_debug (trail, "uuids", "get");
+  svn_fs_base__trail_debug (trail, "uuids", "get");
   SVN_ERR (BDB_WRAP (fs, "get repository uuid",
                      uuids->get (uuids, trail->db_txn, &key, &value, 0)));
-  
+
   *uuid = apr_pstrmemdup (trail->pool, value.data, value.size);
-  
+
   return SVN_NO_ERROR;
 }
 
-svn_error_t *svn_fs__bdb_set_uuid (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__set_uuid (svn_fs_t *fs,
                                    int idx,
                                    const char *uuid,
                                    trail_t *trail)
 {
-  DB *uuids = fs->uuids;
+  base_fs_data_t *bfd = fs->fsap_data;
+  DB *uuids = bfd->uuids;
   DBT key;
   DBT value;
-  
-  svn_fs__clear_dbt (&key);
+
+  svn_fs_base__clear_dbt (&key);
   key.data = &idx;
   key.size = sizeof (idx);
-  
-  svn_fs__clear_dbt (&value);
+
+  svn_fs_base__clear_dbt (&value);
   value.size = strlen (uuid);
   value.data = apr_pstrmemdup (trail->pool, uuid, value.size + 1);
-  
-  svn_fs__trail_debug (trail, "uuids", "put");
+
+  svn_fs_base__trail_debug (trail, "uuids", "put");
   SVN_ERR (BDB_WRAP (fs, "set repository uuid",
                      uuids->put (uuids, trail->db_txn, &key, &value, 0)));
-  
+
   return SVN_NO_ERROR;
 }

Modified: trunk/subversion/libsvn_fs_base/bdb/uuids-table.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/bdb/uuids-table.h	(original)
+++ trunk/subversion/libsvn_fs_base/bdb/uuids-table.h	Thu Apr 29 18:17:29 2004
@@ -32,10 +32,10 @@
 /* Open a `uuids' table in @a env.
  *
  * Open a `uuids' table in @a env.  If @a create is non-zero, create
- * one if it doesn't exist.  Set @a *uuids_p to the new table.  
+ * one if it doesn't exist.  Set @a *uuids_p to the new table.
  * Return a Berkeley DB error code.
  */
-int svn_fs__bdb_open_uuids_table (DB **uuids_p,
+int svn_fs_bdb__open_uuids_table (DB **uuids_p,
                                   DB_ENV *env,
                                   svn_boolean_t create);
 
@@ -43,7 +43,7 @@
  * storing the result in @a *uuid.
  */
 
-svn_error_t *svn_fs__bdb_get_uuid (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__get_uuid (svn_fs_t *fs,
                                    int idx,
                                    const char **uuid,
                                    trail_t *trail);
@@ -52,7 +52,7 @@
  * to @a uuid.
  */
 
-svn_error_t *svn_fs__bdb_set_uuid (svn_fs_t *fs,
+svn_error_t *svn_fs_bdb__set_uuid (svn_fs_t *fs,
                                    int idx,
                                    const char *uuid,
                                    trail_t *trail);

Modified: trunk/subversion/libsvn_fs_base/dag.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/dag.c	(original)
+++ trunk/subversion/libsvn_fs_base/dag.c	Thu Apr 29 18:17:29 2004
@@ -31,7 +31,6 @@
 #include "key-gen.h"
 #include "node-rev.h"
 #include "trail.h"
-#include "id.h"
 #include "reps-strings.h"
 #include "revs-txns.h"
 
@@ -44,6 +43,8 @@
 #include "bdb/reps-table.h"
 #include "bdb/strings-table.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
 /* Initializing a filesystem.  */
 
@@ -75,7 +76,7 @@
      this yourself, but you're probably better off just calling
      `get_node_revision' and `set_node_revision', which take care of
      things for you.  */
-  svn_fs__node_revision_t *node_revision;
+  node_revision_t *node_revision;
 
   /* the path at which this node was created. */
   const char *created_path;
@@ -84,28 +85,28 @@
 
 
 /* Trivial helper/accessor functions. */
-svn_node_kind_t svn_fs__dag_node_kind (dag_node_t *node)
+svn_node_kind_t svn_fs_base__dag_node_kind (dag_node_t *node)
 {
   return node->kind;
 }
 
 
 const svn_fs_id_t *
-svn_fs__dag_get_id (dag_node_t *node)
+svn_fs_base__dag_get_id (dag_node_t *node)
 {
   return node->id;
 }
 
 
 const char *
-svn_fs__dag_get_created_path (dag_node_t *node)
+svn_fs_base__dag_get_created_path (dag_node_t *node)
 {
   return node->created_path;
 }
 
 
 svn_fs_t *
-svn_fs__dag_get_fs (dag_node_t *node)
+svn_fs_base__dag_get_fs (dag_node_t *node)
 {
   return node->fs;
 }
@@ -121,11 +122,11 @@
 
 
 /* Dup NODEREV and all associated data into POOL */
-static svn_fs__node_revision_t *
-copy_node_revision (svn_fs__node_revision_t *noderev,
+static node_revision_t *
+copy_node_revision (node_revision_t *noderev,
                     apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *nr = apr_pcalloc (pool, sizeof (*nr));
+  node_revision_t *nr = apr_pcalloc (pool, sizeof (*nr));
   nr->kind = noderev->kind;
   if (noderev->predecessor_id)
     nr->predecessor_id = svn_fs__id_copy (noderev->predecessor_id, pool);
@@ -146,7 +147,7 @@
    NODEREV must be allocated in TRAIL->pool.  */
 static void
 cache_node_revision (dag_node_t *node,
-                     svn_fs__node_revision_t *noderev,
+                     node_revision_t *noderev,
                      trail_t *trail)
 {
   /* ### todo: For now, we will always throw away the node revision at trail
@@ -162,7 +163,7 @@
       /* Mutable nodes might have other processes change their
          contents, so we must throw away this node revision once the
          trail is complete.  */
-      svn_fs__record_completion (trail, uncache_node_revision, node);
+      svn_fs_base__record_completion (trail, uncache_node_revision, node);
       node->node_revision = noderev;
 
 #if 0
@@ -175,7 +176,7 @@
     }
 #endif /* 0 */
 }
-                     
+
 
 /* Set *NODEREV_P to the cached node-revision for NODE, as part of
    TRAIL.  If NODE is immutable, the node-revision is allocated in
@@ -191,21 +192,21 @@
    changes that never got committed.  It's probably best not to change
    the structure at all.  */
 static svn_error_t *
-get_node_revision (svn_fs__node_revision_t **noderev_p,
+get_node_revision (node_revision_t **noderev_p,
                    dag_node_t *node,
                    trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* If we've already got a copy, there's no need to read it in.  */
   if (! node->node_revision)
     {
       /* Read it in, and cache it.  */
-      SVN_ERR (svn_fs__bdb_get_node_revision (&noderev, node->fs, 
+      SVN_ERR (svn_fs_bdb__get_node_revision (&noderev, node->fs,
                                               node->id, trail));
       cache_node_revision (node, noderev, trail);
     }
-          
+
   /* Now NODE->node_revision is set.  */
   *noderev_p = node->node_revision;
   return SVN_NO_ERROR;
@@ -216,11 +217,11 @@
    NODE's cache up to date.  NODEREV must be allocated in TRAIL->pool.  */
 static svn_error_t *
 set_node_revision (dag_node_t *node,
-                   svn_fs__node_revision_t *noderev,
+                   node_revision_t *noderev,
                    trail_t *trail)
 {
   /* Write it out.  */
-  SVN_ERR (svn_fs__bdb_put_node_revision (node->fs, node->id, noderev, trail));
+  SVN_ERR (svn_fs_bdb__put_node_revision (node->fs, node->id, noderev, trail));
 
   /* Since the write succeeded, update the cache.  */
   cache_node_revision (node, noderev, trail);
@@ -229,26 +230,27 @@
 }
 
 
-svn_boolean_t svn_fs__dag_check_mutable (dag_node_t *node, 
-                                         const char *txn_id)
+svn_boolean_t svn_fs_base__dag_check_mutable (dag_node_t *node,
+                                              const char *txn_id)
 {
-  return (strcmp (svn_fs__id_txn_id (svn_fs__dag_get_id (node)), txn_id) == 0);
+  return (strcmp (svn_fs__id_txn_id (svn_fs_base__dag_get_id (node)),
+                  txn_id) == 0);
 }
 
 
 svn_error_t *
-svn_fs__dag_get_node (dag_node_t **node,
-                      svn_fs_t *fs,
-                      const svn_fs_id_t *id,
-                      trail_t *trail)
+svn_fs_base__dag_get_node (dag_node_t **node,
+                           svn_fs_t *fs,
+                           const svn_fs_id_t *id,
+                           trail_t *trail)
 {
   dag_node_t *new_node;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Construct the node. */
   new_node = apr_pcalloc (trail->pool, sizeof (*new_node));
   new_node->fs = fs;
-  new_node->id = svn_fs__id_copy (id, trail->pool); 
+  new_node->id = svn_fs__id_copy (id, trail->pool);
   new_node->pool = trail->pool;
 
   /* Grab the contents so we can inspect the node's kind and created path. */
@@ -265,25 +267,25 @@
 
 
 svn_error_t *
-svn_fs__dag_get_revision (svn_revnum_t *rev,
-                          dag_node_t *node,
-                          trail_t *trail)
+svn_fs_base__dag_get_revision (svn_revnum_t *rev,
+                               dag_node_t *node,
+                               trail_t *trail)
 {
   /* Use the txn ID from the NODE's id to look up the transaction and
      get its revision number.  */
-  return svn_fs__txn_get_revision 
-    (rev, svn_fs__dag_get_fs (node), 
-     svn_fs__id_txn_id (svn_fs__dag_get_id (node)), trail);
+  return svn_fs_base__txn_get_revision
+    (rev, svn_fs_base__dag_get_fs (node),
+     svn_fs__id_txn_id (svn_fs_base__dag_get_id (node)), trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
-                                dag_node_t *node,
-                                trail_t *trail)
+svn_fs_base__dag_get_predecessor_id (const svn_fs_id_t **id_p,
+                                     dag_node_t *node,
+                                     trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
-  
+  node_revision_t *noderev;
+
   SVN_ERR (get_node_revision (&noderev, node, trail));
   *id_p = noderev->predecessor_id;
   return SVN_NO_ERROR;
@@ -291,12 +293,12 @@
 
 
 svn_error_t *
-svn_fs__dag_get_predecessor_count (int *count,
-                                   dag_node_t *node,
-                                   trail_t *trail)
+svn_fs_base__dag_get_predecessor_count (int *count,
+                                        dag_node_t *node,
+                                        trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
-  
+  node_revision_t *noderev;
+
   SVN_ERR (get_node_revision (&noderev, node, trail));
   *count = noderev->predecessor_count;
   return SVN_NO_ERROR;
@@ -304,19 +306,19 @@
 
 
 svn_error_t *
-svn_fs__dag_walk_predecessors (dag_node_t *node,
-                               svn_fs__dag_pred_func_t callback,
-                               void *baton,
-                               trail_t *trail)
+svn_fs_base__dag_walk_predecessors (dag_node_t *node,
+                                    dag_pred_func_t callback,
+                                    void *baton,
+                                    trail_t *trail)
 {
-  svn_fs_t *fs = svn_fs__dag_get_fs (node);
+  svn_fs_t *fs = svn_fs_base__dag_get_fs (node);
   dag_node_t *this_node;
   svn_boolean_t done = FALSE;
 
   this_node = node;
   while ((! done) && this_node)
     {
-      svn_fs__node_revision_t *noderev;
+      node_revision_t *noderev;
 
       /* Get the node revision for THIS_NODE so we can examine its
          predecessor id.  */
@@ -325,8 +327,8 @@
       /* If THIS_NODE has a predecessor, replace THIS_NODE with the
          precessor, else set it to NULL.  */
       if (noderev->predecessor_id)
-        SVN_ERR (svn_fs__dag_get_node (&this_node, fs, 
-                                       noderev->predecessor_id, trail));
+        SVN_ERR (svn_fs_base__dag_get_node (&this_node, fs,
+                                            noderev->predecessor_id, trail));
       else
         this_node = NULL;
 
@@ -340,64 +342,65 @@
 }
 
 
-/* Trail body for svn_fs__dag_init_fs. */
+/* Trail body for svn_fs_base__dag_init_fs. */
 static svn_error_t *
 txn_body_dag_init_fs (void *baton, trail_t *trail)
 {
-  svn_fs__node_revision_t noderev;
-  svn_fs__revision_t revision;
+  node_revision_t noderev;
+  revision_t revision;
   svn_revnum_t rev = SVN_INVALID_REVNUM;
   svn_fs_t *fs = trail->fs;
   svn_string_t date;
   const char *txn_id;
   const char *copy_id;
   svn_fs_id_t *root_id = svn_fs_parse_id ("0.0.0", 5, trail->pool);
-  
+
   /* Create empty root directory with node revision 0.0.0. */
   memset (&noderev, 0, sizeof (noderev));
   noderev.kind = svn_node_dir;
   noderev.created_path = "/";
-  SVN_ERR (svn_fs__bdb_put_node_revision (fs, root_id, &noderev, trail));
+  SVN_ERR (svn_fs_bdb__put_node_revision (fs, root_id, &noderev, trail));
 
   /* Create a new transaction (better have an id of "0") */
-  SVN_ERR (svn_fs__bdb_create_txn (&txn_id, fs, root_id, trail));
+  SVN_ERR (svn_fs_bdb__create_txn (&txn_id, fs, root_id, trail));
   if (strcmp (txn_id, "0"))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_CORRUPT, 0,
        "Corrupt DB: initial transaction id not '0' in filesystem '%s'",
        fs->path);
 
   /* Create a default copy (better have an id of "0") */
-  SVN_ERR (svn_fs__bdb_reserve_copy_id (&copy_id, fs, trail));
+  SVN_ERR (svn_fs_bdb__reserve_copy_id (&copy_id, fs, trail));
   if (strcmp (copy_id, "0"))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_CORRUPT, 0,
        "Corrupt DB: initial copy id not '0' in filesystem '%s'", fs->path);
-  SVN_ERR (svn_fs__bdb_create_copy (fs, copy_id, NULL, NULL, root_id, 
-                                    svn_fs__copy_kind_real, trail));
+  SVN_ERR (svn_fs_bdb__create_copy (fs, copy_id, NULL, NULL, root_id,
+                                    copy_kind_real, trail));
 
   /* Link it into filesystem revision 0. */
   revision.txn_id = txn_id;
-  SVN_ERR (svn_fs__bdb_put_rev (&rev, fs, &revision, trail));
+  SVN_ERR (svn_fs_bdb__put_rev (&rev, fs, &revision, trail));
   if (rev != 0)
     return svn_error_createf (SVN_ERR_FS_CORRUPT, 0,
                               "Corrupt DB: initial revision number is not '0'"
                               " in filesystem '%s'", fs->path);
 
   /* Promote our transaction to a "committed" transaction. */
-  SVN_ERR (svn_fs__txn_make_committed (fs, txn_id, rev, trail));
+  SVN_ERR (svn_fs_base__txn_make_committed (fs, txn_id, rev, trail));
 
   /* Set a date on revision 0. */
   date.data = svn_time_to_cstring (apr_time_now(), trail->pool);
   date.len = strlen (date.data);
-  return svn_fs__set_rev_prop (fs, 0, SVN_PROP_REVISION_DATE, &date, trail);
+  return svn_fs_base__set_rev_prop (fs, 0, SVN_PROP_REVISION_DATE, &date,
+                                    trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_init_fs (svn_fs_t *fs)
+svn_fs_base__dag_init_fs (svn_fs_t *fs)
 {
-  return svn_fs__retry_txn (fs, txn_body_dag_init_fs, NULL, fs->pool);
+  return svn_fs_base__retry_txn (fs, txn_body_dag_init_fs, NULL, fs->pool);
 }
 
 
@@ -414,7 +417,7 @@
 static svn_error_t *
 get_dir_entries (apr_hash_t **entries_p,
                  svn_fs_t *fs,
-                 svn_fs__node_revision_t *noderev,
+                 node_revision_t *noderev,
                  trail_t *trail)
 {
   apr_hash_t *entries = apr_hash_make (trail->pool);
@@ -432,15 +435,15 @@
   if (noderev->data_key)
     {
       /* Now we have a rep, follow through to get the entries. */
-      SVN_ERR (svn_fs__rep_contents (&entries_raw, fs, 
-                                     noderev->data_key, trail));
-      entries_skel = svn_fs__parse_skel (entries_raw.data, entries_raw.len,
-                                         trail->pool);
+      SVN_ERR (svn_fs_base__rep_contents (&entries_raw, fs,
+                                          noderev->data_key, trail));
+      entries_skel = svn_fs_base__parse_skel (entries_raw.data,
+                                              entries_raw.len, trail->pool);
 
       /* Were there entries?  Make a hash from them. */
       if (entries_skel)
-        SVN_ERR (svn_fs__parse_entries_skel (&entries, entries_skel, 
-                                             trail->pool));
+        SVN_ERR (svn_fs_base__parse_entries_skel (&entries, entries_skel,
+                                                  trail->pool));
     }
 
   /* No hash?  No problem.  */
@@ -456,7 +459,7 @@
       apr_ssize_t klen;
       void *val;
       svn_fs_dirent_t *dirent = apr_palloc (trail->pool, sizeof (*dirent));
-      
+
       /* KEY will be the entry name in ancestor, VAL the id.  */
       apr_hash_this (hi, &key, &klen, &val);
       dirent->name = key;
@@ -475,7 +478,7 @@
    entry is allocated in TRAIL->pool or in the same pool as PARENT;
    the caller should copy if it cares.  */
 static svn_error_t *
-dir_entry_id_from_node (const svn_fs_id_t **id_p, 
+dir_entry_id_from_node (const svn_fs_id_t **id_p,
                         dag_node_t *parent,
                         const char *name,
                         trail_t *trail)
@@ -483,12 +486,12 @@
   apr_hash_t *entries;
   svn_fs_dirent_t *dirent;
 
-  SVN_ERR (svn_fs__dag_dir_entries (&entries, parent, trail));
+  SVN_ERR (svn_fs_base__dag_dir_entries (&entries, parent, trail));
   if (entries)
     dirent = apr_hash_get (entries, name, APR_HASH_KEY_STRING);
   else
     dirent = NULL;
-    
+
   *id_p = dirent ? dirent->id : NULL;
   return SVN_NO_ERROR;
 }
@@ -509,7 +512,7 @@
            const char *txn_id,
            trail_t *trail)
 {
-  svn_fs__node_revision_t *parent_noderev;
+  node_revision_t *parent_noderev;
   const char *rep_key, *mutable_rep_key;
   apr_hash_t *entries = NULL;
   svn_stream_t *wstream;
@@ -517,22 +520,22 @@
   svn_string_t raw_entries;
   svn_stringbuf_t *raw_entries_buf;
   skel_t *entries_skel;
-  svn_fs_t *fs = svn_fs__dag_get_fs (parent);
+  svn_fs_t *fs = svn_fs_base__dag_get_fs (parent);
 
   /* Get the parent's node-revision. */
   SVN_ERR (get_node_revision (&parent_noderev, parent, trail));
   rep_key = parent_noderev->data_key;
-  SVN_ERR (svn_fs__get_mutable_rep (&mutable_rep_key, rep_key,
-                                    fs, txn_id, trail));
+  SVN_ERR (svn_fs_base__get_mutable_rep (&mutable_rep_key, rep_key,
+                                         fs, txn_id, trail));
 
   /* If the parent node already pointed at a mutable representation,
      we don't need to do anything.  But if it didn't, either because
      the parent didn't refer to any rep yet or because it referred to
      an immutable one, we must make the parent refer to the mutable
      rep we just created. */
-  if (! svn_fs__same_keys (rep_key, mutable_rep_key))
+  if (! svn_fs_base__same_keys (rep_key, mutable_rep_key))
     {
-      svn_fs__node_revision_t *new_noderev = 
+      node_revision_t *new_noderev =
         copy_node_revision (parent_noderev, trail->pool);
       new_noderev->data_key = mutable_rep_key;
       SVN_ERR (set_node_revision (parent, new_noderev, trail));
@@ -542,12 +545,12 @@
      list for it.  Else, go read its existing entries list. */
   if (rep_key)
     {
-      SVN_ERR (svn_fs__rep_contents (&raw_entries, fs, rep_key, trail));
-      entries_skel = svn_fs__parse_skel (raw_entries.data, raw_entries.len,
-                                         trail->pool);
+      SVN_ERR (svn_fs_base__rep_contents (&raw_entries, fs, rep_key, trail));
+      entries_skel = svn_fs_base__parse_skel (raw_entries.data,
+                                              raw_entries.len, trail->pool);
       if (entries_skel)
-        SVN_ERR (svn_fs__parse_entries_skel (&entries, entries_skel, 
-                                             trail->pool));
+        SVN_ERR (svn_fs_base__parse_entries_skel (&entries, entries_skel,
+                                                  trail->pool));
     }
 
   /* If we still have no ENTRIES hash, make one here.  */
@@ -558,11 +561,12 @@
   apr_hash_set (entries, name, APR_HASH_KEY_STRING, id);
 
   /* Finally, replace the old entries list with the new one. */
-  SVN_ERR (svn_fs__unparse_entries_skel (&entries_skel, entries, trail->pool));
-  raw_entries_buf = svn_fs__unparse_skel (entries_skel, trail->pool);
-  SVN_ERR (svn_fs__rep_contents_write_stream (&wstream, fs, mutable_rep_key,
-                                              txn_id, TRUE, trail, 
+  SVN_ERR (svn_fs_base__unparse_entries_skel (&entries_skel, entries,
                                               trail->pool));
+  raw_entries_buf = svn_fs_base__unparse_skel (entries_skel, trail->pool);
+  SVN_ERR (svn_fs_base__rep_contents_write_stream (&wstream, fs,
+                                                   mutable_rep_key, txn_id,
+                                                   TRUE, trail, trail->pool));
   len = raw_entries_buf->len;
   SVN_ERR (svn_stream_write (wstream, raw_entries_buf->data, &len));
   SVN_ERR (svn_stream_close (wstream));
@@ -585,11 +589,11 @@
             trail_t *trail)
 {
   const svn_fs_id_t *new_node_id;
-  svn_fs__node_revision_t new_noderev;
+  node_revision_t new_noderev;
 
   /* Make sure that NAME is a single path component. */
   if (! svn_path_is_single_path_component (name))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
        "Attempted to create a node with an illegal name '%s'", name);
 
@@ -598,17 +602,17 @@
     return svn_error_create
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
        "Attempted to create entry in non-directory parent");
-    
+
   /* Check that the parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
-    return svn_error_createf 
+  if (! svn_fs_base__dag_check_mutable (parent, txn_id))
+    return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to clone child of non-mutable node");
 
   /* Check that parent does not already have an entry named NAME. */
   SVN_ERR (dir_entry_id_from_node (&new_node_id, parent, name, trail));
   if (new_node_id)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_ALREADY_EXISTS, NULL,
        "Attempted to create entry that already exists");
 
@@ -616,19 +620,20 @@
   memset (&new_noderev, 0, sizeof (new_noderev));
   new_noderev.kind = is_dir ? svn_node_dir : svn_node_file;
   new_noderev.created_path = svn_path_join (parent_path, name, trail->pool);
-  SVN_ERR (svn_fs__create_node 
-           (&new_node_id, svn_fs__dag_get_fs (parent),
-            &new_noderev, svn_fs__id_copy_id (svn_fs__dag_get_id (parent)),
+  SVN_ERR (svn_fs_base__create_node
+           (&new_node_id, svn_fs_base__dag_get_fs (parent), &new_noderev,
+            svn_fs__id_copy_id (svn_fs_base__dag_get_id (parent)),
             txn_id, trail));
 
   /* Create a new dag_node_t for our new node */
-  SVN_ERR (svn_fs__dag_get_node (child_p, svn_fs__dag_get_fs (parent),
-                                 new_node_id, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (child_p,
+                                      svn_fs_base__dag_get_fs (parent),
+                                      new_node_id, trail));
 
   /* We can safely call set_entry because we already know that
      PARENT is mutable, and we just created CHILD, so we know it has
      no ancestors (therefore, PARENT cannot be an ancestor of CHILD) */
-  SVN_ERR (set_entry (parent, name, svn_fs__dag_get_id (*child_p), 
+  SVN_ERR (set_entry (parent, name, svn_fs_base__dag_get_id (*child_p),
                       txn_id, trail));
 
   return SVN_NO_ERROR;
@@ -636,32 +641,33 @@
 
 
 svn_error_t *
-svn_fs__dag_dir_entries (apr_hash_t **entries,
-                         dag_node_t *node,
-                         trail_t *trail)
+svn_fs_base__dag_dir_entries (apr_hash_t **entries,
+                              dag_node_t *node,
+                              trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   SVN_ERR (get_node_revision (&noderev, node, trail));
-  return get_dir_entries (entries, svn_fs__dag_get_fs (node), noderev, trail);
+  return get_dir_entries (entries, svn_fs_base__dag_get_fs (node), noderev,
+                          trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_set_entry (dag_node_t *node,
-                       const char *entry_name,
-                       const svn_fs_id_t *id,
-                       const char *txn_id,
-                       trail_t *trail)
+svn_fs_base__dag_set_entry (dag_node_t *node,
+                            const char *entry_name,
+                            const svn_fs_id_t *id,
+                            const char *txn_id,
+                            trail_t *trail)
 {
   /* Check it's a directory. */
   if (node->kind != svn_node_dir)
     return svn_error_create
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
        "Attempted to set entry in non-directory node");
-  
+
   /* Check it's mutable. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_base__dag_check_mutable (node, txn_id))
     return svn_error_create
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
        "Attempted to set entry in immutable node");
@@ -674,15 +680,15 @@
 /*** Proplists. ***/
 
 svn_error_t *
-svn_fs__dag_get_proplist (apr_hash_t **proplist_p,
-                          dag_node_t *node,
-                          trail_t *trail)
+svn_fs_base__dag_get_proplist (apr_hash_t **proplist_p,
+                               dag_node_t *node,
+                               trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   apr_hash_t *proplist = NULL;
   svn_string_t raw_proplist;
   skel_t *proplist_skel;
-  
+
   /* Go get a fresh NODE-REVISION for this node. */
   SVN_ERR (get_node_revision (&noderev, node, trail));
 
@@ -695,13 +701,14 @@
 
   /* Get the string associated with the property rep, parsing it as a
      skel, and then attempt to parse *that* into a property hash.  */
-  SVN_ERR (svn_fs__rep_contents (&raw_proplist, svn_fs__dag_get_fs (node), 
-                                 noderev->prop_key, trail));
-  proplist_skel = svn_fs__parse_skel (raw_proplist.data, raw_proplist.len,
-                                      trail->pool);
+  SVN_ERR (svn_fs_base__rep_contents (&raw_proplist,
+                                      svn_fs_base__dag_get_fs (node),
+                                      noderev->prop_key, trail));
+  proplist_skel = svn_fs_base__parse_skel (raw_proplist.data, raw_proplist.len,
+                                           trail->pool);
   if (proplist_skel)
-    SVN_ERR (svn_fs__parse_proplist_skel (&proplist, proplist_skel, 
-                                          trail->pool));
+    SVN_ERR (svn_fs_base__parse_proplist_skel (&proplist, proplist_skel,
+                                               trail->pool));
 
   *proplist_p = proplist;
   return SVN_NO_ERROR;
@@ -709,20 +716,20 @@
 
 
 svn_error_t *
-svn_fs__dag_set_proplist (dag_node_t *node,
-                          apr_hash_t *proplist,
-                          const char *txn_id,
-                          trail_t *trail)
+svn_fs_base__dag_set_proplist (dag_node_t *node,
+                               apr_hash_t *proplist,
+                               const char *txn_id,
+                               trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   const char *rep_key, *mutable_rep_key;
-  svn_fs_t *fs = svn_fs__dag_get_fs (node);
-  
+  svn_fs_t *fs = svn_fs_base__dag_get_fs (node);
+
   /* Sanity check: this node better be mutable! */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_base__dag_check_mutable (node, txn_id))
     {
       svn_string_t *idstr = svn_fs_unparse_id (node->id, node->pool);
-      return svn_error_createf 
+      return svn_error_createf
         (SVN_ERR_FS_NOT_MUTABLE, NULL,
          "Can't set proplist on *immutable* node-revision %s", idstr->data);
     }
@@ -733,12 +740,12 @@
 
   /* Get a mutable version of this rep (updating the node revision if
      this isn't a NOOP)  */
-  SVN_ERR (svn_fs__get_mutable_rep (&mutable_rep_key, rep_key,
-                                    fs, txn_id, trail));
-  if (! svn_fs__same_keys (mutable_rep_key, rep_key))
+  SVN_ERR (svn_fs_base__get_mutable_rep (&mutable_rep_key, rep_key,
+                                         fs, txn_id, trail));
+  if (! svn_fs_base__same_keys (mutable_rep_key, rep_key))
     {
       noderev->prop_key = mutable_rep_key;
-      SVN_ERR (svn_fs__bdb_put_node_revision (fs, node->id, noderev, trail));
+      SVN_ERR (svn_fs_bdb__put_node_revision (fs, node->id, noderev, trail));
     }
 
   /* Replace the old property list with the new one. */
@@ -748,12 +755,13 @@
     skel_t *proplist_skel;
     svn_stringbuf_t *raw_proplist_buf;
 
-    SVN_ERR (svn_fs__unparse_proplist_skel (&proplist_skel, proplist, 
-                                            trail->pool));
-    raw_proplist_buf = svn_fs__unparse_skel (proplist_skel, trail->pool);
-    SVN_ERR (svn_fs__rep_contents_write_stream (&wstream, fs, mutable_rep_key,
-                                                txn_id, TRUE, trail, 
-                                                trail->pool));
+    SVN_ERR (svn_fs_base__unparse_proplist_skel (&proplist_skel, proplist,
+                                                 trail->pool));
+    raw_proplist_buf = svn_fs_base__unparse_skel (proplist_skel, trail->pool);
+    SVN_ERR (svn_fs_base__rep_contents_write_stream (&wstream, fs,
+                                                     mutable_rep_key, txn_id,
+                                                     TRUE, trail,
+                                                     trail->pool));
     len = raw_proplist_buf->len;
     SVN_ERR (svn_stream_write (wstream, raw_proplist_buf->data, &len));
     SVN_ERR (svn_stream_close (wstream));
@@ -767,128 +775,133 @@
 /*** Roots. ***/
 
 svn_error_t *
-svn_fs__dag_revision_root (dag_node_t **node_p,
-                           svn_fs_t *fs,
-                           svn_revnum_t rev,
-                           trail_t *trail)
+svn_fs_base__dag_revision_root (dag_node_t **node_p,
+                                svn_fs_t *fs,
+                                svn_revnum_t rev,
+                                trail_t *trail)
 {
   const svn_fs_id_t *root_id;
 
-  SVN_ERR (svn_fs__rev_get_root (&root_id, fs, rev, trail));
-  return svn_fs__dag_get_node (node_p, fs, root_id, trail);
+  SVN_ERR (svn_fs_base__rev_get_root (&root_id, fs, rev, trail));
+  return svn_fs_base__dag_get_node (node_p, fs, root_id, trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_txn_root (dag_node_t **node_p,
-                      svn_fs_t *fs,
-                      const char *txn_id,
-                      trail_t *trail)
+svn_fs_base__dag_txn_root (dag_node_t **node_p,
+                           svn_fs_t *fs,
+                           const char *txn_id,
+                           trail_t *trail)
 {
   const svn_fs_id_t *root_id, *ignored;
-  
-  SVN_ERR (svn_fs__get_txn_ids (&root_id, &ignored, fs, txn_id, trail));
-  return svn_fs__dag_get_node (node_p, fs, root_id, trail);
+
+  SVN_ERR (svn_fs_base__get_txn_ids (&root_id, &ignored, fs, txn_id, trail));
+  return svn_fs_base__dag_get_node (node_p, fs, root_id, trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_txn_base_root (dag_node_t **node_p,
-                           svn_fs_t *fs,
-                           const char *txn_id,
-                           trail_t *trail)
+svn_fs_base__dag_txn_base_root (dag_node_t **node_p,
+                                svn_fs_t *fs,
+                                const char *txn_id,
+                                trail_t *trail)
 {
   const svn_fs_id_t *base_root_id, *ignored;
-  
-  SVN_ERR (svn_fs__get_txn_ids (&ignored, &base_root_id, fs, txn_id, trail));
-  return svn_fs__dag_get_node (node_p, fs, base_root_id, trail);
+
+  SVN_ERR (svn_fs_base__get_txn_ids (&ignored, &base_root_id, fs, txn_id,
+                                     trail));
+  return svn_fs_base__dag_get_node (node_p, fs, base_root_id, trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_clone_child (dag_node_t **child_p,
-                         dag_node_t *parent,
-                         const char *parent_path,
-                         const char *name,
-                         const char *copy_id,
-                         const char *txn_id,
-                         trail_t *trail)
+svn_fs_base__dag_clone_child (dag_node_t **child_p,
+                              dag_node_t *parent,
+                              const char *parent_path,
+                              const char *name,
+                              const char *copy_id,
+                              const char *txn_id,
+                              trail_t *trail)
 {
   dag_node_t *cur_entry; /* parent's current entry named NAME */
   const svn_fs_id_t *new_node_id; /* node id we'll put into NEW_NODE */
-  svn_fs_t *fs = svn_fs__dag_get_fs (parent);
+  svn_fs_t *fs = svn_fs_base__dag_get_fs (parent);
 
   /* First check that the parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
-    return svn_error_createf 
+  if (! svn_fs_base__dag_check_mutable (parent, txn_id))
+    return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to clone child of non-mutable node");
 
   /* Make sure that NAME is a single path component. */
   if (! svn_path_is_single_path_component (name))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
        "Attempted to make a child clone with an illegal name '%s'", name);
 
   /* Find the node named NAME in PARENT's entries list if it exists. */
-  SVN_ERR (svn_fs__dag_open (&cur_entry, parent, name, trail));
+  SVN_ERR (svn_fs_base__dag_open (&cur_entry, parent, name, trail));
 
   /* Check for mutability in the node we found.  If it's mutable, we
      don't need to clone it. */
-  if (svn_fs__dag_check_mutable (cur_entry, txn_id))
+  if (svn_fs_base__dag_check_mutable (cur_entry, txn_id))
     {
       /* This has already been cloned */
       new_node_id = cur_entry->id;
     }
   else
     {
-      svn_fs__node_revision_t *noderev;
-      
+      node_revision_t *noderev;
+
       /* Go get a fresh NODE-REVISION for current child node. */
       SVN_ERR (get_node_revision (&noderev, cur_entry, trail));
-      
+
       /* Do the clone thingy here. */
       noderev->predecessor_id = svn_fs__id_copy (cur_entry->id, trail->pool);
       if (noderev->predecessor_count != -1)
         noderev->predecessor_count++;
       noderev->created_path = svn_path_join (parent_path, name, trail->pool);
-      SVN_ERR (svn_fs__create_successor (&new_node_id, fs, cur_entry->id, 
-                                         noderev, copy_id, txn_id, trail));
-      
+      SVN_ERR (svn_fs_base__create_successor (&new_node_id, fs, cur_entry->id,
+                                              noderev, copy_id, txn_id,
+                                              trail));
+
       /* Replace the ID in the parent's ENTRY list with the ID which
          refers to the mutable clone of this child. */
       SVN_ERR (set_entry (parent, name, new_node_id, txn_id, trail));
     }
 
   /* Initialize the youngster. */
-  return svn_fs__dag_get_node (child_p, fs, new_node_id, trail);
+  return svn_fs_base__dag_get_node (child_p, fs, new_node_id, trail);
 }
 
 
 
 svn_error_t *
-svn_fs__dag_clone_root (dag_node_t **root_p,
-                        svn_fs_t *fs,
-                        const char *txn_id,
-                        trail_t *trail)
+svn_fs_base__dag_clone_root (dag_node_t **root_p,
+                             svn_fs_t *fs,
+                             const char *txn_id,
+                             trail_t *trail)
 {
   const svn_fs_id_t *base_root_id, *root_id;
-  svn_fs__node_revision_t *noderev;
-  
+  node_revision_t *noderev;
+
   /* Get the node ID's of the root directories of the transaction and
      its base revision.  */
-  SVN_ERR (svn_fs__get_txn_ids (&root_id, &base_root_id, fs, txn_id, trail));
+  SVN_ERR (svn_fs_base__get_txn_ids (&root_id, &base_root_id, fs, txn_id,
+                                     trail));
 
   /* Oh, give me a clone...
      (If they're the same, we haven't cloned the transaction's root
      directory yet.)  */
-  if (svn_fs__id_eq (root_id, base_root_id)) 
+  if (svn_fs__id_eq (root_id, base_root_id))
     {
+      const char *base_copy_id = svn_fs__id_copy_id (base_root_id);
+
       /* Of my own flesh and bone...
          (Get the NODE-REVISION for the base node, and then write
          it back out as the clone.) */
-      SVN_ERR (svn_fs__bdb_get_node_revision (&noderev, fs, 
-                                              base_root_id, trail));
+      SVN_ERR (svn_fs_bdb__get_node_revision (&noderev, fs, base_root_id,
+                                              trail));
 
       /* Store it. */
       /* ### todo: Does it even makes sense to have a different copy id for
@@ -897,20 +910,19 @@
       noderev->predecessor_id = svn_fs__id_copy (base_root_id, trail->pool);
       if (noderev->predecessor_count != -1)
         noderev->predecessor_count++;
-      SVN_ERR (svn_fs__create_successor (&root_id, fs, base_root_id, 
-                                         noderev, 
-                                         svn_fs__id_copy_id (base_root_id),
-                                         txn_id, trail));
+      SVN_ERR (svn_fs_base__create_successor (&root_id, fs, base_root_id,
+                                              noderev, base_copy_id,
+                                              txn_id, trail));
 
       /* ... And when it is grown
        *      Then my own little clone
        *        Will be of the opposite sex!
        */
-      SVN_ERR (svn_fs__set_txn_root (fs, txn_id, root_id, trail));
+      SVN_ERR (svn_fs_base__set_txn_root (fs, txn_id, root_id, trail));
     }
 
   /* One way or another, root_id now identifies a cloned root node. */
-  SVN_ERR (svn_fs__dag_get_node (root_p, fs, root_id, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (root_p, fs, root_id, trail));
 
   /*
    * (Sung to the tune of "Home, Home on the Range", with thanks to
@@ -924,40 +936,40 @@
 /* Delete the directory entry named NAME from PARENT, as part of
    TRAIL.  PARENT must be mutable.  NAME must be a single path
    component.  If REQUIRE_EMPTY is true and the node being deleted is
-   a directory, it must be empty.  
+   a directory, it must be empty.
 
    If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
    PARENT.  */
 svn_error_t *
-svn_fs__dag_delete (dag_node_t *parent,
-                    const char *name,
-                    const char *txn_id,
-                    trail_t *trail)
+svn_fs_base__dag_delete (dag_node_t *parent,
+                         const char *name,
+                         const char *txn_id,
+                         trail_t *trail)
 {
-  svn_fs__node_revision_t *parent_noderev;
+  node_revision_t *parent_noderev;
   const char *rep_key, *mutable_rep_key;
   apr_hash_t *entries = NULL;
   skel_t *entries_skel;
   svn_fs_t *fs = parent->fs;
   svn_string_t str;
   svn_fs_id_t *id = NULL;
-  dag_node_t *node; 
+  dag_node_t *node;
 
   /* Make sure parent is a directory. */
   if (parent->kind != svn_node_dir)
     return svn_error_createf
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
-       "Attempted to delete entry '%s' from *non*-directory node", name);    
+       "Attempted to delete entry '%s' from *non*-directory node", name);
 
   /* Make sure parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
+  if (! svn_fs_base__dag_check_mutable (parent, txn_id))
     return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to delete entry '%s' from immutable directory node", name);
 
   /* Make sure that NAME is a single path component. */
   if (! svn_path_is_single_path_component (name))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
        "Attempted to delete a node with an illegal name '%s'", name);
 
@@ -971,18 +983,18 @@
      no data, and no data means no entries...there's nothing here to
      delete! */
   if (! rep_key)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NO_SUCH_ENTRY, NULL,
        "Delete failed--directory has no entry '%s'", name);
 
   /* Ensure we have a key to a mutable representation of the entries
      list.  We'll have to update the NODE-REVISION if it points to an
      immutable version.  */
-  SVN_ERR (svn_fs__get_mutable_rep (&mutable_rep_key, rep_key,
-                                    fs, txn_id, trail));
-  if (! svn_fs__same_keys (mutable_rep_key, rep_key))
+  SVN_ERR (svn_fs_base__get_mutable_rep (&mutable_rep_key, rep_key,
+                                         fs, txn_id, trail));
+  if (! svn_fs_base__same_keys (mutable_rep_key, rep_key))
     {
-      svn_fs__node_revision_t *new_noderev =
+      node_revision_t *new_noderev =
         copy_node_revision (parent_noderev, trail->pool);
       new_noderev->data_key = mutable_rep_key;
       SVN_ERR (set_node_revision (parent, new_noderev, trail));
@@ -991,12 +1003,13 @@
   /* Read the representation, then use it to get the string that holds
      the entries list.  Parse that list into a skel, and parse *that*
      into a hash. */
-  
-  SVN_ERR (svn_fs__rep_contents (&str, fs, rep_key, trail));
-  entries_skel = svn_fs__parse_skel (str.data, str.len, trail->pool);
+
+  SVN_ERR (svn_fs_base__rep_contents (&str, fs, rep_key, trail));
+  entries_skel = svn_fs_base__parse_skel (str.data, str.len, trail->pool);
   if (entries_skel)
-    SVN_ERR (svn_fs__parse_entries_skel (&entries, entries_skel, trail->pool));
-  
+    SVN_ERR (svn_fs_base__parse_entries_skel (&entries, entries_skel,
+                                              trail->pool));
+
   /* Find NAME in the ENTRIES skel.  */
   if (entries)
     id = apr_hash_get (entries, name, APR_HASH_KEY_STRING);
@@ -1005,17 +1018,17 @@
      ENTRIES, perhaps because ID just isn't in the existing ENTRIES
      ... it doesn't matter), return an error.  */
   if (! id)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NO_SUCH_ENTRY, NULL,
        "Delete failed--directory has no entry '%s'", name);
 
   /* Use the ID of this ENTRY to get the entry's node.  */
-  SVN_ERR (svn_fs__dag_get_node (&node, svn_fs__dag_get_fs (parent), 
-                                 id, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&node, svn_fs_base__dag_get_fs (parent),
+                                      id, trail));
 
   /* If mutable, remove it and any mutable children from db. */
-  SVN_ERR (svn_fs__dag_delete_if_mutable (parent->fs, id, txn_id, trail));
-        
+  SVN_ERR (svn_fs_base__dag_delete_if_mutable (parent->fs, id, txn_id, trail));
+
   /* Remove this entry from its parent's entries list. */
   apr_hash_set (entries, name, APR_HASH_KEY_STRING, NULL);
 
@@ -1024,77 +1037,77 @@
     svn_stream_t *ws;
     svn_stringbuf_t *unparsed_entries;
     apr_size_t len;
-    
-    SVN_ERR (svn_fs__unparse_entries_skel (&entries_skel, entries, 
-                                           trail->pool));
-    unparsed_entries = svn_fs__unparse_skel (entries_skel, trail->pool);
-    SVN_ERR (svn_fs__rep_contents_write_stream (&ws, fs, mutable_rep_key,
-                                                txn_id, TRUE, trail,
+
+    SVN_ERR (svn_fs_base__unparse_entries_skel (&entries_skel, entries,
                                                 trail->pool));
+    unparsed_entries = svn_fs_base__unparse_skel (entries_skel, trail->pool);
+    SVN_ERR (svn_fs_base__rep_contents_write_stream (&ws, fs, mutable_rep_key,
+                                                     txn_id, TRUE, trail,
+                                                     trail->pool));
     len = unparsed_entries->len;
     SVN_ERR (svn_stream_write (ws, unparsed_entries->data, &len));
     SVN_ERR (svn_stream_close (ws));
   }
-    
+
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_remove_node (svn_fs_t *fs,
-                         const svn_fs_id_t *id,
-                         const char *txn_id,
-                         trail_t *trail)
+svn_fs_base__dag_remove_node (svn_fs_t *fs,
+                              const svn_fs_id_t *id,
+                              const char *txn_id,
+                              trail_t *trail)
 {
   dag_node_t *node;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Fetch the node. */
-  SVN_ERR (svn_fs__dag_get_node (&node, fs, id, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&node, fs, id, trail));
 
   /* If immutable, do nothing and return immediately. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
-    return svn_error_createf (SVN_ERR_FS_NOT_MUTABLE, NULL, 
+  if (! svn_fs_base__dag_check_mutable (node, txn_id))
+    return svn_error_createf (SVN_ERR_FS_NOT_MUTABLE, NULL,
                               "Attempted removal of immutable node");
 
   /* Get a fresh node-revision. */
-  SVN_ERR (svn_fs__bdb_get_node_revision (&noderev, fs, id, trail));
+  SVN_ERR (svn_fs_bdb__get_node_revision (&noderev, fs, id, trail));
 
   /* Delete any mutable property representation. */
   if (noderev->prop_key)
-    SVN_ERR (svn_fs__delete_rep_if_mutable (fs, noderev->prop_key,
-                                            txn_id, trail));
-  
+    SVN_ERR (svn_fs_base__delete_rep_if_mutable (fs, noderev->prop_key,
+                                                 txn_id, trail));
+
   /* Delete any mutable data representation. */
   if (noderev->data_key)
-    SVN_ERR (svn_fs__delete_rep_if_mutable (fs, noderev->data_key, 
-                                            txn_id, trail));
+    SVN_ERR (svn_fs_base__delete_rep_if_mutable (fs, noderev->data_key,
+                                                 txn_id, trail));
 
   /* Delete any mutable edit representation (files only). */
   if (noderev->edit_key)
-    SVN_ERR (svn_fs__delete_rep_if_mutable (fs, noderev->edit_key, 
-                                            txn_id, trail));
+    SVN_ERR (svn_fs_base__delete_rep_if_mutable (fs, noderev->edit_key,
+                                                 txn_id, trail));
 
   /* Delete the node revision itself. */
-  SVN_ERR (svn_fs__delete_node_revision (fs, id, trail));
-  
+  SVN_ERR (svn_fs_base__delete_node_revision (fs, id, trail));
+
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_delete_if_mutable (svn_fs_t *fs,
-                               const svn_fs_id_t *id,
-                               const char *txn_id,
-                               trail_t *trail)
+svn_fs_base__dag_delete_if_mutable (svn_fs_t *fs,
+                                    const svn_fs_id_t *id,
+                                    const char *txn_id,
+                                    trail_t *trail)
 {
   dag_node_t *node;
 
   /* Get the node. */
-  SVN_ERR (svn_fs__dag_get_node (&node, fs, id, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&node, fs, id, trail));
 
   /* If immutable, do nothing and return immediately. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_base__dag_check_mutable (node, txn_id))
     return SVN_NO_ERROR;
 
   /* Else it's mutable.  Recurse on directories... */
@@ -1105,39 +1118,39 @@
       apr_pool_t *pool = trail->pool;
 
       /* Loop over hash entries */
-      SVN_ERR (svn_fs__dag_dir_entries (&entries, node, trail));
+      SVN_ERR (svn_fs_base__dag_dir_entries (&entries, node, trail));
       if (entries)
         {
-          for (hi = apr_hash_first (pool, entries); 
-               hi; 
+          for (hi = apr_hash_first (pool, entries);
+               hi;
                hi = apr_hash_next (hi))
             {
               void *val;
               svn_fs_dirent_t *dirent;
-              
+
               apr_hash_this (hi, NULL, NULL, &val);
               dirent = val;
-              SVN_ERR (svn_fs__dag_delete_if_mutable (fs, dirent->id, 
-                                                      txn_id, trail));
+              SVN_ERR (svn_fs_base__dag_delete_if_mutable (fs, dirent->id,
+                                                           txn_id, trail));
             }
         }
     }
 
   /* ... then delete the node itself, after deleting any mutable
      representations and strings it points to. */
-  SVN_ERR (svn_fs__dag_remove_node (fs, id, txn_id, trail));
-  
+  SVN_ERR (svn_fs_base__dag_remove_node (fs, id, txn_id, trail));
+
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_make_file (dag_node_t **child_p,
-                       dag_node_t *parent,
-                       const char *parent_path,
-                       const char *name,
-                       const char *txn_id, 
-                       trail_t *trail)
+svn_fs_base__dag_make_file (dag_node_t **child_p,
+                            dag_node_t *parent,
+                            const char *parent_path,
+                            const char *name,
+                            const char *txn_id,
+                            trail_t *trail)
 {
   /* Call our little helper function */
   return make_entry (child_p, parent, parent_path, name, FALSE, txn_id, trail);
@@ -1145,12 +1158,12 @@
 
 
 svn_error_t *
-svn_fs__dag_make_dir (dag_node_t **child_p,
-                      dag_node_t *parent,
-                      const char *parent_path,
-                      const char *name,
-                      const char *txn_id, 
-                      trail_t *trail)
+svn_fs_base__dag_make_dir (dag_node_t **child_p,
+                           dag_node_t *parent,
+                           const char *parent_path,
+                           const char *name,
+                           const char *txn_id,
+                           trail_t *trail)
 {
   /* Call our little helper function */
   return make_entry (child_p, parent, parent_path, name, TRUE, txn_id, trail);
@@ -1158,19 +1171,19 @@
 
 
 svn_error_t *
-svn_fs__dag_get_contents (svn_stream_t **contents,
-                          dag_node_t *file,
-                          apr_pool_t *pool,
-                          trail_t *trail)
-{ 
-  svn_fs__node_revision_t *noderev;
+svn_fs_base__dag_get_contents (svn_stream_t **contents,
+                               dag_node_t *file,
+                               apr_pool_t *pool,
+                               trail_t *trail)
+{
+  node_revision_t *noderev;
 
   /* Make sure our node is a file. */
   if (file->kind != svn_node_file)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FILE, NULL,
        "Attempted to get textual contents of a *non*-file node");
-  
+
   /* Go get a fresh node-revision for FILE. */
   SVN_ERR (get_node_revision (&noderev, file, trail));
 
@@ -1179,36 +1192,36 @@
      the stream that we're not providing it a trail that lives across
      reads.  This means the stream will do each read in a one-off,
      temporary trail.  */
-  SVN_ERR (svn_fs__rep_contents_read_stream (contents, file->fs,
-                                             noderev->data_key,
-                                             FALSE, trail, pool));
+  SVN_ERR (svn_fs_base__rep_contents_read_stream (contents, file->fs,
+                                                  noderev->data_key,
+                                                  FALSE, trail, pool));
 
   /* Note that we're not registering any `close' func, because there's
      nothing to cleanup outside of our trail.  When the trail is
-     freed, the stream/baton will be too. */ 
+     freed, the stream/baton will be too. */
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_file_length (svn_filesize_t *length,
-                         dag_node_t *file,
-                         trail_t *trail)
-{ 
-  svn_fs__node_revision_t *noderev;
+svn_fs_base__dag_file_length (svn_filesize_t *length,
+                              dag_node_t *file,
+                              trail_t *trail)
+{
+  node_revision_t *noderev;
 
   /* Make sure our node is a file. */
   if (file->kind != svn_node_file)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FILE, NULL,
        "Attempted to get length of a *non*-file node");
 
   /* Go get a fresh node-revision for FILE, and . */
   SVN_ERR (get_node_revision (&noderev, file, trail));
   if (noderev->data_key)
-    SVN_ERR (svn_fs__rep_contents_size (length, file->fs,
-                                        noderev->data_key, trail));
+    SVN_ERR (svn_fs_base__rep_contents_size (length, file->fs,
+                                             noderev->data_key, trail));
   else
     *length = 0;
 
@@ -1217,21 +1230,21 @@
 
 
 svn_error_t *
-svn_fs__dag_file_checksum (unsigned char digest[],
-                           dag_node_t *file,
-                           trail_t *trail)
-{ 
-  svn_fs__node_revision_t *noderev;
+svn_fs_base__dag_file_checksum (unsigned char digest[],
+                                dag_node_t *file,
+                                trail_t *trail)
+{
+  node_revision_t *noderev;
 
   if (file->kind != svn_node_file)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FILE, NULL,
        "Attempted to get checksum of a *non*-file node");
 
   SVN_ERR (get_node_revision (&noderev, file, trail));
   if (noderev->data_key)
-    SVN_ERR (svn_fs__rep_contents_checksum (digest, file->fs,
-                                            noderev->data_key, trail));
+    SVN_ERR (svn_fs_base__rep_contents_checksum (digest, file->fs,
+                                                 noderev->data_key, trail));
   else
     memset (digest, 0, APR_MD5_DIGESTSIZE);
 
@@ -1240,26 +1253,26 @@
 
 
 svn_error_t *
-svn_fs__dag_get_edit_stream (svn_stream_t **contents,
-                             dag_node_t *file,
-                             apr_pool_t *pool,
-                             const char *txn_id,
-                             trail_t *trail)
+svn_fs_base__dag_get_edit_stream (svn_stream_t **contents,
+                                  dag_node_t *file,
+                                  apr_pool_t *pool,
+                                  const char *txn_id,
+                                  trail_t *trail)
 {
   svn_fs_t *fs = file->fs;   /* just for nicer indentation */
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   const char *mutable_rep_key;
   svn_stream_t *ws;
 
   /* Make sure our node is a file. */
   if (file->kind != svn_node_file)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FILE, NULL,
        "Attempted to set textual contents of a *non*-file node");
-  
+
   /* Make sure our node is mutable. */
-  if (! svn_fs__dag_check_mutable (file, txn_id))
-    return svn_error_createf 
+  if (! svn_fs_base__dag_check_mutable (file, txn_id))
+    return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to set textual contents of an immutable node");
 
@@ -1269,21 +1282,22 @@
   /* If this node already has an EDIT-DATA-KEY, destroy the data
      associated with that key.  */
   if (noderev->edit_key)
-    SVN_ERR (svn_fs__delete_rep_if_mutable (fs, noderev->edit_key,
-                                            txn_id, trail));
+    SVN_ERR (svn_fs_base__delete_rep_if_mutable (fs, noderev->edit_key,
+                                                 txn_id, trail));
 
   /* Now, let's ensure that we have a new EDIT-DATA-KEY available for
      use. */
-  SVN_ERR (svn_fs__get_mutable_rep (&mutable_rep_key, NULL, fs,
-                                    txn_id, trail));
-  
+  SVN_ERR (svn_fs_base__get_mutable_rep (&mutable_rep_key, NULL, fs,
+                                         txn_id, trail));
+
   /* We made a new rep, so update the node revision. */
   noderev->edit_key = mutable_rep_key;
-  SVN_ERR (svn_fs__bdb_put_node_revision (fs, file->id, noderev, trail));
+  SVN_ERR (svn_fs_bdb__put_node_revision (fs, file->id, noderev, trail));
 
   /* Return a writable stream with which to set new contents. */
-  SVN_ERR (svn_fs__rep_contents_write_stream (&ws, fs, mutable_rep_key,
-                                              txn_id, FALSE, trail, pool));
+  SVN_ERR (svn_fs_base__rep_contents_write_stream (&ws, fs, mutable_rep_key,
+                                                   txn_id, FALSE, trail,
+                                                   pool));
   *contents = ws;
 
   return SVN_NO_ERROR;
@@ -1292,24 +1306,24 @@
 
 
 svn_error_t *
-svn_fs__dag_finalize_edits (dag_node_t *file,
-                            const char *checksum,
-                            const char *txn_id, 
-                            trail_t *trail)
+svn_fs_base__dag_finalize_edits (dag_node_t *file,
+                                 const char *checksum,
+                                 const char *txn_id,
+                                 trail_t *trail)
 {
   svn_fs_t *fs = file->fs;   /* just for nicer indentation */
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   const char *old_data_key;
-  
+
   /* Make sure our node is a file. */
   if (file->kind != svn_node_file)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FILE, NULL,
        "Attempted to set textual contents of a *non*-file node");
-  
+
   /* Make sure our node is mutable. */
-  if (! svn_fs__dag_check_mutable (file, txn_id))
-    return svn_error_createf 
+  if (! svn_fs_base__dag_check_mutable (file, txn_id))
+    return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to set textual contents of an immutable node");
 
@@ -1325,13 +1339,13 @@
       unsigned char digest[APR_MD5_DIGESTSIZE];
       const char *hex;
 
-      SVN_ERR (svn_fs__rep_contents_checksum
+      SVN_ERR (svn_fs_base__rep_contents_checksum
                (digest, fs, noderev->edit_key, trail));
 
       hex = svn_md5_digest_to_cstring (digest, trail->pool);
       if (strcmp (checksum, hex) != 0)
         return svn_error_createf
-          (SVN_ERR_CHECKSUM_MISMATCH, 
+          (SVN_ERR_CHECKSUM_MISMATCH,
            NULL,
            "Checksum mismatch, rep '%s':\n"
            "   expected:  %s\n"
@@ -1346,12 +1360,13 @@
   old_data_key = noderev->data_key;
   noderev->data_key = noderev->edit_key;
   noderev->edit_key = NULL;
-  SVN_ERR (svn_fs__bdb_put_node_revision (fs, file->id, noderev, trail));
-  
+  SVN_ERR (svn_fs_bdb__put_node_revision (fs, file->id, noderev, trail));
+
   /* Only *now* can we safely destroy the old representation (if it
      even existed in the first place). */
   if (old_data_key)
-    SVN_ERR (svn_fs__delete_rep_if_mutable (fs, old_data_key, txn_id, trail));
+    SVN_ERR (svn_fs_base__delete_rep_if_mutable (fs, old_data_key, txn_id,
+                                                 trail));
 
   return SVN_NO_ERROR;
 }
@@ -1359,8 +1374,8 @@
 
 
 dag_node_t *
-svn_fs__dag_dup (dag_node_t *node,
-                 apr_pool_t *pool)
+svn_fs_base__dag_dup (dag_node_t *node,
+                      apr_pool_t *pool)
 {
   /* Allocate our new node. */
   dag_node_t *new_node = apr_pcalloc (pool, sizeof (*new_node));
@@ -1379,93 +1394,94 @@
 
 
 svn_error_t *
-svn_fs__dag_open (dag_node_t **child_p,
-                  dag_node_t *parent,
-                  const char *name,
-                  trail_t *trail)
+svn_fs_base__dag_open (dag_node_t **child_p,
+                       dag_node_t *parent,
+                       const char *name,
+                       trail_t *trail)
 {
   const svn_fs_id_t *node_id;
 
   /* Ensure that NAME exists in PARENT's entry list. */
   SVN_ERR (dir_entry_id_from_node (&node_id, parent, name, trail));
   if (! node_id)
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_FOUND, NULL,
        "Attempted to open non-existant child node '%s'", name);
-  
+
   /* Make sure that NAME is a single path component. */
   if (! svn_path_is_single_path_component (name))
-    return svn_error_createf 
+    return svn_error_createf
       (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
        "Attempted to open node with an illegal name '%s'", name);
 
   /* Now get the node that was requested. */
-  return svn_fs__dag_get_node (child_p, svn_fs__dag_get_fs (parent),
-                               node_id, trail);
+  return svn_fs_base__dag_get_node (child_p, svn_fs_base__dag_get_fs (parent),
+                                    node_id, trail);
 }
 
 
 svn_error_t *
-svn_fs__dag_copy (dag_node_t *to_node,
-                  const char *entry,
-                  dag_node_t *from_node,
-                  svn_boolean_t preserve_history,
-                  svn_revnum_t from_rev,
-                  const char *from_path,
-                  const char *txn_id, 
-                  trail_t *trail)
+svn_fs_base__dag_copy (dag_node_t *to_node,
+                       const char *entry,
+                       dag_node_t *from_node,
+                       svn_boolean_t preserve_history,
+                       svn_revnum_t from_rev,
+                       const char *from_path,
+                       const char *txn_id,
+                       trail_t *trail)
 {
   const svn_fs_id_t *id;
-  
+
   if (preserve_history)
     {
-      svn_fs__node_revision_t *from_noderev, *to_noderev;
+      node_revision_t *from_noderev, *to_noderev;
       const char *copy_id;
-      svn_fs_t *fs = svn_fs__dag_get_fs (from_node);
-      const svn_fs_id_t *src_id = svn_fs__dag_get_id (from_node);
+      svn_fs_t *fs = svn_fs_base__dag_get_fs (from_node);
+      const svn_fs_id_t *src_id = svn_fs_base__dag_get_id (from_node);
       const char *from_txn_id = NULL;
 
       /* Make a copy of the original node revision. */
       SVN_ERR (get_node_revision (&from_noderev, from_node, trail));
       to_noderev = copy_node_revision (from_noderev, trail->pool);
-      
+
       /* Reserve a copy ID for this new copy. */
-      SVN_ERR (svn_fs__bdb_reserve_copy_id (&copy_id, fs, trail));
+      SVN_ERR (svn_fs_bdb__reserve_copy_id (&copy_id, fs, trail));
 
       /* Create a successor with its predecessor pointing at the copy
          source. */
       to_noderev->predecessor_id = svn_fs__id_copy (src_id, trail->pool);
       if (to_noderev->predecessor_count != -1)
         to_noderev->predecessor_count++;
-      to_noderev->created_path = 
-        svn_path_join (svn_fs__dag_get_created_path (to_node), entry, 
+      to_noderev->created_path =
+        svn_path_join (svn_fs_base__dag_get_created_path (to_node), entry,
                        trail->pool);
-      SVN_ERR (svn_fs__create_successor (&id, fs, src_id, to_noderev,
-                                         copy_id, txn_id, trail));
+      SVN_ERR (svn_fs_base__create_successor (&id, fs, src_id, to_noderev,
+                                              copy_id, txn_id, trail));
 
       /* Translate FROM_REV into a transaction ID. */
-      SVN_ERR (svn_fs__rev_get_txn_id (&from_txn_id, fs, from_rev, trail));
+      SVN_ERR (svn_fs_base__rev_get_txn_id (&from_txn_id, fs, from_rev,
+                                            trail));
 
       /* Now that we've done the copy, we need to add the information
          about the copy to the `copies' table, using the COPY_ID we
          reserved above.  */
-      SVN_ERR (svn_fs__bdb_create_copy 
-               (fs, copy_id, 
-                svn_fs__canonicalize_abspath (from_path, trail->pool), 
-                from_txn_id, id, svn_fs__copy_kind_real, trail));
+      SVN_ERR (svn_fs_bdb__create_copy
+               (fs, copy_id,
+                svn_fs__canonicalize_abspath (from_path, trail->pool),
+                from_txn_id, id, copy_kind_real, trail));
 
       /* Finally, add the COPY_ID to the transaction's list of copies
          so that, if this transaction is aborted, the `copies' table
          entry we added above will be cleaned up. */
-      SVN_ERR (svn_fs__add_txn_copy (fs, txn_id, copy_id, trail));
+      SVN_ERR (svn_fs_base__add_txn_copy (fs, txn_id, copy_id, trail));
     }
   else  /* don't preserve history */
     {
-      id = svn_fs__dag_get_id (from_node);
+      id = svn_fs_base__dag_get_id (from_node);
     }
-      
+
   /* Set the entry in to_node to the new id. */
-  SVN_ERR (svn_fs__dag_set_entry (to_node, entry, id, txn_id, trail));
+  SVN_ERR (svn_fs_base__dag_set_entry (to_node, entry, id, txn_id, trail));
 
   return SVN_NO_ERROR;
 }
@@ -1475,13 +1491,13 @@
 /*** Deltification ***/
 
 svn_error_t *
-svn_fs__dag_deltify (dag_node_t *target,
-                     dag_node_t *source,
-                     svn_boolean_t props_only,
-                     trail_t *trail)
+svn_fs_base__dag_deltify (dag_node_t *target,
+                          dag_node_t *source,
+                          svn_boolean_t props_only,
+                          trail_t *trail)
 {
-  svn_fs__node_revision_t *source_nr, *target_nr;
-  svn_fs_t *fs = svn_fs__dag_get_fs (target);
+  node_revision_t *source_nr, *target_nr;
+  svn_fs_t *fs = svn_fs_base__dag_get_fs (target);
 
   /* Get node revisions for the two nodes.  */
   SVN_ERR (get_node_revision (&target_nr, target, trail));
@@ -1489,21 +1505,21 @@
 
   /* If TARGET and SOURCE both have properties, and are not sharing a
      property key, deltify TARGET's properties.  */
-  if (target_nr->prop_key 
+  if (target_nr->prop_key
       && source_nr->prop_key
       && (strcmp (target_nr->prop_key, source_nr->prop_key)))
-    SVN_ERR (svn_fs__rep_deltify (fs, target_nr->prop_key, 
-                                  source_nr->prop_key, trail));
+    SVN_ERR (svn_fs_base__rep_deltify (fs, target_nr->prop_key,
+                                       source_nr->prop_key, trail));
 
   /* If we are not only attending to properties, and if TARGET and
      SOURCE both have data, and are not sharing a data key, deltify
      TARGET's data.  */
   if ((! props_only)
-      && target_nr->data_key 
-      && source_nr->data_key 
-      && (strcmp (target_nr->data_key, source_nr->data_key)))     
-   SVN_ERR (svn_fs__rep_deltify (fs, target_nr->data_key, 
-                                 source_nr->data_key, trail));
+      && target_nr->data_key
+      && source_nr->data_key
+      && (strcmp (target_nr->data_key, source_nr->data_key)))
+   SVN_ERR (svn_fs_base__rep_deltify (fs, target_nr->data_key,
+                                      source_nr->data_key, trail));
 
   return SVN_NO_ERROR;
 }
@@ -1514,29 +1530,29 @@
 /*** Committing ***/
 
 svn_error_t *
-svn_fs__dag_commit_txn (svn_revnum_t *new_rev,
-                        svn_fs_t *fs,
-                        const char *txn_id,
-                        trail_t *trail)
+svn_fs_base__dag_commit_txn (svn_revnum_t *new_rev,
+                             svn_fs_t *fs,
+                             const char *txn_id,
+                             trail_t *trail)
 {
-  svn_fs__revision_t revision;
+  revision_t revision;
   svn_string_t date;
 
   /* Add new revision entry to `revisions' table. */
   revision.txn_id = txn_id;
   if (new_rev)
     *new_rev = SVN_INVALID_REVNUM;
-  SVN_ERR (svn_fs__bdb_put_rev (new_rev, fs, &revision, trail));
+  SVN_ERR (svn_fs_bdb__put_rev (new_rev, fs, &revision, trail));
 
   /* Promote the unfinished transaction to a committed one. */
-  SVN_ERR (svn_fs__txn_make_committed (fs, txn_id, *new_rev, trail));
+  SVN_ERR (svn_fs_base__txn_make_committed (fs, txn_id, *new_rev, trail));
 
   /* Set a date on the commit.  We wait until now to fetch the date,
      so it's definitely newer than any previous revision's date. */
   date.data = svn_time_to_cstring (apr_time_now(), trail->pool);
   date.len = strlen (date.data);
-  SVN_ERR (svn_fs__set_rev_prop (fs, *new_rev, SVN_PROP_REVISION_DATE, 
-                                 &date, trail));
+  SVN_ERR (svn_fs_base__set_rev_prop (fs, *new_rev, SVN_PROP_REVISION_DATE,
+                                      &date, trail));
 
   return SVN_NO_ERROR;
 }
@@ -1546,13 +1562,13 @@
 /*** Comparison. ***/
 
 svn_error_t *
-svn_fs__things_different (svn_boolean_t *props_changed,
-                          svn_boolean_t *contents_changed,
-                          dag_node_t *node1,
-                          dag_node_t *node2,
-                          trail_t *trail)
+svn_fs_base__things_different (svn_boolean_t *props_changed,
+                               svn_boolean_t *contents_changed,
+                               dag_node_t *node1,
+                               dag_node_t *node2,
+                               trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev1, *noderev2;
+  node_revision_t *noderev1, *noderev2;
 
   /* If we have no place to store our results, don't bother doing
      anything. */
@@ -1565,14 +1581,14 @@
 
   /* Compare property keys. */
   if (props_changed != NULL)
-    *props_changed = (! svn_fs__same_keys (noderev1->prop_key, 
-                                           noderev2->prop_key));
+    *props_changed = (! svn_fs_base__same_keys (noderev1->prop_key,
+                                                noderev2->prop_key));
 
   /* Compare contents keys. */
   if (contents_changed != NULL)
-    *contents_changed = (! svn_fs__same_keys (noderev1->data_key, 
-                                              noderev2->data_key));
-  
+    *contents_changed = (! svn_fs_base__same_keys (noderev1->data_key,
+                                                   noderev2->data_key));
+
   return SVN_NO_ERROR;
 }
 
@@ -1600,7 +1616,7 @@
   if (node)
     {
       /* ... compare NODE's ID with the ID we're looking for. */
-      if (svn_fs__id_eq (b->node1_id, svn_fs__dag_get_id (node)))
+      if (svn_fs__id_eq (b->node1_id, svn_fs_base__dag_get_id (node)))
         b->is_ancestor = TRUE;
 
       /* Now, if we only are interested in parenthood, we don't care
@@ -1613,15 +1629,15 @@
 }
 
 svn_error_t *
-svn_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
-                         dag_node_t *node1,
-                         dag_node_t *node2,
-                         trail_t *trail)
+svn_fs_base__dag_is_ancestor (svn_boolean_t *is_ancestor,
+                              dag_node_t *node1,
+                              dag_node_t *node2,
+                              trail_t *trail)
 {
   struct is_ancestor_baton baton;
-  const svn_fs_id_t 
-    *id1 = svn_fs__dag_get_id (node1),
-    *id2 = svn_fs__dag_get_id (node2);
+  const svn_fs_id_t
+    *id1 = svn_fs_base__dag_get_id (node1),
+    *id2 = svn_fs_base__dag_get_id (node2);
 
   /* Pessimism. */
   *is_ancestor = FALSE;
@@ -1634,8 +1650,8 @@
   baton.need_parent = FALSE;
   baton.node1_id = id1;
 
-  SVN_ERR (svn_fs__dag_walk_predecessors (node2, is_ancestor_callback,
-                                          &baton, trail));
+  SVN_ERR (svn_fs_base__dag_walk_predecessors (node2, is_ancestor_callback,
+                                               &baton, trail));
   if (baton.is_ancestor)
     *is_ancestor = TRUE;
 
@@ -1644,15 +1660,15 @@
 
 
 svn_error_t *
-svn_fs__dag_is_parent (svn_boolean_t *is_parent,
-                       dag_node_t *node1,
-                       dag_node_t *node2,
-                       trail_t *trail)
+svn_fs_base__dag_is_parent (svn_boolean_t *is_parent,
+                            dag_node_t *node1,
+                            dag_node_t *node2,
+                            trail_t *trail)
 {
   struct is_ancestor_baton baton;
-  const svn_fs_id_t 
-    *id1 = svn_fs__dag_get_id (node1),
-    *id2 = svn_fs__dag_get_id (node2);
+  const svn_fs_id_t
+    *id1 = svn_fs_base__dag_get_id (node1),
+    *id2 = svn_fs_base__dag_get_id (node2);
 
   /* Pessimism. */
   *is_parent = FALSE;
@@ -1665,8 +1681,8 @@
   baton.need_parent = TRUE;
   baton.node1_id = id1;
 
-  SVN_ERR (svn_fs__dag_walk_predecessors (node2, is_ancestor_callback,
-                                          &baton, trail));
+  SVN_ERR (svn_fs_base__dag_walk_predecessors (node2, is_ancestor_callback,
+                                               &baton, trail));
   if (baton.is_ancestor)
     *is_parent = TRUE;
 

Modified: trunk/subversion/libsvn_fs_base/dag.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/dag.h	(original)
+++ trunk/subversion/libsvn_fs_base/dag.h	Thu Apr 29 18:17:29 2004
@@ -57,7 +57,7 @@
 
 /* Given a filesystem FS, which contains all the necessary tables,
    create the initial revision 0, and the initial root directory.  */
-svn_error_t *svn_fs__dag_init_fs (svn_fs_t *fs);
+svn_error_t *svn_fs_base__dag_init_fs (svn_fs_t *fs);
 
 
 
@@ -69,10 +69,10 @@
 /* Fill *NODE with a dag_node_t representing node revision ID in FS,
    allocating in TRAIL->pool.  */
 svn_error_t *
-svn_fs__dag_get_node (dag_node_t **node,
-                      svn_fs_t *fs,
-                      const svn_fs_id_t *id,
-                      trail_t *trail);
+svn_fs_base__dag_get_node (dag_node_t **node,
+                           svn_fs_t *fs,
+                           const svn_fs_id_t *id,
+                           trail_t *trail);
 
 
 /* Return a new dag_node_t object referring to the same node as NODE,
@@ -80,52 +80,52 @@
    trail that wants to refer to dag nodes that may have been allocated
    elsewhere, you can call this function, passing "trail->pool", and
    avoid inter-pool pointers.  */
-dag_node_t *svn_fs__dag_dup (dag_node_t *node,
-                             apr_pool_t *pool);
+dag_node_t *svn_fs_base__dag_dup (dag_node_t *node,
+                                  apr_pool_t *pool);
 
 
 /* Return the filesystem containing NODE.  */
-svn_fs_t *svn_fs__dag_get_fs (dag_node_t *node);
+svn_fs_t *svn_fs_base__dag_get_fs (dag_node_t *node);
 
 
 /* Set *REV to NODE's revision number, as part of TRAIL.  If NODE has
    never been committed as part of a revision, set *REV to
    SVN_INVALID_REVNUM.  */
-svn_error_t *svn_fs__dag_get_revision (svn_revnum_t *rev,
-                                       dag_node_t *node,
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_revision (svn_revnum_t *rev,
+                                            dag_node_t *node,
+                                            trail_t *trail);
 
 
 /* Return the node revision ID of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
-const svn_fs_id_t *svn_fs__dag_get_id (dag_node_t *node);
+const svn_fs_id_t *svn_fs_base__dag_get_id (dag_node_t *node);
 
 
 /* Return the created path of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
-const char *svn_fs__dag_get_created_path (dag_node_t *node);
+const char *svn_fs_base__dag_get_created_path (dag_node_t *node);
 
 
 /* Set *ID_P to the node revision ID of NODE's immediate predecessor,
    or NULL if NODE has no predecessor, as part of TRAIL.  The returned
    ID will be allocated in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
-                                             dag_node_t *node,
-                                             trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_predecessor_id (const svn_fs_id_t **id_p,
+                                                  dag_node_t *node,
+                                                  trail_t *trail);
 
 
 /* Set *COUNT to the number of predecessors NODE has (recursively), or
    -1 if not known, as part of TRAIL.  */
-svn_error_t *svn_fs__dag_get_predecessor_count (int *count,
-                                                dag_node_t *node,
-                                                trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_predecessor_count (int *count,
+                                                     dag_node_t *node,
+                                                     trail_t *trail);
 
 
-/* Callback function type for svn_fs__dag_walk_predecessors() */
-typedef svn_error_t *(*svn_fs__dag_pred_func_t) (void *baton,
-                                                 dag_node_t *node,
-                                                 svn_boolean_t *done,
-                                                 trail_t *trail);
+/* Callback function type for svn_fs_base__dag_walk_predecessors() */
+typedef svn_error_t *(*dag_pred_func_t) (void *baton,
+                                         dag_node_t *node,
+                                         svn_boolean_t *done,
+                                         trail_t *trail);
 
 /* Walk over NODE's predecessor list, calling CALLBACK (with its
    associated BATON) for each predecessor until the callback returns
@@ -136,18 +136,18 @@
    complete.
 
    Do all this as part of TRAIL.  */
-svn_error_t *svn_fs__dag_walk_predecessors (dag_node_t *node,
-                                            svn_fs__dag_pred_func_t callback,
-                                            void *baton,
-                                            trail_t *trail);
+svn_error_t *svn_fs_base__dag_walk_predecessors (dag_node_t *node,
+                                                 dag_pred_func_t callback,
+                                                 void *baton,
+                                                 trail_t *trail);
 
 /* Return non-zero IFF NODE is currently mutable under Subversion
    transaction TXN_ID.  */
-svn_boolean_t svn_fs__dag_check_mutable (dag_node_t *node,
-                                         const char *txn_id);
+svn_boolean_t svn_fs_base__dag_check_mutable (dag_node_t *node,
+                                              const char *txn_id);
 
 /* Return the node kind of NODE. */
-svn_node_kind_t svn_fs__dag_node_kind (dag_node_t *node);
+svn_node_kind_t svn_fs_base__dag_node_kind (dag_node_t *node);
 
 /* Set *PROPLIST_P to a PROPLIST hash representing the entire property
    list of NODE, as part of TRAIL.  The hash has const char * names
@@ -156,17 +156,17 @@
    If properties do not exist on NODE, *PROPLIST_P will be set to NULL.
 
    The returned property list is allocated in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_get_proplist (apr_hash_t **proplist_p,
-                                       dag_node_t *node,
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_proplist (apr_hash_t **proplist_p,
+                                            dag_node_t *node,
+                                            trail_t *trail);
 
 /* Set the property list of NODE to PROPLIST, as part of TRAIL.  The
    node being changed must be mutable.  TXN_ID is the Subversion
    transaction under which this occurs.  */
-svn_error_t *svn_fs__dag_set_proplist (dag_node_t *node,
-                                       apr_hash_t *proplist,
-                                       const char *txn_id, 
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__dag_set_proplist (dag_node_t *node,
+                                            apr_hash_t *proplist,
+                                            const char *txn_id,
+                                            trail_t *trail);
 
 
 
@@ -175,10 +175,10 @@
 
 /* Open the root of revision REV of filesystem FS, as part of TRAIL.
    Set *NODE_P to the new node.  Allocate the node in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_revision_root (dag_node_t **node_p,
-                                        svn_fs_t *fs,
-                                        svn_revnum_t rev,
-                                        trail_t *trail);
+svn_error_t *svn_fs_base__dag_revision_root (dag_node_t **node_p,
+                                             svn_fs_t *fs,
+                                             svn_revnum_t rev,
+                                             trail_t *trail);
 
 
 /* Set *NODE_P to the root of transaction TXN_ID in FS, as part
@@ -187,19 +187,19 @@
    Note that the root node of TXN_ID is not necessarily mutable.  If no
    changes have been made in the transaction, then it may share its
    root directory with its base revision.  To get a mutable root node
-   for a transaction, call svn_fs__dag_clone_root.  */
-svn_error_t *svn_fs__dag_txn_root (dag_node_t **node_p,
-                                   svn_fs_t *fs,
-                                   const char *txn_id,
-                                   trail_t *trail);
+   for a transaction, call svn_fs_base__dag_clone_root.  */
+svn_error_t *svn_fs_base__dag_txn_root (dag_node_t **node_p,
+                                        svn_fs_t *fs,
+                                        const char *txn_id,
+                                        trail_t *trail);
 
 
 /* Set *NODE_P to the base root of transaction TXN_ID in FS, as part
    of TRAIL.  Allocate the node in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_txn_base_root (dag_node_t **node_p,
-                                        svn_fs_t *fs,
-                                        const char *txn_id,
-                                        trail_t *trail);
+svn_error_t *svn_fs_base__dag_txn_base_root (dag_node_t **node_p,
+                                             svn_fs_t *fs,
+                                             const char *txn_id,
+                                             trail_t *trail);
 
 
 /* Clone the root directory of TXN_ID in FS, and update the
@@ -207,10 +207,10 @@
    done already.  In either case, set *ROOT_P to a reference to the
    root directory clone.  Do all this as part of TRAIL, and allocate
    *ROOT_P in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_clone_root (dag_node_t **root_p,
-                                     svn_fs_t *fs,
-                                     const char *txn_id,
-                                     trail_t *trail);
+svn_error_t *svn_fs_base__dag_clone_root (dag_node_t **root_p,
+                                          svn_fs_t *fs,
+                                          const char *txn_id,
+                                          trail_t *trail);
 
 
 /* Commit the transaction TXN_ID in FS, as part of TRAIL.  Store the
@@ -227,10 +227,10 @@
    Do any necessary temporary allocation in a subpool of TRAIL->pool.
    Consume temporary space at most proportional to the maximum depth
    of SVN_TXN's tree of mutable nodes.  */
-svn_error_t *svn_fs__dag_commit_txn (svn_revnum_t *new_rev,
-                                     svn_fs_t *fs,
-                                     const char *txn_id,
-                                     trail_t *trail);
+svn_error_t *svn_fs_base__dag_commit_txn (svn_revnum_t *new_rev,
+                                          svn_fs_t *fs,
+                                          const char *txn_id,
+                                          trail_t *trail);
 
 
 
@@ -241,10 +241,10 @@
    Set *CHILD_P to the new node, allocated in TRAIL->pool.  NAME must be a
    single path component; it cannot be a slash-separated directory
    path.  */
-svn_error_t *svn_fs__dag_open (dag_node_t **child_p,
-                               dag_node_t *parent,
-                               const char *name,
-                               trail_t *trail);
+svn_error_t *svn_fs_base__dag_open (dag_node_t **child_p,
+                                    dag_node_t *parent,
+                                    const char *name,
+                                    trail_t *trail);
 
 
 /* Set *ENTRIES_P to a hash table of NODE's entries, as part of TRAIL,
@@ -254,26 +254,26 @@
    The returned table is allocated in *either* TRAIL->pool or the pool
    NODE was allocated in, at this function's discretion; the caller
    must finish using it while both of those remain live.  If the
-   caller needs the table to live longer, it should copy the hash. 
+   caller needs the table to live longer, it should copy the hash.
 
    NOTE: the 'kind' field of the svn_fs_dirent_t's is set to
    svn_node_unknown by this function -- callers that need in
    interesting value in these slots should fill them in using a new
    TRAIL, since the list of entries can be arbitrarily large.  */
-svn_error_t *svn_fs__dag_dir_entries (apr_hash_t **entries_p,
-                                      dag_node_t *node,
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__dag_dir_entries (apr_hash_t **entries_p,
+                                           dag_node_t *node,
+                                           trail_t *trail);
 
 
 /* Set ENTRY_NAME in NODE to point to ID, as part of TRAIL.  NODE must
    be a mutable directory.  ID can refer to a mutable or immutable
    node.  If ENTRY_NAME does not exist, it will be created.  TXN_ID is
    the Subversion transaction under which this occurs.*/
-svn_error_t *svn_fs__dag_set_entry (dag_node_t *node,
-                                    const char *entry_name,
-                                    const svn_fs_id_t *id,
-                                    const char *txn_id, 
-                                    trail_t *trail);
+svn_error_t *svn_fs_base__dag_set_entry (dag_node_t *node,
+                                         const char *entry_name,
+                                         const svn_fs_id_t *id,
+                                         const char *txn_id,
+                                         trail_t *trail);
 
 
 /* Make a new mutable clone of the node named NAME in PARENT, and
@@ -287,19 +287,19 @@
 
    COPY_ID, if non-NULL, is a key into the `copies' table, and
    indicates that this new node is being created as the result of a
-   copy operation, and specifically which operation that was.  
+   copy operation, and specifically which operation that was.
 
    PATH is the canonicalized absolute path at which this node is being
    created.
 
    TXN_ID is the Subversion transaction under which this occurs.  */
-svn_error_t *svn_fs__dag_clone_child (dag_node_t **child_p,
-                                      dag_node_t *parent,
-                                      const char *parent_path,
-                                      const char *name,
-                                      const char *copy_id,
-                                      const char *txn_id, 
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__dag_clone_child (dag_node_t **child_p,
+                                           dag_node_t *parent,
+                                           const char *parent_path,
+                                           const char *name,
+                                           const char *copy_id,
+                                           const char *txn_id,
+                                           trail_t *trail);
 
 
 /* Delete the directory entry named NAME from PARENT, as part of
@@ -311,10 +311,10 @@
 
    If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
    PARENT.  */
-svn_error_t *svn_fs__dag_delete (dag_node_t *parent,
-                                 const char *name,
-                                 const char *txn_id,
-                                 trail_t *trail);
+svn_error_t *svn_fs_base__dag_delete (dag_node_t *parent,
+                                      const char *name,
+                                      const char *txn_id,
+                                      trail_t *trail);
 
 
 /* Delete the node revision assigned to node ID from FS's `nodes'
@@ -327,10 +327,10 @@
    children, you risk orphaning those children by leaving them
    dangling, disconnected from all DAG trees.  It is assumed that
    callers of this interface know what in the world they are doing.  */
-svn_error_t *svn_fs__dag_remove_node (svn_fs_t *fs,
-                                      const svn_fs_id_t *id,
-                                      const char *txn_id,
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__dag_remove_node (svn_fs_t *fs,
+                                           const svn_fs_id_t *id,
+                                           const char *txn_id,
+                                           trail_t *trail);
 
 
 /* Delete all mutable node revisions reachable from node ID, including
@@ -339,10 +339,10 @@
    revision.  ID may refer to a file or directory, which may be
    mutable or immutable.  TXN_ID is the Subversion transaction under
    which this occurs.  */
-svn_error_t *svn_fs__dag_delete_if_mutable (svn_fs_t *fs,
-                                            const svn_fs_id_t *id,
-                                            const char *txn_id,
-                                            trail_t *trail);
+svn_error_t *svn_fs_base__dag_delete_if_mutable (svn_fs_t *fs,
+                                                 const svn_fs_id_t *id,
+                                                 const char *txn_id,
+                                                 trail_t *trail);
 
 
 /* Create a new mutable directory named NAME in PARENT, as part of
@@ -354,12 +354,12 @@
    must not currently have an entry named NAME.  Do any temporary
    allocation in TRAIL->pool.  TXN_ID is the Subversion transaction
    under which this occurs.  */
-svn_error_t *svn_fs__dag_make_dir (dag_node_t **child_p,
-                                   dag_node_t *parent,
-                                   const char *parent_path,
-                                   const char *name,
-                                   const char *txn_id,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__dag_make_dir (dag_node_t **child_p,
+                                        dag_node_t *parent,
+                                        const char *parent_path,
+                                        const char *name,
+                                        const char *txn_id,
+                                        trail_t *trail);
 
 
 
@@ -371,10 +371,10 @@
    which may or may not be TRAIL->pool.
 
    If FILE is not a file, return SVN_ERR_FS_NOT_FILE.  */
-svn_error_t *svn_fs__dag_get_contents (svn_stream_t **contents,
-                                       dag_node_t *file,
-                                       apr_pool_t *pool,
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_contents (svn_stream_t **contents,
+                                            dag_node_t *file,
+                                            apr_pool_t *pool,
+                                            trail_t *trail);
 
 
 /* Return a generic writable stream in *CONTENTS with which to set the
@@ -384,15 +384,15 @@
 
    Any previous edits on the file will be deleted, and a new edit
    stream will be constructed.  */
-svn_error_t *svn_fs__dag_get_edit_stream (svn_stream_t **contents,
-                                          dag_node_t *file,
-                                          apr_pool_t *pool,
-                                          const char *txn_id, 
-                                          trail_t *trail);
+svn_error_t *svn_fs_base__dag_get_edit_stream (svn_stream_t **contents,
+                                               dag_node_t *file,
+                                               apr_pool_t *pool,
+                                               const char *txn_id,
+                                               trail_t *trail);
 
 
 /* Signify the completion of edits to FILE made using the stream
-   returned by svn_fs__dag_get_edit_stream, as part of TRAIL.  TXN_ID
+   returned by svn_fs_base__dag_get_edit_stream, as part of TRAIL.  TXN_ID
    is the Subversion transaction under which this occurs.
 
    If CHECKSUM is non-null, it must match the checksum for FILE's
@@ -400,16 +400,16 @@
    used), else the error SVN_ERR_CHECKSUM_MISMATCH is returned.
 
    This operation is a no-op if no edits are present.  */
-svn_error_t *svn_fs__dag_finalize_edits (dag_node_t *file,
-                                         const char *checksum,
-                                         const char *txn_id, 
-                                         trail_t *trail);
+svn_error_t *svn_fs_base__dag_finalize_edits (dag_node_t *file,
+                                              const char *checksum,
+                                              const char *txn_id,
+                                              trail_t *trail);
 
 
 /* Set *LENGTH to the length of the contents of FILE, as part of TRAIL. */
-svn_error_t *svn_fs__dag_file_length (svn_filesize_t *length,
-                                      dag_node_t *file,
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__dag_file_length (svn_filesize_t *length,
+                                           dag_node_t *file,
+                                           trail_t *trail);
 
 /* Put the recorded MD5 checksum of FILE into DIGEST, as part of
  * TRAIL.  DIGEST must point to APR_MD5_DIGESTSIZE bytes of storage.
@@ -418,9 +418,9 @@
  * just put all 0's into DIGEST.
  */
 svn_error_t *
-svn_fs__dag_file_checksum (unsigned char digest[],
-                           dag_node_t *file,
-                           trail_t *trail);
+svn_fs_base__dag_file_checksum (unsigned char digest[],
+                                dag_node_t *file,
+                                trail_t *trail);
 
 /* Create a new mutable file named NAME in PARENT, as part of TRAIL.
    Set *CHILD_P to a reference to the new node, allocated in
@@ -430,12 +430,12 @@
    PARENT_PATH must be the canonicalized absolute path of the parent
    directory.  TXN_ID is the Subversion transaction under which this
    occurs.  */
-svn_error_t *svn_fs__dag_make_file (dag_node_t **child_p,
-                                    dag_node_t *parent,
-                                    const char *parent_path,
-                                    const char *name,
-                                    const char *txn_id,
-                                    trail_t *trail);
+svn_error_t *svn_fs_base__dag_make_file (dag_node_t **child_p,
+                                         dag_node_t *parent,
+                                         const char *parent_path,
+                                         const char *name,
+                                         const char *txn_id,
+                                         trail_t *trail);
 
 
 
@@ -448,17 +448,17 @@
    If PRESERVE_HISTORY is true, the new node will record that it was
    copied from FROM_PATH in FROM_REV; therefore, FROM_NODE should be
    the node found at FROM_PATH in FROM_REV, although this is not
-   checked.  
+   checked.
 
    If PRESERVE_HISTORY is false, FROM_PATH and FROM_REV are ignored.  */
-svn_error_t *svn_fs__dag_copy (dag_node_t *to_node,
-                               const char *entry,
-                               dag_node_t *from_node,
-                               svn_boolean_t preserve_history,
-                               svn_revnum_t from_rev,
-                               const char *from_path,
-                               const char *txn_id, 
-                               trail_t *trail);
+svn_error_t *svn_fs_base__dag_copy (dag_node_t *to_node,
+                                    const char *entry,
+                                    dag_node_t *from_node,
+                                    svn_boolean_t preserve_history,
+                                    svn_revnum_t from_rev,
+                                    const char *from_path,
+                                    const char *txn_id,
+                                    trail_t *trail);
 
 
 
@@ -467,22 +467,22 @@
 /* Change TARGET's representation to be a delta against SOURCE, as
    part of TRAIL.  If TARGET or SOURCE does not exist, do nothing and
    return success.  If PROPS_ONLY is non-zero, only the node property
-   portion of TARGET will be deltified.  
+   portion of TARGET will be deltified.
 
    WARNING WARNING WARNING: Do *NOT* call this with a mutable SOURCE
    node.  Things will go *very* sour if you deltify TARGET against a
    node that might just disappear from the filesystem in the (near)
    future.  */
-svn_error_t *svn_fs__dag_deltify (dag_node_t *target,
-                                  dag_node_t *source,
-                                  svn_boolean_t props_only,
-                                  trail_t *trail);
+svn_error_t *svn_fs_base__dag_deltify (dag_node_t *target,
+                                       dag_node_t *source,
+                                       svn_boolean_t props_only,
+                                       trail_t *trail);
 
 
 /* Comparison */
 
 /* Find out what is the same between two nodes.
- 
+
    If PROPS_CHANGED is non-null, set *PROPS_CHANGED to 1 if the two
    nodes have different property lists, or to 0 if same.
 
@@ -497,27 +497,27 @@
    may leave us with a slight chance of a false positive, though I
    don't really see how that would happen in practice.  Nevertheless,
    it should probably be fixed.  */
-svn_error_t *svn_fs__things_different (svn_boolean_t *props_changed,
-                                       svn_boolean_t *contents_changed,
-                                       dag_node_t *node1,
-                                       dag_node_t *node2,
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__things_different (svn_boolean_t *props_changed,
+                                            svn_boolean_t *contents_changed,
+                                            dag_node_t *node1,
+                                            dag_node_t *node2,
+                                            trail_t *trail);
 
 
 /* Set *IS_ANCESTOR to non-zero IFF NODE1 is an ancestor of NODE2.
    Perform this test under TRAIL.  */
-svn_error_t *svn_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
-                                      dag_node_t *node1,
-                                      dag_node_t *node2,
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__dag_is_ancestor (svn_boolean_t *is_ancestor,
+                                           dag_node_t *node1,
+                                           dag_node_t *node2,
+                                           trail_t *trail);
 
 
 /* Set *IS_PARENT to non-zero IFF NODE1 is the parent of NODE2.
    Perform this test under TRAIL.  */
-svn_error_t *svn_fs__dag_is_parent (svn_boolean_t *is_ancestor,
-                                    dag_node_t *node1,
-                                    dag_node_t *node2,
-                                    trail_t *trail);
+svn_error_t *svn_fs_base__dag_is_parent (svn_boolean_t *is_ancestor,
+                                         dag_node_t *node1,
+                                         dag_node_t *node2,
+                                         trail_t *trail);
 
 #ifdef __cplusplus
 }

Modified: trunk/subversion/libsvn_fs_base/err.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/err.c	(original)
+++ trunk/subversion/libsvn_fs_base/err.c	Thu Apr 29 18:17:29 2004
@@ -23,13 +23,13 @@
 #include <apr_strings.h>
 
 #include "svn_fs.h"
-#include "fs.h"
 #include "err.h"
+#include "../libsvn_fs/fs-loader.h"
 
 svn_error_t *
-svn_fs__check_fs (svn_fs_t *fs)
+svn_fs_base__check_fs (svn_fs_t *fs)
 {
-  if (fs->env)
+  if (fs->fsap_data)
     return SVN_NO_ERROR;
   else
     return svn_error_create (SVN_ERR_FS_NOT_OPEN, 0,
@@ -51,7 +51,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_node_revision (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_base__err_corrupt_node_revision (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   return
     corrupt_id ("Corrupt node revision for node '%s' in filesystem '%s'",
@@ -60,7 +60,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_fs_revision (svn_fs_t *fs, svn_revnum_t rev)
+svn_fs_base__err_corrupt_fs_revision (svn_fs_t *fs, svn_revnum_t rev)
 {
   return svn_error_createf
     (SVN_ERR_FS_CORRUPT, 0,
@@ -70,7 +70,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_clone (svn_fs_t *fs,
+svn_fs_base__err_corrupt_clone (svn_fs_t *fs,
                            const char *svn_txn,
                            const char *base_path)
 {
@@ -83,7 +83,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_base__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   return
     corrupt_id ("Corrupt node revision id '%s' appears in filesystem '%s'",
@@ -92,7 +92,7 @@
 
 
 svn_error_t *
-svn_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_base__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   svn_string_t *id_str = svn_fs_unparse_id (id, fs->pool);
   return svn_error_createf
@@ -103,7 +103,7 @@
 
 
 svn_error_t *
-svn_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev)
+svn_fs_base__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev)
 {
   return svn_error_createf
     (SVN_ERR_FS_NO_SUCH_REVISION, 0,
@@ -115,7 +115,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_nodes_key (svn_fs_t *fs)
+svn_fs_base__err_corrupt_nodes_key (svn_fs_t *fs)
 {
   return
     svn_error_createf
@@ -125,18 +125,18 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table)
+svn_fs_base__err_corrupt_next_id (svn_fs_t *fs, const char *table)
 {
   return
     svn_error_createf
     (SVN_ERR_FS_CORRUPT, 0,
-     "Corrupt value for 'next-id' key in '%s' table of filesystem '%s'", 
+     "Corrupt value for 'next-id' key in '%s' table of filesystem '%s'",
      table, fs->path);
 }
 
 
 svn_error_t *
-svn_fs__err_corrupt_txn (svn_fs_t *fs,
+svn_fs_base__err_corrupt_txn (svn_fs_t *fs,
                          const char *txn)
 {
   return
@@ -148,18 +148,18 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id)
+svn_fs_base__err_corrupt_copy (svn_fs_t *fs, const char *copy_id)
 {
   return
     svn_error_createf
     (SVN_ERR_FS_CORRUPT, 0,
-     "Corrupt entry in 'copies' table for '%s' in filesystem '%s'", 
+     "Corrupt entry in 'copies' table for '%s' in filesystem '%s'",
      copy_id, fs->path);
 }
 
 
 svn_error_t *
-svn_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev, const char *path)
+svn_fs_base__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev, const char *path)
 {
   return
     svn_error_createf
@@ -170,7 +170,7 @@
 
 
 svn_error_t *
-svn_fs__err_path_syntax (svn_fs_t *fs, const char *path)
+svn_fs_base__err_path_syntax (svn_fs_t *fs, const char *path)
 {
   return
     svn_error_createf
@@ -181,7 +181,7 @@
 
 
 svn_error_t *
-svn_fs__err_no_such_txn (svn_fs_t *fs, const char *txn)
+svn_fs_base__err_no_such_txn (svn_fs_t *fs, const char *txn)
 {
   return
     svn_error_createf
@@ -192,7 +192,7 @@
 
 
 svn_error_t *
-svn_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn)
+svn_fs_base__err_txn_not_mutable (svn_fs_t *fs, const char *txn)
 {
   return
     svn_error_createf
@@ -203,7 +203,7 @@
 
 
 svn_error_t *
-svn_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id)
+svn_fs_base__err_no_such_copy (svn_fs_t *fs, const char *copy_id)
 {
   return
     svn_error_createf
@@ -213,7 +213,7 @@
 
 
 svn_error_t *
-svn_fs__err_not_directory (svn_fs_t *fs, const char *path)
+svn_fs_base__err_not_directory (svn_fs_t *fs, const char *path)
 {
   return
     svn_error_createf

Modified: trunk/subversion/libsvn_fs_base/err.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/err.h	(original)
+++ trunk/subversion/libsvn_fs_base/err.h	Thu Apr 29 18:17:29 2004
@@ -32,7 +32,7 @@
 
 /* Verify that FS refers to an open database; return an appropriate
    error if this is not the case.  */
-svn_error_t *svn_fs__check_fs (svn_fs_t *fs);
+svn_error_t *svn_fs_base__check_fs (svn_fs_t *fs);
 
 
 
@@ -40,68 +40,70 @@
 
 
 /* SVN_ERR_FS_CORRUPT: the REPRESENTATION skel of node ID in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_representation (svn_fs_t *fs,
-                                                 const svn_fs_id_t *id);
+svn_error_t *svn_fs_base__err_corrupt_representation (svn_fs_t *fs,
+                                                      const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the NODE-REVISION skel of node ID in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_node_revision (svn_fs_t *fs,
-                                                const svn_fs_id_t *id);
+svn_error_t *svn_fs_base__err_corrupt_node_revision (svn_fs_t *fs,
+                                                     const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the REVISION skel of revision REV in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_fs_revision (svn_fs_t *fs,
-                                              svn_revnum_t rev);
+svn_error_t *svn_fs_base__err_corrupt_fs_revision (svn_fs_t *fs,
+                                                   svn_revnum_t rev);
 
 /* SVN_ERR_FS_CORRUPT: ID is a node ID, not a node revision ID.  */
-svn_error_t *svn_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id);
+svn_error_t *svn_fs_base__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the clone record for BASE_PATH in SVN_TXN in FS
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_clone (svn_fs_t *fs,
-                                        const char *svn_txn,
-                                        const char *base_path);
+svn_error_t *svn_fs_base__err_corrupt_clone (svn_fs_t *fs,
+                                             const char *svn_txn,
+                                             const char *base_path);
 
 /* SVN_ERR_FS_ID_NOT_FOUND: something in FS refers to node revision
    ID, but that node revision doesn't exist.  */
-svn_error_t *svn_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id);
+svn_error_t *svn_fs_base__err_dangling_id (svn_fs_t *fs,
+                                           const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: something in FS refers to filesystem revision REV,
    but that filesystem revision doesn't exist.  */
-svn_error_t *svn_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev);
+svn_error_t *svn_fs_base__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev);
 
 /* SVN_ERR_FS_CORRUPT: a key in FS's `nodes' table is bogus.  */
-svn_error_t *svn_fs__err_corrupt_nodes_key (svn_fs_t *fs);
+svn_error_t *svn_fs_base__err_corrupt_nodes_key (svn_fs_t *fs);
 
 /* SVN_ERR_FS_CORRUPT: the `next-id' value in TABLE is bogus.  */
-svn_error_t *svn_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table);
+svn_error_t *svn_fs_base__err_corrupt_next_id (svn_fs_t *fs,
+                                               const char *table);
 
 /* SVN_ERR_FS_CORRUPT: the entry for TXN in the `transactions' table
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_txn (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_base__err_corrupt_txn (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_CORRUPT: the entry for COPY_ID in the `copies' table
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id);
+svn_error_t *svn_fs_base__err_corrupt_copy (svn_fs_t *fs, const char *copy_id);
 
 /* SVN_ERR_FS_NOT_MUTABLE: the caller attempted to change a node
    outside of a transaction.  */
-svn_error_t *svn_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev,
-                                      const char *path);
+svn_error_t *svn_fs_base__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev,
+                                           const char *path);
 
 /* SVN_ERR_FS_PATH_SYNTAX: PATH is not a valid path name.  */
-svn_error_t *svn_fs__err_path_syntax (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_base__err_path_syntax (svn_fs_t *fs, const char *path);
 
 /* SVN_ERR_FS_NO_SUCH_TRANSACTION: there is no transaction named TXN in FS.  */
-svn_error_t *svn_fs__err_no_such_txn (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_base__err_no_such_txn (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_TRANSACTION_NOT_MUTABLE: trying to change the
    unchangeable transaction named TXN in FS.  */
-svn_error_t *svn_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_base__err_txn_not_mutable (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_NO_SUCH_COPY: there is no copy with id COPY_ID in FS.  */
-svn_error_t *svn_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id);
+svn_error_t *svn_fs_base__err_no_such_copy (svn_fs_t *fs, const char *copy_id);
 
 /* SVN_ERR_FS_NOT_DIRECTORY: PATH does not refer to a directory in FS.  */
-svn_error_t *svn_fs__err_not_directory (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_base__err_not_directory (svn_fs_t *fs, const char *path);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/fs.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/fs.c	(original)
+++ trunk/subversion/libsvn_fs_base/fs.c	Thu Apr 29 18:17:29 2004
@@ -34,6 +34,9 @@
 #include "fs.h"
 #include "err.h"
 #include "dag.h"
+#include "revs-txns.h"
+#include "uuid.h"
+#include "tree.h"
 #include "svn_private_config.h"
 
 #include "bdb/bdb-err.h"
@@ -47,6 +50,8 @@
 #include "bdb/strings-table.h"
 #include "bdb/uuids-table.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
 /* Checking for return values, and reporting errors.  */
 
@@ -92,7 +97,7 @@
 static svn_error_t *
 check_already_open (svn_fs_t *fs)
 {
-  if (fs->env)
+  if (fs->fsap_data)
     return svn_error_create (SVN_ERR_FS_ALREADY_OPEN, 0,
                              "Filesystem object already open");
   else
@@ -100,18 +105,6 @@
 }
 
 
-/* A default warning handling function.  */
-
-static void
-default_warning_func (void *baton, svn_error_t *err)
-{
-  /* The one unforgiveable sin is to fail silently.  Dumping to stderr
-     or /dev/tty is not acceptable default behavior for server
-     processes, since those may both be equivalent to /dev/null.  */
-  abort ();
-}
-
-
 /* Cleanup functions.  */
 
 /* Close a database in the filesystem FS.
@@ -150,23 +143,24 @@
 static svn_error_t *
 cleanup_fs (svn_fs_t *fs)
 {
-  DB_ENV *env = fs->env;
+  base_fs_data_t *bfd = fs->fsap_data;
+  DB_ENV *env = bfd ? bfd->env : NULL;
 
   if (! env)
     return SVN_NO_ERROR;
 
   /* Close the databases.  */
-  SVN_ERR (cleanup_fs_db (fs, &fs->nodes, "nodes"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->revisions, "revisions"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->transactions, "transactions"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->copies, "copies"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->changes, "changes"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->representations, "representations"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->strings, "strings"));
-  SVN_ERR (cleanup_fs_db (fs, &fs->uuids, "uuids"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->nodes, "nodes"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->revisions, "revisions"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->transactions, "transactions"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->copies, "copies"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->changes, "changes"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->representations, "representations"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->strings, "strings"));
+  SVN_ERR (cleanup_fs_db (fs, &bfd->uuids, "uuids"));
 
   /* Finally, close the environment.  */
-  fs->env = 0;
+  bfd->env = 0;
   SVN_ERR (BDB_WRAP (fs, "closing environment",
                     env->close (env, 0)));
 
@@ -176,13 +170,14 @@
 #if 0   /* Set to 1 for instrumenting. */
 static void print_fs_stats(svn_fs_t *fs)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   DB_TXN_STAT *t;
   DB_LOCK_STAT *l;
   int db_err;
 
   /* Print transaction statistics for this DB env. */
-  if ((db_err = fs->env->txn_stat (fs->env, &t, 0)) != 0)
-    fprintf (stderr, "Error running fs->env->txn_stat(): %s",
+  if ((db_err = bfd->env->txn_stat (bfd->env, &t, 0)) != 0)
+    fprintf (stderr, "Error running bfd->env->txn_stat(): %s",
              db_strerror (db_err));
   else
     {
@@ -205,8 +200,8 @@
     }
 
   /* Print transaction statistics for this DB env. */
-  if ((db_err = fs->env->lock_stat (fs->env, &l, 0)) != 0)
-    fprintf (stderr, "Error running fs->env->lock_stat(): %s",
+  if ((db_err = bfd->env->lock_stat (bfd->env, &l, 0)) != 0)
+    fprintf (stderr, "Error running bfd->env->lock_stat(): %s",
              db_strerror (db_err));
   else
     {
@@ -282,46 +277,15 @@
 }
 
 
-/* Allocating and freeing filesystem objects.  */
-
-svn_fs_t *
-svn_fs_new (apr_hash_t *fs_config, apr_pool_t *parent_pool)
-{
-  svn_fs_t *new_fs;
-  apr_pool_t *pool = svn_pool_create (parent_pool);
-
-  /* Allocate a new filesystem object in its own pool, which is a
-     subpool of POOL.  */
-  new_fs = apr_pcalloc (pool, sizeof (svn_fs_t));
-  new_fs->pool = pool;
-  new_fs->warning = default_warning_func;
-  new_fs->config = fs_config;
-
-  apr_pool_cleanup_register (new_fs->pool, new_fs,
-                             cleanup_fs_apr,
-                             apr_pool_cleanup_null);
-
-  return new_fs;
-}
-
 
-void
-svn_fs_set_warning_func (svn_fs_t *fs,
-                         svn_fs_warning_callback_t warning,
-                         void *warning_baton)
+static svn_error_t *
+base_bdb_set_errcall (svn_fs_t *fs,
+                      void (*db_errcall_fcn) (const char *errpfx, char *msg))
 {
-  fs->warning = warning;
-  fs->warning_baton = warning_baton;
-}
+  base_fs_data_t *bfd = fs->fsap_data;
 
-
-svn_error_t *
-svn_fs_set_berkeley_errcall (svn_fs_t *fs, 
-                             void (*db_errcall_fcn) (const char *errpfx,
-                                                     char *msg))
-{
-  SVN_ERR (svn_fs__check_fs (fs));
-  fs->env->set_errcall(fs->env, db_errcall_fcn);
+  SVN_ERR (svn_fs_base__check_fs (fs));
+  bfd->env->set_errcall(bfd->env, db_errcall_fcn);
 
   return SVN_NO_ERROR;
 }
@@ -335,33 +299,27 @@
 static svn_error_t *
 allocate_env (svn_fs_t *fs)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
+
   /* Allocate a Berkeley DB environment object.  */
   SVN_ERR (BDB_WRAP (fs, "allocating environment object",
-                    db_env_create (&fs->env, 0)));
+                     db_env_create (&bfd->env, 0)));
 
   /* Needed on Windows in case Subversion and Berkeley DB are using
      different C runtime libraries  */
   SVN_ERR (BDB_WRAP (fs, "setting environment object's allocation functions",
-                     fs->env->set_alloc (fs->env, malloc, realloc, free)));
+                     bfd->env->set_alloc (bfd->env, malloc, realloc, free)));
 
   /* If we detect a deadlock, select a transaction to abort at random
      from those participating in the deadlock.  */
   SVN_ERR (BDB_WRAP (fs, "setting deadlock detection policy",
-                    fs->env->set_lk_detect (fs->env, DB_LOCK_RANDOM)));
+                     bfd->env->set_lk_detect (bfd->env, DB_LOCK_RANDOM)));
 
   return SVN_NO_ERROR;
 }
 
 
 
-/* Filesystem creation/opening. */
-const char *
-svn_fs_berkeley_path (svn_fs_t *fs, apr_pool_t *pool)
-{
-  return apr_pstrdup (pool, fs->path);
-}
-
-
 /* Write the DB_CONFIG file. */
 static svn_error_t *
 bdb_write_config  (svn_fs_t *fs)
@@ -503,28 +461,46 @@
 }
 
 
-svn_error_t *
-svn_fs_create_berkeley (svn_fs_t *fs, const char *path)
+
+/* Creating a new filesystem */
+
+static fs_vtable_t fs_vtable = {
+  svn_fs_base__youngest_rev,
+  svn_fs_base__revision_prop,
+  svn_fs_base__revision_proplist,
+  svn_fs_base__change_rev_prop,
+  svn_fs_base__get_uuid,
+  svn_fs_base__set_uuid,
+  svn_fs_base__revision_root,
+  svn_fs_base__begin_txn,
+  svn_fs_base__open_txn,
+  svn_fs_base__purge_txn,
+  svn_fs_base__list_transactions,
+  svn_fs_base__deltify
+};
+
+static svn_error_t *
+base_create (svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
-  apr_status_t apr_err;
   svn_error_t *svn_err;
   const char *path_apr;
   const char *path_native;
+  base_fs_data_t *bfd;
 
-  SVN_ERR (check_bdb_version (fs->pool));
+  SVN_ERR (check_bdb_version (pool));
   SVN_ERR (check_already_open (fs));
 
+  apr_pool_cleanup_register (fs->pool, fs, cleanup_fs_apr,
+                             apr_pool_cleanup_null);
+
+  bfd = apr_pcalloc (fs->pool, sizeof (*bfd));
+  fs->vtable = &fs_vtable;
+  fs->fsap_data = bfd;
+
   /* Initialize the fs's path. */
   fs->path = apr_pstrdup (fs->pool, path);
   SVN_ERR (svn_path_cstring_from_utf8 (&path_apr, fs->path, fs->pool));
 
-  /* Create the directory for the new Berkeley DB environment.  */
-  apr_err = apr_dir_make (path_apr, APR_OS_DEFAULT, fs->pool);
-  if (apr_err != APR_SUCCESS)
-    return svn_error_wrap_apr (apr_err,
-                               "Can't create Berkeley DB environment dir '%s'",
-                               fs->path);
-
   SVN_ERR (bdb_write_config (fs));
 
   svn_err = allocate_env (fs);
@@ -533,50 +509,51 @@
   /* Create the Berkeley DB environment.  */
   SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, fs->path, fs->pool));
   svn_err = BDB_WRAP (fs, "creating environment",
-                     fs->env->open (fs->env, path_native,
-                                    (DB_CREATE
-                                     | DB_INIT_LOCK 
-                                     | DB_INIT_LOG
-                                     | DB_INIT_MPOOL
-                                     | DB_INIT_TXN),
-                                    0666));
+                      bfd->env->open (bfd->env, path_native,
+                                      (DB_CREATE
+                                       | DB_INIT_LOCK
+                                       | DB_INIT_LOG
+                                       | DB_INIT_MPOOL
+                                       | DB_INIT_TXN),
+                                      0666));
   if (svn_err) goto error;
 
   /* Create the databases in the environment.  */
   svn_err = BDB_WRAP (fs, "creating 'nodes' table",
-                     svn_fs__bdb_open_nodes_table (&fs->nodes, fs->env, TRUE));
+                      svn_fs_bdb__open_nodes_table (&bfd->nodes, bfd->env,
+                                                    TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'revisions' table",
-                     svn_fs__bdb_open_revisions_table (&fs->revisions,
-                                                       fs->env, TRUE));
+                      svn_fs_bdb__open_revisions_table (&bfd->revisions,
+                                                        bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'transactions' table",
-                     svn_fs__bdb_open_transactions_table (&fs->transactions,
-                                                          fs->env, TRUE));
+                      svn_fs_bdb__open_transactions_table (&bfd->transactions,
+                                                           bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'copies' table",
-                     svn_fs__bdb_open_copies_table (&fs->copies,
-                                                    fs->env, TRUE));
+                      svn_fs_bdb__open_copies_table (&bfd->copies,
+                                                     bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'changes' table",
-                     svn_fs__bdb_open_changes_table (&fs->changes,
-                                                     fs->env, TRUE));
+                      svn_fs_bdb__open_changes_table (&bfd->changes,
+                                                      bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'representations' table",
-                     svn_fs__bdb_open_reps_table (&fs->representations,
-                                                  fs->env, TRUE));
+                      svn_fs_bdb__open_reps_table (&bfd->representations,
+                                                   bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'strings' table",
-                     svn_fs__bdb_open_strings_table (&fs->strings,
-                                                     fs->env, TRUE));
+                      svn_fs_bdb__open_strings_table (&bfd->strings,
+                                                      bfd->env, TRUE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "creating 'uuids' table",
-                     svn_fs__bdb_open_uuids_table (&fs->uuids,
-                                                   fs->env, TRUE));
+                      svn_fs_bdb__open_uuids_table (&bfd->uuids,
+                                                    bfd->env, TRUE));
   if (svn_err) goto error;
 
   /* Initialize the DAG subsystem. */
-  svn_err = svn_fs__dag_init_fs (fs);
+  svn_err = svn_fs_base__dag_init_fs (fs);
   if (svn_err) goto error;
 
   return SVN_NO_ERROR;
@@ -590,15 +567,23 @@
 /* Gaining access to an existing Berkeley DB-based filesystem.  */
 
 
-svn_error_t *
-svn_fs_open_berkeley (svn_fs_t *fs, const char *path)
+static svn_error_t *
+base_open (svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
   svn_error_t *svn_err;
   const char *path_native;
+  base_fs_data_t *bfd;
 
-  SVN_ERR (check_bdb_version (fs->pool));
+  SVN_ERR (check_bdb_version (pool));
   SVN_ERR (check_already_open (fs));
 
+  apr_pool_cleanup_register (fs->pool, fs, cleanup_fs_apr,
+                             apr_pool_cleanup_null);
+
+  bfd = apr_pcalloc (fs->pool, sizeof (*bfd));
+  fs->vtable = &fs_vtable;
+  fs->fsap_data = bfd;
+
   /* Initialize paths. */
   fs->path = apr_pstrdup (fs->pool, path);
 
@@ -608,74 +593,160 @@
   /* Open the Berkeley DB environment.  */
   SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, fs->path, fs->pool));
   svn_err = BDB_WRAP (fs, "opening environment",
-                     fs->env->open (fs->env, path_native,
-                                    (DB_CREATE
-                                     | DB_INIT_LOCK
-                                     | DB_INIT_LOG
-                                     | DB_INIT_MPOOL
-                                     | DB_INIT_TXN),
-                                    0666));
+                      bfd->env->open (bfd->env, path_native,
+                                      (DB_CREATE
+                                       | DB_INIT_LOCK
+                                       | DB_INIT_LOG
+                                       | DB_INIT_MPOOL
+                                       | DB_INIT_TXN),
+                                      0666));
   if (svn_err) goto error;
 
   /* Open the various databases.  */
   svn_err = BDB_WRAP (fs, "opening 'nodes' table",
-                     svn_fs__bdb_open_nodes_table (&fs->nodes, 
-                                                   fs->env, FALSE));
+                      svn_fs_bdb__open_nodes_table (&bfd->nodes,
+                                                    bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'revisions' table",
-                     svn_fs__bdb_open_revisions_table (&fs->revisions,
-                                                       fs->env, FALSE));
+                      svn_fs_bdb__open_revisions_table (&bfd->revisions,
+                                                        bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'transactions' table",
-                     svn_fs__bdb_open_transactions_table (&fs->transactions,
-                                                          fs->env, FALSE));
+                      svn_fs_bdb__open_transactions_table (&bfd->transactions,
+                                                           bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'copies' table",
-                     svn_fs__bdb_open_copies_table (&fs->copies,
-                                                    fs->env, FALSE));
+                      svn_fs_bdb__open_copies_table (&bfd->copies,
+                                                     bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'changes' table",
-                     svn_fs__bdb_open_changes_table (&fs->changes,
-                                                     fs->env, FALSE));
+                      svn_fs_bdb__open_changes_table (&bfd->changes,
+                                                      bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'representations' table",
-                     svn_fs__bdb_open_reps_table (&fs->representations,
-                                                  fs->env, FALSE));
+                      svn_fs_bdb__open_reps_table (&bfd->representations,
+                                                   bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'strings' table",
-                     svn_fs__bdb_open_strings_table (&fs->strings,
-                                                     fs->env, FALSE));
+                      svn_fs_bdb__open_strings_table (&bfd->strings,
+                                                      bfd->env, FALSE));
   if (svn_err) goto error;
   svn_err = BDB_WRAP (fs, "opening 'uuids' table",
-                     svn_fs__bdb_open_uuids_table (&fs->uuids,
-                                                   fs->env, FALSE));
+                      svn_fs_bdb__open_uuids_table (&bfd->uuids,
+                                                    bfd->env, FALSE));
   if (svn_err) goto error;
 
   return SVN_NO_ERROR;
-  
+
  error:
   svn_error_clear (cleanup_fs (fs));
   return svn_err;
 }
 
 
+/* Running recovery on a Berkeley DB-based filesystem.  */
+
+
+static svn_error_t *
+base_bdb_recover (const char *path,
+                  apr_pool_t *pool)
+{
+  DB_ENV *env;
+  const char *path_native;
+
+  SVN_BDB_ERR (db_env_create (&env, 0));
+
+  /* Here's the comment copied from db_recover.c:
+
+     Initialize the environment -- we don't actually do anything
+     else, that all that's needed to run recovery.
+
+     Note that we specify a private environment, as we're about to
+     create a region, and we don't want to leave it around.  If we
+     leave the region around, the application that should create it
+     will simply join it instead, and will then be running with
+     incorrectly sized (and probably terribly small) caches.  */
+
+  SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));
+  SVN_BDB_ERR (env->open (env, path_native, (DB_RECOVER | DB_CREATE
+                                             | DB_INIT_LOCK | DB_INIT_LOG
+                                             | DB_INIT_MPOOL | DB_INIT_TXN
+                                             | DB_PRIVATE),
+                          0666));
+  SVN_BDB_ERR (env->close (env, 0));
+
+  return SVN_NO_ERROR;
+}
+
+
+
+/* Running the 'archive' command on a Berkeley DB-based filesystem.  */
+
+
+static svn_error_t *
+base_bdb_logfiles (apr_array_header_t **logfiles,
+                   const char *path,
+                   svn_boolean_t only_unused,
+                   apr_pool_t *pool)
+{
+  DB_ENV *env;
+  const char *path_native;
+  char **filelist;
+  char **filename;
+  u_int32_t flags = only_unused ? 0 : DB_ARCH_LOG;
+
+  *logfiles = apr_array_make (pool, 4, sizeof (const char *));
+
+  SVN_BDB_ERR (db_env_create (&env, 0));
+
+  /* Needed on Windows in case Subversion and Berkeley DB are using
+     different C runtime libraries  */
+  SVN_BDB_ERR (env->set_alloc (env, malloc, realloc, free));
+
+  SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));
+  SVN_BDB_ERR (env->open (env, path_native, (DB_CREATE
+                                             | DB_INIT_LOCK | DB_INIT_LOG
+                                             | DB_INIT_MPOOL | DB_INIT_TXN),
+                          0666));
+  SVN_BDB_ERR (env->log_archive (env, &filelist, flags));
+
+  if (filelist == NULL)
+    {
+      SVN_BDB_ERR (env->close (env, 0));
+      return SVN_NO_ERROR;
+    }
+
+  for (filename = filelist; *filename != NULL; ++filename)
+    {
+      APR_ARRAY_PUSH (*logfiles, const char *) = apr_pstrdup (pool, *filename);
+    }
+
+  free (filelist);
+
+  SVN_BDB_ERR (env->close (env, 0));
+
+  return SVN_NO_ERROR;
+}
+
+
+
 /* Copying a live Berkeley DB-base filesystem.  */
 
 /**
- * Delete all unused log files from DBD enviroment at @a live_path that exist 
+ * Delete all unused log files from DBD enviroment at @a live_path that exist
  * in @a backup_path.
  */
 static svn_error_t *
-svn_fs__clean_logs(const char *live_path, 
-                   const char *backup_path, 
-                   apr_pool_t *pool) 
+svn_fs_base__clean_logs(const char *live_path,
+                        const char *backup_path,
+                        apr_pool_t *pool)
 {
   apr_array_header_t *logfiles;
 
-  SVN_ERR (svn_fs_berkeley_logfiles (&logfiles,
-                                     live_path,
-                                     TRUE,        /* Only unused logs */
-                                     pool));
+  SVN_ERR (base_bdb_logfiles (&logfiles,
+                              live_path,
+                              TRUE,        /* Only unused logs */
+                              pool));
 
   {  /* Process unused logs from live area */
     int idx;
@@ -692,23 +763,23 @@
         live_log_path = svn_path_join (live_path, log_file, sub_pool);
         backup_log_path = svn_path_join (backup_path, log_file, sub_pool);
 
-        { /* Compare files. No point in using MD5 and wasting CPU cycles as we 
+        { /* Compare files. No point in using MD5 and wasting CPU cycles as we
              got full copies of both logs */
-          
+
           svn_boolean_t files_match = FALSE;
           svn_node_kind_t kind;
 
-          /* Check to see if there is a corresponding log file in the backup 
+          /* Check to see if there is a corresponding log file in the backup
              directory */
           SVN_ERR (svn_io_check_path (backup_log_path, &kind, pool));
-          
+
           /* If the copy of the log exists, compare them */
           if (kind == svn_node_file)
-            SVN_ERR (svn_io_files_contents_same_p (&files_match, 
-                                                   live_log_path, 
-                                                   backup_log_path, 
+            SVN_ERR (svn_io_files_contents_same_p (&files_match,
+                                                   live_log_path,
+                                                   backup_log_path,
                                                    sub_pool));
-                                                   
+
           /* If log files do not match, go to the next log filr. */
           if (files_match == FALSE)
             continue;
@@ -723,25 +794,25 @@
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_hotcopy_berkeley (const char *src_path, 
-                         const char *dest_path, 
-                         svn_boolean_t clean_logs, 
-                         apr_pool_t *pool)
+static svn_error_t *
+base_hotcopy (const char *src_path,
+              const char *dest_path,
+              svn_boolean_t clean_logs,
+              apr_pool_t *pool)
 {
   /* Check DBD version, just in case */
   SVN_ERR (check_bdb_version (pool));
 
   /* Copy the DB_CONFIG file. */
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "DB_CONFIG", pool));
-  
+
   /* Copy the databases.  */
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "nodes", pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "revisions", pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "transactions", pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "copies", pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "changes", pool));
-  SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "representations", 
+  SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "representations",
                                  pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "strings", pool));
   SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, "uuids", pool));
@@ -750,15 +821,15 @@
     apr_array_header_t *logfiles;
     int idx;
 
-    SVN_ERR (svn_fs_berkeley_logfiles (&logfiles,
-                                       src_path,
-                                       FALSE,   /* All logs */
-                                       pool));
+    SVN_ERR (base_bdb_logfiles (&logfiles,
+                                src_path,
+                                FALSE,   /* All logs */
+                                pool));
 
     /* Process log files. */
     for (idx = 0; idx < logfiles->nelts; idx++)
       {
-        SVN_ERR (svn_io_dir_file_copy (src_path, dest_path, 
+        SVN_ERR (svn_io_dir_file_copy (src_path, dest_path,
                                        APR_ARRAY_IDX (logfiles, idx,
                                                       const char *),
                                        pool));
@@ -766,107 +837,22 @@
   }
 
   /* Since this is a copy we will have exclusive access to the repository. */
-  SVN_ERR (svn_fs_berkeley_recover (dest_path, pool));
+  SVN_ERR (base_bdb_recover (dest_path, pool));
 
   if (clean_logs == TRUE)
-    SVN_ERR (svn_fs__clean_logs (src_path, dest_path, pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Running recovery on a Berkeley DB-based filesystem.  */
-
-
-svn_error_t *
-svn_fs_berkeley_recover (const char *path,
-                         apr_pool_t *pool)
-{
-  DB_ENV *env;
-  const char *path_native;
-
-  SVN_BDB_ERR (db_env_create (&env, 0));
-
-  /* Here's the comment copied from db_recover.c:
-   
-     Initialize the environment -- we don't actually do anything
-     else, that all that's needed to run recovery.
-   
-     Note that we specify a private environment, as we're about to
-     create a region, and we don't want to leave it around.  If we
-     leave the region around, the application that should create it
-     will simply join it instead, and will then be running with
-     incorrectly sized (and probably terribly small) caches.  */
-
-  SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));
-  SVN_BDB_ERR (env->open (env, path_native, (DB_RECOVER | DB_CREATE
-                                             | DB_INIT_LOCK | DB_INIT_LOG
-                                             | DB_INIT_MPOOL | DB_INIT_TXN
-                                             | DB_PRIVATE),
-                          0666));
-  SVN_BDB_ERR (env->close (env, 0));
-
-  return SVN_NO_ERROR;
-}
-
-
-
-/* Running the 'archive' command on a Berkeley DB-based filesystem.  */
-
-
-svn_error_t *svn_fs_berkeley_logfiles (apr_array_header_t **logfiles,
-                                       const char *path,
-                                       svn_boolean_t only_unused,
-                                       apr_pool_t *pool)
-{
-  DB_ENV *env;
-  const char *path_native;
-  char **filelist;
-  char **filename;
-  u_int32_t flags = only_unused ? 0 : DB_ARCH_LOG;
-
-  *logfiles = apr_array_make (pool, 4, sizeof (const char *));
-
-  SVN_BDB_ERR (db_env_create (&env, 0));
-
-  /* Needed on Windows in case Subversion and Berkeley DB are using
-     different C runtime libraries  */
-  SVN_BDB_ERR (env->set_alloc (env, malloc, realloc, free));
-
-  SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));
-  SVN_BDB_ERR (env->open (env, path_native, (DB_CREATE
-                                             | DB_INIT_LOCK | DB_INIT_LOG
-                                             | DB_INIT_MPOOL | DB_INIT_TXN),
-                          0666));
-  SVN_BDB_ERR (env->log_archive (env, &filelist, flags));
-
-  if (filelist == NULL)
-    {
-      SVN_BDB_ERR (env->close (env, 0));
-      return SVN_NO_ERROR;
-    }
-
-  for (filename = filelist; *filename != NULL; ++filename)
-    {
-      APR_ARRAY_PUSH (*logfiles, const char *) = apr_pstrdup (pool, *filename);
-    }
-
-  free (filelist);
-  
-  SVN_BDB_ERR (env->close (env, 0));
+    SVN_ERR (svn_fs_base__clean_logs (src_path, dest_path, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-
 
 /* Deleting a Berkeley DB-based filesystem.  */
 
 
-svn_error_t *
-svn_fs_delete_berkeley (const char *path,
-                        apr_pool_t *pool)
+static svn_error_t *
+base_delete_fs (const char *path,
+                apr_pool_t *pool)
 {
   DB_ENV *env;
   const char *path_native;
@@ -885,62 +871,14 @@
 
 
 
-/* Miscellany */
-
-const char *
-svn_fs__canonicalize_abspath (const char *path, apr_pool_t *pool)
-{
-  char *newpath;
-  int path_len;
-  int path_i = 0, newpath_i = 0;
-  svn_boolean_t eating_slashes = FALSE;
-
-  /* No PATH?  No problem. */
-  if (! path)
-    return NULL;
-  
-  /* Empty PATH?  That's just "/". */
-  if (! *path)
-    return apr_pstrdup (pool, "/");
-
-  /* Now, the fun begins.  Alloc enough room to hold PATH with an
-     added leading '/'. */
-  path_len = strlen (path);
-  newpath = apr_pcalloc (pool, path_len + 2);
+/* Base FS library vtable, used by the FS loader library. */
 
-  /* No leading slash?  Fix that. */
-  if (*path != '/')
-    {
-      newpath[newpath_i++] = '/';
-    }
-  
-  for (path_i = 0; path_i < path_len; path_i++)
-    {
-      if (path[path_i] == '/')
-        {
-          /* The current character is a '/'.  If we are eating up
-             extra '/' characters, skip this character.  Else, note
-             that we are now eating slashes. */
-          if (eating_slashes)
-            continue;
-          eating_slashes = TRUE;
-        }
-      else
-        {
-          /* The current character is NOT a '/'.  If we were eating
-             slashes, we need not do that any more. */
-          if (eating_slashes)
-            eating_slashes = FALSE;
-        }
-
-      /* Copy the current character into our new buffer. */
-      newpath[newpath_i++] = path[path_i];
-    }
-  
-  /* Did we leave a '/' attached to the end of NEWPATH (other than in
-     the root directory case)? */
-  if ((newpath[newpath_i - 1] == '/') && (newpath_i > 1))
-    newpath[newpath_i - 1] = '\0';
-
-  return newpath;
-}
+fs_library_vtable_t svn_fs_base__vtable = {
+  base_create,
+  base_open,
+  base_delete_fs,
+  base_hotcopy,
+  base_bdb_set_errcall,
+  base_bdb_recover,
+  base_bdb_logfiles
+};

Modified: trunk/subversion/libsvn_fs_base/fs.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/fs.h	(original)
+++ trunk/subversion/libsvn_fs_base/fs.h	Thu Apr 29 18:17:29 2004
@@ -33,16 +33,8 @@
 
 /*** The filesystem structure.  ***/
 
-struct svn_fs_t 
+typedef struct
 {
-  /* A pool managing this filesystem.  Freeing this pool must
-     completely clean up the filesystem, including any database
-     or system resources it holds.  */
-  apr_pool_t *pool;
-
-  /* The path to the repository's top-level directory. */
-  char *path;
-
   /* A Berkeley DB environment for all the filesystem's databases.
      This establishes the scope of the filesystem's transactions.  */
   DB_ENV *env;
@@ -61,29 +53,9 @@
      transaction trail alive. */
   svn_boolean_t in_txn_trail;
 
-  /* A callback function for printing warning messages, and a baton to
-     pass through to it.  */
-  svn_fs_warning_callback_t warning;
-  void *warning_baton;
-
-  /* The filesystem configuration. */
-  apr_hash_t *config;
-
   /* The filesystem UUID (or NULL if not-yet-known; see svn_fs_get_uuid). */
   const char *uuid;
-};
-
-
-/* Return a canonicalized version of a filesystem PATH, allocated in
-   POOL.  While the filesystem API is pretty flexible about the
-   incoming paths (they must be UTF-8 with '/' as separators, but they
-   don't have to begin with '/', and multiple contiguous '/'s are
-   ignored) we want any paths that are physically stored in the
-   underlying database to look consistent.  Specifically, absolute
-   filesystem paths should begin with '/', and all redundant and trailing '/'
-   characters be removed.  */
-const char *
-svn_fs__canonicalize_abspath (const char *path, apr_pool_t *pool);
+} base_fs_data_t;
 
 
 /*** Filesystem Revision ***/
@@ -93,24 +65,24 @@
      revision. */
   const char *txn_id;
 
-} svn_fs__revision_t;
+} revision_t;
 
 
 /*** Transaction Kind ***/
 typedef enum
 {
-  svn_fs__transaction_kind_normal = 1,  /* normal, uncommitted */
-  svn_fs__transaction_kind_committed,   /* committed */
-  svn_fs__transaction_kind_dead         /* uncommitted and dead */
+  transaction_kind_normal = 1,  /* normal, uncommitted */
+  transaction_kind_committed,   /* committed */
+  transaction_kind_dead         /* uncommitted and dead */
 
-} svn_fs__transaction_kind_t;
+} transaction_kind_t;
 
 
 /*** Filesystem Transaction ***/
 typedef struct
 {
   /* kind of transaction. */
-  svn_fs__transaction_kind_t kind;
+  transaction_kind_t kind;
 
   /* revision which this transaction was committed to create, or an
      invalid revision number if this transaction was never committed. */
@@ -131,7 +103,7 @@
      no copies in this transaction.  */
   apr_array_header_t *copies;
 
-} svn_fs__transaction_t;
+} transaction_t;
 
 
 /*** Node-Revision ***/
@@ -164,20 +136,20 @@
   /* path at which this node first came into existence.  */
   const char *created_path;
 
-} svn_fs__node_revision_t;
+} node_revision_t;
 
 
 /*** Representation Kind ***/
 typedef enum
 {
-  svn_fs__rep_kind_fulltext = 1, /* fulltext */
-  svn_fs__rep_kind_delta         /* delta */
+  rep_kind_fulltext = 1, /* fulltext */
+  rep_kind_delta         /* delta */
 
-} svn_fs__rep_kind_t;
+} rep_kind_t;
 
 
 /*** "Delta" Offset/Window Chunk ***/
-typedef struct 
+typedef struct
 {
   /* diff format version number ### at this point, "svndiff" is the
      only format used. */
@@ -187,7 +159,7 @@
   svn_filesize_t offset;
 
   /* string-key to which this representation points. */
-  const char *string_key; 
+  const char *string_key;
 
   /* size of the fulltext data represented by this delta window. */
   apr_size_t size;
@@ -198,14 +170,14 @@
 
   /* apr_off_t rep_offset;  ### not implemented */
 
-} svn_fs__rep_delta_chunk_t;
+} rep_delta_chunk_t;
 
 
 /*** Representation ***/
 typedef struct
 {
   /* representation kind */
-  svn_fs__rep_kind_t kind;
+  rep_kind_t kind;
 
   /* transaction ID under which representation was created (used as a
      mutability flag when compared with a current editing
@@ -215,14 +187,14 @@
   /* MD5 checksum for the contents produced by this representation.
      This checksum is for the contents the rep shows to consumers,
      regardless of how the rep stores the data under the hood.  It is
-     independent of the storage (fulltext, delta, whatever). 
+     independent of the storage (fulltext, delta, whatever).
 
      If all the bytes are 0, then for compatibility behave as though
      this checksum matches the expected checksum. */
   unsigned char checksum[APR_MD5_DIGESTSIZE];
 
   /* kind-specific stuff */
-  union 
+  union
   {
     /* fulltext stuff */
     struct
@@ -235,29 +207,29 @@
     /* delta stuff */
     struct
     {
-      /* an array of svn_fs__rep_delta_chunk_t * chunks of delta
+      /* an array of rep_delta_chunk_t * chunks of delta
          information */
       apr_array_header_t *chunks;
 
     } delta;
   } contents;
-} svn_fs__representation_t;
+} representation_t;
 
 
 /*** Copy Kind ***/
 typedef enum
 {
-  svn_fs__copy_kind_real = 1, /* real copy */
-  svn_fs__copy_kind_soft      /* soft copy */
+  copy_kind_real = 1, /* real copy */
+  copy_kind_soft      /* soft copy */
 
-} svn_fs__copy_kind_t;
+} copy_kind_t;
 
 
 /*** Copy ***/
 typedef struct
 {
   /* What kind of copy occurred. */
-  svn_fs__copy_kind_t kind;
+  copy_kind_t kind;
 
   /* Path of copy source. */
   const char *src_path;
@@ -268,7 +240,7 @@
   /* Node-revision of copy destination. */
   const svn_fs_id_t *dst_noderev_id;
 
-} svn_fs__copy_t;
+} copy_t;
 
 
 /*** Change ***/
@@ -287,7 +259,7 @@
   svn_boolean_t text_mod;
   svn_boolean_t prop_mod;
 
-} svn_fs__change_t;
+} change_t;
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/key-gen.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/key-gen.c	(original)
+++ trunk/subversion/libsvn_fs_base/key-gen.c	Thu Apr 29 18:17:29 2004
@@ -28,9 +28,8 @@
 /* Converting text to numbers.  */
 
 apr_size_t
-svn_fs__getsize (const char *data, apr_size_t len,
-                 const char **endptr,
-                 apr_size_t max)
+svn_fs_base__getsize (const char *data, apr_size_t len,
+                      const char **endptr, apr_size_t max)
 {
   /* We can't detect overflow by simply comparing value against max,
      since multiplying value by ten can overflow in strange ways if
@@ -85,12 +84,12 @@
 /* Converting numbers to text.  */
 
 int
-svn_fs__putsize (char *data, apr_size_t len, apr_size_t value)
+svn_fs_base__putsize (char *data, apr_size_t len, apr_size_t value)
 {
   apr_size_t i = 0;
 
   /* Generate the digits, least-significant first.  */
-  do 
+  do
     {
       if (i >= len)
         return 0;
@@ -120,11 +119,9 @@
 
 /*** Keys for reps and strings. ***/
 
-const char svn_fs__next_key_key[] = "next-key";
-
 
 void
-svn_fs__next_key (const char *this, apr_size_t *len, char *next)
+svn_fs_base__next_key (const char *this, apr_size_t *len, char *next)
 {
   apr_size_t olen = *len;     /* remember the first length */
   int i = olen - 1;           /* initial index; we work backwards */
@@ -132,14 +129,14 @@
   svn_boolean_t carry = TRUE; /* boolean: do we have a carry or not?
                                  We start with a carry, because we're
                                  incrementing the number, after all. */
-  
+
   /* Leading zeros are not allowed, except for the string "0". */
   if ((*len > 1) && (this[0] == '0'))
     {
       *len = 0;
       return;
     }
-  
+
   for (i = (olen - 1); i >= 0; i--)
     {
       c = this[i];
@@ -158,7 +155,7 @@
           else
             {
               carry = FALSE;
-              
+
               if (c == '9')
                 next[i] = 'a';
               else
@@ -174,9 +171,9 @@
   *len = olen + (carry ? 1 : 0);
 
   /* Ensure that we haven't overrun the (ludicrous) bound on key length.
-     Note that SVN_FS__MAX_KEY_SIZE is a bound on the size *including*
+     Note that MAX_KEY_SIZE is a bound on the size *including*
      the trailing null byte. */
-  assert (*len < SVN_FS__MAX_KEY_SIZE);
+  assert (*len < MAX_KEY_SIZE);
 
   /* Now we know it's safe to add the null terminator. */
   next[*len] = '\0';
@@ -191,7 +188,7 @@
 
 
 int
-svn_fs__key_compare (const char *a, const char *b)
+svn_fs_base__key_compare (const char *a, const char *b)
 {
   int a_len = strlen (a);
   int b_len = strlen (b);
@@ -207,7 +204,7 @@
 
 
 svn_boolean_t
-svn_fs__same_keys (const char *a, const char *b)
+svn_fs_base__same_keys (const char *a, const char *b)
 {
   if (! (a || b))
     return TRUE;

Modified: trunk/subversion/libsvn_fs_base/key-gen.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/key-gen.h	(original)
+++ trunk/subversion/libsvn_fs_base/key-gen.h	Thu Apr 29 18:17:29 2004
@@ -27,10 +27,10 @@
 #endif /* __cplusplus */
 
 
-/* The alphanumeric keys passed in and out of svn_fs__next_key
+/* The alphanumeric keys passed in and out of svn_fs_base__next_key
    are guaranteed never to be longer than this many bytes,
    *including* the trailing null byte.  It is therefore safe
-   to declare a key as "char key[SVN_FS__MAX_KEY_SIZE]".
+   to declare a key as "char key[MAX_KEY_SIZE]".
 
    Note that this limit will be a problem if the number of
    keys in a table ever exceeds
@@ -44,7 +44,11 @@
        947748581376,
 
    but that's a risk we'll live with for now. */
-#define SVN_FS__MAX_KEY_SIZE 200
+#define MAX_KEY_SIZE 200
+
+/* In the `representations' and `strings', the value at this key is
+   the key to use when storing a new rep or string. */
+#define NEXT_KEY_KEY "next-key"
 
 
 /* Return the value of the string of digits at DATA as an ASCII
@@ -57,19 +61,14 @@
    locale-dependent, whereas we're trying to parse data in a
    local-independent format.  */
 
-apr_size_t svn_fs__getsize (const char *data, apr_size_t len,
-                            const char **endptr, apr_size_t max);
+apr_size_t svn_fs_base__getsize (const char *data, apr_size_t len,
+                                 const char **endptr, apr_size_t max);
 
 
 /* Store the ASCII decimal representation of VALUE at DATA.  Return
    the length of the representation if all goes well; return zero if
    the result doesn't fit in LEN bytes.  */
-int svn_fs__putsize (char *data, apr_size_t len, apr_size_t value);
-
-
-/* In the `representations' and `strings', the value at this key is
-   the key to use when storing a new rep or string. */
-extern const char svn_fs__next_key_key[];
+int svn_fs_base__putsize (char *data, apr_size_t len, apr_size_t value);
 
 
 /* Generate the next key after a given alphanumeric key.
@@ -90,7 +89,7 @@
  * string "0", then *LEN is set to zero and the effect on NEXT
  * is undefined.
  */
-void svn_fs__next_key (const char *this, apr_size_t *len, char *next);
+void svn_fs_base__next_key (const char *this, apr_size_t *len, char *next);
 
 
 /* Compare two strings A and B as base-36 alphanumeric keys.
@@ -98,14 +97,14 @@
  * Return -1, 0, or 1 if A is less than, equal to, or greater than B,
  * respectively.
  */
-int svn_fs__key_compare (const char *a, const char *b);
+int svn_fs_base__key_compare (const char *a, const char *b);
 
 /* Compare two strings A and B as base-36 alphanumber keys.
  *
  * Return TRUE iff both keys are NULL or both keys have the same
  * contents.
  */
-svn_boolean_t svn_fs__same_keys (const char *a, const char *b);
+svn_boolean_t svn_fs_base__same_keys (const char *a, const char *b);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/node-rev.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/node-rev.c	(original)
+++ trunk/subversion/libsvn_fs_base/node-rev.c	Thu Apr 29 18:17:29 2004
@@ -34,20 +34,20 @@
 
 
 svn_error_t *
-svn_fs__create_node (const svn_fs_id_t **id_p,
-                     svn_fs_t *fs,
-                     svn_fs__node_revision_t *noderev,
-                     const char *copy_id,
-                     const char *txn_id,
-                     trail_t *trail)
+svn_fs_base__create_node (const svn_fs_id_t **id_p,
+                          svn_fs_t *fs,
+                          node_revision_t *noderev,
+                          const char *copy_id,
+                          const char *txn_id,
+                          trail_t *trail)
 {
   svn_fs_id_t *id;
 
   /* Find an unused ID for the node.  */
-  SVN_ERR (svn_fs__bdb_new_node_id (&id, fs, copy_id, txn_id, trail));
+  SVN_ERR (svn_fs_bdb__new_node_id (&id, fs, copy_id, txn_id, trail));
 
   /* Store its NODE-REVISION skel.  */
-  SVN_ERR (svn_fs__bdb_put_node_revision (fs, id, noderev, trail));
+  SVN_ERR (svn_fs_bdb__put_node_revision (fs, id, noderev, trail));
 
   *id_p = id;
   return SVN_NO_ERROR;
@@ -58,22 +58,22 @@
 /* Creating new revisions of existing nodes.  */
 
 svn_error_t *
-svn_fs__create_successor (const svn_fs_id_t **new_id_p,
-                          svn_fs_t *fs,
-                          const svn_fs_id_t *old_id,
-                          svn_fs__node_revision_t *new_noderev,
-                          const char *copy_id,
-                          const char *txn_id,
-                          trail_t *trail)
+svn_fs_base__create_successor (const svn_fs_id_t **new_id_p,
+                               svn_fs_t *fs,
+                               const svn_fs_id_t *old_id,
+                               node_revision_t *new_noderev,
+                               const char *copy_id,
+                               const char *txn_id,
+                               trail_t *trail)
 {
   svn_fs_id_t *new_id;
 
   /* Choose an ID for the new node, and store it in the database.  */
-  SVN_ERR (svn_fs__bdb_new_successor_id (&new_id, fs, old_id, copy_id,
+  SVN_ERR (svn_fs_bdb__new_successor_id (&new_id, fs, old_id, copy_id,
                                          txn_id, trail));
 
   /* Store the new skel under that ID.  */
-  SVN_ERR (svn_fs__bdb_put_node_revision (fs, new_id, new_noderev, trail));
+  SVN_ERR (svn_fs_bdb__put_node_revision (fs, new_id, new_noderev, trail));
 
   *new_id_p = new_id;
   return SVN_NO_ERROR;
@@ -84,12 +84,12 @@
 /* Deleting a node revision. */
 
 svn_error_t *
-svn_fs__delete_node_revision (svn_fs_t *fs,
-                              const svn_fs_id_t *id,
-                              trail_t *trail)
+svn_fs_base__delete_node_revision (svn_fs_t *fs,
+                                   const svn_fs_id_t *id,
+                                   trail_t *trail)
 {
   /* ### todo: here, we should adjust other nodes to compensate for
      the missing node. */
 
-  return svn_fs__bdb_delete_nodes_entry (fs, id, trail);
+  return svn_fs_bdb__delete_nodes_entry (fs, id, trail);
 }

Modified: trunk/subversion/libsvn_fs_base/node-rev.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/node-rev.h	(original)
+++ trunk/subversion/libsvn_fs_base/node-rev.h	Thu Apr 29 18:17:29 2004
@@ -42,9 +42,9 @@
 
    After this call, the node table manager assumes that the new node's
    contents will change frequently.  */
-svn_error_t *svn_fs__create_node (const svn_fs_id_t **id_p,
+svn_error_t *svn_fs_base__create_node (const svn_fs_id_t **id_p,
                                   svn_fs_t *fs,
-                                  svn_fs__node_revision_t *noderev,
+                                  node_revision_t *noderev,
                                   const char *copy_id,
                                   const char *txn_id,
                                   trail_t *trail);
@@ -52,7 +52,7 @@
 /* Create a node revision in FS which is an immediate successor of
    OLD_ID, whose contents are NEW_NR, as part of TRAIL.  Set *NEW_ID_P
    to the new node revision's ID.  Use TRAIL->pool for any temporary
-   allocation.  
+   allocation.
 
    COPY_ID, if non-NULL, is a key into the `copies' table, and
    indicates that this new node is being created as the result of a
@@ -63,10 +63,10 @@
    After this call, the deltification code assumes that the new node's
    contents will change frequently, and will avoid representing other
    nodes as deltas against this node's contents.  */
-svn_error_t *svn_fs__create_successor (const svn_fs_id_t **new_id_p,
+svn_error_t *svn_fs_base__create_successor (const svn_fs_id_t **new_id_p,
                                        svn_fs_t *fs,
                                        const svn_fs_id_t *old_id,
-                                       svn_fs__node_revision_t *new_nr,
+                                       node_revision_t *new_nr,
                                        const char *copy_id,
                                        const char *txn_id,
                                        trail_t *trail);
@@ -75,7 +75,7 @@
 /* Delete node revision ID from FS's `nodes' table, as part of TRAIL.
    WARNING: This does not check that the node revision is mutable!
    Callers should do that check themselves.  */
-svn_error_t *svn_fs__delete_node_revision (svn_fs_t *fs,
+svn_error_t *svn_fs_base__delete_node_revision (svn_fs_t *fs,
                                            const svn_fs_id_t *id,
                                            trail_t *trail);
 

Modified: trunk/subversion/libsvn_fs_base/reps-strings.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/reps-strings.c	(original)
+++ trunk/subversion/libsvn_fs_base/reps-strings.c	Thu Apr 29 18:17:29 2004
@@ -41,7 +41,7 @@
 
 
 /* Return non-zero iff REP is mutable under transaction TXN_ID. */
-static svn_boolean_t rep_is_mutable (svn_fs__representation_t *rep, 
+static svn_boolean_t rep_is_mutable (representation_t *rep,
                                      const char *txn_id)
 {
   if ((! rep->txn_id) || (strcmp (rep->txn_id, txn_id) != 0))
@@ -52,34 +52,34 @@
 
 /* Return a `fulltext' representation, allocated in POOL, which
  * references the string STR_KEY.
- * 
+ *
  * If TXN_ID is non-zero and non-NULL, make the representation mutable
  * under that TXN_ID.
- * 
+ *
  * If STR_KEY is non-null, copy it into an allocation from POOL.
- * 
+ *
  * If CHECKSUM is non-null, use it as the checksum for the new rep;
  * else initialize the rep with an all-zero (i.e., always successful)
  * checksum.
  */
-static svn_fs__representation_t *
-make_fulltext_rep (const char *str_key, 
+static representation_t *
+make_fulltext_rep (const char *str_key,
                    const char *txn_id,
                    const unsigned char *checksum,
                    apr_pool_t *pool)
 
 {
-  svn_fs__representation_t *rep = apr_pcalloc (pool, sizeof (*rep));
+  representation_t *rep = apr_pcalloc (pool, sizeof (*rep));
   if (txn_id && *txn_id)
     rep->txn_id = apr_pstrdup (pool, txn_id);
-  rep->kind = svn_fs__rep_kind_fulltext;
+  rep->kind = rep_kind_fulltext;
 
   if (checksum)
     memcpy (rep->checksum, checksum, APR_MD5_DIGESTSIZE);
   else
     memset (rep->checksum, 0, APR_MD5_DIGESTSIZE);
 
-  rep->contents.fulltext.string_key 
+  rep->contents.fulltext.string_key
     = str_key ? apr_pstrdup (pool, str_key) : NULL;
   return rep;
 }
@@ -89,15 +89,15 @@
    representation REP.  Allocate *KEYS in POOL. */
 static svn_error_t *
 delta_string_keys (apr_array_header_t **keys,
-                   const svn_fs__representation_t *rep, 
+                   const representation_t *rep,
                    apr_pool_t *pool)
 {
   const char *key;
   int i;
   apr_array_header_t *chunks;
 
-  if (rep->kind != svn_fs__rep_kind_delta)
-    return svn_error_create 
+  if (rep->kind != rep_kind_delta)
+    return svn_error_create
       (SVN_ERR_FS_GENERAL, NULL,
        "Representation is not of type 'delta'");
 
@@ -108,13 +108,13 @@
   *keys = apr_array_make (pool, chunks->nelts, sizeof (key));
   if (! chunks->nelts)
     return SVN_NO_ERROR;
-  
+
   /* Now, push the string keys for each window into *KEYS */
   for (i = 0; i < chunks->nelts; i++)
     {
-      svn_fs__rep_delta_chunk_t *chunk = 
-        (((svn_fs__rep_delta_chunk_t **) chunks->elts)[i]);
-      
+      rep_delta_chunk_t *chunk =
+        (((rep_delta_chunk_t **) chunks->elts)[i]);
+
       key = apr_pstrdup (pool, chunk->string_key);
       (*((const char **)(apr_array_push (*keys)))) = key;
     }
@@ -125,8 +125,8 @@
 
 /* Delete the strings associated with array KEYS in FS as part of TRAIL.  */
 static svn_error_t *
-delete_strings (apr_array_header_t *keys, 
-                svn_fs_t *fs, 
+delete_strings (apr_array_header_t *keys,
+                svn_fs_t *fs,
                 trail_t *trail)
 {
   int i;
@@ -135,7 +135,7 @@
   for (i = 0; i < keys->nelts; i++)
     {
       str_key = ((const char **) keys->elts)[i];
-      SVN_ERR (svn_fs__bdb_string_delete (fs, str_key, trail));
+      SVN_ERR (svn_fs_bdb__string_delete (fs, str_key, trail));
     }
   return SVN_NO_ERROR;
 }
@@ -215,7 +215,7 @@
 static svn_error_t *
 get_one_window (struct compose_handler_baton *cb,
                 svn_fs_t *fs,
-                svn_fs__representation_t *rep,
+                representation_t *rep,
                 int cur_chunk)
 {
   svn_stream_t *wstream;
@@ -225,7 +225,7 @@
   const char *str_key;
 
   apr_array_header_t *chunks = rep->contents.delta.chunks;
-  svn_fs__rep_delta_chunk_t *this_chunk, *first_chunk;
+  rep_delta_chunk_t *this_chunk, *first_chunk;
 
   cb->init = TRUE;
   if (chunks->nelts <= cur_chunk)
@@ -242,7 +242,7 @@
      we might simply convert chunks that use a different version
      of the diff format -- or, heck, a different format
      altogether -- to the format/version of the first chunk.  */
-  first_chunk = APR_ARRAY_IDX (chunks, 0, svn_fs__rep_delta_chunk_t*);
+  first_chunk = APR_ARRAY_IDX (chunks, 0, rep_delta_chunk_t*);
   diffdata[0] = 'S';
   diffdata[1] = 'V';
   diffdata[2] = 'N';
@@ -253,7 +253,7 @@
 
   /* Get this string key which holds this window's data.
      ### todo: make sure this is an `svndiff' DIFF skel here. */
-  this_chunk = APR_ARRAY_IDX (chunks, cur_chunk, svn_fs__rep_delta_chunk_t*);
+  this_chunk = APR_ARRAY_IDX (chunks, cur_chunk, rep_delta_chunk_t*);
   str_key = this_chunk->string_key;
 
   /* Run through the svndiff data, at least as far as necessary. */
@@ -261,7 +261,7 @@
   do
     {
       amt = sizeof (diffdata);
-      SVN_ERR (svn_fs__bdb_string_read (fs, str_key, diffdata,
+      SVN_ERR (svn_fs_bdb__string_read (fs, str_key, diffdata,
                                         off, &amt, cb->trail));
       off += amt;
       SVN_ERR (svn_stream_write (wstream, diffdata, &amt));
@@ -285,7 +285,7 @@
 static svn_error_t *
 rep_undeltify_range (svn_fs_t *fs,
                      apr_array_header_t *deltas,
-                     svn_fs__representation_t *fulltext,
+                     representation_t *fulltext,
                      int cur_chunk,
                      char *buf,
                      apr_size_t offset,
@@ -305,8 +305,8 @@
       cb.done = FALSE;
       for (cur_rep = 0; !cb.done && cur_rep < deltas->nelts; ++cur_rep)
         {
-          svn_fs__representation_t *const rep =
-            APR_ARRAY_IDX (deltas, cur_rep, svn_fs__representation_t*);
+          representation_t *const rep =
+            APR_ARRAY_IDX (deltas, cur_rep, representation_t*);
           SVN_ERR (get_one_window (&cb, fs, rep, cur_chunk));
         }
 
@@ -324,7 +324,7 @@
         {
           apr_size_t source_len = cb.window->sview_len;
           source_buf = apr_palloc (cb.window_pool, source_len);
-          SVN_ERR (svn_fs__bdb_string_read
+          SVN_ERR (svn_fs_bdb__string_read
                    (fs, fulltext->contents.fulltext.string_key,
                     source_buf, cb.window->sview_offset, &source_len, trail));
           assert (source_len == cb.window->sview_len);
@@ -378,7 +378,7 @@
    dependent deltas.  Oh, and the chunks in REP must be ordered. */
 
 static int
-get_chunk_offset (svn_fs__representation_t *rep,
+get_chunk_offset (representation_t *rep,
                   svn_filesize_t rep_offset,
                   apr_size_t *chunk_offset)
 {
@@ -390,8 +390,8 @@
      the very second we notice it's slowing us down. */
   for (cur_chunk = 0; cur_chunk < chunks->nelts; ++cur_chunk)
   {
-    const svn_fs__rep_delta_chunk_t *const this_chunk
-      = APR_ARRAY_IDX (chunks, cur_chunk, svn_fs__rep_delta_chunk_t*);
+    const rep_delta_chunk_t *const this_chunk
+      = APR_ARRAY_IDX (chunks, cur_chunk, rep_delta_chunk_t*);
 
     if ((this_chunk->offset + this_chunk->size) > rep_offset)
       {
@@ -416,17 +416,17 @@
                 apr_size_t *len,
                 trail_t *trail)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
   apr_size_t chunk_offset;
 
   /* Read in our REP. */
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
+  if (rep->kind == rep_kind_fulltext)
     {
-      SVN_ERR (svn_fs__bdb_string_read (fs, rep->contents.fulltext.string_key, 
+      SVN_ERR (svn_fs_bdb__string_read (fs, rep->contents.fulltext.string_key,
                                         buf, offset, len, trail));
     }
-  else if (rep->kind == svn_fs__rep_kind_delta)
+  else if (rep->kind == rep_kind_delta)
     {
       const int cur_chunk = get_chunk_offset (rep, offset, &chunk_offset);
       if (cur_chunk < 0)
@@ -440,12 +440,12 @@
             apr_array_make (trail->pool, 666, sizeof (rep));
           do
             {
-              const svn_fs__rep_delta_chunk_t *const first_chunk
+              const rep_delta_chunk_t *const first_chunk
                 = APR_ARRAY_IDX (rep->contents.delta.chunks,
-                                 0, svn_fs__rep_delta_chunk_t*);
-              const svn_fs__rep_delta_chunk_t *const chunk
+                                 0, rep_delta_chunk_t*);
+              const rep_delta_chunk_t *const chunk
                 = APR_ARRAY_IDX (rep->contents.delta.chunks,
-                                 cur_chunk, svn_fs__rep_delta_chunk_t*);
+                                 cur_chunk, rep_delta_chunk_t*);
 
               /* Verify that this chunk is of the same version as the first. */
               if (first_chunk->version != chunk->version)
@@ -455,19 +455,18 @@
                    rep_key);
 
               rep_key = chunk->rep_key;
-              *(svn_fs__representation_t**) apr_array_push (reps) = rep;
-              SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+              *(representation_t**) apr_array_push (reps) = rep;
+              SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
             }
-          while (rep->kind == svn_fs__rep_kind_delta
+          while (rep->kind == rep_kind_delta
                  && rep->contents.delta.chunks->nelts > cur_chunk);
 
           /* Right. We've either just read the fulltext rep, a rep that's
              too short, in which case we'll undeltify without source data.*/
-          if (rep->kind != svn_fs__rep_kind_delta
-              && rep->kind != svn_fs__rep_kind_fulltext)
+          if (rep->kind != rep_kind_delta && rep->kind != rep_kind_fulltext)
             abort(); /* unknown kind */
 
-          if (rep->kind == svn_fs__rep_kind_delta)
+          if (rep->kind == rep_kind_delta)
             rep = NULL;         /* Don't use source data */
           SVN_ERR (rep_undeltify_range (fs, reps, rep, cur_chunk,
                                         buf, chunk_offset, len, trail));
@@ -481,13 +480,13 @@
 
 
 svn_error_t *
-svn_fs__get_mutable_rep (const char **new_rep_key,
-                         const char *rep_key,
-                         svn_fs_t *fs,
-                         const char *txn_id,
-                         trail_t *trail)
+svn_fs_base__get_mutable_rep (const char **new_rep_key,
+                              const char *rep_key,
+                              svn_fs_t *fs,
+                              const char *txn_id,
+                              trail_t *trail)
 {
-  svn_fs__representation_t *rep = NULL;
+  representation_t *rep = NULL;
   const char *new_str = NULL;
 
   /* We were passed an existing REP_KEY, so examine it.  If it is
@@ -495,44 +494,45 @@
      key.  */
   if (rep_key && (rep_key[0] != '\0'))
     {
-      SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+      SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
       if (rep_is_mutable (rep, txn_id))
         {
           *new_rep_key = rep_key;
           return SVN_NO_ERROR;
         }
     }
-  
+
   /* Either we weren't provided a base key to examine, or the base key
      we were provided was not mutable.  So, let's make a new
      representation and return its key to the caller. */
-  SVN_ERR (svn_fs__bdb_string_append (fs, &new_str, 0, NULL, trail));
+  SVN_ERR (svn_fs_bdb__string_append (fs, &new_str, 0, NULL, trail));
   rep = make_fulltext_rep (new_str, txn_id, svn_md5_empty_string_digest (),
                            trail->pool);
-  SVN_ERR (svn_fs__bdb_write_new_rep (new_rep_key, fs, rep, trail));
+  SVN_ERR (svn_fs_bdb__write_new_rep (new_rep_key, fs, rep, trail));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__delete_rep_if_mutable (svn_fs_t *fs,
-                               const char *rep_key,
-                               const char *txn_id,
-                               trail_t *trail)
+svn_fs_base__delete_rep_if_mutable (svn_fs_t *fs,
+                                    const char *rep_key,
+                                    const char *txn_id,
+                                    trail_t *trail)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
 
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
   if (! rep_is_mutable (rep, txn_id))
     return SVN_NO_ERROR;
 
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  if (rep->kind == rep_kind_fulltext)
     {
-      SVN_ERR (svn_fs__bdb_string_delete (fs, rep->contents.fulltext.string_key,
+      SVN_ERR (svn_fs_bdb__string_delete (fs,
+                                          rep->contents.fulltext.string_key,
                                           trail));
     }
-  else if (rep->kind == svn_fs__rep_kind_delta)
+  else if (rep->kind == rep_kind_delta)
     {
       apr_array_header_t *keys;
       SVN_ERR (delta_string_keys (&keys, rep, trail->pool));
@@ -541,7 +541,7 @@
   else /* unknown kind */
     abort ();
 
-  SVN_ERR (svn_fs__bdb_delete_rep (fs, rep_key, trail));
+  SVN_ERR (svn_fs_bdb__delete_rep (fs, rep_key, trail));
   return SVN_NO_ERROR;
 }
 
@@ -569,7 +569,7 @@
      refetch the representation skel every time we want to read
      another chunk.  */
   const char *rep_key;
-  
+
   /* How many bytes have been read already. */
   svn_filesize_t offset;
 
@@ -578,7 +578,7 @@
   trail_t *trail;
 
   /* MD5 checksum.  Initialized when the baton is created, updated as
-     we read data, and finalized when the stream is closed. */ 
+     we read data, and finalized when the stream is closed. */
   struct apr_md5_ctx_t md5_context;
 
   /* The length of the rep's contents (as fulltext, that is,
@@ -616,7 +616,7 @@
   apr_md5_init (&(b->md5_context));
 
   if (rep_key)
-    SVN_ERR (svn_fs__rep_contents_size (&(b->size), fs, rep_key, trail));
+    SVN_ERR (svn_fs_base__rep_contents_size (&(b->size), fs, rep_key, trail));
   else
     b->size = 0;
 
@@ -637,35 +637,35 @@
 /*** Retrieving data. ***/
 
 svn_error_t *
-svn_fs__rep_contents_size (svn_filesize_t *size_p,
-                           svn_fs_t *fs,
-                           const char *rep_key,
-                           trail_t *trail)
+svn_fs_base__rep_contents_size (svn_filesize_t *size_p,
+                                svn_fs_t *fs,
+                                const char *rep_key,
+                                trail_t *trail)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
 
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
 
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  if (rep->kind == rep_kind_fulltext)
     {
       /* Get the size by asking Berkeley for the string's length. */
-      SVN_ERR (svn_fs__bdb_string_size (size_p, fs, 
-                                        rep->contents.fulltext.string_key, 
+      SVN_ERR (svn_fs_bdb__string_size (size_p, fs,
+                                        rep->contents.fulltext.string_key,
                                         trail));
     }
-  else if (rep->kind == svn_fs__rep_kind_delta)
+  else if (rep->kind == rep_kind_delta)
     {
       /* Get the size by finding the last window pkg in the delta and
          adding its offset to its size.  This way, we won't even be
          messed up by overlapping windows, as long as the window pkgs
          are still ordered. */
       apr_array_header_t *chunks = rep->contents.delta.chunks;
-      svn_fs__rep_delta_chunk_t *last_chunk;
+      rep_delta_chunk_t *last_chunk;
 
       assert (chunks->nelts);
 
       last_chunk = APR_ARRAY_IDX (chunks, chunks->nelts - 1,
-                                  svn_fs__rep_delta_chunk_t *);
+                                  rep_delta_chunk_t *);
       *size_p = last_chunk->offset + last_chunk->size;
     }
   else /* unknown kind */
@@ -676,14 +676,14 @@
 
 
 svn_error_t *
-svn_fs__rep_contents_checksum (unsigned char digest[],
-                               svn_fs_t *fs,
-                               const char *rep_key,
-                               trail_t *trail)
+svn_fs_base__rep_contents_checksum (unsigned char digest[],
+                                    svn_fs_t *fs,
+                                    const char *rep_key,
+                                    trail_t *trail)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
 
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
   memcpy (digest, rep->checksum, APR_MD5_DIGESTSIZE);
 
   return SVN_NO_ERROR;
@@ -691,16 +691,17 @@
 
 
 svn_error_t *
-svn_fs__rep_contents (svn_string_t *str,
-                      svn_fs_t *fs,
-                      const char *rep_key,
-                      trail_t *trail)
+svn_fs_base__rep_contents (svn_string_t *str,
+                           svn_fs_t *fs,
+                           const char *rep_key,
+                           trail_t *trail)
 {
   svn_filesize_t contents_size;
   apr_size_t len;
   char *data;
 
-  SVN_ERR (svn_fs__rep_contents_size (&contents_size, fs, rep_key, trail));
+  SVN_ERR (svn_fs_base__rep_contents_size (&contents_size, fs, rep_key,
+                                           trail));
 
   /* What if the contents are larger than we can handle? */
   if (contents_size > SVN_MAX_OBJECT_SIZE)
@@ -725,15 +726,15 @@
 
   /* Just the standard paranoia. */
   {
-    svn_fs__representation_t *rep;
+    representation_t *rep;
     apr_md5_ctx_t md5_context;
     unsigned char checksum[APR_MD5_DIGESTSIZE];
-    
+
     apr_md5_init (&md5_context);
     apr_md5_update (&md5_context, str->data, str->len);
     apr_md5_final (checksum, &md5_context);
 
-    SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+    SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
     if (! svn_md5_digests_match (checksum, rep->checksum))
       return svn_error_createf
         (SVN_ERR_FS_CORRUPT, NULL,
@@ -764,7 +765,7 @@
 
    Afterwards, *(BATON->len) is the number of bytes actually read, and
    BATON->rb->offset is incremented by that amount.
-   
+
    If BATON->rb->rep_key is null, this is assumed to mean the file's
    contents have no representation, i.e., the file has no contents.
    In that case, if BATON->rb->offset > 0, return the error
@@ -810,13 +811,13 @@
 
           if (args->rb->offset == args->rb->size)
             {
-              svn_fs__representation_t *rep;
+              representation_t *rep;
               unsigned char checksum[APR_MD5_DIGESTSIZE];
-              
+
               apr_md5_final (checksum, &(args->rb->md5_context));
               args->rb->checksum_finalized = TRUE;
 
-              SVN_ERR (svn_fs__bdb_read_rep (&rep, args->rb->fs,
+              SVN_ERR (svn_fs_bdb__read_rep (&rep, args->rb->fs,
                                              args->rb->rep_key, trail));
               if (! svn_md5_digests_match (checksum, rep->checksum))
                 return svn_error_createf
@@ -865,10 +866,10 @@
          from creating millions of unnecessary trail subpools when
          reading a big file. */
       apr_pool_t *subpool = svn_pool_create (rb->pool);
-      SVN_ERR (svn_fs__retry_txn (rb->fs,
-                                  txn_body_read_rep,
-                                  &args,
-                                  subpool));
+      SVN_ERR (svn_fs_base__retry_txn (rb->fs,
+                                       txn_body_read_rep,
+                                       &args,
+                                       subpool));
       svn_pool_destroy (subpool);
     }
   return SVN_NO_ERROR;
@@ -885,13 +886,13 @@
 
   /* The representation skel whose contents we want to write. */
   const char *rep_key;
-  
+
   /* The transaction id under which this write action will take
      place. */
   const char *txn_id;
 
   /* If present, do the write as part of this trail, and use trail's
-     pool.  Otherwise, see `pool' below.  */ 
+     pool.  Otherwise, see `pool' below.  */
   trail_t *trail;
 
   /* MD5 checksum.  Initialized when the baton is created, updated as
@@ -939,21 +940,21 @@
            const char *txn_id,
            trail_t *trail)
 {
-  svn_fs__representation_t *rep;
-        
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+  representation_t *rep;
+
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
 
   if (! rep_is_mutable (rep, txn_id))
     return svn_error_createf
       (SVN_ERR_FS_REP_NOT_MUTABLE, NULL,
        "Rep '%s' is not mutable", rep_key);
 
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  if (rep->kind == rep_kind_fulltext)
     {
-      SVN_ERR (svn_fs__bdb_string_append
+      SVN_ERR (svn_fs_bdb__string_append
                (fs, &(rep->contents.fulltext.string_key), len, buf, trail));
     }
-  else if (rep->kind == svn_fs__rep_kind_delta)
+  else if (rep->kind == rep_kind_delta)
     {
       /* There should never be a case when we have a mutable
          non-fulltext rep.  The only code that creates mutable reps is
@@ -979,7 +980,7 @@
 
 /* BATON is of type `write_rep_args':
    Append onto BATON->wb->rep_key's contents BATON->len bytes of
-   data from BATON->wb->buf, in BATON->rb->fs, as part of TRAIL.  
+   data from BATON->wb->buf, in BATON->rb->fs, as part of TRAIL.
 
    If the representation is not mutable, return the error
    SVN_FS_REP_NOT_MUTABLE.  */
@@ -1002,8 +1003,8 @@
 
 
 static svn_error_t *
-rep_write_contents (void *baton, 
-                    const char *buf, 
+rep_write_contents (void *baton,
+                    const char *buf,
                     apr_size_t *len)
 {
   struct rep_write_baton *wb = baton;
@@ -1029,10 +1030,10 @@
          millions of unnecessary trail subpools when writing a big
          file. */
       apr_pool_t *subpool = svn_pool_create (wb->pool);
-      SVN_ERR (svn_fs__retry_txn (wb->fs,
-                                  txn_body_write_rep,
-                                  &args,
-                                  subpool));
+      SVN_ERR (svn_fs_base__retry_txn (wb->fs,
+                                       txn_body_write_rep,
+                                       &args,
+                                       subpool));
       svn_pool_destroy (subpool);
     }
 
@@ -1046,17 +1047,17 @@
 txn_body_write_close_rep (void *baton, trail_t *trail)
 {
   struct rep_write_baton *wb = baton;
-  svn_fs__representation_t *rep;
+  representation_t *rep;
 
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, wb->fs, wb->rep_key, trail));
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, wb->fs, wb->rep_key, trail));
   memcpy (rep->checksum, wb->md5_digest, APR_MD5_DIGESTSIZE);
-  SVN_ERR (svn_fs__bdb_write_rep (wb->fs, wb->rep_key, rep, trail));
+  SVN_ERR (svn_fs_bdb__write_rep (wb->fs, wb->rep_key, rep, trail));
 
   return SVN_NO_ERROR;
 }
 
 
-/* BATON is of type `struct rep_write_baton'. 
+/* BATON is of type `struct rep_write_baton'.
  *
  * Finalize BATON->md5_context and store the resulting digest under
  * BATON->rep_key.
@@ -1087,10 +1088,10 @@
     }
   else
     {
-      SVN_ERR (svn_fs__retry_txn (wb->fs,
-                                  txn_body_write_close_rep,
-                                  wb,
-                                  wb->pool));
+      SVN_ERR (svn_fs_base__retry_txn (wb->fs,
+                                       txn_body_write_close_rep,
+                                       wb,
+                                       wb->pool));
     }
 
   return SVN_NO_ERROR;
@@ -1100,12 +1101,12 @@
 /** Public read and write stream constructors. **/
 
 svn_error_t *
-svn_fs__rep_contents_read_stream (svn_stream_t **rs_p,
-                                  svn_fs_t *fs,
-                                  const char *rep_key,
-                                  svn_boolean_t use_trail_for_reads,
-                                  trail_t *trail,
-                                  apr_pool_t *pool)
+svn_fs_base__rep_contents_read_stream (svn_stream_t **rs_p,
+                                       svn_fs_t *fs,
+                                       const char *rep_key,
+                                       svn_boolean_t use_trail_for_reads,
+                                       trail_t *trail,
+                                       apr_pool_t *pool)
 {
   struct rep_read_baton *rb;
 
@@ -1128,10 +1129,10 @@
                     const char *txn_id,
                     trail_t *trail)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
   const char *str_key;
 
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, fs, rep_key, trail));
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, fs, rep_key, trail));
 
   /* Make sure it's mutable. */
   if (! rep_is_mutable (rep, txn_id))
@@ -1139,30 +1140,30 @@
       (SVN_ERR_FS_REP_NOT_MUTABLE, NULL,
        "Rep '%s' is not mutable", rep_key);
 
-  assert (rep->kind == svn_fs__rep_kind_fulltext);
+  assert (rep->kind == rep_kind_fulltext);
 
   /* If rep has no string, just return success.  Else, clear the
      underlying string.  */
   str_key = rep->contents.fulltext.string_key;
   if (str_key && *str_key)
     {
-      SVN_ERR (svn_fs__bdb_string_clear (fs, str_key, trail));
+      SVN_ERR (svn_fs_bdb__string_clear (fs, str_key, trail));
       memcpy (rep->checksum, svn_md5_empty_string_digest (),
               APR_MD5_DIGESTSIZE);
-      SVN_ERR (svn_fs__bdb_write_rep (fs, rep_key, rep, trail));
+      SVN_ERR (svn_fs_bdb__write_rep (fs, rep_key, rep, trail));
     }
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__rep_contents_write_stream (svn_stream_t **ws_p,
-                                   svn_fs_t *fs,
-                                   const char *rep_key,
-                                   const char *txn_id,
-                                   svn_boolean_t use_trail_for_writes,
-                                   trail_t *trail,
-                                   apr_pool_t *pool)
+svn_fs_base__rep_contents_write_stream (svn_stream_t **ws_p,
+                                        svn_fs_t *fs,
+                                        const char *rep_key,
+                                        const char *txn_id,
+                                        svn_boolean_t use_trail_for_writes,
+                                        trail_t *trail,
+                                        apr_pool_t *pool)
 {
   struct rep_write_baton *wb;
 
@@ -1190,7 +1191,7 @@
   svn_fs_t *fs;
 
   /* The key of the string we're writing to.  Typically this is
-     initialized to NULL, so svn_fs__string_append() can fill in a
+     initialized to NULL, so svn_fs_base__string_append() can fill in a
      value. */
   const char *key;
 
@@ -1241,16 +1242,16 @@
       *len -= nheader;
       buf += nheader;
       wb->header_read += nheader;
-      
+
       /* If we have *now* read the full 4-byte header, check that
          least byte for the version number of the svndiff format. */
       if (wb->header_read == 4)
         wb->version = *(buf - 1);
     }
-  
+
   /* Append to the current string we're writing (or create a new one
      if WB->key is NULL). */
-  SVN_ERR (svn_fs__bdb_string_append (wb->fs, &(wb->key), *len, 
+  SVN_ERR (svn_fs_bdb__string_append (wb->fs, &(wb->key), *len,
                                       buf, wb->trail));
 
   /* Make sure we (still) have a key. */
@@ -1280,10 +1281,10 @@
 
 
 svn_error_t *
-svn_fs__rep_deltify (svn_fs_t *fs,
-                     const char *target,
-                     const char *source,
-                     trail_t *trail)
+svn_fs_base__rep_deltify (svn_fs_t *fs,
+                          const char *target,
+                          const char *source,
+                          trail_t *trail)
 {
   apr_pool_t *pool = trail->pool; /* convenience */
   svn_stream_t *source_stream; /* stream to read the source */
@@ -1297,11 +1298,11 @@
   /* stream to write new (deltified) target data and its baton */
   svn_stream_t *new_target_stream;
   struct write_svndiff_strings_baton new_target_baton;
-  
+
   /* window handler/baton for writing to above stream */
   svn_txdelta_window_handler_t new_target_handler;
   void *new_target_handler_baton;
-  
+
   /* yes, we do windows */
   svn_txdelta_window_t *window;
 
@@ -1315,7 +1316,7 @@
 
   /* TARGET's original string keys */
   apr_array_header_t *orig_str_keys;
-  
+
   /* The digest for the representation's fulltext contents. */
   unsigned char rep_digest[APR_MD5_DIGESTSIZE];
 
@@ -1343,10 +1344,10 @@
   svn_stream_set_write (new_target_stream, write_svndiff_strings);
 
   /* Get streams to our source and target text data. */
-  SVN_ERR (svn_fs__rep_contents_read_stream (&source_stream, fs, source,
-                                             TRUE, trail, pool));
-  SVN_ERR (svn_fs__rep_contents_read_stream (&target_stream, fs, target,
-                                             TRUE, trail, pool));
+  SVN_ERR (svn_fs_base__rep_contents_read_stream (&source_stream, fs, source,
+                                                  TRUE, trail, pool));
+  SVN_ERR (svn_fs_base__rep_contents_read_stream (&target_stream, fs, target,
+                                                  TRUE, trail, pool));
 
   /* Setup a stream to convert the textdelta data into svndiff windows. */
   svn_txdelta (&txdelta_stream, source_stream, target_stream, pool);
@@ -1382,7 +1383,7 @@
           /* Update our recordkeeping variables. */
           tview_off += window->tview_len;
           diffsize += ww->svndiff_len;
-           
+
           /* Free the window. */
           svn_pool_clear (wpool);
         }
@@ -1407,16 +1408,16 @@
      if we're replacing a delta; in that case, we're going for a time
      optimization, not a space optimization.)  */
   {
-    svn_fs__representation_t *old_rep;
+    representation_t *old_rep;
     const char *str_key;
 
-    SVN_ERR (svn_fs__bdb_read_rep (&old_rep, fs, target, trail));
-    if (old_rep->kind == svn_fs__rep_kind_fulltext)
+    SVN_ERR (svn_fs_bdb__read_rep (&old_rep, fs, target, trail));
+    if (old_rep->kind == rep_kind_fulltext)
       {
         svn_filesize_t old_size = 0;
 
         str_key = old_rep->contents.fulltext.string_key;
-        SVN_ERR (svn_fs__bdb_string_size (&old_size, fs, str_key, trail));
+        SVN_ERR (svn_fs_bdb__string_size (&old_size, fs, str_key, trail));
         orig_str_keys = apr_array_make (pool, 1, sizeof (str_key));
         (*((const char **)(apr_array_push (orig_str_keys)))) = str_key;
 
@@ -1428,12 +1429,12 @@
             for (i = 0; i < windows->nelts; i++)
               {
                 ww = ((window_write_t **) windows->elts)[i];
-                SVN_ERR (svn_fs__bdb_string_delete (fs, ww->key, trail));
+                SVN_ERR (svn_fs_bdb__string_delete (fs, ww->key, trail));
               }
             return SVN_NO_ERROR;
           }
       }
-    else if (old_rep->kind == svn_fs__rep_kind_delta)
+    else if (old_rep->kind == rep_kind_delta)
       SVN_ERR (delta_string_keys (&orig_str_keys, old_rep, pool));
     else /* unknown kind */
       abort ();
@@ -1445,12 +1446,12 @@
   /* Hook the new strings we wrote into the rest of the filesystem by
      building a new representation to replace our old one. */
   {
-    svn_fs__representation_t new_rep;
-    svn_fs__rep_delta_chunk_t *chunk;
+    representation_t new_rep;
+    rep_delta_chunk_t *chunk;
     apr_array_header_t *chunks;
     int i;
 
-    new_rep.kind = svn_fs__rep_kind_delta;
+    new_rep.kind = rep_kind_delta;
     new_rep.txn_id = NULL;
 
     /* Migrate the old rep's checksum to the new rep. */
@@ -1475,14 +1476,14 @@
         chunk->rep_key = source;
 
         /* Add this chunk to the array. */
-        (*((svn_fs__rep_delta_chunk_t **)(apr_array_push (chunks)))) = chunk;
+        (*((rep_delta_chunk_t **)(apr_array_push (chunks)))) = chunk;
       }
-    
+
     /* Put the chunks array into the representation. */
     new_rep.contents.delta.chunks = chunks;
 
     /* Write out the new representation. */
-    SVN_ERR (svn_fs__bdb_write_rep (fs, target, &new_rep, trail));
+    SVN_ERR (svn_fs_bdb__write_rep (fs, target, &new_rep, trail));
 
     /* Delete the original pre-deltified strings. */
     SVN_ERR (delete_strings (orig_str_keys, fs, trail));

Modified: trunk/subversion/libsvn_fs_base/reps-strings.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/reps-strings.h	(original)
+++ trunk/subversion/libsvn_fs_base/reps-strings.h	Thu Apr 29 18:17:29 2004
@@ -41,11 +41,11 @@
    If REP_KEY is already a mutable representation, set *NEW_REP_KEY to
    REP_KEY, else set *NEW_REP_KEY to a brand new rep key allocated in
    TRAIL->pool. */
-svn_error_t *svn_fs__get_mutable_rep (const char **new_rep_key,
-                                      const char *rep_key,
-                                      svn_fs_t *fs, 
-                                      const char *txn_id,
-                                      trail_t *trail);
+svn_error_t *svn_fs_base__get_mutable_rep (const char **new_rep_key,
+                                           const char *rep_key,
+                                           svn_fs_t *fs,
+                                           const char *txn_id,
+                                           trail_t *trail);
 
 
 /* Delete REP_KEY from FS if REP_KEY is mutable, as part of trail, or
@@ -53,11 +53,11 @@
    the string it refers to is deleted as well.  TXN_ID is the id of
    the Subversion transaction under which this occurs.
 
-   If no such rep, return SVN_ERR_FS_NO_SUCH_REPRESENTATION.  */ 
-svn_error_t *svn_fs__delete_rep_if_mutable (svn_fs_t *fs,
-                                            const char *rep_key,
-                                            const char *txn_id,
-                                            trail_t *trail);
+   If no such rep, return SVN_ERR_FS_NO_SUCH_REPRESENTATION.  */
+svn_error_t *svn_fs_base__delete_rep_if_mutable (svn_fs_t *fs,
+                                                 const char *rep_key,
+                                                 const char *txn_id,
+                                                 trail_t *trail);
 
 
 
@@ -67,10 +67,10 @@
 /* Set *SIZE_P to the size of REP_KEY's contents in FS, as part of TRAIL.
    Note: this is the fulltext size, no matter how the contents are
    represented in storage.  */
-svn_error_t *svn_fs__rep_contents_size (svn_filesize_t *size_p,
-                                        svn_fs_t *fs,
-                                        const char *rep_key,
-                                        trail_t *trail);
+svn_error_t *svn_fs_base__rep_contents_size (svn_filesize_t *size_p,
+                                             svn_fs_t *fs,
+                                             const char *rep_key,
+                                             trail_t *trail);
 
 
 /* Put into DIGEST the MD5 checksum for REP_KEY in FS, as part of TRAIL.
@@ -78,10 +78,10 @@
    If no checksum is available, do not calculate one dynamically, just
    put all 0's into DIGEST.  (By convention, the all-zero checksum is
    considered to match any checksum.) */
-svn_error_t *svn_fs__rep_contents_checksum (unsigned char digest[],
-                                            svn_fs_t *fs,
-                                            const char *rep_key,
-                                            trail_t *trail);
+svn_error_t *svn_fs_base__rep_contents_checksum (unsigned char digest[],
+                                                 svn_fs_t *fs,
+                                                 const char *rep_key,
+                                                 trail_t *trail);
 
 
 /* Set STR->data to the contents of REP_KEY in FS, and STR->len to the
@@ -91,10 +91,10 @@
 
    Note: this is the fulltext contents, no matter how the contents are
    represented in storage.  */
-svn_error_t *svn_fs__rep_contents (svn_string_t *str,
-                                   svn_fs_t *fs,
-                                   const char *rep_key,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__rep_contents (svn_string_t *str,
+                                        svn_fs_t *fs,
+                                        const char *rep_key,
+                                        trail_t *trail);
 
 
 /* Set *RS_P to a stream to read the contents of REP_KEY in FS.
@@ -106,14 +106,14 @@
    of TRAIL; otherwise, each read happens in an internal, one-off
    trail (though TRAIL is still required).  POOL may be TRAIL->pool. */
 svn_error_t *
-svn_fs__rep_contents_read_stream (svn_stream_t **rs_p,
-                                  svn_fs_t *fs,
-                                  const char *rep_key,
-                                  svn_boolean_t use_trail_for_reads,
-                                  trail_t *trail,
-                                  apr_pool_t *pool);
+svn_fs_base__rep_contents_read_stream (svn_stream_t **rs_p,
+                                       svn_fs_t *fs,
+                                       const char *rep_key,
+                                       svn_boolean_t use_trail_for_reads,
+                                       trail_t *trail,
+                                       apr_pool_t *pool);
+
 
-                                       
 /* Set *WS_P to a stream to write the contents of REP_KEY.  Allocate
    the stream in POOL.  TXN_ID is the id of the Subversion transaction
    under which this occurs.
@@ -125,13 +125,13 @@
    If REP_KEY is not mutable, writes to *WS_P will return the
    error SVN_ERR_FS_REP_NOT_MUTABLE.  */
 svn_error_t *
-svn_fs__rep_contents_write_stream (svn_stream_t **ws_p,
-                                   svn_fs_t *fs,
-                                   const char *rep_key,
-                                   const char *txn_id,
-                                   svn_boolean_t use_trail_for_writes,
-                                   trail_t *trail,
-                                   apr_pool_t *pool);
+svn_fs_base__rep_contents_write_stream (svn_stream_t **ws_p,
+                                        svn_fs_t *fs,
+                                        const char *rep_key,
+                                        const char *txn_id,
+                                        svn_boolean_t use_trail_for_writes,
+                                        trail_t *trail,
+                                        apr_pool_t *pool);
 
 
 
@@ -144,17 +144,17 @@
    This usually results in TARGET's data being stored as a diff
    against SOURCE; but it might not, if it turns out to be more
    efficient to store the contents some other way.  */
-svn_error_t *svn_fs__rep_deltify (svn_fs_t *fs,
-                                  const char *target,
-                                  const char *source,
-                                  trail_t *trail);
+svn_error_t *svn_fs_base__rep_deltify (svn_fs_t *fs,
+                                       const char *target,
+                                       const char *source,
+                                       trail_t *trail);
 
 
 /* Ensure that REP_KEY refers to storage that is maintained as fulltext,
    not as a delta against other strings, in FS, as part of TRAIL.  */
-svn_error_t *svn_fs__rep_undeltify (svn_fs_t *fs,
-                                    const char *rep_key,
-                                    trail_t *trail);
+svn_error_t *svn_fs_base__rep_undeltify (svn_fs_t *fs,
+                                         const char *rep_key,
+                                         trail_t *trail);
 
 
 

Modified: trunk/subversion/libsvn_fs_base/revs-txns.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/revs-txns.c	(original)
+++ trunk/subversion/libsvn_fs_base/revs-txns.c	Thu Apr 29 18:17:29 2004
@@ -29,7 +29,6 @@
 #include "fs.h"
 #include "dag.h"
 #include "err.h"
-#include "id.h"
 #include "trail.h"
 #include "tree.h"
 #include "revs-txns.h"
@@ -38,6 +37,7 @@
 #include "bdb/txn-table.h"
 #include "bdb/copies-table.h"
 #include "bdb/changes-table.h"
+#include "../libsvn_fs/fs-loader.h"
 
 
 
@@ -49,18 +49,18 @@
    EXPECT_DEAD is not set, an error is thrown if the transaction is
    *not* dead. */
 static svn_error_t *
-get_txn (svn_fs__transaction_t **txn_p,
+get_txn (transaction_t **txn_p,
          svn_fs_t *fs,
          const char *txn_id,
          svn_boolean_t expect_dead,
          trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
-  SVN_ERR (svn_fs__bdb_get_txn (&txn, fs, txn_id, trail));
-  if (expect_dead && (txn->kind != svn_fs__transaction_kind_dead))
+  transaction_t *txn;
+  SVN_ERR (svn_fs_bdb__get_txn (&txn, fs, txn_id, trail));
+  if (expect_dead && (txn->kind != transaction_kind_dead))
     return svn_error_createf (SVN_ERR_FS_TRANSACTION_NOT_DEAD, 0,
                               "Transaction is not dead: '%s'", txn_id);
-  if ((! expect_dead) && (txn->kind == svn_fs__transaction_kind_dead))
+  if ((! expect_dead) && (txn->kind == transaction_kind_dead))
     return svn_error_createf (SVN_ERR_FS_TRANSACTION_DEAD, 0,
                               "Transaction is dead: '%s'", txn_id);
   *txn_p = txn;
@@ -69,7 +69,7 @@
 
 
 /* This is only for symmetry with the get_txn() helper. */
-#define put_txn svn_fs__bdb_put_txn
+#define put_txn svn_fs_bdb__put_txn
 
 
 
@@ -79,22 +79,22 @@
    (as long as those parameters aren't NULL) for the revision REV in
    FS as part of TRAIL.  */
 static svn_error_t *
-get_rev_txn (svn_fs__transaction_t **txn_p,
+get_rev_txn (transaction_t **txn_p,
              const char **txn_id,
              svn_fs_t *fs,
              svn_revnum_t rev,
              trail_t *trail)
 {
-  svn_fs__revision_t *revision;
-  svn_fs__transaction_t *txn;
-  
-  SVN_ERR (svn_fs__bdb_get_rev (&revision, fs, rev, trail));
+  revision_t *revision;
+  transaction_t *txn;
+
+  SVN_ERR (svn_fs_bdb__get_rev (&revision, fs, rev, trail));
   if (revision->txn_id == NULL)
-    return svn_fs__err_corrupt_fs_revision (fs, rev);
+    return svn_fs_base__err_corrupt_fs_revision (fs, rev);
 
   SVN_ERR (get_txn (&txn, fs, revision->txn_id, FALSE, trail));
   if (txn->revision != rev)
-    return svn_fs__err_corrupt_txn (fs, revision->txn_id);
+    return svn_fs_base__err_corrupt_txn (fs, revision->txn_id);
 
   if (txn_p)
     *txn_p = txn;
@@ -105,16 +105,16 @@
 
 
 svn_error_t *
-svn_fs__rev_get_root (const svn_fs_id_t **root_id_p,
-                      svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      trail_t *trail)
+svn_fs_base__rev_get_root (const svn_fs_id_t **root_id_p,
+                           svn_fs_t *fs,
+                           svn_revnum_t rev,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
-  
+  transaction_t *txn;
+
   SVN_ERR (get_rev_txn (&txn, NULL, fs, rev, trail));
   if (txn->root_id == NULL)
-    return svn_fs__err_corrupt_fs_revision (fs, rev);
+    return svn_fs_base__err_corrupt_fs_revision (fs, rev);
 
   *root_id_p = txn->root_id;
   return SVN_NO_ERROR;
@@ -122,16 +122,16 @@
 
 
 svn_error_t *
-svn_fs__rev_get_txn_id (const char **txn_id_p,
-                        svn_fs_t *fs,
-                        svn_revnum_t rev,
-                        trail_t *trail)
+svn_fs_base__rev_get_txn_id (const char **txn_id_p,
+                             svn_fs_t *fs,
+                             svn_revnum_t rev,
+                             trail_t *trail)
 {
-  svn_fs__revision_t *revision;
+  revision_t *revision;
 
-  SVN_ERR (svn_fs__bdb_get_rev (&revision, fs, rev, trail));
+  SVN_ERR (svn_fs_bdb__get_rev (&revision, fs, rev, trail));
   if (revision->txn_id == NULL)
-    return svn_fs__err_corrupt_fs_revision (fs, rev);
+    return svn_fs_base__err_corrupt_fs_revision (fs, rev);
 
   *txn_id_p = revision->txn_id;
   return SVN_NO_ERROR;
@@ -142,18 +142,19 @@
 txn_body_youngest_rev (void *baton,
                        trail_t *trail)
 {
-  return svn_fs__bdb_youngest_rev (baton, trail->fs, trail);
+  return svn_fs_bdb__youngest_rev (baton, trail->fs, trail);
 }
 
 
 svn_error_t *
-svn_fs_youngest_rev (svn_revnum_t *youngest_p,
-                     svn_fs_t *fs,
-                     apr_pool_t *pool)
+svn_fs_base__youngest_rev (svn_revnum_t *youngest_p,
+                           svn_fs_t *fs,
+                           apr_pool_t *pool)
 {
   svn_revnum_t youngest;
-  SVN_ERR (svn_fs__check_fs (fs));
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_youngest_rev, &youngest, pool));
+  SVN_ERR (svn_fs_base__check_fs (fs));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_youngest_rev, &youngest,
+                                   pool));
   *youngest_p = youngest;
   return SVN_NO_ERROR;
 }
@@ -169,7 +170,7 @@
 txn_body_revision_proplist (void *baton, trail_t *trail)
 {
   struct revision_proplist_args *args = baton;
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   SVN_ERR (get_rev_txn (&txn, NULL, trail->fs, args->rev, trail));
   *(args->table_p) = txn->proplist;
@@ -178,19 +179,20 @@
 
 
 svn_error_t *
-svn_fs_revision_proplist (apr_hash_t **table_p,
-                          svn_fs_t *fs,
-                          svn_revnum_t rev,
-                          apr_pool_t *pool)
+svn_fs_base__revision_proplist (apr_hash_t **table_p,
+                                svn_fs_t *fs,
+                                svn_revnum_t rev,
+                                apr_pool_t *pool)
 {
   struct revision_proplist_args args;
   apr_hash_t *table;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.table_p = &table;
   args.rev = rev;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_revision_proplist, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_revision_proplist, &args,
+                                   pool));
 
   *table_p = table ? table : apr_hash_make (pool);
   return SVN_NO_ERROR;
@@ -198,21 +200,22 @@
 
 
 svn_error_t *
-svn_fs_revision_prop (svn_string_t **value_p,
-                      svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      const char *propname,
-                      apr_pool_t *pool)
+svn_fs_base__revision_prop (svn_string_t **value_p,
+                            svn_fs_t *fs,
+                            svn_revnum_t rev,
+                            const char *propname,
+                            apr_pool_t *pool)
 {
   struct revision_proplist_args args;
   apr_hash_t *table;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   /* Get the proplist. */
   args.table_p = &table;
   args.rev = rev;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_revision_proplist, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_revision_proplist, &args,
+                                   pool));
 
   /* And then the prop from that list (if there was a list). */
   *value_p = NULL;
@@ -224,13 +227,13 @@
 
 
 svn_error_t *
-svn_fs__set_rev_prop (svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      const char *name,
-                      const svn_string_t *value,
-                      trail_t *trail)
+svn_fs_base__set_rev_prop (svn_fs_t *fs,
+                           svn_revnum_t rev,
+                           const char *name,
+                           const svn_string_t *value,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
   const char *txn_id;
 
   SVN_ERR (get_rev_txn (&txn, &txn_id, fs, rev, trail));
@@ -263,28 +266,28 @@
 {
   struct change_rev_prop_args *args = baton;
 
-  SVN_ERR (svn_fs__set_rev_prop (trail->fs, args->rev,
-                                 args->name, args->value, trail));
+  SVN_ERR (svn_fs_base__set_rev_prop (trail->fs, args->rev,
+                                      args->name, args->value, trail));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs_change_rev_prop (svn_fs_t *fs,
-                        svn_revnum_t rev,
-                        const char *name,
-                        const svn_string_t *value,
-                        apr_pool_t *pool)
+svn_fs_base__change_rev_prop (svn_fs_t *fs,
+                              svn_revnum_t rev,
+                              const char *name,
+                              const svn_string_t *value,
+                              apr_pool_t *pool)
 {
   struct change_rev_prop_args args;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.rev = rev;
   args.name = name;
   args.value = value;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_change_rev_prop, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_change_rev_prop, &args, pool));
 
   return SVN_NO_ERROR;
 }
@@ -294,36 +297,36 @@
 /*** Transactions ***/
 
 svn_error_t *
-svn_fs__txn_make_committed (svn_fs_t *fs,
-                            const char *txn_name,
-                            svn_revnum_t revision,
-                            trail_t *trail)
+svn_fs_base__txn_make_committed (svn_fs_t *fs,
+                                 const char *txn_name,
+                                 svn_revnum_t revision,
+                                 trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   /* Don't you dare call this with an invalid REVISION. */
   assert (SVN_IS_VALID_REVNUM (revision));
 
   /* Make sure the TXN is not committed already. */
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   /* Convert TXN to a committed transaction. */
   txn->base_id = NULL;
   txn->revision = revision;
-  txn->kind = svn_fs__transaction_kind_committed;
+  txn->kind = transaction_kind_committed;
   return put_txn (fs, txn, txn_name, trail);
 }
 
 
 svn_error_t *
-svn_fs__txn_get_revision (svn_revnum_t *revision,
-                          svn_fs_t *fs,
-                          const char *txn_name,
-                          trail_t *trail)
+svn_fs_base__txn_get_revision (svn_revnum_t *revision,
+                               svn_fs_t *fs,
+                               const char *txn_name,
+                               trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
   *revision = txn->revision;
   return SVN_NO_ERROR;
@@ -331,17 +334,17 @@
 
 
 svn_error_t *
-svn_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
-                     const svn_fs_id_t **base_root_id_p,
-                     svn_fs_t *fs,
-                     const char *txn_name,
-                     trail_t *trail)
+svn_fs_base__get_txn_ids (const svn_fs_id_t **root_id_p,
+                          const svn_fs_id_t **base_root_id_p,
+                          svn_fs_t *fs,
+                          const char *txn_name,
+                          trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
-  
+  transaction_t *txn;
+
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   *root_id_p = txn->root_id;
   *base_root_id_p = txn->base_id;
@@ -350,16 +353,16 @@
 
 
 svn_error_t *
-svn_fs__set_txn_root (svn_fs_t *fs,
-                      const char *txn_name,
-                      const svn_fs_id_t *new_id,
-                      trail_t *trail)
+svn_fs_base__set_txn_root (svn_fs_t *fs,
+                           const char *txn_name,
+                           const svn_fs_id_t *new_id,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   if (! svn_fs__id_eq (txn->root_id, new_id))
     {
@@ -371,16 +374,16 @@
 
 
 svn_error_t *
-svn_fs__set_txn_base (svn_fs_t *fs,
-                      const char *txn_name,
-                      const svn_fs_id_t *new_id,
-                      trail_t *trail)
+svn_fs_base__set_txn_base (svn_fs_t *fs,
+                           const char *txn_name,
+                           const svn_fs_id_t *new_id,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   if (! svn_fs__id_eq (txn->base_id, new_id))
     {
@@ -392,17 +395,17 @@
 
 
 svn_error_t *
-svn_fs__add_txn_copy (svn_fs_t *fs,
-                      const char *txn_name,
-                      const char *copy_id,
-                      trail_t *trail)
+svn_fs_base__add_txn_copy (svn_fs_t *fs,
+                           const char *txn_name,
+                           const char *copy_id,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   /* Get the transaction and ensure its mutability. */
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   /* Allocate a new array if this transaction has no copies. */
   if (! txn->copies)
@@ -429,32 +432,32 @@
 static svn_error_t *
 txn_body_txn_proplist (void *baton, trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
   struct txn_proplist_args *args = baton;
 
   SVN_ERR (get_txn (&txn, trail->fs, args->id, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (trail->fs, args->id);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (trail->fs, args->id);
 
-  *(args->table_p) = txn->proplist; 
+  *(args->table_p) = txn->proplist;
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs_txn_proplist (apr_hash_t **table_p,
-                     svn_fs_txn_t *txn,
-                     apr_pool_t *pool)
+svn_fs_base__txn_proplist (apr_hash_t **table_p,
+                           svn_fs_txn_t *txn,
+                           apr_pool_t *pool)
 {
   struct txn_proplist_args args;
   apr_hash_t *table;
   svn_fs_t *fs = txn->fs;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.table_p = &table;
-  SVN_ERR (svn_fs_txn_name (&args.id, txn, pool));
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_txn_proplist, &args, pool));
+  args.id = txn->id;
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_txn_proplist, &args, pool));
 
   *table_p = table ? table : apr_hash_make (pool);
   return SVN_NO_ERROR;
@@ -462,21 +465,21 @@
 
 
 svn_error_t *
-svn_fs_txn_prop (svn_string_t **value_p,
-                 svn_fs_txn_t *txn,
-                 const char *propname,
-                 apr_pool_t *pool)
+svn_fs_base__txn_prop (svn_string_t **value_p,
+                       svn_fs_txn_t *txn,
+                       const char *propname,
+                       apr_pool_t *pool)
 {
   struct txn_proplist_args args;
   apr_hash_t *table;
   svn_fs_t *fs = txn->fs;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   /* Get the proplist. */
   args.table_p = &table;
-  SVN_ERR (svn_fs_txn_name (&args.id, txn, pool));
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_txn_proplist, &args, pool));
+  args.id = txn->id;
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_txn_proplist, &args, pool));
 
   /* And then the prop from that list (if there was a list). */
   *value_p = NULL;
@@ -496,17 +499,17 @@
 
 
 svn_error_t *
-svn_fs__set_txn_prop (svn_fs_t *fs,
-                      const char *txn_name,
-                      const char *name,
-                      const svn_string_t *value,
-                      trail_t *trail)
+svn_fs_base__set_txn_prop (svn_fs_t *fs,
+                           const char *txn_name,
+                           const char *name,
+                           const svn_string_t *value,
+                           trail_t *trail)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
 
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, trail));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (fs, txn_name);
 
   /* If there's no proplist, but we're just deleting a property, exit now. */
   if ((! txn->proplist) && (! value))
@@ -528,31 +531,44 @@
 txn_body_change_txn_prop (void *baton, trail_t *trail)
 {
   struct change_txn_prop_args *args = baton;
-  return svn_fs__set_txn_prop (trail->fs, args->id, args->name, 
-                               args->value, trail);
+  return svn_fs_base__set_txn_prop (trail->fs, args->id, args->name,
+                                    args->value, trail);
 }
 
 
 svn_error_t *
-svn_fs_change_txn_prop (svn_fs_txn_t *txn,
-                        const char *name,
-                        const svn_string_t *value,
-                        apr_pool_t *pool)
+svn_fs_base__change_txn_prop (svn_fs_txn_t *txn,
+                              const char *name,
+                              const svn_string_t *value,
+                              apr_pool_t *pool)
 {
   struct change_txn_prop_args args;
   svn_fs_t *fs = txn->fs;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
-  SVN_ERR (svn_fs_txn_name (&args.id, txn, pool));
+  args.id = txn->id;
   args.name = name;
   args.value = value;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_change_txn_prop, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_change_txn_prop, &args, pool));
 
   return SVN_NO_ERROR;
 }
 
 
+
+/* Creating a transaction */
+
+txn_vtable_t txn_vtable = {
+  svn_fs_base__commit_txn,
+  svn_fs_base__abort_txn,
+  svn_fs_base__txn_prop,
+  svn_fs_base__txn_proplist,
+  svn_fs_base__change_txn_prop,
+  svn_fs_base__txn_root
+};
+
+
 /* Allocate and return a new transaction object in POOL for FS whose
    transaction ID is ID.  ID is not copied.  */
 static svn_fs_txn_t *
@@ -566,10 +582,12 @@
   txn->fs = fs;
   txn->id = id;
   txn->base_rev = base_rev;
+  txn->vtable = &txn_vtable;
+  txn->fsap_data = NULL;
 
   return txn;
 }
-          
+
 
 struct begin_txn_args
 {
@@ -586,8 +604,8 @@
   const svn_fs_id_t *root_id;
   const char *txn_id;
 
-  SVN_ERR (svn_fs__rev_get_root (&root_id, trail->fs, args->rev, trail));
-  SVN_ERR (svn_fs__bdb_create_txn (&txn_id, trail->fs, root_id, trail));
+  SVN_ERR (svn_fs_base__rev_get_root (&root_id, trail->fs, args->rev, trail));
+  SVN_ERR (svn_fs_bdb__create_txn (&txn_id, trail->fs, root_id, trail));
 
   *args->txn_p = make_txn (trail->fs, txn_id, args->rev, trail->pool);
   return SVN_NO_ERROR;
@@ -599,21 +617,21 @@
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
 svn_error_t *
-svn_fs_begin_txn (svn_fs_txn_t **txn_p,
-                  svn_fs_t *fs,
-                  svn_revnum_t rev,
-                  apr_pool_t *pool)
+svn_fs_base__begin_txn (svn_fs_txn_t **txn_p,
+                        svn_fs_t *fs,
+                        svn_revnum_t rev,
+                        apr_pool_t *pool)
 {
   svn_fs_txn_t *txn;
   struct begin_txn_args args;
   svn_string_t date;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.txn_p = &txn;
   args.rev   = rev;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_begin_txn, &args, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_begin_txn, &args, pool));
+
   *txn_p = txn;
 
   /* Put a datestamp on the newly created txn, so we always know
@@ -623,30 +641,13 @@
      automatically overwritten with a revision datestamp. */
   date.data = svn_time_to_cstring (apr_time_now(), pool);
   date.len = strlen (date.data);
-  SVN_ERR (svn_fs_change_txn_prop (txn, SVN_PROP_REVISION_DATE, 
-                                   &date, pool));
+  SVN_ERR (svn_fs_base__change_txn_prop (txn, SVN_PROP_REVISION_DATE,
+                                         &date, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_txn_name (const char **name_p,
-                 svn_fs_txn_t *txn,
-                 apr_pool_t *pool)
-{
-  *name_p = apr_pstrdup (pool, txn->id);
-  return SVN_NO_ERROR;
-}
-
-
-svn_revnum_t
-svn_fs_txn_base_revision (svn_fs_txn_t *txn)
-{
-  return txn->base_rev;
-}
-
-
 struct open_txn_args
 {
   svn_fs_txn_t **txn_p;
@@ -659,34 +660,37 @@
                    trail_t *trail)
 {
   struct open_txn_args *args = baton;
-  svn_fs__transaction_t *fstxn;
+  transaction_t *fstxn;
   svn_revnum_t base_rev = SVN_INVALID_REVNUM;
+  const char *txn_id;
 
   SVN_ERR (get_txn (&fstxn, trail->fs, args->name, FALSE, trail));
-  if (fstxn->kind != svn_fs__transaction_kind_committed)
-    SVN_ERR (svn_fs__txn_get_revision (&base_rev, trail->fs,
-                                       svn_fs__id_txn_id (fstxn->base_id), 
-                                       trail));
-  *args->txn_p = make_txn (trail->fs, args->name, base_rev, trail->pool); 
+  if (fstxn->kind != transaction_kind_committed)
+    {
+      txn_id = svn_fs__id_txn_id (fstxn->base_id);
+      SVN_ERR (svn_fs_base__txn_get_revision (&base_rev, trail->fs, txn_id,
+                                              trail));
+    }
+  *args->txn_p = make_txn (trail->fs, args->name, base_rev, trail->pool);
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs_open_txn (svn_fs_txn_t **txn_p,
-                 svn_fs_t *fs,
-                 const char *name,
-                 apr_pool_t *pool)
+svn_fs_base__open_txn (svn_fs_txn_t **txn_p,
+                       svn_fs_t *fs,
+                       const char *name,
+                       apr_pool_t *pool)
 {
   svn_fs_txn_t *txn;
   struct open_txn_args args;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.txn_p = &txn;
   args.name = name;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_open_txn, &args, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_open_txn, &args, pool));
+
   *txn_p = txn;
   return SVN_NO_ERROR;
 }
@@ -694,7 +698,7 @@
 
 struct cleanup_txn_args
 {
-  svn_fs__transaction_t **txn_p;
+  transaction_t **txn_p;
   const char *name;
 };
 
@@ -711,7 +715,7 @@
 static svn_error_t *
 txn_body_cleanup_txn_copy (void *baton, trail_t *trail)
 {
-  svn_error_t *err = svn_fs__bdb_delete_copy (trail->fs, baton, trail);
+  svn_error_t *err = svn_fs_bdb__delete_copy (trail->fs, baton, trail);
 
   /* Copy doesn't exist?  No sweat. */
   if (err && (err->apr_err == SVN_ERR_FS_NO_SUCH_COPY))
@@ -726,7 +730,7 @@
 static svn_error_t *
 txn_body_cleanup_txn_changes (void *baton, trail_t *trail)
 {
-  return svn_fs__bdb_changes_delete (trail->fs, baton, trail);
+  return svn_fs_bdb__changes_delete (trail->fs, baton, trail);
 }
 
 
@@ -745,19 +749,19 @@
   dag_node_t *node;
 
   /* Get the node. */
-  SVN_ERR (svn_fs__dag_get_node (&node, trail->fs, args->id, trail));
-        
+  SVN_ERR (svn_fs_base__dag_get_node (&node, trail->fs, args->id, trail));
+
   /* If immutable, do nothing and return. */
-  if (! svn_fs__dag_check_mutable (node, args->txn_id))
+  if (! svn_fs_base__dag_check_mutable (node, args->txn_id))
     return SVN_NO_ERROR;
 
   /* If a directory, do nothing and return. */
   *(args->dirents) = NULL;
-  if (svn_fs__dag_node_kind (node) != svn_node_dir)
+  if (svn_fs_base__dag_node_kind (node) != svn_node_dir)
     return SVN_NO_ERROR;
-  
+
   /* Else it's mutable.  Get it's dirents. */
-  return svn_fs__dag_dir_entries (args->dirents, node, trail);
+  return svn_fs_base__dag_dir_entries (args->dirents, node, trail);
 }
 
 
@@ -772,7 +776,8 @@
 txn_body_remove_node (void *baton, trail_t *trail)
 {
   struct remove_node_args *args = baton;
-  return svn_fs__dag_remove_node (trail->fs, args->id, args->txn_id, trail);
+  return svn_fs_base__dag_remove_node (trail->fs, args->id, args->txn_id,
+                                       trail);
 }
 
 
@@ -789,7 +794,7 @@
   svn_error_t *err;
 
   /* If this sucker isn't mutable, there's nothing to do. */
-  if (svn_fs__key_compare (svn_fs__id_txn_id (id), txn_id) != 0)
+  if (svn_fs_base__key_compare (svn_fs__id_txn_id (id), txn_id) != 0)
     return SVN_NO_ERROR;
 
   /* See if the thing has dirents that need to be recursed upon.  If
@@ -798,7 +803,7 @@
   dirent_args.dirents = &dirents;
   dirent_args.id = id;
   dirent_args.txn_id = txn_id;
-  err = svn_fs__retry_txn (fs, txn_body_get_dirents, &dirent_args, pool);
+  err = svn_fs_base__retry_txn (fs, txn_body_get_dirents, &dirent_args, pool);
   if (err && (err->apr_err == SVN_ERR_FS_ID_NOT_FOUND))
     {
       svn_error_clear (err);
@@ -828,33 +833,33 @@
   /* Remove the node. */
   rm_args.id = id;
   rm_args.txn_id = txn_id;
-  return svn_fs__retry_txn (fs, txn_body_remove_node, &rm_args, pool);
+  return svn_fs_base__retry_txn (fs, txn_body_remove_node, &rm_args, pool);
 }
 
 
 static svn_error_t *
 txn_body_delete_txn (void *baton, trail_t *trail)
 {
-  return svn_fs__bdb_delete_txn (trail->fs, baton, trail);
+  return svn_fs_bdb__delete_txn (trail->fs, baton, trail);
 }
 
 
 svn_error_t *
-svn_fs_purge_txn (svn_fs_t *fs,
-                  const char *txn_id,
-                  apr_pool_t *pool)
+svn_fs_base__purge_txn (svn_fs_t *fs,
+                        const char *txn_id,
+                        apr_pool_t *pool)
 {
   struct cleanup_txn_args args;
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
   int i;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   /* Open the transaction, expecting it to be dead. */
   args.txn_p = &txn;
   args.name = txn_id;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_cleanup_txn, &args, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_cleanup_txn, &args, pool));
+
   /* Delete the mutable portion of the tree hanging from the
      transaction (which should gracefully recover if we've already
      done this). */
@@ -862,7 +867,7 @@
 
   /* Kill the transaction's changes (which should gracefully recover
      if...). */
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_cleanup_txn_changes, 
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_cleanup_txn_changes,
                               (void *)txn_id, pool));
 
   /* Kill the transaction's copies (which should gracefully...). */
@@ -870,16 +875,17 @@
     {
       for (i = 0; i < txn->copies->nelts; i++)
         {
-          SVN_ERR (svn_fs__retry_txn 
+          SVN_ERR (svn_fs_base__retry_txn
                    (fs, txn_body_cleanup_txn_copy,
-                    (void *)APR_ARRAY_IDX (txn->copies, i, const char *), 
+                    (void *)APR_ARRAY_IDX (txn->copies, i, const char *),
                     pool));
         }
     }
-      
+
   /* Kill the transaction itself (which ... just kidding -- this has
      no graceful failure mode). */
-  return svn_fs__retry_txn (fs, txn_body_delete_txn, (void *)txn_id, pool);
+  return svn_fs_base__retry_txn (fs, txn_body_delete_txn, (void *)txn_id,
+                                 pool);
 }
 
 
@@ -887,30 +893,30 @@
 txn_body_abort_txn (void *baton, trail_t *trail)
 {
   svn_fs_txn_t *txn = baton;
-  svn_fs__transaction_t *fstxn;
+  transaction_t *fstxn;
 
   /* Get the transaction by its id, set it to "dead", and store the
      transaction. */
   SVN_ERR (get_txn (&fstxn, txn->fs, txn->id, FALSE, trail));
-  if (fstxn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (txn->fs, txn->id);
+  if (fstxn->kind != transaction_kind_normal)
+    return svn_fs_base__err_txn_not_mutable (txn->fs, txn->id);
 
-  fstxn->kind = svn_fs__transaction_kind_dead;
+  fstxn->kind = transaction_kind_dead;
   return put_txn (txn->fs, fstxn, txn->id, trail);
 }
 
 
 svn_error_t *
-svn_fs_abort_txn (svn_fs_txn_t *txn,
-                  apr_pool_t *pool)
+svn_fs_base__abort_txn (svn_fs_txn_t *txn,
+                        apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__check_fs (txn->fs));
+  SVN_ERR (svn_fs_base__check_fs (txn->fs));
 
   /* Set the transaction to "dead". */
-  SVN_ERR (svn_fs__retry_txn (txn->fs, txn_body_abort_txn, txn, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (txn->fs, txn_body_abort_txn, txn, pool));
+
   /* Now, purge it. */
-  SVN_ERR_W (svn_fs_purge_txn (txn->fs, txn->id, pool),
+  SVN_ERR_W (svn_fs_base__purge_txn (txn->fs, txn->id, pool),
              "Transaction aborted, but cleanup failed");
 
   return SVN_NO_ERROR;
@@ -928,25 +934,25 @@
                             trail_t *trail)
 {
   struct list_transactions_args *args = baton;
-  SVN_ERR (svn_fs__bdb_get_txn_list (args->names_p, trail->fs, 
+  SVN_ERR (svn_fs_bdb__get_txn_list (args->names_p, trail->fs,
                                      args->pool, trail));
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_fs_list_transactions (apr_array_header_t **names_p,
-                          svn_fs_t *fs,
-                          apr_pool_t *pool)
+svn_fs_base__list_transactions (apr_array_header_t **names_p,
+                                svn_fs_t *fs,
+                                apr_pool_t *pool)
 {
   apr_array_header_t *names;
   struct list_transactions_args args;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.names_p = &names;
   args.pool = pool;
-  SVN_ERR (svn_fs__retry (fs, txn_body_list_transactions, &args, pool));
+  SVN_ERR (svn_fs_base__retry (fs, txn_body_list_transactions, &args, pool));
 
   *names_p = names;
   return SVN_NO_ERROR;

Modified: trunk/subversion/libsvn_fs_base/revs-txns.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/revs-txns.h	(original)
+++ trunk/subversion/libsvn_fs_base/revs-txns.h	Thu Apr 29 18:17:29 2004
@@ -32,73 +32,54 @@
 
 
 
-/* The private structure underlying the public svn_fs_txn_t typedef.  */
-
-struct svn_fs_txn_t
-{
-  /* The filesystem to which this transaction belongs.  */
-  svn_fs_t *fs;
-
-  /* The revision on which this transaction is based, or
-     SVN_INVALID_REVISION if the transaction is not based on a
-     revision at all. */
-  svn_revnum_t base_rev;
-
-  /* The ID of this transaction --- a null-terminated string.
-     This is the key into the `transactions' table.  */
-  const char *id;
-};
-
-
-
 /*** Revisions ***/
 
 /* Set *ROOT_ID_P to the ID of the root directory of revision REV in FS,
    as part of TRAIL.  Allocate the ID in TRAIL->pool.  */
-svn_error_t *svn_fs__rev_get_root (const svn_fs_id_t **root_id_p,
-                                   svn_fs_t *fs,
-                                   svn_revnum_t rev,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__rev_get_root (const svn_fs_id_t **root_id_p,
+                                        svn_fs_t *fs,
+                                        svn_revnum_t rev,
+                                        trail_t *trail);
 
 
 /* Set *TXN_ID_P to the ID of the transaction that was committed to
    create REV in FS, as part of TRAIL.  Allocate the ID in
    TRAIL->pool.  */
-svn_error_t *svn_fs__rev_get_txn_id (const char **txn_id_p,
-                                     svn_fs_t *fs,
-                                     svn_revnum_t rev,
-                                     trail_t *trail);
+svn_error_t *svn_fs_base__rev_get_txn_id (const char **txn_id_p,
+                                          svn_fs_t *fs,
+                                          svn_revnum_t rev,
+                                          trail_t *trail);
 
 
 /* Set property NAME to VALUE on REV in FS, as part of TRAIL.  */
-svn_error_t *svn_fs__set_rev_prop (svn_fs_t *fs,
-                                   svn_revnum_t rev,
-                                   const char *name,
-                                   const svn_string_t *value,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__set_rev_prop (svn_fs_t *fs,
+                                        svn_revnum_t rev,
+                                        const char *name,
+                                        const svn_string_t *value,
+                                        trail_t *trail);
 
 
 
 /*** Transactions ***/
 
 /* Convert the unfinished transaction in FS named TXN_NAME to a
-   committed transaction that refers to REVISION as part of TRAIL.  
+   committed transaction that refers to REVISION as part of TRAIL.
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__txn_make_committed (svn_fs_t *fs,
-                                         const char *txn_name,
-                                         svn_revnum_t revision,
-                                         trail_t *trail);
+svn_error_t *svn_fs_base__txn_make_committed (svn_fs_t *fs,
+                                              const char *txn_name,
+                                              svn_revnum_t revision,
+                                              trail_t *trail);
 
 
 /* Set *REVISION to the revision which was created when FS transaction
    TXN_NAME was committed, or to SVN_INVALID_REVNUM if the transaction
    has not been committed.  Do all of this as part of TRAIL.  */
-svn_error_t *svn_fs__txn_get_revision (svn_revnum_t *revision,
-                                       svn_fs_t *fs,
-                                       const char *txn_name,
-                                       trail_t *trail);
+svn_error_t *svn_fs_base__txn_get_revision (svn_revnum_t *revision,
+                                            svn_fs_t *fs,
+                                            const char *txn_name,
+                                            trail_t *trail);
 
 
 /* Retrieve information about the Subversion transaction SVN_TXN from
@@ -114,23 +95,23 @@
    transaction that has already been committed.
 
    Allocate *ROOT_ID_P and *BASE_ROOT_ID_P in TRAIL->pool.  */
-svn_error_t *svn_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
-                                  const svn_fs_id_t **base_root_id_p,
-                                  svn_fs_t *fs,
-                                  const char *txn_name,
-                                  trail_t *trail);
+svn_error_t *svn_fs_base__get_txn_ids (const svn_fs_id_t **root_id_p,
+                                       const svn_fs_id_t **base_root_id_p,
+                                       svn_fs_t *fs,
+                                       const char *txn_name,
+                                       trail_t *trail);
 
 
 /* Set the root directory of the Subversion transaction TXN_NAME in FS
    to ROOT_ID, as part of TRAIL.  Do any necessary temporary
-   allocation in TRAIL->pool. 
+   allocation in TRAIL->pool.
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__set_txn_root (svn_fs_t *fs,
-                                   const char *txn_name,
-                                   const svn_fs_id_t *root_id,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__set_txn_root (svn_fs_t *fs,
+                                        const char *txn_name,
+                                        const svn_fs_id_t *root_id,
+                                        trail_t *trail);
 
 
 /* Add COPY_ID to the list of copies made under the Subversion
@@ -138,34 +119,80 @@
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__add_txn_copy (svn_fs_t *fs,
-                                   const char *txn_name,
-                                   const char *copy_id,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__add_txn_copy (svn_fs_t *fs,
+                                        const char *txn_name,
+                                        const char *copy_id,
+                                        trail_t *trail);
 
 
 /* Set the base root directory of TXN_NAME in FS to NEW_ID, as part of
-   TRAIL.  Do any necessary temporary allocation in TRAIL->pool. 
+   TRAIL.  Do any necessary temporary allocation in TRAIL->pool.
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__set_txn_base (svn_fs_t *fs,
-                                   const char *txn_name,
-                                   const svn_fs_id_t *new_id,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__set_txn_base (svn_fs_t *fs,
+                                        const char *txn_name,
+                                        const svn_fs_id_t *new_id,
+                                        trail_t *trail);
 
 
 /* Set a property NAME to VALUE on transaction TXN_NAME in FS as part
-   of TRAIL.  Use TRAIL->pool for any necessary allocations.  
+   of TRAIL.  Use TRAIL->pool for any necessary allocations.
 
    Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
    transaction that has already been committed.  */
-svn_error_t *svn_fs__set_txn_prop (svn_fs_t *fs,
-                                   const char *txn_name,
-                                   const char *name,
-                                   const svn_string_t *value,
-                                   trail_t *trail);
+svn_error_t *svn_fs_base__set_txn_prop (svn_fs_t *fs,
+                                        const char *txn_name,
+                                        const char *name,
+                                        const svn_string_t *value,
+                                        trail_t *trail);
+
+
+/* These functions implement some of the calls in the FS loader
+   library's fs and txn vtables. */
+
+svn_error_t *svn_fs_base__youngest_rev (svn_revnum_t *youngest_p, svn_fs_t *fs,
+                                        apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__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_base__revision_proplist (apr_hash_t **table_p,
+                                             svn_fs_t *fs,
+                                             svn_revnum_t rev,
+                                             apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__change_rev_prop (svn_fs_t *fs, svn_revnum_t rev,
+                                           const char *name,
+                                           const svn_string_t *value,
+                                           apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__begin_txn (svn_fs_txn_t **txn_p, svn_fs_t *fs,
+                                     svn_revnum_t rev, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__open_txn (svn_fs_txn_t **txn, svn_fs_t *fs,
+                                    const char *name, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__purge_txn (svn_fs_t *fs, const char *txn_id,
+                                     apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__list_transactions (apr_array_header_t **names_p,
+                                             svn_fs_t *fs, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__abort_txn (svn_fs_txn_t *txn, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__txn_prop (svn_string_t **value_p, svn_fs_txn_t *txn,
+                                    const char *propname, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__txn_proplist (apr_hash_t **table_p,
+                                        svn_fs_txn_t *txn,
+                                        apr_pool_t *pool);
 
+svn_error_t *svn_fs_base__change_txn_prop (svn_fs_txn_t *txn, const char *name,
+                                           const svn_string_t *value,
+                                           apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/trail.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/trail.c	(original)
+++ trunk/subversion/libsvn_fs_base/trail.c	Thu Apr 29 18:17:29 2004
@@ -25,6 +25,7 @@
 #include "err.h"
 #include "bdb/bdb-err.h"
 #include "trail.h"
+#include "../libsvn_fs/fs-loader.h"
 
 
 #if defined(SVN_FS__TRAIL_DEBUG)
@@ -37,7 +38,7 @@
 };
 
 void
-svn_fs__trail_debug (trail_t *trail, const char *table, const char *op)
+svn_fs_base__trail_debug (trail_t *trail, const char *table, const char *op)
 {
   struct trail_debug_t *trail_debug;
 
@@ -95,6 +96,7 @@
              svn_boolean_t use_txn,
              apr_pool_t *pool)
 {
+  base_fs_data_t *bfd = fs->fsap_data;
   trail_t *trail = apr_pcalloc (pool, sizeof (*trail));
 
   trail->pool = svn_pool_create (pool);
@@ -105,12 +107,13 @@
     {
       /* If we're already inside a trail operation, abort() -- this is
          a coding problem (and will likely hang the repository anyway). */
-      if (fs->in_txn_trail)
+      if (bfd->in_txn_trail)
         abort();
 
       SVN_ERR (BDB_WRAP (fs, "beginning Berkeley DB transaction",
-                         fs->env->txn_begin (fs->env, 0, &trail->db_txn, 0)));
-      fs->in_txn_trail = TRUE;
+                         bfd->env->txn_begin (bfd->env, 0,
+                                              &trail->db_txn, 0)));
+      bfd->in_txn_trail = TRUE;
     }
   else
     {
@@ -127,6 +130,7 @@
 {
   struct undo *undo;
   svn_fs_t *fs = trail->fs;
+  base_fs_data_t *bfd = fs->fsap_data;
 
   /* Undo those changes which should only persist when the transaction
      succeeds.  */
@@ -138,7 +142,7 @@
     {
       SVN_ERR (BDB_WRAP (fs, "aborting Berkeley DB transaction",
                          trail->db_txn->abort (trail->db_txn)));
-      fs->in_txn_trail = FALSE;
+      bfd->in_txn_trail = FALSE;
     }
   svn_pool_destroy (trail->pool);
 
@@ -152,6 +156,7 @@
   struct undo *undo;
   int db_err;
   svn_fs_t *fs = trail->fs;
+  base_fs_data_t *bfd = fs->fsap_data;
 
   /* Undo those changes which should persist only while the
      transaction is active.  */
@@ -166,13 +171,13 @@
     {
       SVN_ERR (BDB_WRAP (fs, "committing Berkeley DB transaction",
                          trail->db_txn->commit (trail->db_txn, 0)));
-      fs->in_txn_trail = FALSE;
+      bfd->in_txn_trail = FALSE;
     }
 
   /* Do a checkpoint here, if enough has gone on.
      The checkpoint parameters below are pretty arbitrary.  Perhaps
      there should be an svn_fs_berkeley_mumble function to set them.  */
-  db_err = fs->env->txn_checkpoint (fs->env, 1024, 5, 0);
+  db_err = bfd->env->txn_checkpoint (bfd->env, 1024, 5, 0);
 
   /* Pre-4.1 Berkeley documentation says:
 
@@ -191,7 +196,7 @@
       if (db_err != DB_INCOMPLETE)
 #endif /* SVN_BDB_HAS_DB_INCOMPLETE */
         {
-          return svn_fs__bdb_wrap_db
+          return svn_fs_bdb__wrap_db
             (fs, "checkpointing after Berkeley DB transaction", db_err);
         }
     }
@@ -220,7 +225,7 @@
       trail_t *trail;
       svn_error_t *svn_err, *err;
       svn_boolean_t deadlocked = FALSE;
-      
+
       SVN_ERR (begin_trail (&trail, fs, use_txn, pool));
 
       /* Do the body of the transaction.  */
@@ -230,7 +235,7 @@
         {
           /* The transaction succeeded!  Commit it.  */
           SVN_ERR (commit_trail (trail));
-          
+
           if (use_txn)
             print_trail_debug (trail, txn_body_fn_name, filename, line);
 
@@ -259,43 +264,44 @@
 
 
 svn_error_t *
-svn_fs__retry_debug (svn_fs_t *fs,
-                     svn_error_t *(*txn_body) (void *baton, trail_t *trail),
-                     void *baton,
-                     apr_pool_t *pool,
-                     const char *txn_body_fn_name,
-                     const char *filename,
-                     int line)
+svn_fs_base__retry_debug (svn_fs_t *fs,
+                          svn_error_t *(*txn_body) (void *baton,
+                                                    trail_t *trail),
+                          void *baton,
+                          apr_pool_t *pool,
+                          const char *txn_body_fn_name,
+                          const char *filename,
+                          int line)
 {
-  return do_retry (fs, txn_body, baton, TRUE, pool, 
+  return do_retry (fs, txn_body, baton, TRUE, pool,
                    txn_body_fn_name, filename, line);
-}					 
+}
 
 
 #if defined(SVN_FS__TRAIL_DEBUG)
-#undef svn_fs__retry_txn
+#undef svn_fs_base__retry_txn
 #endif
 
 svn_error_t *
-svn_fs__retry_txn (svn_fs_t *fs,
-                   svn_error_t *(*txn_body) (void *baton, trail_t *trail),
-                   void *baton,
-                   apr_pool_t *pool)
+svn_fs_base__retry_txn (svn_fs_t *fs,
+                        svn_error_t *(*txn_body) (void *baton, trail_t *trail),
+                        void *baton,
+                        apr_pool_t *pool)
 {
-  return do_retry (fs, txn_body, baton, TRUE, pool, 
+  return do_retry (fs, txn_body, baton, TRUE, pool,
                    "unknown", "", 0);
-}					 
+}
 
 
 svn_error_t *
-svn_fs__retry (svn_fs_t *fs,
-               svn_error_t *(*txn_body) (void *baton, trail_t *trail),
-               void *baton,
-               apr_pool_t *pool)
+svn_fs_base__retry (svn_fs_t *fs,
+                    svn_error_t *(*txn_body) (void *baton, trail_t *trail),
+                    void *baton,
+                    apr_pool_t *pool)
 {
-  return do_retry (fs, txn_body, baton, FALSE, pool, 
+  return do_retry (fs, txn_body, baton, FALSE, pool,
                    NULL, NULL, 0);
-}					 
+}
 
 
 
@@ -313,21 +319,21 @@
   undo->prev = trail->undo;
   trail->undo = undo;
 }
-             
+
 
 void
-svn_fs__record_undo (trail_t *trail,
-                     void (*func) (void *baton),
-                     void *baton)
+svn_fs_base__record_undo (trail_t *trail,
+                          void (*func) (void *baton),
+                          void *baton)
 {
   record_undo (trail, func, baton, undo_on_failure);
 }
 
 
 void
-svn_fs__record_completion (trail_t *trail,
-                           void (*func) (void *baton),
-                           void *baton)
+svn_fs_base__record_completion (trail_t *trail,
+                                void (*func) (void *baton),
+                                void *baton)
 {
   record_undo (trail, func, baton, undo_on_success | undo_on_failure);
 }

Modified: trunk/subversion/libsvn_fs_base/trail.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/trail.h	(original)
+++ trunk/subversion/libsvn_fs_base/trail.h	Thu Apr 29 18:17:29 2004
@@ -35,7 +35,7 @@
    one."
 
    Well, there isn't a function that returns a trail.  All trails come
-   from svn_fs__retry_txn.  Here's how to use that:
+   from svn_fs_base__retry_txn.  Here's how to use that:
 
    When using Berkeley DB transactions to protect the integrity of a
    database, there are several things you need to keep in mind:
@@ -65,16 +65,16 @@
      need to clear your cache once the transaction completes, either
      successfully or unsuccessfully.
 
-   The `svn_fs__retry_txn' function and its friends help you manage
+   The `svn_fs_base__retry_txn' function and its friends help you manage
    all of that, in one nice package.
-   
+
    To use it, write your code in a function like this:
-  
+
        static svn_error_t *
        txn_body_do_my_thing (void *baton,
                              trail_t *trail)
        {
-         ... 
+         ...
          Do everything which needs to be protected by a Berkeley DB
          transaction here.  Use TRAIL->db_txn as your Berkeley DB
          transaction, and do your allocation in TRAIL->pool.  Pass
@@ -88,10 +88,10 @@
          ...
        }
 
-   Now, call svn_fs__retry_txn, passing a pointer to your function as
+   Now, call svn_fs_base__retry_txn, passing a pointer to your function as
    an argument:
 
-       err = svn_fs__retry_txn (fs, txn_body_do_my_thing, baton, pool);
+       err = svn_fs_base__retry_txn (fs, txn_body_do_my_thing, baton, pool);
 
    This will simply invoke your function `txn_body_do_my_thing',
    passing BATON through unchanged, and providing a fresh TRAIL
@@ -100,35 +100,35 @@
    use.
 
    If your function returns a Subversion error wrapping a Berkeley DB
-   DB_LOCK_DEADLOCK error, `svn_fs__retry_txn' will abort the trail's
+   DB_LOCK_DEADLOCK error, `svn_fs_base__retry_txn' will abort the trail's
    Berkeley DB transaction for you (thus undoing any database changes
    you've made), free the trail's subpool (thus undoing any allocation
    you may have done), and try the whole thing again with a new trail,
    containing a new Berkeley DB transaction and pool.
 
    If your function returns any other kind of Subversion error,
-   `svn_fs__retry_txn' will abort the trail's Berkeley DB transaction,
+   `svn_fs_base__retry_txn' will abort the trail's Berkeley DB transaction,
    free the subpool, and return your error to its caller.
 
    If, heavens forbid, your function actually succeeds, returning
-   SVN_NO_ERROR, `svn_fs__retry_txn' commits the trail's Berkeley DB
+   SVN_NO_ERROR, `svn_fs_base__retry_txn' commits the trail's Berkeley DB
    transaction, thus making your DB changes permanent, leaves the
    trail's pool alone, so all the objects it contains are still
    around, and returns SVN_NO_ERROR.
 
    If you're making changes to in-memory data structures which should
    be reverted if the transaction doesn't complete successfully, you
-   can call `svn_fs__record_undo' as you make your changes to register
+   can call `svn_fs_base__record_undo' as you make your changes to register
    functions that will undo them.  On failure (either due to deadlock
-   or a real error), `svn_fs__retry_txn' will invoke your undo
+   or a real error), `svn_fs_base__retry_txn' will invoke your undo
    functions, youngest first, to restore your data structures to the
    state they were in when you started the transaction.
 
    If you're caching things in in-memory data structures, which may go
    stale once the transaction is complete, you can call
-   `svn_fs__record_completion' to register functions that will clear
+   `svn_fs_base__record_completion' to register functions that will clear
    your caches.  When the trail completes, successfully or
-   unsuccessfully, `svn_fs__retry_txn' will invoke your completion
+   unsuccessfully, `svn_fs_base__retry_txn' will invoke your completion
    functions, youngest first, to remove whatever cached information
    you like.  */
 
@@ -185,35 +185,37 @@
    ensure that whatever transactions a filesystem function starts, it
    either aborts or commits before it returns.  If we don't somehow
    complete all our transactions, later operations could deadlock.  */
-svn_error_t *svn_fs__retry_txn (svn_fs_t *fs,
-                                svn_error_t *(*txn_body) (void *baton,
-                                                          trail_t *trail),
-                                void *baton,
-                                apr_pool_t *pool);
-
-svn_error_t *svn_fs__retry_debug (svn_fs_t *fs,
-                                  svn_error_t *(*txn_body) (void *baton,
-                                                            trail_t *trail),
-                                  void *baton,
-                                  apr_pool_t *pool,
-                                  const char *txn_body_fn_name,
-                                  const char *filename,
-                                  int line);
+svn_error_t *svn_fs_base__retry_txn (svn_fs_t *fs,
+                                     svn_error_t *(*txn_body) (void *baton,
+                                                               trail_t *trail),
+                                     void *baton,
+                                     apr_pool_t *pool);
+
+svn_error_t *
+svn_fs_base__retry_debug (svn_fs_t *fs,
+                          svn_error_t *(*txn_body) (void *baton,
+                                                    trail_t *trail),
+                          void *baton,
+                          apr_pool_t *pool,
+                          const char *txn_body_fn_name,
+                          const char *filename,
+                          int line);
 
 #if defined(SVN_FS__TRAIL_DEBUG)
-#define svn_fs__retry_txn(fs, txn_body, baton, pool) \
-  svn_fs__retry_debug(fs, txn_body, baton, pool, #txn_body, __FILE__, __LINE__)
+#define svn_fs_base__retry_txn(fs, txn_body, baton, pool) \
+  svn_fs_base__retry_debug(fs, txn_body, baton, pool, #txn_body,
+                           __FILE__, __LINE__)
 #endif
 
 
 /* Try an action repeatedly until it doesn't deadlock.  This is
-   exactly like svn_fs__retry_txn() (whose documentation you really
+   exactly like svn_fs_base__retry_txn() (whose documentation you really
    should read) except that no Berkeley DB transaction is created. */
-svn_error_t *svn_fs__retry (svn_fs_t *fs,
-                            svn_error_t *(*txn_body) (void *baton, 
-                                                      trail_t *trail),
-                            void *baton,
-                            apr_pool_t *pool);
+svn_error_t *svn_fs_base__retry (svn_fs_t *fs,
+                                 svn_error_t *(*txn_body) (void *baton,
+                                                           trail_t *trail),
+                                 void *baton,
+                                 apr_pool_t *pool);
 
 
 /* Record a change which should be undone if TRAIL is aborted, either
@@ -232,15 +234,15 @@
 
    When you make a such a change, call this function with a FUNC and
    BATON that, if invoked, will undo the change.  If TRAIL fails to
-   complete (deadlock, error, etc.), svn_fs__retry_txn will invoke the
+   complete (deadlock, error, etc.), svn_fs_base__retry_txn will invoke the
    FUNC/BATON pairs that were registered via this function.
 
    Younger undo and completion functions get invoked before older
    functions.  Undo and completion functions are ordered with respect
    to each other.  */
-void svn_fs__record_undo (trail_t *trail,
-                          void (*func) (void *baton),
-                          void *baton);
+void svn_fs_base__record_undo (trail_t *trail,
+                               void (*func) (void *baton),
+                               void *baton);
 
 
 /* Record a change which should be undone when TRAIL is completed,
@@ -253,16 +255,17 @@
    Younger undo and completion functions get invoked before older
    functions.  Undo and completion functions are ordered with respect
    to each other.  */
-void svn_fs__record_completion (trail_t *trail,
-                                void (*func) (void *baton),
-                                void *baton);
-                                     
+void svn_fs_base__record_completion (trail_t *trail,
+                                     void (*func) (void *baton),
+                                     void *baton);
+
 
 /* Record that OPeration is being done on TABLE in the TRAIL. */
 #if defined(SVN_FS__TRAIL_DEBUG)
-void svn_fs__trail_debug (trail_t *trail, const char *table, const char *op);
+void svn_fs_base__trail_debug (trail_t *trail, const char *table,
+                               const char *op);
 #else
-#define svn_fs__trail_debug(trail, table, operation)
+#define svn_fs_base__trail_debug(trail, table, operation)
 #endif
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/tree.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/tree.c	(original)
+++ trunk/subversion/libsvn_fs_base/tree.c	Thu Apr 29 18:17:29 2004
@@ -40,7 +40,6 @@
 #include "svn_fs.h"
 #include "svn_hash.h"
 #include "svn_sorts.h"
-#include "id.h"
 #include "fs.h"
 #include "err.h"
 #include "trail.h"
@@ -54,6 +53,7 @@
 #include "bdb/nodes-table.h"
 #include "bdb/changes-table.h"
 #include "bdb/copies-table.h"
+#include "../libsvn_fs/fs-loader.h"
 
 
 /* ### I believe this constant will become internal to reps-strings.c.
@@ -91,35 +91,9 @@
 };
 
 
-typedef enum root_kind_t {
-  unspecified_root = 0,
-  revision_root,
-  transaction_root
-} root_kind_t;
-
-
-struct svn_fs_root_t
+typedef struct
 {
 
-  /* What filesystem does this root belong to?  */
-  svn_fs_t *fs;
-
-  /* All data belonging to this root is allocated in this pool.
-     Destroying this pool will correctly free all resources the root
-     holds.  */
-  apr_pool_t *pool;
-
-  /* What kind of root is this?  */
-  root_kind_t kind;
-
-  /* For transaction roots (i.e., KIND == transaction_root), the name of
-     that transaction, allocated in POOL.  */
-  const char *txn;
-
-  /* For revision roots (i.e., KIND == revision_root), the number of
-     that revision.  */
-  svn_revnum_t rev;
-
   /* For revision roots, this is a dag node for the revision's root
      directory.  For transaction roots, we open the root directory
      afresh every time, since the root may have been cloned, or
@@ -127,7 +101,7 @@
   dag_node_t *root_dir;
 
   /* Cache structures, for mapping const char * PATH to const
-     struct dag_node_cache_t * structures.  
+     struct dag_node_cache_t * structures.
 
      ### Currently this is only used for revision roots.  To be safe
      for transaction roots, you must have the guarantee that there is
@@ -141,65 +115,15 @@
   apr_hash_t *node_cache;
   const char *node_cache_keys[SVN_FS_NODE_CACHE_MAX_KEYS];
   int node_cache_idx;
-};
+} base_root_data_t;
 
 
-
-/* Creating root objects.  */
-
-
-/* Construct a new root object in FS, allocated from POOL.  */
-static svn_fs_root_t *
-make_root (svn_fs_t *fs,
-           apr_pool_t *pool)
-{
-  /* We create a subpool for each root object to allow us to implement
-     svn_fs_close_root.  */
-  apr_pool_t *subpool = svn_pool_create (pool);
-  svn_fs_root_t *root = apr_pcalloc (subpool, sizeof (*root));
-
-  root->fs = fs;
-  root->pool = subpool;
-
-  /* Init the node ID cache. */
-  root->node_cache = apr_hash_make (pool);
-  root->node_cache_idx = 0;
-
-  return root;
-}
-
-
-/* Construct a root object referring to the root of REVISION in FS,
-   whose root directory is ROOT_DIR.  Create the new root in POOL.  */
-static svn_fs_root_t *
-make_revision_root (svn_fs_t *fs,
-                    svn_revnum_t rev,
-                    dag_node_t *root_dir,
-                    apr_pool_t *pool)
-{
-  svn_fs_root_t *root = make_root (fs, pool);
-  root->kind = revision_root;
-  root->rev = rev;
-  root->root_dir = root_dir;
-
-  return root;
-}
-
-
-/* Construct a root object referring to the root of the transaction
-   named TXN in FS.  Create the new root in POOL.  */
-static svn_fs_root_t *
-make_txn_root (svn_fs_t *fs,
-               const char *txn,
-               apr_pool_t *pool)
-{
-  svn_fs_root_t *root = make_root (fs, pool);
-  root->kind = transaction_root;
-  root->txn = apr_pstrdup (root->pool, txn);
-
-  return root;
-}
+static svn_fs_root_t *make_revision_root (svn_fs_t *fs, svn_revnum_t rev,
+                                          dag_node_t *root_dir,
+                                          apr_pool_t *pool);
 
+static svn_fs_root_t *make_txn_root (svn_fs_t *fs, const char *txn,
+                                     apr_pool_t *pool);
 
 
 /*** Node Caching in the Roots. ***/
@@ -211,19 +135,20 @@
                     const char *path,
                     apr_pool_t *pool)
 {
+  base_root_data_t *brd = root->fsap_data;
   struct dag_node_cache_t *cache_item;
 
   /* Assert valid input. */
   assert (*path == '/');
 
   /* Only allow revision roots. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return NULL;
 
   /* Look in the cache for our desired item. */
-  cache_item = apr_hash_get (root->node_cache, path, APR_HASH_KEY_STRING);
+  cache_item = apr_hash_get (brd->node_cache, path, APR_HASH_KEY_STRING);
   if (cache_item)
-    return svn_fs__dag_dup (cache_item->node, pool);
+    return svn_fs_base__dag_dup (cache_item->node, pool);
 
   return NULL;
 }
@@ -238,10 +163,11 @@
                     const char *path,
                     dag_node_t *node)
 {
+  base_root_data_t *brd = root->fsap_data;
   const char *cache_path;
   apr_pool_t *cache_pool;
   struct dag_node_cache_t *cache_item;
-  int num_keys = apr_hash_count (root->node_cache);
+  int num_keys = apr_hash_count (brd->node_cache);
 
   /* What?  No POOL passed to this function?
 
@@ -255,11 +181,11 @@
 
   /* Assert valid input and state. */
   assert (*path == '/');
-  assert ((root->node_cache_idx <= num_keys)
+  assert ((brd->node_cache_idx <= num_keys)
           && (num_keys <= SVN_FS_NODE_CACHE_MAX_KEYS));
 
   /* Only allow revision roots. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return;
 
   /* Special case: the caller wants us to replace an existing cached
@@ -268,7 +194,7 @@
      root, and that only happens once under that root.  So, we'll be a
      little bit sloppy here, and count on callers doing the right
      thing. */
-  cache_item = apr_hash_get (root->node_cache, path, APR_HASH_KEY_STRING);
+  cache_item = apr_hash_get (brd->node_cache, path, APR_HASH_KEY_STRING);
   if (cache_item)
     {
       /* ### This section is somehow broken.  I don't know how, but it
@@ -279,9 +205,9 @@
 
 #if 0
       int cache_index = cache_item->idx;
-      cache_path = root->node_cache_keys[cache_index];
+      cache_path = brd->node_cache_keys[cache_index];
       cache_pool = cache_item->pool;
-      cache_item->node = svn_fs__dag_dup (node, cache_pool);
+      cache_item->node = svn_fs_base__dag_dup (node, cache_pool);
 
       /* Now, move the cache key reference to the end of the keys in
          the keys array (unless it's already at the end).  ### Yes,
@@ -290,29 +216,29 @@
       if (cache_index != (num_keys - 1))
         {
           int move_num = SVN_FS_NODE_CACHE_MAX_KEYS - cache_index - 1;
-          memmove (root->node_cache_keys + cache_index,
-                   root->node_cache_keys + cache_index + 1,
+          memmove (brd->node_cache_keys + cache_index,
+                   brd->node_cache_keys + cache_index + 1,
                    move_num * sizeof (const char *));
           cache_index = num_keys - 1;
-          root->node_cache_keys[cache_index] = cache_path;
+          brd->node_cache_keys[cache_index] = cache_path;
         }
 
       /* Advance the cache pointers. */
       cache_item->idx = cache_index;
-      root->node_cache_idx = (cache_index + 1) % SVN_FS_NODE_CACHE_MAX_KEYS;
+      brd->node_cache_idx = (cache_index + 1) % SVN_FS_NODE_CACHE_MAX_KEYS;
       return;
 #endif
     }
 
   /* We're adding a new cache item.  First, see if we have room for it
      (otherwise, make some room). */
-  if (apr_hash_count (root->node_cache) == SVN_FS_NODE_CACHE_MAX_KEYS)
+  if (apr_hash_count (brd->node_cache) == SVN_FS_NODE_CACHE_MAX_KEYS)
     {
       /* No room.  Expire the oldest thing. */
-      cache_path = root->node_cache_keys[root->node_cache_idx];
-      cache_item = apr_hash_get (root->node_cache, cache_path,
+      cache_path = brd->node_cache_keys[brd->node_cache_idx];
+      cache_item = apr_hash_get (brd->node_cache, cache_path,
                                  APR_HASH_KEY_STRING);
-      apr_hash_set (root->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
+      apr_hash_set (brd->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
       cache_pool = cache_item->pool;
       svn_pool_clear (cache_pool);
     }
@@ -323,18 +249,17 @@
 
   /* Make the cache item, allocated in its own pool. */
   cache_item = apr_palloc (cache_pool, sizeof (*cache_item));
-  cache_item->node = svn_fs__dag_dup (node, cache_pool);
-  cache_item->idx = root->node_cache_idx;
+  cache_item->node = svn_fs_base__dag_dup (node, cache_pool);
+  cache_item->idx = brd->node_cache_idx;
   cache_item->pool = cache_pool;
 
   /* Now add it to the cache. */
   cache_path = apr_pstrdup (cache_pool, path);
-  apr_hash_set (root->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
-  root->node_cache_keys[root->node_cache_idx] = cache_path;
-          
+  apr_hash_set (brd->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
+  brd->node_cache_keys[brd->node_cache_idx] = cache_path;
+
   /* Advance the cache pointer. */
-  root->node_cache_idx = (root->node_cache_idx + 1) 
-                           % SVN_FS_NODE_CACHE_MAX_KEYS;
+  brd->node_cache_idx = (brd->node_cache_idx + 1) % SVN_FS_NODE_CACHE_MAX_KEYS;
 }
 
 
@@ -362,8 +287,8 @@
   svn_fs_root_t *root;
 
   /* Verify that the transaction actually exists.  */
-  SVN_ERR (svn_fs__get_txn_ids (&root_id, &base_root_id, fs, 
-                                svn_txn_id, trail));
+  SVN_ERR (svn_fs_base__get_txn_ids (&root_id, &base_root_id, fs,
+                                     svn_txn_id, trail));
 
   root = make_txn_root (fs, svn_txn_id, trail->pool);
 
@@ -373,16 +298,16 @@
 
 
 svn_error_t *
-svn_fs_txn_root (svn_fs_root_t **root_p,
-                 svn_fs_txn_t *txn,
-                 apr_pool_t *pool)
+svn_fs_base__txn_root (svn_fs_root_t **root_p,
+                       svn_fs_txn_t *txn,
+                       apr_pool_t *pool)
 {
   svn_fs_root_t *root;
   struct txn_root_args args;
 
   args.root_p = &root;
   args.txn = txn;
-  SVN_ERR (svn_fs__retry_txn (txn->fs, txn_body_txn_root, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (txn->fs, txn_body_txn_root, &args, pool));
 
   *root_p = root;
   return SVN_NO_ERROR;
@@ -404,7 +329,8 @@
   dag_node_t *root_dir;
   svn_fs_root_t *root;
 
-  SVN_ERR (svn_fs__dag_revision_root (&root_dir, trail->fs, args->rev, trail));
+  SVN_ERR (svn_fs_base__dag_revision_root (&root_dir, trail->fs, args->rev,
+                                           trail));
   root = make_revision_root (trail->fs, args->rev, root_dir, trail->pool);
 
   *args->root_p = root;
@@ -413,19 +339,19 @@
 
 
 svn_error_t *
-svn_fs_revision_root (svn_fs_root_t **root_p,
-                      svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      apr_pool_t *pool)
+svn_fs_base__revision_root (svn_fs_root_t **root_p,
+                            svn_fs_t *fs,
+                            svn_revnum_t rev,
+                            apr_pool_t *pool)
 {
   struct revision_root_args args;
   svn_fs_root_t *root;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.root_p = &root;
   args.rev = rev;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_revision_root, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_revision_root, &args, pool));
 
   *root_p = root;
   return SVN_NO_ERROR;
@@ -440,20 +366,18 @@
 static svn_error_t *
 not_found (svn_fs_root_t *root, const char *path)
 {
-  if (root->kind == transaction_root)
+  if (root->is_txn_root)
     return
       svn_error_createf
       (SVN_ERR_FS_NOT_FOUND, 0,
        "File not found: transaction '%s', path '%s'",
        root->txn, path);
-  else if (root->kind == revision_root)
+  else
     return
       svn_error_createf
       (SVN_ERR_FS_NOT_FOUND, 0,
        "File not found: revision '%" SVN_REVNUM_T_FMT "', path '%s'",
        root->rev, path);
-  else
-    abort ();
 }
 
 
@@ -463,20 +387,18 @@
 {
   svn_fs_t *fs = root->fs;
 
-  if (root->kind == transaction_root)
+  if (root->is_txn_root)
     return
       svn_error_createf
       (SVN_ERR_FS_ALREADY_EXISTS, 0,
        "File already exists: filesystem '%s', transaction '%s', path '%s'",
        fs->path, root->txn, path);
-  else if (root->kind == revision_root)
+  else
     return
       svn_error_createf
       (SVN_ERR_FS_ALREADY_EXISTS, 0,
        "File already exists: filesystem '%s', revision '%" SVN_REVNUM_T_FMT
        "', path '%s'", fs->path, root->rev, path);
-  else
-    abort ();
 }
 
 
@@ -490,58 +412,6 @@
 
 
 
-/* Simple root operations.  */
-
-void
-svn_fs_close_root (svn_fs_root_t *root)
-{
-  svn_pool_destroy (root->pool);
-}
-
-
-svn_fs_t *
-svn_fs_root_fs (svn_fs_root_t *root)
-{
-  return root->fs;
-}
-
-
-svn_boolean_t
-svn_fs_is_txn_root (svn_fs_root_t *root)
-{
-  return root->kind == transaction_root;
-}
-
-
-svn_boolean_t
-svn_fs_is_revision_root (svn_fs_root_t *root)
-{
-  return root->kind == revision_root;
-}
-
-
-const char *
-svn_fs_txn_root_name (svn_fs_root_t *root,
-                      apr_pool_t *pool)
-{
-  if (root->kind == transaction_root)
-    return apr_pstrdup (pool, root->txn);
-  else
-    return NULL;
-}
-
-
-svn_revnum_t
-svn_fs_revision_root_revision (svn_fs_root_t *root)
-{
-  if (root->kind == revision_root)
-    return root->rev;
-  else
-    return SVN_INVALID_REVNUM;
-}
-
-
-
 /* Getting dag nodes for roots.  */
 
 
@@ -552,20 +422,20 @@
            svn_fs_root_t *root,
            trail_t *trail)
 {
-  if (root->kind == revision_root)
+  base_root_data_t *brd = root->fsap_data;
+
+  if (! root->is_txn_root)
     {
       /* It's a revision root, so we already have its root directory
          opened.  */
-      *node_p = svn_fs__dag_dup (root->root_dir, trail->pool);
+      *node_p = svn_fs_base__dag_dup (brd->root_dir, trail->pool);
       return SVN_NO_ERROR;
     }
-  else if (root->kind == transaction_root)
+  else
     {
       /* It's a transaction root.  Open a fresh copy.  */
-      return svn_fs__dag_txn_root (node_p, root->fs, root->txn, trail);
+      return svn_fs_base__dag_txn_root (node_p, root->fs, root->txn, trail);
     }
-  else
-    abort ();
 }
 
 
@@ -578,13 +448,11 @@
                    const char *error_path,
                    trail_t *trail)
 {
-  if (root->kind == transaction_root)
-    return svn_fs__dag_clone_root (node_p, root->fs, 
-                                   svn_fs_txn_root_name (root, trail->pool),
-                                   trail);
+  if (root->is_txn_root)
+    return svn_fs_base__dag_clone_root (node_p, root->fs, root->txn, trail);
   else
     /* If it's not a transaction root, we can't change its contents.  */
-    return svn_fs__err_not_mutable (root->fs, root->rev, error_path);
+    return svn_fs_base__err_not_mutable (root->fs, root->rev, error_path);
 }
 
 
@@ -607,7 +475,7 @@
    also needs to change the parent directory.  */
 typedef struct parent_path_t
 {
-  
+
   /* A node along the path.  This could be the final node, one of its
      parents, or the root.  Every parent path ends with an element for
      the root directory.  */
@@ -637,8 +505,8 @@
   const char *path_so_far = "/";
   if (parent_path->parent)
     path_so_far = parent_path_path (parent_path->parent, pool);
-  return parent_path->entry 
-         ? svn_path_join (path_so_far, parent_path->entry, pool) 
+  return parent_path->entry
+         ? svn_path_join (path_so_far, parent_path->entry, pool)
          : path_so_far;
 }
 
@@ -661,19 +529,19 @@
   const svn_fs_id_t *child_id, *parent_id;
   const char *child_copy_id, *parent_copy_id;
   const char *id_path = NULL;
-  svn_fs__copy_t *copy;
+  copy_t *copy;
 
   /* Make some assertions about the function input. */
   assert (child && child->parent && txn_id);
 
   /* Initialize some convenience variables. */
-  child_id = svn_fs__dag_get_id (child->node);
-  parent_id = svn_fs__dag_get_id (child->parent->node);
+  child_id = svn_fs_base__dag_get_id (child->node);
+  parent_id = svn_fs_base__dag_get_id (child->parent->node);
   child_copy_id = svn_fs__id_copy_id (child_id);
   parent_copy_id = svn_fs__id_copy_id (parent_id);
 
   /* If this child is already mutable, we have nothing to do. */
-  if (svn_fs__key_compare (svn_fs__id_txn_id (child_id), txn_id) == 0)
+  if (svn_fs_base__key_compare (svn_fs__id_txn_id (child_id), txn_id) == 0)
     {
       *inherit_p = copy_id_inherit_self;
       *copy_src_path = NULL;
@@ -694,7 +562,7 @@
      the same, then the child is already on the same branch as the
      parent, and should use the same mutability copy ID that the
      parent will use. */
-  if (svn_fs__key_compare (child_copy_id, parent_copy_id) == 0)
+  if (svn_fs_base__key_compare (child_copy_id, parent_copy_id) == 0)
     return SVN_NO_ERROR;
 
   /* If the child is on the same branch that the parent is on, the
@@ -704,13 +572,13 @@
      branch as its parent if the child itself is not a branch point,
      or if it is a branch point that we are accessing via its original
      copy destination path. */
-  SVN_ERR (svn_fs__bdb_get_copy (&copy, fs, child_copy_id, trail));
+  SVN_ERR (svn_fs_bdb__get_copy (&copy, fs, child_copy_id, trail));
   if (svn_fs_compare_ids (copy->dst_noderev_id, child_id) == -1)
     return SVN_NO_ERROR;
 
   /* Determine if we are looking at the child via its original path or
      as a subtree item of a copied tree. */
-  id_path = svn_fs__dag_get_created_path (child->node);
+  id_path = svn_fs_base__dag_get_created_path (child->node);
   if (strcmp (id_path, parent_path_path (child, trail->pool)) == 0)
     {
       *inherit_p = copy_id_inherit_self;
@@ -822,7 +690,7 @@
    them, and tell them whether the entry exists already.
 
    NOTE: Public interfaces which only *read* from the filesystem
-   should not call this function directly, but should instead use 
+   should not call this function directly, but should instead use
    get_dag().
 */
 static svn_error_t *
@@ -845,26 +713,26 @@
   /* Make a parent_path item for the root node, using its own current
      copy id.  */
   SVN_ERR (root_node (&here, root, trail));
-  id = svn_fs__dag_get_id (here);
+  id = svn_fs_base__dag_get_id (here);
   parent_path = make_parent_path (here, 0, 0, pool);
   parent_path->copy_inherit = copy_id_inherit_self;
-  
+
   rest = canon_path + 1; /* skip the leading '/', it saves in iteration */
 
   /* Whenever we are at the top of this loop:
      - HERE is our current directory,
      - ID is the node revision ID of HERE,
-     - REST is the path we're going to find in HERE, and 
+     - REST is the path we're going to find in HERE, and
      - PARENT_PATH includes HERE and all its parents.  */
   for (;;)
     {
       const char *next;
       char *entry;
       dag_node_t *child;
-      
+
       /* Parse out the next entry from the path.  */
       entry = next_entry_name (&next, rest, pool);
-      
+
       /* Calculate the path traversed thus far. */
       path_so_far = svn_path_join (path_so_far, entry, pool);
 
@@ -890,32 +758,32 @@
           if (cached_node)
             child = cached_node;
           else
-            err = svn_fs__dag_open (&child, here, entry, trail);
-          
+            err = svn_fs_base__dag_open (&child, here, entry, trail);
+
           /* "file not found" requires special handling.  */
           if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
             {
               /* If this was the last path component, and the caller
                  said it was optional, then don't return an error;
                  just put a NULL node pointer in the path.  */
-              
+
               svn_error_clear (err);
-              
+
               if ((flags & open_path_last_optional)
                   && (! next || *next == '\0'))
                 {
-                  parent_path = make_parent_path (NULL, entry, parent_path, 
+                  parent_path = make_parent_path (NULL, entry, parent_path,
                                                   pool);
                   break;
                 }
               else
                 {
-                  /* Build a better error message than svn_fs__dag_open
+                  /* Build a better error message than svn_fs_base__dag_open
                      can provide, giving the root and full path name.  */
                   return not_found (root, path);
                 }
             }
-          
+
           /* Other errors we return normally.  */
           SVN_ERR (err);
 
@@ -923,7 +791,7 @@
           parent_path = make_parent_path (child, entry, parent_path, pool);
           if (txn_id)
             {
-              SVN_ERR (get_copy_inheritance (&inherit, &copy_path, 
+              SVN_ERR (get_copy_inheritance (&inherit, &copy_path,
                                              fs, parent_path, txn_id, trail));
               parent_path->copy_inherit = inherit;
               parent_path->copy_src_path = apr_pstrdup (pool, copy_path);
@@ -933,16 +801,16 @@
           if (! cached_node)
             dag_node_cache_set (root, path_so_far, child);
         }
-      
+
       /* Are we finished traversing the path?  */
       if (! next)
         break;
-      
+
       /* The path isn't finished yet; we'd better be in a directory.  */
-      if (svn_fs__dag_node_kind (child) != svn_node_dir)
-        SVN_ERR_W (svn_fs__err_not_directory (fs, path_so_far),
+      if (svn_fs_base__dag_node_kind (child) != svn_node_dir)
+        SVN_ERR_W (svn_fs_base__err_not_directory (fs, path_so_far),
                    apr_pstrcat (pool, "Failure opening '", path, "'", NULL));
-      
+
       rest = next;
       here = child;
     }
@@ -964,18 +832,18 @@
                    trail_t *trail)
 {
   dag_node_t *clone;
-  const char *txn_id = svn_fs_txn_root_name (root, trail->pool);
-  svn_fs_t *fs = svn_fs_root_fs (root);
+  const char *txn_id = root->txn;
+  svn_fs_t *fs = root->fs;
 
   /* Is the node mutable already?  */
-  if (svn_fs__dag_check_mutable (parent_path->node, txn_id))
+  if (svn_fs_base__dag_check_mutable (parent_path->node, txn_id))
     return SVN_NO_ERROR;
 
   /* Are we trying to clone the root, or somebody's child node?  */
   if (parent_path->parent)
     {
       const svn_fs_id_t *parent_id;
-      const svn_fs_id_t *node_id = svn_fs__dag_get_id (parent_path->node);
+      const svn_fs_id_t *node_id = svn_fs_base__dag_get_id (parent_path->node);
       const char *copy_id = NULL;
       const char *copy_src_path = parent_path->copy_src_path;
       copy_id_inherit_t inherit = parent_path->copy_inherit;
@@ -983,18 +851,18 @@
 
       /* We're trying to clone somebody's child.  Make sure our parent
          is mutable.  */
-      SVN_ERR (make_path_mutable (root, parent_path->parent, 
+      SVN_ERR (make_path_mutable (root, parent_path->parent,
                                   error_path, trail));
 
       switch (inherit)
         {
         case copy_id_inherit_parent:
-          parent_id = svn_fs__dag_get_id (parent_path->parent->node);
+          parent_id = svn_fs_base__dag_get_id (parent_path->parent->node);
           copy_id = svn_fs__id_copy_id (parent_id);
           break;
-          
+
         case copy_id_inherit_new:
-          SVN_ERR (svn_fs__bdb_reserve_copy_id (&copy_id, fs, trail));
+          SVN_ERR (svn_fs_bdb__reserve_copy_id (&copy_id, fs, trail));
           break;
 
         case copy_id_inherit_self:
@@ -1006,28 +874,28 @@
           abort(); /* uh-oh -- somebody didn't calculate copy-ID
                       inheritance data. */
         }
-          
+
       /* Now make this node mutable.  */
       clone_path = parent_path_path (parent_path->parent, trail->pool);
-      SVN_ERR (svn_fs__dag_clone_child (&clone,
-                                        parent_path->parent->node,
-                                        clone_path,
-                                        parent_path->entry, 
-                                        copy_id, txn_id, 
-                                        trail));
-      
+      SVN_ERR (svn_fs_base__dag_clone_child (&clone,
+                                             parent_path->parent->node,
+                                             clone_path,
+                                             parent_path->entry,
+                                             copy_id, txn_id,
+                                             trail));
+
       /* If we just created a brand new copy ID, we need to store a
          `copies' table entry for it, as well as a notation in the
          transaction that should this transaction be terminated, our
          new copy needs to be removed. */
       if (inherit == copy_id_inherit_new)
         {
-          const svn_fs_id_t *new_node_id = svn_fs__dag_get_id (clone);
-          SVN_ERR (svn_fs__bdb_create_copy (fs, copy_id, copy_src_path, 
+          const svn_fs_id_t *new_node_id = svn_fs_base__dag_get_id (clone);
+          SVN_ERR (svn_fs_bdb__create_copy (fs, copy_id, copy_src_path,
                                             svn_fs__id_txn_id (node_id),
-                                            new_node_id, 
-                                            svn_fs__copy_kind_soft, trail));
-          SVN_ERR (svn_fs__add_txn_copy (fs, txn_id, copy_id, trail));
+                                            new_node_id,
+                                            copy_kind_soft, trail));
+          SVN_ERR (svn_fs_base__add_txn_copy (fs, txn_id, copy_id, trail));
         }
     }
   else
@@ -1093,13 +961,13 @@
             svn_boolean_t prop_mod,
             trail_t *trail)
 {
-  svn_fs__change_t change;
+  change_t change;
   change.path = svn_fs__canonicalize_abspath (path, trail->pool);
   change.noderev_id = noderev_id;
   change.kind = change_kind;
   change.text_mod = text_mod;
   change.prop_mod = prop_mod;
-  return svn_fs__bdb_changes_add (fs, txn_id, &change, trail);
+  return svn_fs_bdb__changes_add (fs, txn_id, &change, trail);
 }
 
 
@@ -1121,26 +989,28 @@
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  *args->id_p = svn_fs__id_copy (svn_fs__dag_get_id (node), trail->pool);
+  *args->id_p = svn_fs__id_copy (svn_fs_base__dag_get_id (node), trail->pool);
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_node_id (const svn_fs_id_t **id_p,
-                svn_fs_root_t *root,
-                const char *path,
-                apr_pool_t *pool)
+static svn_error_t *
+base_node_id (const svn_fs_id_t **id_p,
+              svn_fs_root_t *root,
+              const char *path,
+              apr_pool_t *pool)
 {
-  if ((root->kind == revision_root)
+  base_root_data_t *brd = root->fsap_data;
+
+  if (! root->is_txn_root
       && (path[0] == '\0' || ((path[0] == '/') && (path[1] == '\0'))))
     {
-      /* Optimize the case where we don't need any db access at all. 
+      /* Optimize the case where we don't need any db access at all.
          The root directory ("" or "/") node is stored in the
          svn_fs_root_t object, and never changes when it's a revision
          root, so we can just reach in and grab it directly. */
-      *id_p = svn_fs__id_copy (svn_fs__dag_get_id (root->root_dir), pool);
+      *id_p = svn_fs__id_copy (svn_fs_base__dag_get_id (brd->root_dir), pool);
     }
   else
     {
@@ -1151,7 +1021,8 @@
       args.root = root;
       args.path = path;
 
-      SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_node_id, &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_node_id, &args,
+                                       pool));
       *id_p = id;
     }
   return SVN_NO_ERROR;
@@ -1172,23 +1043,23 @@
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  SVN_ERR (svn_fs__dag_get_revision (&(args->revision), node, trail));
+  SVN_ERR (svn_fs_base__dag_get_revision (&(args->revision), node, trail));
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_node_created_rev (svn_revnum_t *revision,
-                         svn_fs_root_t *root,
-                         const char *path,
-                         apr_pool_t *pool)
+static svn_error_t *
+base_node_created_rev (svn_revnum_t *revision,
+                       svn_fs_root_t *root,
+                       const char *path,
+                       apr_pool_t *pool)
 {
   struct node_created_rev_args args;
 
   args.revision = SVN_INVALID_REVNUM;
   args.root = root;
   args.path = path;
-  SVN_ERR (svn_fs__retry_txn 
+  SVN_ERR (svn_fs_base__retry_txn
            (root->fs, txn_body_node_created_rev, &args, pool));
   *revision = args.revision;
   return SVN_NO_ERROR;
@@ -1209,23 +1080,23 @@
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  *args->created_path = svn_fs__dag_get_created_path (node);
+  *args->created_path = svn_fs_base__dag_get_created_path (node);
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_node_created_path (const char **created_path,
-                          svn_fs_root_t *root,
-                          const char *path,
-                          apr_pool_t *pool)
+static svn_error_t *
+base_node_created_path (const char **created_path,
+                        svn_fs_root_t *root,
+                        const char *path,
+                        apr_pool_t *pool)
 {
   struct node_created_path_args args;
 
   args.created_path = created_path;
   args.root = root;
   args.path = path;
-  SVN_ERR (svn_fs__retry_txn 
+  SVN_ERR (svn_fs_base__retry_txn
            (root->fs, txn_body_node_created_path, &args, pool));
   return SVN_NO_ERROR;
 }
@@ -1243,9 +1114,9 @@
   struct node_kind_args *args = baton;
   dag_node_t *node;
 
-  SVN_ERR (svn_fs__dag_get_node (&node, trail->fs, args->id, trail));
-  args->kind = svn_fs__dag_node_kind (node);
-  
+  SVN_ERR (svn_fs_base__dag_get_node (&node, trail->fs, args->id, trail));
+  args->kind = svn_fs_base__dag_node_kind (node);
+
   return SVN_NO_ERROR;
 }
 
@@ -1260,22 +1131,22 @@
   const svn_fs_id_t *node_id;
 
   /* Get the node id. */
-  SVN_ERR (svn_fs_node_id (&node_id, root, path, pool));
-    
+  SVN_ERR (base_node_id (&node_id, root, path, pool));
+
   /* Use the node id to get the real kind. */
   args.id = node_id;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_node_kind, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_node_kind, &args, pool));
 
   *kind_p = args.kind;
   return SVN_NO_ERROR;
 }
 
-  
-svn_error_t *
-svn_fs_check_path (svn_node_kind_t *kind_p,
-                   svn_fs_root_t *root,
-                   const char *path,
-                   apr_pool_t *pool)
+
+static svn_error_t *
+base_check_path (svn_node_kind_t *kind_p,
+                 svn_fs_root_t *root,
+                 const char *path,
+                 apr_pool_t *pool)
 {
   svn_error_t *err = node_kind (kind_p, root, path, pool);
   if (err && (err->apr_err == SVN_ERR_FS_NOT_FOUND))
@@ -1291,32 +1162,6 @@
 }
 
 
-svn_error_t *
-svn_fs_is_dir (svn_boolean_t *is_dir,
-               svn_fs_root_t *root,
-               const char *path,
-               apr_pool_t *pool)
-{
-  svn_node_kind_t kind;
-  SVN_ERR (node_kind (&kind, root, path, pool));
-  *is_dir = (kind == svn_node_dir);
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_is_file (svn_boolean_t *is_file,
-                svn_fs_root_t *root,
-                const char *path,
-                apr_pool_t *pool)
-{
-  svn_node_kind_t kind;
-  SVN_ERR (node_kind (&kind, root, path, pool));
-  *is_file = (kind == svn_node_file);
-  return SVN_NO_ERROR;
-}
-
-
 struct node_prop_args
 {
   svn_string_t **value_p;
@@ -1335,21 +1180,21 @@
   apr_hash_t *proplist;
 
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  SVN_ERR (svn_fs__dag_get_proplist (&proplist, node, trail));
+  SVN_ERR (svn_fs_base__dag_get_proplist (&proplist, node, trail));
   *(args->value_p) = NULL;
   if (proplist)
-    *(args->value_p) = apr_hash_get (proplist, args->propname, 
+    *(args->value_p) = apr_hash_get (proplist, args->propname,
                                      APR_HASH_KEY_STRING);
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_node_prop (svn_string_t **value_p,
-                  svn_fs_root_t *root,
-                  const char *path,
-                  const char *propname,
-                  apr_pool_t *pool)
+static svn_error_t *
+base_node_prop (svn_string_t **value_p,
+                svn_fs_root_t *root,
+                const char *path,
+                const char *propname,
+                apr_pool_t *pool)
 {
   struct node_prop_args args;
   svn_string_t *value;
@@ -1358,7 +1203,7 @@
   args.root     = root;
   args.path     = path;
   args.propname = propname;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_node_prop, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_node_prop, &args, pool));
 
   *value_p = value;
   return SVN_NO_ERROR;
@@ -1380,17 +1225,17 @@
   apr_hash_t *proplist;
 
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  SVN_ERR (svn_fs__dag_get_proplist (&proplist, node, trail));
+  SVN_ERR (svn_fs_base__dag_get_proplist (&proplist, node, trail));
   *args->table_p = proplist ? proplist : apr_hash_make (trail->pool);
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_node_proplist (apr_hash_t **table_p,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *pool)
+static svn_error_t *
+base_node_proplist (apr_hash_t **table_p,
+                    svn_fs_root_t *root,
+                    const char *path,
+                    apr_pool_t *pool)
 {
   apr_hash_t *table;
   struct node_proplist_args args;
@@ -1399,7 +1244,8 @@
   args.root = root;
   args.path = path;
 
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_node_proplist, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_node_proplist, &args,
+                                   pool));
 
   *table_p = table;
   return SVN_NO_ERROR;
@@ -1421,11 +1267,12 @@
   struct change_node_prop_args *args = baton;
   parent_path_t *parent_path;
   apr_hash_t *proplist;
-  const char *txn_id = svn_fs_txn_root_name (args->root, trail->pool);
+  const char *txn_id = args->root->txn;
 
   SVN_ERR (open_path (&parent_path, args->root, args->path, 0, txn_id, trail));
   SVN_ERR (make_path_mutable (args->root, parent_path, args->path, trail));
-  SVN_ERR (svn_fs__dag_get_proplist (&proplist, parent_path->node, trail));
+  SVN_ERR (svn_fs_base__dag_get_proplist (&proplist, parent_path->node,
+                                          trail));
 
   /* If there's no proplist, but we're just deleting a property, exit now. */
   if ((! proplist) && (! args->value))
@@ -1439,36 +1286,36 @@
   apr_hash_set (proplist, args->name, APR_HASH_KEY_STRING, args->value);
 
   /* Overwrite the node's proplist. */
-  SVN_ERR (svn_fs__dag_set_proplist (parent_path->node, proplist, 
-                                     txn_id, trail));
+  SVN_ERR (svn_fs_base__dag_set_proplist (parent_path->node, proplist,
+                                          txn_id, trail));
 
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (args->root), txn_id, 
-                       args->path, svn_fs__dag_get_id (parent_path->node),
+  SVN_ERR (add_change (args->root->fs, txn_id,
+                       args->path, svn_fs_base__dag_get_id (parent_path->node),
                        svn_fs_path_change_modify, 0, 1, trail));
-  
+
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_change_node_prop (svn_fs_root_t *root,
-                         const char *path,
-                         const char *name,
-                         const svn_string_t *value,
-                         apr_pool_t *pool)
+static svn_error_t *
+base_change_node_prop (svn_fs_root_t *root,
+                       const char *path,
+                       const char *name,
+                       const svn_string_t *value,
+                       apr_pool_t *pool)
 {
   struct change_node_prop_args args;
 
-  if (! svn_fs_is_txn_root (root))
+  if (! root->is_txn_root)
     return not_txn (root);
 
   args.root  = root;
   args.path  = path;
   args.name  = name;
   args.value = value;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_change_node_prop, &args,
-                              pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_change_node_prop, &args,
+                                   pool));
 
   return SVN_NO_ERROR;
 }
@@ -1493,28 +1340,28 @@
 
   SVN_ERR (get_dag (&node1, args->root1, args->path1, trail));
   SVN_ERR (get_dag (&node2, args->root2, args->path2, trail));
-  SVN_ERR (svn_fs__things_different (args->changed_p, NULL, 
-                                     node1, node2, trail));
+  SVN_ERR (svn_fs_base__things_different (args->changed_p, NULL,
+                                          node1, node2, trail));
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_props_changed (svn_boolean_t *changed_p,
-                      svn_fs_root_t *root1,
-                      const char *path1,
-                      svn_fs_root_t *root2,
-                      const char *path2,
-                      apr_pool_t *pool)
+static svn_error_t *
+base_props_changed (svn_boolean_t *changed_p,
+                    svn_fs_root_t *root1,
+                    const char *path1,
+                    svn_fs_root_t *root2,
+                    const char *path2,
+                    apr_pool_t *pool)
 {
   struct things_changed_args args;
-  
+
   /* Check that roots are in the same fs. */
-  if ((svn_fs_root_fs (root1)) != (svn_fs_root_fs (root2)))
+  if (root1->fs != root2->fs)
     return svn_error_create
       (SVN_ERR_FS_GENERAL, NULL,
        "Asking props changed in two different filesystems");
-  
+
   args.root1      = root1;
   args.root2      = root2;
   args.path1      = path1;
@@ -1522,14 +1369,92 @@
   args.changed_p  = changed_p;
   args.pool       = pool;
 
-  SVN_ERR (svn_fs__retry_txn (root1->fs, txn_body_props_changed,
-                              &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root1->fs, txn_body_props_changed,
+                                   &args, pool));
 
   return SVN_NO_ERROR;
 }
 
 
 
+/* Getting a directory's entries */
+
+
+struct dir_entries_args
+{
+  apr_hash_t **table_p;
+  svn_fs_root_t *root;
+  const char *path;
+};
+
+
+static svn_error_t *
+txn_body_dir_entries (void *baton,
+                      trail_t *trail)
+{
+  struct dir_entries_args *args = baton;
+  dag_node_t *node;
+  apr_hash_t *entries;
+
+  SVN_ERR (get_dag (&node, args->root, args->path, trail));
+
+  /* Get the entries for PARENT_PATH. */
+  SVN_ERR (svn_fs_base__dag_dir_entries (&entries, node, trail));
+
+  /* Potentially initialize the return value to an empty hash. */
+  *args->table_p = entries ? entries : apr_hash_make (trail->pool);
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+base_dir_entries (apr_hash_t **table_p,
+                  svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
+{
+  struct dir_entries_args args;
+  apr_hash_t *table;
+  svn_fs_t *fs = root->fs;
+
+  args.table_p = &table;
+  args.root    = root;
+  args.path    = path;
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_dir_entries, &args,
+                                   pool));
+
+  /* Add in the kind data. */
+  if (table)
+    {
+      apr_hash_index_t *hi;
+      apr_pool_t *subpool = svn_pool_create (pool);
+      for (hi = apr_hash_first (subpool, table); hi; hi = apr_hash_next (hi))
+        {
+          svn_fs_dirent_t *entry;
+          struct node_kind_args nk_args;
+          void *val;
+
+          /* KEY will be the entry name in ancestor (about which we
+             simple don't care), VAL the dirent. */
+          apr_hash_this (hi, NULL, NULL, &val);
+          entry = val;
+          nk_args.id = entry->id;
+          SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_node_kind, &nk_args,
+                                           pool));
+          entry->kind = nk_args.kind;
+        }
+    }
+  else
+    {
+      table = apr_hash_make (pool);
+    }
+
+  *table_p = table;
+  return SVN_NO_ERROR;
+}
+
+
+
 /* Merges and commits. */
 
 
@@ -1565,9 +1490,12 @@
   struct txn_deltify_args *args = baton;
   dag_node_t *tgt_node, *base_node;
 
-  SVN_ERR (svn_fs__dag_get_node (&tgt_node, trail->fs, args->tgt_id, trail));
-  SVN_ERR (svn_fs__dag_get_node (&base_node, trail->fs, args->base_id, trail));
-  SVN_ERR (svn_fs__dag_deltify (tgt_node, base_node, args->is_dir, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&tgt_node, trail->fs, args->tgt_id,
+                                      trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&base_node, trail->fs, args->base_id,
+                                      trail));
+  SVN_ERR (svn_fs_base__dag_deltify (tgt_node, base_node, args->is_dir,
+                                     trail));
 
   return SVN_NO_ERROR;
 }
@@ -1583,10 +1511,10 @@
 static svn_error_t *
 txn_body_pred_count (void *baton, trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   struct txn_pred_count_args *args = baton;
 
-  SVN_ERR (svn_fs__bdb_get_node_revision (&noderev, trail->fs, 
+  SVN_ERR (svn_fs_bdb__get_node_revision (&noderev, trail->fs,
                                           args->id, trail));
   args->pred_count = noderev->predecessor_count;
   return SVN_NO_ERROR;
@@ -1604,10 +1532,10 @@
 static svn_error_t *
 txn_body_pred_id (void *baton, trail_t *trail)
 {
-  svn_fs__node_revision_t *nr;
+  node_revision_t *nr;
   struct txn_pred_id_args *args = baton;
 
-  SVN_ERR (svn_fs__bdb_get_node_revision (&nr, trail->fs, args->id, trail));
+  SVN_ERR (svn_fs_bdb__get_node_revision (&nr, trail->fs, args->id, trail));
   if (nr->predecessor_id)
     args->pred_id = svn_fs__id_copy (nr->predecessor_id, args->pool);
   else
@@ -1628,11 +1556,11 @@
 {
   const svn_fs_id_t *id;
   apr_hash_t *entries = NULL;
-  svn_boolean_t is_dir;
+  svn_node_kind_t kind;
   struct txn_deltify_args td_args;
 
   /* Get the ID for PATH under ROOT. */
-  SVN_ERR (svn_fs_node_id (&id, root, path, pool));
+  SVN_ERR (base_node_id (&id, root, path, pool));
 
   /* Check for mutability.  Not mutable?  Go no further.  This is safe
      to do because for items in the tree to be mutable, their parent
@@ -1642,11 +1570,11 @@
     return SVN_NO_ERROR;
 
   /* Is this a directory?  */
-  SVN_ERR (svn_fs_is_dir (&is_dir, root, path, pool));
+  SVN_ERR (base_check_path (&kind, root, path, pool));
 
   /* If this is a directory, read its entries.  */
-  if (is_dir)
-    SVN_ERR (svn_fs_dir_entries (&entries, root, path, pool));
+  if (kind == svn_node_dir)
+    SVN_ERR (base_dir_entries (&entries, root, path, pool));
 
   /* If there are entries, recurse on 'em.  */
   if (entries)
@@ -1660,7 +1588,7 @@
              which we really don't care) */
           const void *key;
           apr_hash_this (hi, &key, NULL, NULL);
-          SVN_ERR (deltify_mutable (fs, root, 
+          SVN_ERR (deltify_mutable (fs, root,
                                     svn_path_join (path, key, subpool),
                                     txn_id, subpool));
           svn_pool_clear (subpool);
@@ -1668,17 +1596,17 @@
 
       svn_pool_destroy (subpool);
     }
-  
+
   /* Finally, deltify old data against this node. */
   {
     /* Redeltify predecessor node-revisions of the one we added.  The
        idea is to require at most 2*lg(N) deltas to be applied to get
        to any node-revision in a chain of N predecessors.  We do this
        using a technique derived from skip lists:
-       
+
           - Always redeltify the immediate parent
 
-          - If the number of predecessors is divisible by 2, 
+          - If the number of predecessors is divisible by 2,
               redeltify the revision two predecessors back
 
           - If the number of predecessors is divisible by 4,
@@ -1700,9 +1628,10 @@
     int pred_count, nlevels, lev, count;
     const svn_fs_id_t *pred_id;
     struct txn_pred_count_args tpc_args;
-    
+
     tpc_args.id = id;
-    SVN_ERR (svn_fs__retry_txn (fs, txn_body_pred_count, &tpc_args, pool));
+    SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_pred_count, &tpc_args,
+                                     pool));
     pred_count = tpc_args.pred_count;
 
     /* If nothing to deltify, then we're done. */
@@ -1720,12 +1649,12 @@
             pred_count /= 2;
             nlevels++;
           }
-        
+
         /* Don't redeltify the oldest revision. */
         if (1 << (nlevels - 1) == pred_count)
           nlevels--;
       }
-    
+
     /* Redeltify the desired number of predecessors. */
     count = 0;
     pred_id = id;
@@ -1735,7 +1664,7 @@
            redeltify the node-revision two predecessors back). */
         if (lev == 1)
           continue;
-        
+
         /* Note that COUNT is not reset between levels, and neither is
            PREDNODE; we just keep counting from where we were up to
            where we're supposed to get. */
@@ -1745,8 +1674,8 @@
 
             tpi_args.id = pred_id;
             tpi_args.pool = pool;
-            SVN_ERR (svn_fs__retry_txn (fs, txn_body_pred_id, 
-                                        &tpi_args, pool));
+            SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_pred_id,
+                                             &tpi_args, pool));
             pred_id = tpi_args.pred_id;
 
             if (pred_id == NULL)
@@ -1759,8 +1688,9 @@
         /* Finally, do the deltification. */
         td_args.tgt_id = pred_id;
         td_args.base_id = id;
-        td_args.is_dir = is_dir;
-        SVN_ERR (svn_fs__retry_txn (fs, txn_body_txn_deltify, &td_args, pool));
+        td_args.is_dir = (kind == svn_node_dir);
+        SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_txn_deltify, &td_args,
+                                         pool));
       }
   }
 
@@ -1789,20 +1719,20 @@
    as part of TRAIL. */
 static svn_error_t *
 id_check_ancestor (svn_boolean_t *is_ancestor,
-                   svn_fs_t *fs, 
-                   const svn_fs_id_t *id1, 
+                   svn_fs_t *fs,
+                   const svn_fs_id_t *id1,
                    const svn_fs_id_t *id2,
                    trail_t *trail)
 {
   dag_node_t *node1, *node2;
 
   /* Get the nodes. */
-  SVN_ERR (svn_fs__dag_get_node (&node1, fs, id1, trail));
-  SVN_ERR (svn_fs__dag_get_node (&node2, fs, id2, trail));
-  
+  SVN_ERR (svn_fs_base__dag_get_node (&node1, fs, id1, trail));
+  SVN_ERR (svn_fs_base__dag_get_node (&node2, fs, id2, trail));
+
   /* Do the test.  If the test fails, we'll just go with "not an
      ancestor" for now.  ### better come back and check this out.  */
-  return svn_fs__dag_is_ancestor (is_ancestor, node1, node2, trail);
+  return svn_fs_base__dag_is_ancestor (is_ancestor, node1, node2, trail);
 }
 
 
@@ -1815,19 +1745,19 @@
                  int source_pred_count,
                  trail_t *trail)
 {
-  svn_fs__node_revision_t *noderev;
-  
+  node_revision_t *noderev;
+
   /* Set target's predecessor-id to source_id.  */
   if (strcmp (svn_fs__id_txn_id (target_id), txn_id))
     return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Unexpected immutable node at '%s'", target_path);
-  SVN_ERR (svn_fs__bdb_get_node_revision (&noderev, fs, target_id, trail));
+  SVN_ERR (svn_fs_bdb__get_node_revision (&noderev, fs, target_id, trail));
   noderev->predecessor_id = source_id;
   noderev->predecessor_count = source_pred_count;
   if (noderev->predecessor_count != -1)
     noderev->predecessor_count++;
-  return svn_fs__bdb_put_node_revision (fs, target_id, noderev, trail);
+  return svn_fs_bdb__put_node_revision (fs, target_id, noderev, trail);
 }
 
 
@@ -1845,8 +1775,8 @@
   path = svn_fs__canonicalize_abspath (path, trail->pool);
 
   /* First, get the changes associated with TXN_ID. */
-  SVN_ERR (svn_fs__bdb_changes_fetch (&changes, fs, txn_id, trail));
-  
+  SVN_ERR (svn_fs_bdb__changes_fetch (&changes, fs, txn_id, trail));
+
   /* Now, do any of those changes apply to path and indicate deletion? */
   this_change = apr_hash_get (changes, path, APR_HASH_KEY_STRING);
   if (this_change
@@ -1855,12 +1785,12 @@
     {
       /* If so, reset the changes and re-add everything except the
          deletion. */
-      SVN_ERR (add_change (fs, txn_id, path, NULL, 
+      SVN_ERR (add_change (fs, txn_id, path, NULL,
                            svn_fs_path_change_reset, 0, 0, trail));
       if (this_change->change_kind == svn_fs_path_change_replace)
         {
-          SVN_ERR (add_change (fs, txn_id, path, this_change->node_rev_id, 
-                               svn_fs_path_change_add, this_change->text_mod, 
+          SVN_ERR (add_change (fs, txn_id, path, this_change->node_rev_id,
+                               svn_fs_path_change_add, this_change->text_mod,
                                this_change->prop_mod, trail));
         }
     }
@@ -1868,7 +1798,7 @@
     {
       /* Else, this function was called in error, OR something is not
          as we expected it to be in the changes table. */
-      return svn_error_createf 
+      return svn_error_createf
         (SVN_ERR_FS_CORRUPT, NULL,
          "No deletion changes for path '%s' "
          "in transaction '%s' of filesystem '%s'",
@@ -1877,7 +1807,7 @@
 
   return SVN_NO_ERROR;
 }
-                       
+
 
 /* Set the contents of CONFLICT_PATH to PATH, and return an
    SVN_ERR_FS_CONFLICT error that indicates that there was a conflict
@@ -1930,9 +1860,9 @@
   svn_fs_t *fs;
 
   /* Make sure everyone comes from the same filesystem. */
-  fs = svn_fs__dag_get_fs (ancestor);
-  if ((fs != svn_fs__dag_get_fs (source))
-      || (fs != svn_fs__dag_get_fs (target)))
+  fs = svn_fs_base__dag_get_fs (ancestor);
+  if ((fs != svn_fs_base__dag_get_fs (source))
+      || (fs != svn_fs_base__dag_get_fs (target)))
     {
       return svn_error_create
         (SVN_ERR_FS_CORRUPT, NULL,
@@ -1940,11 +1870,11 @@
     }
 
   /* We have the same fs, now check it. */
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
-  source_id   = svn_fs__dag_get_id (source);
-  target_id   = svn_fs__dag_get_id (target);
-  ancestor_id = svn_fs__dag_get_id (ancestor);
+  source_id   = svn_fs_base__dag_get_id (source);
+  target_id   = svn_fs_base__dag_get_id (target);
+  ancestor_id = svn_fs_base__dag_get_id (ancestor);
 
   /* It's improper to call this function with ancestor == target. */
   if (svn_fs__id_eq (ancestor_id, target_id))
@@ -1968,7 +1898,7 @@
 
   /* Else proceed, knowing all three are distinct node revisions.
    *
-   * How to merge from this point: 
+   * How to merge from this point:
    *
    * if (not all 3 are directories)
    *   {
@@ -2007,11 +1937,11 @@
    *           }
    *       }
    *     else if (E exists in source but not target)
-   *       { 
+   *       {
    *         if (E changed between ancestor and source)
    *           conflict;
    *         else if (E did not change between ancestor and source)
-   *           // do nothing 
+   *           // do nothing
    *     else if (E exists in target but not source)
    *       {
    *         if (E points the same node rev in target and ancestor)
@@ -2042,7 +1972,7 @@
    *     else if (E exists in target but different id than E in source)
    *       conflict;
    *   }
-   *         
+   *
    *     // All entries in ancestor and source are accounted for.
    *     // Remaining entries in target should be left as-is.
    *   }
@@ -2072,33 +2002,33 @@
    * See the following message for the full details:
    * http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=166183 */
 
-  if ((svn_fs__dag_node_kind (source) != svn_node_dir)
-      || (svn_fs__dag_node_kind (target) != svn_node_dir)
-      || (svn_fs__dag_node_kind (ancestor) != svn_node_dir))
+  if ((svn_fs_base__dag_node_kind (source) != svn_node_dir)
+      || (svn_fs_base__dag_node_kind (target) != svn_node_dir)
+      || (svn_fs_base__dag_node_kind (ancestor) != svn_node_dir))
     {
       return conflict_err (conflict_p, target_path);
     }
 
-      
+
   /* Possible early merge failure: if target and ancestor have
      different property lists, then the merge should fail.
      Propchanges can *only* be committed on an up-to-date directory.
 
      ### TODO: Please see issue #418 about the inelegance of this. */
   {
-    svn_fs__node_revision_t *tgt_nr, *anc_nr;
+    node_revision_t *tgt_nr, *anc_nr;
 
     /* Get node revisions for our id's. */
-    SVN_ERR (svn_fs__bdb_get_node_revision (&tgt_nr, fs, target_id, trail));
-    SVN_ERR (svn_fs__bdb_get_node_revision (&anc_nr, fs, ancestor_id, trail));
-        
+    SVN_ERR (svn_fs_bdb__get_node_revision (&tgt_nr, fs, target_id, trail));
+    SVN_ERR (svn_fs_bdb__get_node_revision (&anc_nr, fs, ancestor_id, trail));
+
     /* Now compare the prop-keys of the skels.  Note that just because
        the keys are different -doesn't- mean the proplists have
        different contents.  But merge() isn't concerned with contents;
        it doesn't do a brute-force comparison on textual contents, so
        it won't do that here either.  Checking to see if the propkey
        atoms are `equal' is enough. */
-    if (! svn_fs__same_keys (tgt_nr->prop_key, anc_nr->prop_key))
+    if (! svn_fs_base__same_keys (tgt_nr->prop_key, anc_nr->prop_key))
       {
         return conflict_err (conflict_p, target_path);
       }
@@ -2107,19 +2037,19 @@
   /* ### todo: it would be more efficient to simply check for a NULL
      entries hash where necessary below than to allocate an empty hash
      here, but another day, another day... */
-  SVN_ERR (svn_fs__dag_dir_entries (&s_entries, source, trail));
+  SVN_ERR (svn_fs_base__dag_dir_entries (&s_entries, source, trail));
   if (! s_entries)
     s_entries = apr_hash_make (trail->pool);
-  SVN_ERR (svn_fs__dag_dir_entries (&t_entries, target, trail));
+  SVN_ERR (svn_fs_base__dag_dir_entries (&t_entries, target, trail));
   if (! t_entries)
     t_entries = apr_hash_make (trail->pool);
-  SVN_ERR (svn_fs__dag_dir_entries (&a_entries, ancestor, trail));
+  SVN_ERR (svn_fs_base__dag_dir_entries (&a_entries, ancestor, trail));
   if (! a_entries)
     a_entries = apr_hash_make (trail->pool);
 
   /* for each entry E in a_entries... */
-  for (hi = apr_hash_first (trail->pool, a_entries); 
-       hi; 
+  for (hi = apr_hash_first (trail->pool, a_entries);
+       hi;
        hi = apr_hash_next (hi))
     {
       svn_fs_dirent_t *s_entry, *t_entry, *a_entry;
@@ -2127,11 +2057,11 @@
       const void *key;
       void *val;
       apr_ssize_t klen;
-          
+
       /* KEY will be the entry name in ancestor, VAL the dirent */
       apr_hash_this (hi, &key, &klen, &val);
       a_entry = val;
-          
+
       /* E exists in target and source (as well as ancestor) */
       if ((s_entry = apr_hash_get (s_entries, key, klen))
           && (t_entry = apr_hash_get (t_entries, key, klen)))
@@ -2148,7 +2078,7 @@
                    so reproduce the logic below up here so we only ask
                    the questions that need to be asked.  This would be
                    a heckuva lot easier if id_check_ancestor could
-                   return an svn_boolean_t instead of an svn_error_t *, 
+                   return an svn_boolean_t instead of an svn_error_t *,
                    but that's just life, I suppose.
 
                    This could very well be the ugliest code in Subversion. */
@@ -2166,8 +2096,8 @@
                   if (a_ancestorof_t)
                     {
                       /* this is an &&, so we need both ancestor checks. */
-                      SVN_ERR (id_check_ancestor (&t_ancestorof_s, fs, 
-                                                  t_entry->id, s_entry->id, 
+                      SVN_ERR (id_check_ancestor (&t_ancestorof_s, fs,
+                                                  t_entry->id, s_entry->id,
                                                   trail));
                       if (t_ancestorof_s)
                         {
@@ -2180,8 +2110,8 @@
               /* if we didn't choose Case 1, try for Case 2. */
               if (! logic_case)
                 {
-                  SVN_ERR (id_check_ancestor (&s_ancestorof_t, fs, 
-                                              s_entry->id, t_entry->id, 
+                  SVN_ERR (id_check_ancestor (&s_ancestorof_t, fs,
+                                              s_entry->id, t_entry->id,
                                               trail));
                   if (! s_ancestorof_t)
                     {
@@ -2198,13 +2128,13 @@
               if (logic_case == 1)
                 {
                   /* ... target takes source. */
-                  if (! svn_fs__dag_check_mutable (target, txn_id))
+                  if (! svn_fs_base__dag_check_mutable (target, txn_id))
                     return svn_error_createf
                       (SVN_ERR_FS_NOT_MUTABLE, NULL,
                        "Unexpected immutable node at '%s'", target_path);
 
-                  SVN_ERR (svn_fs__dag_set_entry
-                           (target, t_entry->name, s_entry->id, 
+                  SVN_ERR (svn_fs_base__dag_set_entry
+                           (target, t_entry->name, s_entry->id,
                             txn_id, trail));
                 }
               /* or if target entry is different from both and
@@ -2215,17 +2145,19 @@
                   dag_node_t *s_ent_node, *t_ent_node, *a_ent_node;
                   const char *new_tpath;
                   int pred_count;
-                      
-                  SVN_ERR (svn_fs__dag_get_node (&s_ent_node, fs,
-                                                 s_entry->id, trail));
-                  SVN_ERR (svn_fs__dag_get_node (&t_ent_node, fs,
-                                                 t_entry->id, trail));
-                  SVN_ERR (svn_fs__dag_get_node (&a_ent_node, fs,
-                                                 a_entry->id, trail));
-                      
-                  if ((svn_fs__dag_node_kind (s_ent_node) != svn_node_dir)
-                      || (svn_fs__dag_node_kind (t_ent_node) != svn_node_dir)
-                      || (svn_fs__dag_node_kind (a_ent_node) != svn_node_dir))
+
+                  SVN_ERR (svn_fs_base__dag_get_node (&s_ent_node, fs,
+                                                      s_entry->id, trail));
+                  SVN_ERR (svn_fs_base__dag_get_node (&t_ent_node, fs,
+                                                      t_entry->id, trail));
+                  SVN_ERR (svn_fs_base__dag_get_node (&a_ent_node, fs,
+                                                      a_entry->id, trail));
+
+                  if ((svn_fs_base__dag_node_kind (s_ent_node) != svn_node_dir)
+                      || (svn_fs_base__dag_node_kind (t_ent_node)
+                          != svn_node_dir)
+                      || (svn_fs_base__dag_node_kind (a_ent_node)
+                          != svn_node_dir))
                     {
                       /* Not all of these entries is a directory. Conflict. */
                       return conflict_err (conflict_p,
@@ -2241,16 +2173,16 @@
                                   t_ent_node, s_ent_node, a_ent_node,
                                   txn_id, trail));
 
-                  SVN_ERR (svn_fs__dag_get_predecessor_count (&pred_count,
-                                                              s_ent_node,
-                                                              trail));
+                  SVN_ERR (svn_fs_base__dag_get_predecessor_count (&pred_count,
+                                                                   s_ent_node,
+                                                                   trail));
 
                   /* If target is an immediate descendant of ancestor,
                      and source is also a descendant of ancestor, we
                      need to point target's predecessor-id to
                      source. */
                   SVN_ERR (update_ancestry (fs, s_entry->id,
-                                            t_entry->id, txn_id, 
+                                            t_entry->id, txn_id,
                                             new_tpath, pred_count, trail));
                 }
               /* Else target entry has changed since ancestor entry,
@@ -2280,19 +2212,19 @@
                && (! apr_hash_get (s_entries, key, klen)))
         {
           int distance = svn_fs_compare_ids (t_entry->id, a_entry->id);
-          
+
           if (distance == 0)
             {
               /* If E is same in target as ancestor, then it has not
                  changed, and the deletion in source should be
                  honored. */
-              if (! svn_fs__dag_check_mutable (target, txn_id))
+              if (! svn_fs_base__dag_check_mutable (target, txn_id))
                 return svn_error_createf
                   (SVN_ERR_FS_NOT_MUTABLE, NULL,
                    "Unexpected immutable node at '%s'", target_path);
-              
-              SVN_ERR (svn_fs__dag_delete (target, t_entry->name, 
-                                           txn_id, trail));
+
+              SVN_ERR (svn_fs_base__dag_delete (target, t_entry->name,
+                                                txn_id, trail));
 
               /* Seems cleanest to remove it from the target entries
                  hash now, even though no code would break if we
@@ -2322,8 +2254,8 @@
                  except un-record the deletion of E so that this
                  transaction isn't given credit for that portion of
                  this change. */
-              SVN_ERR (undelete_change (fs, svn_path_join (target_path, 
-                                                           t_entry->name, 
+              SVN_ERR (undelete_change (fs, svn_path_join (target_path,
+                                                           t_entry->name,
                                                            trail->pool),
                                         txn_id, trail));
             }
@@ -2334,24 +2266,24 @@
           /* It's a double delete, so do nothing except un-record the
              deletion of E so that this transaction isn't given credit
              for that change. */
-          SVN_ERR (undelete_change (fs, svn_path_join (target_path, 
-                                                       a_entry->name, 
+          SVN_ERR (undelete_change (fs, svn_path_join (target_path,
+                                                       a_entry->name,
                                                        trail->pool),
                                     txn_id, trail));
 
           /* ### kff todo: what about the rename case? */
         }
-          
+
       /* We've taken care of any possible implications E could have.
          Remove it from source_entries, so it's easy later to loop
          over all the source entries that didn't exist in
          ancestor_entries. */
       apr_hash_set (s_entries, key, klen, NULL);
     }
-      
+
   /* For each entry E in source but not in ancestor */
-  for (hi = apr_hash_first (trail->pool, s_entries); 
-       hi; 
+  for (hi = apr_hash_first (trail->pool, s_entries);
+       hi;
        hi = apr_hash_next (hi))
     {
       svn_fs_dirent_t *s_entry, *t_entry;
@@ -2380,12 +2312,12 @@
       if (! t_entry)
         {
           /* target takes source */
-          if (! svn_fs__dag_check_mutable (target, txn_id))
+          if (! svn_fs_base__dag_check_mutable (target, txn_id))
             return svn_error_createf
               (SVN_ERR_FS_NOT_MUTABLE, NULL,
                "Unexpected immutable node at '%s'", target_path);
-              
-          SVN_ERR (svn_fs__dag_set_entry
+
+          SVN_ERR (svn_fs_base__dag_set_entry
                    (target, s_entry->name, s_entry->id, txn_id, trail));
         }
       /* E exists in target but is different from E in source */
@@ -2398,16 +2330,16 @@
 
           /* The remaining case would be: E exists in target and is
            * same as in source.  This implies a twin add, so target
-           * just stays as is.  
+           * just stays as is.
            */
         }
     }
-      
+
   /* All entries in ancestor and source have been accounted for.
    *
    * Any entry E in target that does not exist in ancestor or source
    * is a non-conflicting add, so we don't need to do anything about
-   * it.  
+   * it.
    */
 
   return SVN_NO_ERROR;
@@ -2430,7 +2362,7 @@
 
   /* If a conflict results, this is updated to the path in the txn that
      conflicted.  It must point to a valid svn_stringbuf_t before calling
-     svn_fs__retry_txn, as this determines the pool used to allocate any
+     svn_fs_base__retry_txn, as this determines the pool used to allocate any
      required memory. */
   svn_stringbuf_t *conflict;
 };
@@ -2454,30 +2386,30 @@
 
   source_node = args->source_node;
   ancestor_node = args->ancestor_node;
-  source_id = svn_fs__dag_get_id (source_node);
-  
-  SVN_ERR (svn_fs__dag_txn_root (&txn_root_node, fs, txn_id, trail));
+  source_id = svn_fs_base__dag_get_id (source_node);
+
+  SVN_ERR (svn_fs_base__dag_txn_root (&txn_root_node, fs, txn_id, trail));
 
   if (ancestor_node == NULL)
     {
-      SVN_ERR (svn_fs__dag_txn_base_root (&ancestor_node, fs,
-                                          txn_id, trail));
+      SVN_ERR (svn_fs_base__dag_txn_base_root (&ancestor_node, fs,
+                                               txn_id, trail));
     }
-  
-  if (svn_fs__id_eq (svn_fs__dag_get_id (ancestor_node),
-                    svn_fs__dag_get_id (txn_root_node)))
+
+  if (svn_fs__id_eq (svn_fs_base__dag_get_id (ancestor_node),
+                     svn_fs_base__dag_get_id (txn_root_node)))
     {
       /* If no changes have been made in TXN since its current base,
          then it can't conflict with any changes since that base.  So
          we just set *both* its base and root to source, making TXN
          in effect a repeat of source. */
-      
+
       /* ### kff todo: this would, of course, be a mighty silly thing
          for the caller to do, and we might want to consider whether
          this response is really appropriate. */
-      
-      SVN_ERR (svn_fs__set_txn_base (fs, txn_id, source_id, trail));
-      SVN_ERR (svn_fs__set_txn_root (fs, txn_id, source_id, trail));
+
+      SVN_ERR (svn_fs_base__set_txn_base (fs, txn_id, source_id, trail));
+      SVN_ERR (svn_fs_base__set_txn_root (fs, txn_id, source_id, trail));
     }
   else
     {
@@ -2486,19 +2418,19 @@
       SVN_ERR (merge (args->conflict, "/", txn_root_node,
                       source_node, ancestor_node, txn_id, trail));
 
-      SVN_ERR (svn_fs__dag_get_predecessor_count (&pred_count, source_node,
-                                                  trail));
+      SVN_ERR (svn_fs_base__dag_get_predecessor_count (&pred_count,
+                                                       source_node, trail));
 
       /* After the merge, txn's new "ancestor" is now really the node
          at source_id, so record that fact.  Think of this as
          ratcheting the txn forward in time, so it can't backslide and
          forget the merging work that's already been done. */
-      SVN_ERR (update_ancestry (fs, source_id, 
-                                svn_fs__dag_get_id (txn_root_node),
+      SVN_ERR (update_ancestry (fs, source_id,
+                                svn_fs_base__dag_get_id (txn_root_node),
                                 txn_id, "/", pred_count, trail));
-      SVN_ERR (svn_fs__set_txn_base (fs, txn_id, source_id, trail));
+      SVN_ERR (svn_fs_base__set_txn_base (fs, txn_id, source_id, trail));
     }
-  
+
   return SVN_NO_ERROR;
 }
 
@@ -2535,18 +2467,20 @@
 
   /* Getting the youngest revision locks the revisions table until
      this trail is done. */
-  SVN_ERR (svn_fs__bdb_youngest_rev (&youngest_rev, fs, trail));
+  SVN_ERR (svn_fs_bdb__youngest_rev (&youngest_rev, fs, trail));
 
   /* If the root of the youngest revision is the same as txn's base,
      then no further merging is necessary and we can commit. */
-  SVN_ERR (svn_fs__rev_get_root (&y_rev_root_id, fs, youngest_rev, trail));
-  SVN_ERR (svn_fs__dag_txn_base_root (&txn_base_root_node, fs, txn_name,
+  SVN_ERR (svn_fs_base__rev_get_root (&y_rev_root_id, fs, youngest_rev,
                                       trail));
+  SVN_ERR (svn_fs_base__dag_txn_base_root (&txn_base_root_node, fs, txn_name,
+                                           trail));
   /* ### kff todo: it seems weird to grab the ID for one, and the node
      for the other.  We can certainly do the comparison we need, but
      it would be nice to grab the same type of information from the
-     start, instead of having to transform one of them. */ 
-  if (! svn_fs__id_eq (y_rev_root_id, svn_fs__dag_get_id (txn_base_root_node)))
+     start, instead of having to transform one of them. */
+  if (! svn_fs__id_eq (y_rev_root_id,
+                       svn_fs_base__dag_get_id (txn_base_root_node)))
     {
       svn_string_t *id_str = svn_fs_unparse_id (y_rev_root_id, trail->pool);
       return svn_error_createf
@@ -2554,21 +2488,22 @@
          "Transaction '%s' out of date with respect to revision '%s'",
          txn_name, id_str->data);
     }
-  
+
   /* Else, commit the txn. */
-  SVN_ERR (svn_fs__dag_commit_txn (&(args->new_rev), fs, txn_name, trail));
+  SVN_ERR (svn_fs_base__dag_commit_txn (&(args->new_rev), fs, txn_name,
+                                        trail));
 
   return SVN_NO_ERROR;
 }
 
 
 /* Note:  it is acceptable for this function to call back into
-   public FS API interfaces because it does not itself use trails.  */
+   top-level FS interfaces because it does not itself use trails.  */
 svn_error_t *
-svn_fs_commit_txn (const char **conflict_p,
-                   svn_revnum_t *new_rev, 
-                   svn_fs_txn_t *txn,
-                   apr_pool_t *pool)
+svn_fs_base__commit_txn (const char **conflict_p,
+                         svn_revnum_t *new_rev,
+                         svn_fs_txn_t *txn,
+                         apr_pool_t *pool)
 {
   /* How do commits work in Subversion?
    *
@@ -2601,7 +2536,7 @@
    *    4. Meanwhile, someone commits revision 8.
    *    5. Jane finishes the 6-->7 merge.  T could now be committed
    *       against a latest revision of 7, if only that were still the
-   *       latest.  Unfortunately, 8 is now the latest, so... 
+   *       latest.  Unfortunately, 8 is now the latest, so...
    *    6. Jane starts merging the changes between 7 and 8 into T.
    *    7. Meanwhile, no one commits any new revisions.  Whew.
    *    8. Jane commits T, creating revision 9, whose tree is exactly
@@ -2633,8 +2568,9 @@
          because new revisions might get committed after we've
          obtained it. */
 
-      SVN_ERR (svn_fs_youngest_rev (&youngish_rev, fs, pool));
-      SVN_ERR (svn_fs_revision_root (&youngish_root, fs, youngish_rev, pool));
+      SVN_ERR (svn_fs_base__youngest_rev (&youngish_rev, fs, pool));
+      SVN_ERR (svn_fs_base__revision_root (&youngish_root, fs, youngish_rev,
+                                           pool));
 
       /* Get the dag node for the youngest revision, also in one
          Berkeley transaction.  Later we'll use it as the SOURCE
@@ -2644,29 +2580,29 @@
          may have changed by then -- that's why we're careful to get
          this root in its own bdb txn here). */
       get_root_args.root = youngish_root;
-      SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_root,
+      SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_root,
                                   &get_root_args, pool));
       youngish_root_node = get_root_args.node;
-      
+
       /* Try to merge.  If the merge succeeds, the base root node of
          TARGET's txn will become the same as youngish_root_node, so
          any future merges will only be between that node and whatever
-         the root node of the youngest rev is by then. */ 
+         the root node of the youngest rev is by then. */
       merge_args.ancestor_node = NULL;
       merge_args.source_node = youngish_root_node;
       merge_args.txn = txn;
       merge_args.conflict = svn_stringbuf_create ("", pool);
-      err = svn_fs__retry_txn (fs, txn_body_merge, &merge_args, pool);
+      err = svn_fs_base__retry_txn (fs, txn_body_merge, &merge_args, pool);
       if (err)
         {
           if ((err->apr_err == SVN_ERR_FS_CONFLICT) && conflict_p)
             *conflict_p = merge_args.conflict->data;
           return err;
         }
-      
+
       /* Try to commit. */
       commit_args.txn = txn;
-      err = svn_fs__retry_txn (fs, txn_body_commit, &commit_args, pool);
+      err = svn_fs_base__retry_txn (fs, txn_body_commit, &commit_args, pool);
       if (err && (err->apr_err == SVN_ERR_FS_TXN_OUT_OF_DATE))
         {
           /* Did someone else finish committing a new revision while we
@@ -2675,7 +2611,7 @@
              commit again.  Or if that's not what happened, then just
              return the error. */
           svn_revnum_t youngest_rev;
-          SVN_ERR (svn_fs_youngest_rev (&youngest_rev, fs, pool));
+          SVN_ERR (svn_fs_base__youngest_rev (&youngest_rev, fs, pool));
           if (youngest_rev == youngish_rev)
             return err;
           else
@@ -2699,15 +2635,15 @@
 
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_merge (const char **conflict_p,
-              svn_fs_root_t *source_root,
-              const char *source_path,
-              svn_fs_root_t *target_root,
-              const char *target_path,
-              svn_fs_root_t *ancestor_root,
-              const char *ancestor_path,
-              apr_pool_t *pool)
+static svn_error_t *
+base_merge (const char **conflict_p,
+            svn_fs_root_t *source_root,
+            const char *source_path,
+            svn_fs_root_t *target_root,
+            const char *target_path,
+            svn_fs_root_t *ancestor_root,
+            const char *ancestor_path,
+            apr_pool_t *pool)
 {
   dag_node_t *source, *ancestor;
   struct get_root_args get_root_args;
@@ -2716,13 +2652,12 @@
   svn_error_t *err;
   svn_fs_t *fs;
 
-  if (! svn_fs_is_txn_root (target_root))
+  if (! target_root->is_txn_root)
     return not_txn (target_root);
 
   /* Paranoia. */
-  fs = svn_fs_root_fs (ancestor_root);
-  if ((svn_fs_root_fs (source_root) != fs)
-      || (svn_fs_root_fs (target_root) != fs))
+  fs = ancestor_root->fs;
+  if ((source_root->fs != fs) || (target_root->fs != fs))
     {
       return svn_error_create
         (SVN_ERR_FS_CORRUPT, NULL,
@@ -2740,25 +2675,25 @@
 
   /* Get the ancestor node. */
   get_root_args.root = ancestor_root;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_root, &get_root_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_root, &get_root_args,
+                                   pool));
   ancestor = get_root_args.node;
 
   /* Get the source node. */
   get_root_args.root = source_root;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_root, &get_root_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_root, &get_root_args,
+                                   pool));
   source = get_root_args.node;
-  
+
   /* Open a txn for the txn root into which we're merging. */
-  SVN_ERR (svn_fs_open_txn (&txn, fs,
-                            svn_fs_txn_root_name (target_root, pool),
-                            pool));
+  SVN_ERR (svn_fs_base__open_txn (&txn, fs, target_root->txn, pool));
 
   /* Merge changes between ANCESTOR and SOURCE into TXN. */
   merge_args.source_node = source;
   merge_args.ancestor_node = ancestor;
   merge_args.txn = txn;
   merge_args.conflict = svn_stringbuf_create ("", pool);
-  err = svn_fs__retry_txn (fs, txn_body_merge, &merge_args, pool);
+  err = svn_fs_base__retry_txn (fs, txn_body_merge, &merge_args, pool);
   if (err)
     {
       if ((err->apr_err == SVN_ERR_FS_CONFLICT) && conflict_p)
@@ -2779,108 +2714,35 @@
 
 static svn_error_t *
 txn_body_rev_get_txn_id (void *baton, trail_t *trail)
-{
-  struct rev_get_txn_id_args *args = baton;
-  return svn_fs__rev_get_txn_id (args->txn_id, trail->fs, 
-                                 args->revision, trail);
-}
-
-
-svn_error_t *
-svn_fs_deltify_revision (svn_fs_t *fs,
-                         svn_revnum_t revision,
-                         apr_pool_t *pool)
-{
-  svn_fs_root_t *root;
-  const char *txn_id;
-  struct rev_get_txn_id_args args;
-
-  SVN_ERR (svn_fs_revision_root (&root, fs, revision, pool));
-
-  args.txn_id = &txn_id;
-  args.revision = revision;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_rev_get_txn_id, &args, pool));
-
-  return deltify_mutable (fs, root, "/", txn_id, pool);
-}
-
-
-
-/* Directories.  */
-
-
-struct dir_entries_args
-{
-  apr_hash_t **table_p;
-  svn_fs_root_t *root;
-  const char *path;
-};
-
-
-static svn_error_t *
-txn_body_dir_entries (void *baton,
-                      trail_t *trail)
-{
-  struct dir_entries_args *args = baton;
-  dag_node_t *node;
-  apr_hash_t *entries;
-
-  SVN_ERR (get_dag (&node, args->root, args->path, trail));
-
-  /* Get the entries for PARENT_PATH. */
-  SVN_ERR (svn_fs__dag_dir_entries (&entries, node, trail));
-
-  /* Potentially initialize the return value to an empty hash. */
-  *args->table_p = entries ? entries : apr_hash_make (trail->pool);
-  return SVN_NO_ERROR;
+{
+  struct rev_get_txn_id_args *args = baton;
+  return svn_fs_base__rev_get_txn_id (args->txn_id, trail->fs,
+                                 args->revision, trail);
 }
 
 
 svn_error_t *
-svn_fs_dir_entries (apr_hash_t **table_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+svn_fs_base__deltify (svn_fs_t *fs,
+                      svn_revnum_t revision,
+                      apr_pool_t *pool)
 {
-  struct dir_entries_args args;
-  apr_hash_t *table;
-  svn_fs_t *fs = svn_fs_root_fs (root);
-
-  args.table_p = &table;
-  args.root    = root;
-  args.path    = path;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_dir_entries, &args, pool));
+  svn_fs_root_t *root;
+  const char *txn_id;
+  struct rev_get_txn_id_args args;
 
-  /* Add in the kind data. */
-  if (table)
-    {
-      apr_hash_index_t *hi;
-      apr_pool_t *subpool = svn_pool_create (pool);
-      for (hi = apr_hash_first (subpool, table); hi; hi = apr_hash_next (hi))
-        {
-          svn_fs_dirent_t *entry;
-          struct node_kind_args nk_args;
-          void *val;
+  SVN_ERR (svn_fs_base__revision_root (&root, fs, revision, pool));
 
-          /* KEY will be the entry name in ancestor (about which we
-             simple don't care), VAL the dirent. */
-          apr_hash_this (hi, NULL, NULL, &val);
-          entry = val;
-          nk_args.id = entry->id;
-          SVN_ERR (svn_fs__retry_txn (fs, txn_body_node_kind, &nk_args, pool));
-          entry->kind = nk_args.kind;
-        }
-    }
-  else
-    {
-      table = apr_hash_make (pool);
-    }
+  args.txn_id = &txn_id;
+  args.revision = revision;
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_rev_get_txn_id, &args, pool));
 
-  *table_p = table;
-  return SVN_NO_ERROR;
+  return deltify_mutable (fs, root, "/", txn_id, pool);
 }
 
 
+
+/* Modifying directories */
+
 
 struct make_dir_args
 {
@@ -2898,7 +2760,7 @@
   const char *path = args->path;
   parent_path_t *parent_path;
   dag_node_t *sub_dir;
-  const char *txn_id = svn_fs_txn_root_name (root, trail->pool);
+  const char *txn_id = root->txn;
 
   SVN_ERR (open_path (&parent_path, root, path, open_path_last_optional,
                       txn_id, trail));
@@ -2910,38 +2772,38 @@
 
   /* Create the subdirectory.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, trail));
-  SVN_ERR (svn_fs__dag_make_dir (&sub_dir,
-                                 parent_path->parent->node, 
-                                 parent_path_path (parent_path->parent, 
+  SVN_ERR (svn_fs_base__dag_make_dir (&sub_dir,
+                                 parent_path->parent->node,
+                                 parent_path_path (parent_path->parent,
                                                    trail->pool),
                                  parent_path->entry,
                                  txn_id,
                                  trail));
 
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (sub_dir),
+  SVN_ERR (add_change (root->fs, txn_id, path,
+                       svn_fs_base__dag_get_id (sub_dir),
                        svn_fs_path_change_add, 0, 0, trail));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_make_dir (svn_fs_root_t *root,
-                 const char *path,
-                 apr_pool_t *pool)
+static svn_error_t *
+base_make_dir (svn_fs_root_t *root,
+               const char *path,
+               apr_pool_t *pool)
 {
   struct make_dir_args args;
 
-  if (! svn_fs_is_txn_root (root))
+  if (! root->is_txn_root)
     return not_txn (root);
 
   args.root = root;
   args.path = path;
-  return svn_fs__retry_txn (root->fs, txn_body_make_dir, &args, pool);
+  return svn_fs_base__retry_txn (root->fs, txn_body_make_dir, &args, pool);
 }
-                              
+
 
 struct delete_args
 {
@@ -2961,9 +2823,9 @@
   svn_fs_root_t *root = args->root;
   const char *path = args->path;
   parent_path_t *parent_path;
-  const char *txn_id = svn_fs_txn_root_name (root, trail->pool);
+  const char *txn_id = root->txn;
 
-  if (! svn_fs_is_txn_root (root))
+  if (! root->is_txn_root)
     return not_txn (root);
 
   SVN_ERR (open_path (&parent_path, root, path, 0, txn_id, trail));
@@ -2975,29 +2837,29 @@
 
   /* Make the parent directory mutable, and do the deletion.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, trail));
-  SVN_ERR (svn_fs__dag_delete (parent_path->parent->node,
+  SVN_ERR (svn_fs_base__dag_delete (parent_path->parent->node,
                                parent_path->entry,
                                txn_id, trail));
-  
+
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (parent_path->node),
+  SVN_ERR (add_change (root->fs, txn_id, path,
+                       svn_fs_base__dag_get_id (parent_path->node),
                        svn_fs_path_change_delete, 0, 0, trail));
-  
+
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_delete (svn_fs_root_t *root,
-               const char *path,
-               apr_pool_t *pool)
+static svn_error_t *
+base_delete_node (svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   struct delete_args args;
 
   args.root        = root;
   args.path        = path;
-  return svn_fs__retry_txn (root->fs, txn_body_delete, &args, pool);
+  return svn_fs_base__retry_txn (root->fs, txn_body_delete, &args, pool);
 }
 
 
@@ -3022,9 +2884,9 @@
   const char *to_path = args->to_path;
   dag_node_t *from_node;
   parent_path_t *to_parent_path;
-  const char *txn_id = svn_fs_txn_root_name (to_root, trail->pool);
+  const char *txn_id = to_root->txn;
 
-  if (! svn_fs_is_revision_root (from_root))
+  if (from_root->is_txn_root)
     return svn_error_create (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                              "Copy from mutable tree not currently supported");
 
@@ -3034,7 +2896,7 @@
   /* Build up the parent path from TO_PATH in TO_ROOT.  If the last
      component does not exist, it's not that big a deal.  We'll just
      make one there. */
-  SVN_ERR (open_path (&to_parent_path, to_root, to_path, 
+  SVN_ERR (open_path (&to_parent_path, to_root, to_path,
                       open_path_last_optional, txn_id, trail));
 
   /* If the destination node already exists as the same node as the
@@ -3042,11 +2904,12 @@
      happening at all), just do nothing an return successfully,
      proud that you saved yourself from a tiresome task. */
   if ((to_parent_path->node)
-      && (svn_fs_compare_ids (svn_fs__dag_get_id (from_node),
-                              svn_fs__dag_get_id (to_parent_path->node)) == 0))
+      && (svn_fs_compare_ids (svn_fs_base__dag_get_id (from_node),
+                              svn_fs_base__dag_get_id
+                              (to_parent_path->node)) == 0))
     return SVN_NO_ERROR;
 
-  if (svn_fs_is_revision_root (from_root))
+  if (! from_root->is_txn_root)
     {
       svn_fs_path_change_kind_t kind;
       dag_node_t *new_node;
@@ -3059,20 +2922,20 @@
         kind = svn_fs_path_change_add;
 
       /* Make sure the target node's parents are mutable.  */
-      SVN_ERR (make_path_mutable (to_root, to_parent_path->parent, 
+      SVN_ERR (make_path_mutable (to_root, to_parent_path->parent,
                                   to_path, trail));
 
-      SVN_ERR (svn_fs__dag_copy (to_parent_path->parent->node,
-                                 to_parent_path->entry,
-                                 from_node,
-                                 args->preserve_history,
-                                 svn_fs_revision_root_revision (from_root),
-                                 from_path, txn_id, trail));
+      SVN_ERR (svn_fs_base__dag_copy (to_parent_path->parent->node,
+                                      to_parent_path->entry,
+                                      from_node,
+                                      args->preserve_history,
+                                      from_root->rev,
+                                      from_path, txn_id, trail));
 
       /* Make a record of this modification in the changes table. */
       SVN_ERR (get_dag (&new_node, to_root, to_path, trail));
-      SVN_ERR (add_change (svn_fs_root_fs (to_root), txn_id, 
-                           to_path, svn_fs__dag_get_id (new_node),
+      SVN_ERR (add_change (to_root->fs, txn_id, to_path,
+                           svn_fs_base__dag_get_id (new_node),
                            kind, 0, 0, trail));
     }
   else
@@ -3096,16 +2959,16 @@
 }
 
 
-svn_error_t *
-svn_fs_copy (svn_fs_root_t *from_root,
-             const char *from_path,
-             svn_fs_root_t *to_root,
-             const char *to_path,
-             apr_pool_t *pool)
+static svn_error_t *
+base_copy (svn_fs_root_t *from_root,
+           const char *from_path,
+           svn_fs_root_t *to_root,
+           const char *to_path,
+           apr_pool_t *pool)
 {
   struct copy_args args;
 
-  if (! svn_fs_is_txn_root (to_root))
+  if (! to_root->is_txn_root)
     return not_txn (to_root);
 
   args.from_root         = from_root;
@@ -3114,19 +2977,19 @@
   args.to_path           = to_path;
   args.preserve_history  = TRUE;
 
-  return svn_fs__retry_txn (to_root->fs, txn_body_copy, &args, pool);
+  return svn_fs_base__retry_txn (to_root->fs, txn_body_copy, &args, pool);
 }
 
 
-svn_error_t *
-svn_fs_revision_link (svn_fs_root_t *from_root,
-                      svn_fs_root_t *to_root,
-                      const char *path,
-                      apr_pool_t *pool)
+static svn_error_t *
+base_revision_link (svn_fs_root_t *from_root,
+                    svn_fs_root_t *to_root,
+                    const char *path,
+                    apr_pool_t *pool)
 {
   struct copy_args args;
 
-  if (! svn_fs_is_txn_root (to_root))
+  if (! to_root->is_txn_root)
     return not_txn (to_root);
 
   args.from_root         = from_root;
@@ -3135,7 +2998,7 @@
   args.to_path           = path;
   args.preserve_history  = FALSE;
 
-  return svn_fs__retry_txn (to_root->fs, txn_body_copy, &args, pool);
+  return svn_fs_base__retry_txn (to_root->fs, txn_body_copy, &args, pool);
 }
 
 
@@ -3157,7 +3020,7 @@
   struct copied_from_args *args = baton;
   const svn_fs_id_t *node_id, *pred_id;
   dag_node_t *node;
-  svn_fs_t *fs = svn_fs_root_fs (args->root);
+  svn_fs_t *fs = args->root->fs;
 
   /* Clear the return variables. */
   args->result_path = NULL;
@@ -3165,42 +3028,42 @@
 
   /* Fetch the NODE in question. */
   SVN_ERR (get_dag (&node, args->root, args->path, trail));
-  node_id = svn_fs__dag_get_id (node);
+  node_id = svn_fs_base__dag_get_id (node);
 
   /* Check the node's predecessor-ID.  If it doesn't have one, it
      isn't a copy. */
-  SVN_ERR (svn_fs__dag_get_predecessor_id (&pred_id, node, trail));
+  SVN_ERR (svn_fs_base__dag_get_predecessor_id (&pred_id, node, trail));
   if (! pred_id)
     return SVN_NO_ERROR;
 
   /* If NODE's copy-ID is the same as that of its predecessor... */
-  if (svn_fs__key_compare (svn_fs__id_copy_id (node_id), 
-                           svn_fs__id_copy_id (pred_id)) != 0)
+  if (svn_fs_base__key_compare (svn_fs__id_copy_id (node_id),
+                                svn_fs__id_copy_id (pred_id)) != 0)
     {
       /* ... then NODE was either the target of a copy operation,
          a copied subtree item.  We examine the actual copy record
          to determine which is the case.  */
-      svn_fs__copy_t *copy;
-      SVN_ERR (svn_fs__bdb_get_copy (&copy, fs, 
+      copy_t *copy;
+      SVN_ERR (svn_fs_bdb__get_copy (&copy, fs,
                                      svn_fs__id_copy_id (node_id), trail));
-      if ((copy->kind == svn_fs__copy_kind_real)
+      if ((copy->kind == copy_kind_real)
           && svn_fs__id_eq (copy->dst_noderev_id, node_id))
         {
           args->result_path = copy->src_path;
-          SVN_ERR (svn_fs__txn_get_revision (&(args->result_rev), fs,
-                                             copy->src_txn_id, trail));
+          SVN_ERR (svn_fs_base__txn_get_revision (&(args->result_rev), fs,
+                                                  copy->src_txn_id, trail));
         }
     }
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_copied_from (svn_revnum_t *rev_p,
-                    const char **path_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+static svn_error_t *
+base_copied_from (svn_revnum_t *rev_p,
+                  const char **path_p,
+                  svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   struct copied_from_args args;
 
@@ -3208,7 +3071,8 @@
   args.path = path;
   args.pool = pool;
 
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_copied_from, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs,
+                                   txn_body_copied_from, &args, pool));
 
   *rev_p  = args.result_rev;
   *path_p = args.result_path;
@@ -3237,7 +3101,7 @@
   const char *path = args->path;
   parent_path_t *parent_path;
   dag_node_t *child;
-  const char *txn_id = svn_fs_txn_root_name (root, trail->pool);
+  const char *txn_id = root->txn;
 
   SVN_ERR (open_path (&parent_path, root, path, open_path_last_optional,
                       txn_id, trail));
@@ -3249,33 +3113,32 @@
 
   /* Create the file.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, trail));
-  SVN_ERR (svn_fs__dag_make_file (&child,
-                                  parent_path->parent->node, 
-                                  parent_path_path (parent_path->parent,
-                                                    trail->pool),
-                                  parent_path->entry,
-                                  txn_id,
-                                  trail));
+  SVN_ERR (svn_fs_base__dag_make_file (&child,
+                                       parent_path->parent->node,
+                                       parent_path_path (parent_path->parent,
+                                                         trail->pool),
+                                       parent_path->entry,
+                                       txn_id,
+                                       trail));
 
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (child),
+  SVN_ERR (add_change (root->fs, txn_id, path, svn_fs_base__dag_get_id (child),
                        svn_fs_path_change_add, 0, 0, trail));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_make_file (svn_fs_root_t *root,
-                  const char *path,
-                  apr_pool_t *pool)
+static svn_error_t *
+base_make_file (svn_fs_root_t *root,
+                const char *path,
+                apr_pool_t *pool)
 {
   struct make_file_args args;
 
   args.root = root;
   args.path = path;
-  return svn_fs__retry_txn (root->fs, txn_body_make_file, &args, pool);
+  return svn_fs_base__retry_txn (root->fs, txn_body_make_file, &args, pool);
 }
 
 
@@ -3293,25 +3156,26 @@
 {
   struct file_length_args *args = baton;
   dag_node_t *file;
-  
+
   /* First create a dag_node_t from the root/path pair. */
   SVN_ERR (get_dag (&file, args->root, args->path, trail));
 
   /* Now fetch its length */
-  return svn_fs__dag_file_length (&args->length, file, trail);
+  return svn_fs_base__dag_file_length (&args->length, file, trail);
 }
 
-svn_error_t *
-svn_fs_file_length (svn_filesize_t *length_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+static svn_error_t *
+base_file_length (svn_filesize_t *length_p,
+                  svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   struct file_length_args args;
 
   args.root = root;
   args.path = path;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_file_length, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_file_length, &args,
+                                   pool));
 
   *length_p = args.length;
   return SVN_NO_ERROR;
@@ -3331,23 +3195,24 @@
 {
   struct file_checksum_args *args = baton;
   dag_node_t *file;
-  
+
   SVN_ERR (get_dag (&file, args->root, args->path, trail));
-  return svn_fs__dag_file_checksum (args->digest, file, trail);
+  return svn_fs_base__dag_file_checksum (args->digest, file, trail);
 }
 
-svn_error_t *
-svn_fs_file_md5_checksum (unsigned char digest[],
-                          svn_fs_root_t *root,
-                          const char *path,
-                          apr_pool_t *pool)
+static svn_error_t *
+base_file_md5_checksum (unsigned char digest[],
+                        svn_fs_root_t *root,
+                        const char *path,
+                        apr_pool_t *pool)
 {
   struct file_checksum_args args;
 
   args.root = root;
   args.path = path;
   args.digest = digest;
-  SVN_ERR (svn_fs__retry_txn (root->fs, txn_body_file_checksum, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_file_checksum, &args,
+                                   pool));
 
   return SVN_NO_ERROR;
 }
@@ -3365,7 +3230,7 @@
 
   /* The dag_node that will be made from the above. */
   dag_node_t *node;
-    
+
   /* The pool in which `file_stream' (below) is allocated. */
   apr_pool_t *pool;
 
@@ -3385,22 +3250,22 @@
 
   /* First create a dag_node_t from the root/path pair. */
   SVN_ERR (get_dag (&(fb->node), fb->root, fb->path, trail));
-  
+
   /* Then create a readable stream from the dag_node_t. */
-  SVN_ERR (svn_fs__dag_get_contents (&(fb->file_stream),
-                                     fb->node,
-                                     fb->pool,
-                                     trail));
+  SVN_ERR (svn_fs_base__dag_get_contents (&(fb->file_stream),
+                                          fb->node,
+                                          fb->pool,
+                                          trail));
   return SVN_NO_ERROR;
-}     
+}
 
 
 
-svn_error_t *
-svn_fs_file_contents (svn_stream_t **contents,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *pool)
+static svn_error_t *
+base_file_contents (svn_stream_t **contents,
+                    svn_fs_root_t *root,
+                    const char *path,
+                    apr_pool_t *pool)
 {
   file_contents_baton_t *fb = apr_pcalloc (pool, sizeof(*fb));
   fb->root = root;
@@ -3408,9 +3273,9 @@
   fb->pool = pool;
 
   /* Create the readable stream in the context of a db txn.  */
-  SVN_ERR (svn_fs__retry_txn (svn_fs_root_fs (root),
-                              txn_body_get_file_contents, fb, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_get_file_contents,
+                                   fb, pool));
+
   *contents = fb->file_stream;
   return SVN_NO_ERROR;
 }
@@ -3435,7 +3300,7 @@
   /* The original file info */
   svn_fs_root_t *root;
   const char *path;
-  
+
   /* Derived from the file info */
   dag_node_t *node;
 
@@ -3456,7 +3321,7 @@
 } txdelta_baton_t;
 
 
-/* A trail-ready wrapper around svn_fs__dag_finalize_edits. 
+/* A trail-ready wrapper around svn_fs_base__dag_finalize_edits.
  * This closes BATON->target_stream.
  *
  * Note: If you're confused about how this function relates to another
@@ -3469,11 +3334,10 @@
 txn_body_txdelta_finalize_edits (void *baton, trail_t *trail)
 {
   txdelta_baton_t *tb = (txdelta_baton_t *) baton;
-  return svn_fs__dag_finalize_edits (tb->node, 
-                                     tb->result_checksum,
-                                     svn_fs_txn_root_name (tb->root,
-                                                           trail->pool),
-                                     trail);
+  return svn_fs_base__dag_finalize_edits (tb->node,
+                                          tb->result_checksum,
+                                          tb->root->txn,
+                                          trail);
 }
 
 
@@ -3542,9 +3406,9 @@
       SVN_ERR (svn_stream_close (tb->target_stream));
 
       /* Tell the dag subsystem that we're finished with our edits. */
-      SVN_ERR (svn_fs__retry_txn (svn_fs_root_fs (tb->root),
-                                  txn_body_txdelta_finalize_edits, tb,
-                                  tb->pool));
+      SVN_ERR (svn_fs_base__retry_txn (tb->root->fs,
+                                       txn_body_txdelta_finalize_edits, tb,
+                                       tb->pool));
     }
 
   return SVN_NO_ERROR;
@@ -3556,7 +3420,7 @@
 {
   txdelta_baton_t *tb = (txdelta_baton_t *) baton;
   parent_path_t *parent_path;
-  const char *txn_id = svn_fs_txn_root_name (tb->root, trail->pool);
+  const char *txn_id = tb->root->txn;
 
   /* Call open_path with no flags, as we want this to return an error
      if the node for which we are searching doesn't exist. */
@@ -3573,11 +3437,11 @@
 
       /* Until we finalize the node, its data_key points to the old
          contents, in other words, the base text. */
-      SVN_ERR (svn_fs__dag_file_checksum (digest, tb->node, trail));
+      SVN_ERR (svn_fs_base__dag_file_checksum (digest, tb->node, trail));
       hex = svn_md5_digest_to_cstring (digest, trail->pool);
       if (hex && (strcmp (tb->base_checksum, hex) != 0))
         return svn_error_createf
-          (SVN_ERR_CHECKSUM_MISMATCH, 
+          (SVN_ERR_CHECKSUM_MISMATCH,
            NULL,
            "Base checksum mismatch on '%s':\n"
            "   expected:  %s\n"
@@ -3588,12 +3452,12 @@
   /* Make a readable "source" stream out of the current contents of
      ROOT/PATH; obviously, this must done in the context of a db_txn.
      The stream is returned in tb->source_stream. */
-  SVN_ERR (svn_fs__dag_get_contents (&(tb->source_stream),
-                                     tb->node, tb->pool, trail));
+  SVN_ERR (svn_fs_base__dag_get_contents (&(tb->source_stream),
+                                          tb->node, tb->pool, trail));
 
   /* Make a writable "target" stream */
-  SVN_ERR (svn_fs__dag_get_edit_stream (&(tb->target_stream), tb->node, 
-                                        tb->pool, txn_id, trail));
+  SVN_ERR (svn_fs_base__dag_get_edit_stream (&(tb->target_stream), tb->node,
+                                             tb->pool, txn_id, trail));
 
   /* Make a writable "string" stream which writes data to
      tb->target_string. */
@@ -3611,22 +3475,22 @@
                      &(tb->interpreter_baton));
 
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (tb->root), txn_id, 
-                       tb->path, svn_fs__dag_get_id (tb->node),
+  SVN_ERR (add_change (tb->root->fs, txn_id, tb->path,
+                       svn_fs_base__dag_get_id (tb->node),
                        svn_fs_path_change_modify, 1, 0, trail));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_apply_textdelta (svn_txdelta_window_handler_t *contents_p,
-                        void **contents_baton_p,
-                        svn_fs_root_t *root,
-                        const char *path,
-                        const char *base_checksum,
-                        const char *result_checksum,
-                        apr_pool_t *pool)
+static svn_error_t *
+base_apply_textdelta (svn_txdelta_window_handler_t *contents_p,
+                      void **contents_baton_p,
+                      svn_fs_root_t *root,
+                      const char *path,
+                      const char *base_checksum,
+                      const char *result_checksum,
+                      apr_pool_t *pool)
 {
   txdelta_baton_t *tb = apr_pcalloc (pool, sizeof(*tb));
 
@@ -3644,9 +3508,9 @@
   else
     tb->result_checksum = NULL;
 
-  SVN_ERR (svn_fs__retry_txn (svn_fs_root_fs (root),
-                              txn_body_apply_textdelta, tb, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_apply_textdelta, tb,
+                                   pool));
+
   *contents_p = window_consumer;
   *contents_baton_p = tb;
   return SVN_NO_ERROR;
@@ -3662,10 +3526,10 @@
   /* The original file info */
   svn_fs_root_t *root;
   const char *path;
-  
+
   /* Derived from the file info */
   dag_node_t *node;
-  
+
   /* The returned stream that will accept the file's new contents. */
   svn_stream_t *stream;
 
@@ -3681,8 +3545,8 @@
 };
 
 
-/* A trail-ready wrapper around svn_fs__dag_finalize_edits, but for
- * fulltext data, not text deltas.  Closes BATON->file_stream. 
+/* A trail-ready wrapper around svn_fs_base__dag_finalize_edits, but for
+ * fulltext data, not text deltas.  Closes BATON->file_stream.
  *
  * Note: If you're confused about how this function relates to another
  * of similar name, think of it this way:
@@ -3694,11 +3558,10 @@
 txn_body_fulltext_finalize_edits (void *baton, trail_t *trail)
 {
   struct text_baton_t *tb = baton;
-  return svn_fs__dag_finalize_edits (tb->node, 
-                                     tb->result_checksum,
-                                     svn_fs_txn_root_name (tb->root, 
-                                                           trail->pool),
-                                     trail);
+  return svn_fs_base__dag_finalize_edits (tb->node,
+                                          tb->result_checksum,
+                                          tb->root->txn,
+                                          trail);
 }
 
 /* Write function for the publically returned stream. */
@@ -3725,8 +3588,9 @@
   SVN_ERR (svn_stream_close (tb->file_stream));
 
   /* Need to tell fs that we're done sending text */
-  SVN_ERR (svn_fs__retry_txn (svn_fs_root_fs (tb->root),
-                              txn_body_fulltext_finalize_edits, tb, tb->pool));
+  SVN_ERR (svn_fs_base__retry_txn (tb->root->fs,
+                                   txn_body_fulltext_finalize_edits, tb,
+                                   tb->pool));
 
   return SVN_NO_ERROR;
 }
@@ -3737,7 +3601,7 @@
 {
   struct text_baton_t *tb = baton;
   parent_path_t *parent_path;
-  const char *txn_id = svn_fs_txn_root_name (tb->root, trail->pool);
+  const char *txn_id = tb->root->txn;
 
   /* Call open_path with no flags, as we want this to return an error
      if the node for which we are searching doesn't exist. */
@@ -3748,8 +3612,8 @@
   tb->node = parent_path->node;
 
   /* Make a writable stream for replacing the file's text. */
-  SVN_ERR (svn_fs__dag_get_edit_stream (&(tb->file_stream), tb->node, 
-                                        tb->pool, txn_id, trail));
+  SVN_ERR (svn_fs_base__dag_get_edit_stream (&(tb->file_stream), tb->node,
+                                             tb->pool, txn_id, trail));
 
   /* Create a 'returnable' stream which writes to the file_stream. */
   tb->stream = svn_stream_create (tb, tb->pool);
@@ -3757,20 +3621,20 @@
   svn_stream_set_close (tb->stream, text_stream_closer);
 
   /* Make a record of this modification in the changes table. */
-  SVN_ERR (add_change (svn_fs_root_fs (tb->root), txn_id, 
-                       tb->path, svn_fs__dag_get_id (tb->node),
+  SVN_ERR (add_change (tb->root->fs, txn_id, tb->path,
+                       svn_fs_base__dag_get_id (tb->node),
                        svn_fs_path_change_modify, 1, 0, trail));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_apply_text (svn_stream_t **contents_p,
-                   svn_fs_root_t *root,
-                   const char *path,
-                   const char *result_checksum,
-                   apr_pool_t *pool)
+static svn_error_t *
+base_apply_text (svn_stream_t **contents_p,
+                 svn_fs_root_t *root,
+                 const char *path,
+                 const char *result_checksum,
+                 apr_pool_t *pool)
 {
   struct text_baton_t *tb = apr_pcalloc (pool, sizeof(*tb));
 
@@ -3783,9 +3647,8 @@
   else
     tb->result_checksum = NULL;
 
-  SVN_ERR (svn_fs__retry_txn (svn_fs_root_fs (root),
-                              txn_body_apply_text, tb, pool));
-  
+  SVN_ERR (svn_fs_base__retry_txn (root->fs, txn_body_apply_text, tb, pool));
+
   *contents_p = tb->stream;
   return SVN_NO_ERROR;
 }
@@ -3804,41 +3667,41 @@
 
   SVN_ERR (get_dag (&node1, args->root1, args->path1, trail));
   SVN_ERR (get_dag (&node2, args->root2, args->path2, trail));
-  SVN_ERR (svn_fs__things_different (NULL, args->changed_p,
-                                     node1, node2, trail));
+  SVN_ERR (svn_fs_base__things_different (NULL, args->changed_p,
+                                          node1, node2, trail));
   return SVN_NO_ERROR;
 }
 
 
 /* Note:  it is acceptable for this function to call back into
-   public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_contents_changed (svn_boolean_t *changed_p,
-                         svn_fs_root_t *root1,
-                         const char *path1,
-                         svn_fs_root_t *root2,
-                         const char *path2,
-                         apr_pool_t *pool)
+   top-level interfaces because it does not itself use trails.  */
+static svn_error_t *
+base_contents_changed (svn_boolean_t *changed_p,
+                       svn_fs_root_t *root1,
+                       const char *path1,
+                       svn_fs_root_t *root2,
+                       const char *path2,
+                       apr_pool_t *pool)
 {
   struct things_changed_args args;
 
   /* Check that roots are in the same fs. */
-  if ((svn_fs_root_fs (root1)) != (svn_fs_root_fs (root2)))
+  if (root1->fs != root2->fs)
     return svn_error_create
       (SVN_ERR_FS_GENERAL, NULL,
        "Asking contents changed in two different filesystems");
-  
+
   /* Check that both paths are files. */
   {
-    svn_boolean_t is_file;
+    svn_node_kind_t kind;
 
-    SVN_ERR (svn_fs_is_file (&is_file, root1, path1, pool));
-    if (! is_file)
+    SVN_ERR (base_check_path (&kind, root1, path1, pool));
+    if (kind != svn_node_file)
       return svn_error_createf
         (SVN_ERR_FS_GENERAL, NULL, "'%s' is not a file", path1);
-      
-    SVN_ERR (svn_fs_is_file (&is_file, root2, path2, pool));
-    if (! is_file)
+
+    SVN_ERR (base_check_path (&kind, root2, path2, pool));
+    if (kind != svn_node_file)
       return svn_error_createf
         (SVN_ERR_FS_GENERAL, NULL, "'%s' is not a file", path2);
   }
@@ -3850,8 +3713,8 @@
   args.changed_p  = changed_p;
   args.pool       = pool;
 
-  SVN_ERR (svn_fs__retry_txn (root1->fs, txn_body_contents_changed,
-                              &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (root1->fs, txn_body_contents_changed,
+                                   &args, pool));
 
   return SVN_NO_ERROR;
 }
@@ -3862,25 +3725,25 @@
 
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_get_file_delta_stream (svn_txdelta_stream_t **stream_p,
-                              svn_fs_root_t *source_root,
-                              const char *source_path,
-                              svn_fs_root_t *target_root,
-                              const char *target_path,
-                              apr_pool_t *pool)
+static svn_error_t *
+base_get_file_delta_stream (svn_txdelta_stream_t **stream_p,
+                            svn_fs_root_t *source_root,
+                            const char *source_path,
+                            svn_fs_root_t *target_root,
+                            const char *target_path,
+                            apr_pool_t *pool)
 {
   svn_stream_t *source, *target;
   svn_txdelta_stream_t *delta_stream;
 
   /* Get read functions for the source file contents.  */
   if (source_root && source_path)
-    SVN_ERR (svn_fs_file_contents (&source, source_root, source_path, pool));
+    SVN_ERR (base_file_contents (&source, source_root, source_path, pool));
   else
     source = svn_stream_empty (pool);
 
   /* Get read functions for the target file contents.  */
-  SVN_ERR (svn_fs_file_contents (&target, target_root, target_path, pool));
+  SVN_ERR (base_file_contents (&target, target_root, target_path, pool));
 
   /* Create a delta stream that turns the ancestor into the target.  */
   svn_txdelta (&delta_stream, source, target, pool);
@@ -3909,29 +3772,28 @@
 
   struct paths_changed_args *args = baton;
   const char *txn_id;
-  svn_fs_t *fs = svn_fs_root_fs (args->root);
+  svn_fs_t *fs = args->root->fs;
 
   /* Get the transaction ID from ROOT. */
-  if (svn_fs_is_revision_root (args->root))
-    SVN_ERR (svn_fs__rev_get_txn_id 
-             (&txn_id, fs, svn_fs_revision_root_revision (args->root), trail));
+  if (! args->root->is_txn_root)
+    SVN_ERR (svn_fs_base__rev_get_txn_id (&txn_id, fs, args->root->rev,
+                                          trail));
   else
-    txn_id = svn_fs_txn_root_name (args->root, trail->pool);
+    txn_id = args->root->txn;
 
-  return svn_fs__bdb_changes_fetch (&(args->changes), fs, txn_id, trail);
+  return svn_fs_bdb__changes_fetch (&(args->changes), fs, txn_id, trail);
 }
 
 
-svn_error_t *
-svn_fs_paths_changed (apr_hash_t **changed_paths_p,
-                      svn_fs_root_t *root,
-                      apr_pool_t *pool)
+static svn_error_t *
+base_paths_changed (apr_hash_t **changed_paths_p,
+                    svn_fs_root_t *root,
+                    apr_pool_t *pool)
 {
   struct paths_changed_args args;
   args.root = root;
   args.changes = NULL;
-  SVN_ERR (svn_fs__retry (svn_fs_root_fs (root), txn_body_paths_changed,
-                          &args, pool));
+  SVN_ERR (svn_fs_base__retry (root->fs, txn_body_paths_changed, &args, pool));
   *changed_paths_p = args.changes;
   return SVN_NO_ERROR;
 }
@@ -3939,7 +3801,7 @@
 
 
 /* Our coolio opaque history object. */
-struct svn_fs_history_t
+typedef struct
 {
   /* filesystem object */
   svn_fs_t *fs;
@@ -3954,54 +3816,38 @@
 
   /* FALSE until the first call to svn_fs_history_prev(). */
   svn_boolean_t is_interesting;
-};
+} base_history_data_t;
 
 
-/* Return a new history object (marked as "interesting") for PATH and
-   REVISION, allocated in POOL, and with its members set to the values
-   of the parameters provided.  Note that PATH and PATH_HINT are not
-   duped into POOL -- it is the responsibility of the caller to ensure
-   that this happens. */
-static svn_fs_history_t *
-assemble_history (svn_fs_t *fs,
-                  const char *path,
-                  svn_revnum_t revision,
-                  svn_boolean_t is_interesting,
-                  const char *path_hint,
-                  svn_revnum_t rev_hint,
-                  apr_pool_t *pool)
-{
-  svn_fs_history_t *history = apr_pcalloc (pool, sizeof (*history));
-  history->path = path;
-  history->revision = revision;
-  history->is_interesting = is_interesting;
-  history->path_hint = path_hint;
-  history->rev_hint = rev_hint;
-  history->fs = fs;
-  return history;
-}
+static svn_fs_history_t *assemble_history (svn_fs_t *fs, const char *path,
+                                           svn_revnum_t revision,
+                                           svn_boolean_t is_interesting,
+                                           const char *path_hint,
+                                           svn_revnum_t rev_hint,
+                                           apr_pool_t *pool);
 
 
-svn_error_t *svn_fs_node_history (svn_fs_history_t **history_p,
-                                  svn_fs_root_t *root,
-                                  const char *path,
-                                  apr_pool_t *pool)
+static svn_error_t *
+base_node_history (svn_fs_history_t **history_p,
+                   svn_fs_root_t *root,
+                   const char *path,
+                   apr_pool_t *pool)
 {
   svn_node_kind_t kind;
 
   /* We require a revision root. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return svn_error_create (SVN_ERR_FS_NOT_REVISION_ROOT, NULL, NULL);
 
   /* And we require that the path exist in the root. */
-  SVN_ERR (svn_fs_check_path (&kind, root, path, pool));
+  SVN_ERR (base_check_path (&kind, root, path, pool));
   if (kind == svn_node_none)
     return not_found (root, path);
 
   /* Okay, all seems well.  Build our history object and return it. */
-  *history_p = assemble_history (svn_fs_root_fs (root),
+  *history_p = assemble_history (root->fs,
                                  svn_fs__canonicalize_abspath (path, pool),
-                                 root->rev, FALSE, NULL, 
+                                 root->rev, FALSE, NULL,
                                  SVN_INVALID_REVNUM, pool);
   return SVN_NO_ERROR;
 }
@@ -4014,18 +3860,18 @@
 */
 static svn_error_t *
 examine_copy_inheritance (const char **copy_id,
-                          svn_fs__copy_t **copy,
+                          copy_t **copy,
                           svn_fs_t *fs,
                           parent_path_t *parent_path,
                           trail_t *trail)
 {
   /* The default response -- our current copy ID, and no fetched COPY. */
-  *copy_id = svn_fs__id_copy_id (svn_fs__dag_get_id (parent_path->node));
+  *copy_id = svn_fs__id_copy_id (svn_fs_base__dag_get_id (parent_path->node));
   *copy = NULL;
 
   /* If we have no parent (we are looking at the root node), or if
      this node is supposed to inherit from itself, return that fact. */
-  if (! parent_path->parent) 
+  if (! parent_path->parent)
     return SVN_NO_ERROR;
 
   /* We could be a branch destination (which would answer our question
@@ -4041,13 +3887,13 @@
       /* Get the COPY record.  If it was a real copy (not an implicit
          one), we have our answer.  Otherwise, we fall through to the
          recursive case. */
-      SVN_ERR (svn_fs__bdb_get_copy (copy, fs, *copy_id, trail));
-      if ((*copy)->kind != svn_fs__copy_kind_soft)
+      SVN_ERR (svn_fs_bdb__get_copy (copy, fs, *copy_id, trail));
+      if ((*copy)->kind != copy_kind_soft)
         return SVN_NO_ERROR;
     }
 
   /* Otherwise, our answer is dependent upon our parent. */
-  return examine_copy_inheritance (copy_id, copy, fs, 
+  return examine_copy_inheritance (copy_id, copy, fs,
                                    parent_path->parent, trail);
 }
 
@@ -4067,19 +3913,20 @@
   struct history_prev_args *args = baton;
   svn_fs_history_t **prev_history = args->prev_history_p;
   svn_fs_history_t *history = args->history;
-  const char *commit_path, *src_path, *path = history->path;
-  svn_revnum_t commit_rev, src_rev, dst_rev, revision = history->revision;
+  base_history_data_t *bhd = history->fsap_data;
+  const char *commit_path, *src_path, *path = bhd->path;
+  svn_revnum_t commit_rev, src_rev, dst_rev, revision = bhd->revision;
   apr_pool_t *retpool = args->pool;
-  svn_fs_t *fs = history->fs;
+  svn_fs_t *fs = bhd->fs;
   parent_path_t *parent_path;
   dag_node_t *node;
   svn_fs_root_t *root;
   const svn_fs_id_t *node_id;
   const char *end_copy_id = NULL;
   struct revision_root_args rr_args;
-  svn_boolean_t reported = history->is_interesting;
+  svn_boolean_t reported = bhd->is_interesting;
   const char *txn_id;
-  svn_fs__copy_t *copy = NULL;
+  copy_t *copy = NULL;
   svn_boolean_t retry = FALSE;
 
   /* Initialize our return value. */
@@ -4089,15 +3936,15 @@
      the chase, then our last report was on the destination of a
      copy.  If we are crossing copies, start from those locations,
      otherwise, we're all done here.  */
-  if (history->path_hint && SVN_IS_VALID_REVNUM (history->rev_hint))
+  if (bhd->path_hint && SVN_IS_VALID_REVNUM (bhd->rev_hint))
     {
       reported = FALSE;
       if (! args->cross_copies)
         return SVN_NO_ERROR;
-      path = history->path_hint;
-      revision = history->rev_hint;
+      path = bhd->path_hint;
+      revision = bhd->rev_hint;
     }
-  
+
   /* Construct a ROOT for the current revision. */
   rr_args.root_p = &root;
   rr_args.rev = revision;
@@ -4105,12 +3952,12 @@
 
   /* Open PATH/REVISION, and get its node and a bunch of other
      goodies.  */
-  SVN_ERR (svn_fs__rev_get_txn_id (&txn_id, fs, revision, trail));
+  SVN_ERR (svn_fs_base__rev_get_txn_id (&txn_id, fs, revision, trail));
   SVN_ERR (open_path (&parent_path, root, path, 0, txn_id, trail));
   node = parent_path->node;
-  node_id = svn_fs__dag_get_id (node);
-  commit_path = svn_fs__dag_get_created_path (node);
-  SVN_ERR (svn_fs__dag_get_revision (&commit_rev, node, trail));
+  node_id = svn_fs_base__dag_get_id (node);
+  commit_path = svn_fs_base__dag_get_created_path (node);
+  SVN_ERR (svn_fs_base__dag_get_revision (&commit_rev, node, trail));
 
   /* The Subversion filesystem is written in such a way that a given
      line of history may have at most one interesting history point
@@ -4125,9 +3972,9 @@
         {
           /* ... we either have not yet reported on this revision (and
              need now to do so) ... */
-          *prev_history = assemble_history (fs, 
+          *prev_history = assemble_history (fs,
                                             apr_pstrdup (retpool, commit_path),
-                                            commit_rev, TRUE, NULL, 
+                                            commit_rev, TRUE, NULL,
                                             SVN_INVALID_REVNUM, retpool);
           return SVN_NO_ERROR;
         }
@@ -4138,21 +3985,22 @@
              no predecessor, in which case we're all done!). */
           const svn_fs_id_t *pred_id;
 
-          SVN_ERR (svn_fs__dag_get_predecessor_id (&pred_id, node, trail));
+          SVN_ERR (svn_fs_base__dag_get_predecessor_id (&pred_id, node,
+                                                        trail));
           if (! pred_id)
             return SVN_NO_ERROR;
 
           /* Replace NODE and friends with the information from its
              predecessor. */
-          SVN_ERR (svn_fs__dag_get_node (&node, fs, pred_id, trail));
-          node_id = svn_fs__dag_get_id (node);
-          commit_path = svn_fs__dag_get_created_path (node);
-          SVN_ERR (svn_fs__dag_get_revision (&commit_rev, node, trail));
+          SVN_ERR (svn_fs_base__dag_get_node (&node, fs, pred_id, trail));
+          node_id = svn_fs_base__dag_get_id (node);
+          commit_path = svn_fs_base__dag_get_created_path (node);
+          SVN_ERR (svn_fs_base__dag_get_revision (&commit_rev, node, trail));
         }
     }
 
   /* Calculate a possibly relevant copy ID. */
-  SVN_ERR (examine_copy_inheritance (&end_copy_id, &copy, fs, 
+  SVN_ERR (examine_copy_inheritance (&end_copy_id, &copy, fs,
                                      parent_path, trail));
 
   /* Initialize some state variables. */
@@ -4166,7 +4014,8 @@
      (which is either a real predecessor, or is the node itself
      playing the predecessor role to an imaginary mutable successor),
      then we need to report a copy.  */
-  if (svn_fs__key_compare (svn_fs__id_copy_id (node_id), end_copy_id) != 0)
+  if (svn_fs_base__key_compare (svn_fs__id_copy_id (node_id),
+                                end_copy_id) != 0)
     {
       const char *remainder;
       dag_node_t *dst_node;
@@ -4174,12 +4023,12 @@
 
       /* Get the COPY record if we haven't already fetched it. */
       if (! copy)
-        SVN_ERR (svn_fs__bdb_get_copy (&copy, fs, end_copy_id, trail));
+        SVN_ERR (svn_fs_bdb__get_copy (&copy, fs, end_copy_id, trail));
 
       /* Figure out the destination path of the copy operation. */
-      SVN_ERR (svn_fs__dag_get_node (&dst_node, fs, 
-                                     copy->dst_noderev_id, trail));
-      copy_dst = svn_fs__dag_get_created_path (dst_node);
+      SVN_ERR (svn_fs_base__dag_get_node (&dst_node, fs,
+                                          copy->dst_noderev_id, trail));
+      copy_dst = svn_fs_base__dag_get_created_path (dst_node);
 
       /* If our current path was the very destination of the copy,
          then our new current path will be the copy source.  If our
@@ -4196,17 +4045,17 @@
 
       if (remainder)
         {
-          /* If we get here, then our current path is the destination 
+          /* If we get here, then our current path is the destination
              of, or the child of the destination of, a copy.  Fill
              in the return values and get outta here.  */
-          SVN_ERR (svn_fs__txn_get_revision 
+          SVN_ERR (svn_fs_base__txn_get_revision
                    (&src_rev, fs, copy->src_txn_id, trail));
-          SVN_ERR (svn_fs__txn_get_revision 
-                   (&dst_rev, fs, 
+          SVN_ERR (svn_fs_base__txn_get_revision
+                   (&dst_rev, fs,
                     svn_fs__id_txn_id (copy->dst_noderev_id), trail));
-          src_path = svn_path_join (copy->src_path, remainder, 
+          src_path = svn_path_join (copy->src_path, remainder,
                                     trail->pool);
-          if (copy->kind == svn_fs__copy_kind_soft)
+          if (copy->kind == copy_kind_soft)
             retry = TRUE;
         }
     }
@@ -4224,14 +4073,14 @@
       if ((dst_rev == revision) && reported)
         retry = TRUE;
 
-      *prev_history = assemble_history (fs, apr_pstrdup (retpool, path), 
-                                        dst_rev, retry ? FALSE : TRUE, 
+      *prev_history = assemble_history (fs, apr_pstrdup (retpool, path),
+                                        dst_rev, retry ? FALSE : TRUE,
                                         src_path, src_rev, retpool);
     }
   else
     {
       *prev_history = assemble_history (fs, apr_pstrdup (retpool, commit_path),
-                                        commit_rev, TRUE, NULL, 
+                                        commit_rev, TRUE, NULL,
                                         SVN_INVALID_REVNUM, retpool);
     }
 
@@ -4239,25 +4088,27 @@
 }
 
 
-svn_error_t *svn_fs_history_prev (svn_fs_history_t **prev_history_p,
-                                  svn_fs_history_t *history,
-                                  svn_boolean_t cross_copies,
-                                  apr_pool_t *pool)
+static svn_error_t *
+base_history_prev (svn_fs_history_t **prev_history_p,
+                   svn_fs_history_t *history,
+                   svn_boolean_t cross_copies,
+                   apr_pool_t *pool)
 {
   svn_fs_history_t *prev_history = NULL;
-  svn_fs_t *fs = history->fs;
+  base_history_data_t *bhd = history->fsap_data;
+  svn_fs_t *fs = bhd->fs;
 
   /* Special case: the root directory changes in every single
      revision, no exceptions.  And, the root can't be the target (or
      child of a target -- duh) of a copy.  So, if that's our path,
      then we need only decrement our revision by 1, and there you go. */
-  if (strcmp (history->path, "/") == 0)
+  if (strcmp (bhd->path, "/") == 0)
     {
-      if (! history->is_interesting)
-        prev_history = assemble_history (fs, "/", history->revision,
+      if (! bhd->is_interesting)
+        prev_history = assemble_history (fs, "/", bhd->revision,
                                          1, NULL, SVN_INVALID_REVNUM, pool);
-      else if (history->revision > 0)
-        prev_history = assemble_history (fs, "/", history->revision - 1,
+      else if (bhd->revision > 0)
+        prev_history = assemble_history (fs, "/", bhd->revision - 1,
                                          1, NULL, SVN_INVALID_REVNUM, pool);
     }
   else
@@ -4268,13 +4119,17 @@
       while (1)
         {
           /* Get a trail, and get to work. */
-          
+
           args.prev_history_p = &prev_history;
           args.history = prev_history;
           args.cross_copies = cross_copies;
           args.pool = pool;
-          SVN_ERR (svn_fs__retry_txn (fs, txn_body_history_prev, &args, pool));
-          if ((! prev_history) || (prev_history->is_interesting))
+          SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_history_prev, &args,
+                                           pool));
+          if (! prev_history)
+            break;
+          bhd = prev_history->fsap_data;
+          if (bhd->is_interesting)
             break;
         }
     }
@@ -4284,12 +4139,140 @@
 }
 
 
-svn_error_t *svn_fs_history_location (const char **path,
-                                      svn_revnum_t *revision,
-                                      svn_fs_history_t *history,
-                                      apr_pool_t *pool)
+static svn_error_t *
+base_history_location (const char **path,
+                       svn_revnum_t *revision,
+                       svn_fs_history_t *history,
+                       apr_pool_t *pool)
 {
-  *path = apr_pstrdup (pool, history->path);
-  *revision = history->revision;
+  base_history_data_t *bhd = history->fsap_data;
+
+  *path = apr_pstrdup (pool, bhd->path);
+  *revision = bhd->revision;
   return SVN_NO_ERROR;
+}
+
+
+static history_vtable_t history_vtable = {
+  base_history_prev,
+  base_history_location
+};
+
+
+/* Return a new history object (marked as "interesting") for PATH and
+   REVISION, allocated in POOL, and with its members set to the values
+   of the parameters provided.  Note that PATH and PATH_HINT are not
+   duped into POOL -- it is the responsibility of the caller to ensure
+   that this happens. */
+static svn_fs_history_t *
+assemble_history (svn_fs_t *fs,
+                  const char *path,
+                  svn_revnum_t revision,
+                  svn_boolean_t is_interesting,
+                  const char *path_hint,
+                  svn_revnum_t rev_hint,
+                  apr_pool_t *pool)
+{
+  svn_fs_history_t *history = apr_pcalloc (pool, sizeof (*history));
+  base_history_data_t *bhd = apr_pcalloc (pool, sizeof (*bhd));
+  bhd->path = path;
+  bhd->revision = revision;
+  bhd->is_interesting = is_interesting;
+  bhd->path_hint = path_hint;
+  bhd->rev_hint = rev_hint;
+  bhd->fs = fs;
+  history->vtable = &history_vtable;
+  history->fsap_data = bhd;
+  return history;
+}
+
+
+
+/* Creating root objects.  */
+
+
+static root_vtable_t root_vtable = {
+  base_paths_changed,
+  base_check_path,
+  base_node_history,
+  base_node_id,
+  base_node_created_rev,
+  base_node_created_path,
+  base_delete_node,
+  base_copied_from,
+  base_node_prop,
+  base_node_proplist,
+  base_change_node_prop,
+  base_props_changed,
+  base_dir_entries,
+  base_make_dir,
+  base_copy,
+  base_revision_link,
+  base_file_length,
+  base_file_md5_checksum,
+  base_file_contents,
+  base_make_file,
+  base_apply_textdelta,
+  base_apply_text,
+  base_contents_changed,
+  base_get_file_delta_stream,
+  base_merge
+};
+
+
+/* Construct a new root object in FS, allocated from POOL.  */
+static svn_fs_root_t *
+make_root (svn_fs_t *fs,
+           apr_pool_t *pool)
+{
+  /* We create a subpool for each root object to allow us to implement
+     svn_fs_close_root.  */
+  apr_pool_t *subpool = svn_pool_create (pool);
+  svn_fs_root_t *root = apr_pcalloc (subpool, sizeof (*root));
+  base_root_data_t *brd = apr_palloc(subpool, sizeof (*brd));
+
+  root->fs = fs;
+  root->pool = subpool;
+
+  /* Init the node ID cache. */
+  brd->node_cache = apr_hash_make (pool);
+  brd->node_cache_idx = 0;
+  root->vtable = &root_vtable;
+  root->fsap_data = brd;
+
+  return root;
+}
+
+
+/* Construct a root object referring to the root of REVISION in FS,
+   whose root directory is ROOT_DIR.  Create the new root in POOL.  */
+static svn_fs_root_t *
+make_revision_root (svn_fs_t *fs,
+                    svn_revnum_t rev,
+                    dag_node_t *root_dir,
+                    apr_pool_t *pool)
+{
+  svn_fs_root_t *root = make_root (fs, pool);
+  base_root_data_t *brd = root->fsap_data;
+
+  root->is_txn_root = FALSE;
+  root->rev = rev;
+  brd->root_dir = root_dir;
+
+  return root;
+}
+
+
+/* Construct a root object referring to the root of the transaction
+   named TXN in FS.  Create the new root in POOL.  */
+static svn_fs_root_t *
+make_txn_root (svn_fs_t *fs,
+               const char *txn,
+               apr_pool_t *pool)
+{
+  svn_fs_root_t *root = make_root (fs, pool);
+  root->is_txn_root = TRUE;
+  root->txn = apr_pstrdup (root->pool, txn);
+
+  return root;
 }

Modified: trunk/subversion/libsvn_fs_base/tree.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/tree.h	(original)
+++ trunk/subversion/libsvn_fs_base/tree.h	Thu Apr 29 18:17:29 2004
@@ -24,8 +24,21 @@
 
 
 
-/* The functions you might have expected to find here are all part of
-   the libsvn_fs public interface; see ../include/svn_fs.h. */
+/* These functions implement some of the calls in the FS loader
+   library's fs and txn vtables. */
+
+svn_error_t *svn_fs_base__revision_root (svn_fs_root_t **root_p, svn_fs_t *fs,
+                                         svn_revnum_t rev, apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__deltify (svn_fs_t *fs, svn_revnum_t rev,
+                                   apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__commit_txn (const char **conflict_p,
+                                      svn_revnum_t *new_rev, svn_fs_txn_t *txn,
+                                      apr_pool_t *pool);
+
+svn_error_t *svn_fs_base__txn_root (svn_fs_root_t **root_p, svn_fs_txn_t *txn,
+                                    apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/util/fs_skels.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/util/fs_skels.c	(original)
+++ trunk/subversion/libsvn_fs_base/util/fs_skels.c	Thu Apr 29 18:17:29 2004
@@ -20,14 +20,13 @@
 #include "svn_string.h"
 #include "fs_skels.h"
 #include "skel.h"
-#include "../id.h"
 
 
 static svn_error_t *
 skel_err (const char *skel_type)
 {
   return svn_error_createf (SVN_ERR_FS_MALFORMED_SKEL, NULL,
-                            "Malformed%s%s skeleton", 
+                            "Malformed%s%s skeleton",
                             skel_type ? " " : "",
                             skel_type ? skel_type : "");
 }
@@ -39,10 +38,10 @@
 static svn_boolean_t
 is_valid_checksum_skel (skel_t *skel)
 {
-  if (svn_fs__list_length (skel) != 2)
+  if (svn_fs_base__list_length (skel) != 2)
     return FALSE;
 
-  if (svn_fs__matches_atom (skel->children, "md5")
+  if (svn_fs_base__matches_atom (skel->children, "md5")
       && skel->children->next->is_atom)
     return TRUE;
 
@@ -50,10 +49,10 @@
 }
 
 
-static svn_boolean_t 
+static svn_boolean_t
 is_valid_proplist_skel (skel_t *skel)
 {
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
 
   if ((len >= 0) && (len & 1) == 0)
     {
@@ -73,10 +72,10 @@
 static svn_boolean_t
 is_valid_revision_skel (skel_t *skel)
 {
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
 
   if ((len == 2)
-      && svn_fs__matches_atom (skel->children, "revision")
+      && svn_fs_base__matches_atom (skel->children, "revision")
       && skel->children->next->is_atom)
     return TRUE;
 
@@ -85,20 +84,20 @@
 
 
 static svn_boolean_t
-is_valid_transaction_skel (skel_t *skel, svn_fs__transaction_kind_t *kind)
+is_valid_transaction_skel (skel_t *skel, transaction_kind_t *kind)
 {
-  int len = svn_fs__list_length (skel);
-  
+  int len = svn_fs_base__list_length (skel);
+
   if (len != 5)
     return FALSE;
 
   /* Determine (and verify) the kind. */
-  if (svn_fs__matches_atom (skel->children, "transaction"))
-    *kind = svn_fs__transaction_kind_normal;
-  else if (svn_fs__matches_atom (skel->children, "committed"))
-    *kind = svn_fs__transaction_kind_committed;
-  else if (svn_fs__matches_atom (skel->children, "dead"))
-    *kind = svn_fs__transaction_kind_dead;
+  if (svn_fs_base__matches_atom (skel->children, "transaction"))
+    *kind = transaction_kind_normal;
+  else if (svn_fs_base__matches_atom (skel->children, "committed"))
+    *kind = transaction_kind_committed;
+  else if (svn_fs_base__matches_atom (skel->children, "dead"))
+    *kind = transaction_kind_dead;
   else
     return FALSE;
 
@@ -120,29 +119,29 @@
   skel_t *diff;
 
   /* check the delta skel. */
-  if ((svn_fs__list_length (skel) != 2)
+  if ((svn_fs_base__list_length (skel) != 2)
       || (! skel->children->is_atom))
     return FALSE;
-  
+
   /* check the window. */
   window = skel->children->next;
-  len = svn_fs__list_length (window);
+  len = svn_fs_base__list_length (window);
   if ((len < 3) || (len > 4))
     return FALSE;
   if (! ((! window->children->is_atom)
          && (window->children->next->is_atom)
          && (window->children->next->next->is_atom)))
     return FALSE;
-  if ((len == 5) 
+  if ((len == 5)
       && (! window->children->next->next->next->is_atom))
     return FALSE;
-  
+
   /* check the diff. ### currently we support only svndiff version
      0 delta data. */
   diff = window->children;
-  if ((svn_fs__list_length (diff) == 3)
-      && (svn_fs__matches_atom (diff->children, "svndiff"))
-      && (svn_fs__matches_atom (diff->children->next, "0"))
+  if ((svn_fs_base__list_length (diff) == 3)
+      && (svn_fs_base__matches_atom (diff->children, "svndiff"))
+      && (svn_fs_base__matches_atom (diff->children->next, "0"))
       && (diff->children->next->next->is_atom))
     return TRUE;
 
@@ -150,10 +149,10 @@
 }
 
 
-static svn_boolean_t 
+static svn_boolean_t
 is_valid_representation_skel (skel_t *skel)
 {
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
   skel_t *header;
   int header_len;
 
@@ -165,7 +164,7 @@
   /* check the header.  it must have KIND and TXN atoms, and
      optionally a CHECKSUM (which is a list form). */
   header = skel->children;
-  header_len = svn_fs__list_length (header);
+  header_len = svn_fs_base__list_length (header);
   if (! (((header_len == 2)     /* 2 means old repository, checksum absent */
           && (header->children->is_atom)
           && (header->children->next->is_atom))
@@ -177,16 +176,16 @@
 
   /* check for fulltext rep. */
   if ((len == 2)
-      && (svn_fs__matches_atom (header->children, "fulltext")))
+      && (svn_fs_base__matches_atom (header->children, "fulltext")))
     return TRUE;
 
   /* check for delta rep. */
   if ((len >= 2)
-      && (svn_fs__matches_atom (header->children, "delta")))
+      && (svn_fs_base__matches_atom (header->children, "delta")))
     {
       /* it's a delta rep.  check the validity.  */
       skel_t *chunk = skel->children->next;
-      
+
       /* loop over chunks, checking each one. */
       while (chunk)
         {
@@ -206,7 +205,7 @@
 static svn_boolean_t
 is_valid_node_revision_header_skel (skel_t *skel, skel_t **kind_p)
 {
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
 
   if (len < 2)
     return FALSE;
@@ -245,7 +244,7 @@
 static svn_boolean_t
 is_valid_node_revision_skel (skel_t *skel)
 {
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
 
   if (len >= 1)
     {
@@ -254,13 +253,13 @@
 
       if (is_valid_node_revision_header_skel (header, &kind))
         {
-          if (svn_fs__matches_atom (kind, "dir")
+          if (svn_fs_base__matches_atom (kind, "dir")
               && len == 3
               && header->next->is_atom
               && header->next->next->is_atom)
             return TRUE;
-          
-          if (svn_fs__matches_atom (kind, "file")
+
+          if (svn_fs_base__matches_atom (kind, "file")
               && ((len == 3) || (len == 4))
               && header->next->is_atom
               && header->next->next->is_atom)
@@ -279,9 +278,9 @@
 static svn_boolean_t
 is_valid_copy_skel (skel_t *skel)
 {
-  return (((svn_fs__list_length (skel) == 4)
-           && (svn_fs__matches_atom (skel->children, "copy")
-               || svn_fs__matches_atom (skel->children, "soft-copy"))
+  return (((svn_fs_base__list_length (skel) == 4)
+           && (svn_fs_base__matches_atom (skel->children, "copy")
+               || svn_fs_base__matches_atom (skel->children, "soft-copy"))
            && skel->children->next->is_atom
            && skel->children->next->next->is_atom
            && skel->children->next->next->next->is_atom) ? TRUE : FALSE);
@@ -291,8 +290,8 @@
 static svn_boolean_t
 is_valid_change_skel (skel_t *skel, svn_fs_path_change_kind_t *kind)
 {
-  if ((svn_fs__list_length (skel) == 6)
-      && svn_fs__matches_atom (skel->children, "change")
+  if ((svn_fs_base__list_length (skel) == 6)
+      && svn_fs_base__matches_atom (skel->children, "change")
       && skel->children->next->is_atom
       && skel->children->next->next->is_atom
       && skel->children->next->next->next->is_atom
@@ -302,31 +301,31 @@
       skel_t *kind_skel = skel->children->next->next->next;
 
       /* check the kind (and return it) */
-      if (svn_fs__matches_atom (kind_skel, "reset"))
+      if (svn_fs_base__matches_atom (kind_skel, "reset"))
         {
           if (kind)
             *kind = svn_fs_path_change_reset;
           return TRUE;
         }
-      if (svn_fs__matches_atom (kind_skel, "add"))
+      if (svn_fs_base__matches_atom (kind_skel, "add"))
         {
           if (kind)
             *kind = svn_fs_path_change_add;
           return TRUE;
         }
-      if (svn_fs__matches_atom (kind_skel, "delete"))
+      if (svn_fs_base__matches_atom (kind_skel, "delete"))
         {
           if (kind)
             *kind = svn_fs_path_change_delete;
           return TRUE;
         }
-      if (svn_fs__matches_atom (kind_skel, "replace"))
+      if (svn_fs_base__matches_atom (kind_skel, "replace"))
         {
           if (kind)
             *kind = svn_fs_path_change_replace;
           return TRUE;
         }
-      if (svn_fs__matches_atom (kind_skel, "modify"))
+      if (svn_fs_base__matches_atom (kind_skel, "modify"))
         {
           if (kind)
             *kind = svn_fs_path_change_modify;
@@ -341,9 +340,9 @@
 /*** Parsing (conversion from skeleton to native FS type) ***/
 
 svn_error_t *
-svn_fs__parse_proplist_skel (apr_hash_t **proplist_p,
-                             skel_t *skel,
-                             apr_pool_t *pool)
+svn_fs_base__parse_proplist_skel (apr_hash_t **proplist_p,
+                                  skel_t *skel,
+                                  apr_pool_t *pool)
 {
   apr_hash_t *proplist = NULL;
   skel_t *elt;
@@ -351,16 +350,16 @@
   /* Validate the skel. */
   if (! is_valid_proplist_skel (skel))
     return skel_err ("proplist");
-  
+
   /* Create the returned structure */
   if (skel->children)
     proplist = apr_hash_make (pool);
   for (elt = skel->children; elt; elt = elt->next->next)
     {
-      svn_string_t *value = svn_string_ncreate (elt->next->data, 
+      svn_string_t *value = svn_string_ncreate (elt->next->data,
                                                 elt->next->len, pool);
-      apr_hash_set (proplist, 
-                    apr_pstrmemdup (pool, elt->data, elt->len), 
+      apr_hash_set (proplist,
+                    apr_pstrmemdup (pool, elt->data, elt->len),
                     elt->len,
                     value);
     }
@@ -372,11 +371,11 @@
 
 
 svn_error_t *
-svn_fs__parse_revision_skel (svn_fs__revision_t **revision_p, 
-                             skel_t *skel,
-                             apr_pool_t *pool)
+svn_fs_base__parse_revision_skel (revision_t **revision_p,
+                                  skel_t *skel,
+                                  apr_pool_t *pool)
 {
-  svn_fs__revision_t *revision;
+  revision_t *revision;
 
   /* Validate the skel. */
   if (! is_valid_revision_skel (skel))
@@ -384,9 +383,9 @@
 
   /* Create the returned structure */
   revision = apr_pcalloc (pool, sizeof (*revision));
-  revision->txn_id = apr_pstrmemdup (pool, skel->children->next->data, 
+  revision->txn_id = apr_pstrmemdup (pool, skel->children->next->data,
                                      skel->children->next->len);
-  
+
   /* Return the structure. */
   *revision_p = revision;
   return SVN_NO_ERROR;
@@ -394,15 +393,15 @@
 
 
 svn_error_t *
-svn_fs__parse_transaction_skel (svn_fs__transaction_t **transaction_p, 
-                                skel_t *skel,
-                                apr_pool_t *pool)
+svn_fs_base__parse_transaction_skel (transaction_t **transaction_p,
+                                     skel_t *skel,
+                                     apr_pool_t *pool)
 {
-  svn_fs__transaction_t *transaction;
-  svn_fs__transaction_kind_t kind;
+  transaction_t *transaction;
+  transaction_kind_t kind;
   skel_t *root_id, *base_id_or_rev, *proplist, *copies;
   int len;
-  
+
   /* Validate the skel. */
   if (! is_valid_transaction_skel (skel, &kind))
     return skel_err ("transaction");
@@ -419,7 +418,7 @@
   transaction->kind = kind;
 
   /* REVISION or BASE-ID */
-  if (kind == svn_fs__transaction_kind_committed)
+  if (kind == transaction_kind_committed)
     {
       /* Committed transactions have a revision number... */
       transaction->base_id = NULL;
@@ -427,9 +426,9 @@
                                                     base_id_or_rev->len));
       if (! SVN_IS_VALID_REVNUM (transaction->revision))
         return skel_err ("tranaction");
-      
+
     }
-  else 
+  else
     {
       /* ...where unfinished transactions have a base node-revision-id. */
       transaction->revision = SVN_INVALID_REVNUM;
@@ -438,20 +437,20 @@
     }
 
   /* ROOT-ID */
-  transaction->root_id = svn_fs_parse_id (root_id->data, 
+  transaction->root_id = svn_fs_parse_id (root_id->data,
                                           root_id->len, pool);
 
   /* PROPLIST */
-  SVN_ERR (svn_fs__parse_proplist_skel (&(transaction->proplist), 
-                                        proplist, pool));
-      
+  SVN_ERR (svn_fs_base__parse_proplist_skel (&(transaction->proplist),
+                                             proplist, pool));
+
   /* COPIES */
-  if ((len = svn_fs__list_length (copies)))
+  if ((len = svn_fs_base__list_length (copies)))
     {
       const char *copy_id;
       apr_array_header_t *txncopies;
       skel_t *cpy = copies->children;
-      
+
       txncopies = apr_array_make (pool, len, sizeof (copy_id));
       while (cpy)
         {
@@ -469,11 +468,11 @@
 
 
 svn_error_t *
-svn_fs__parse_representation_skel (svn_fs__representation_t **rep_p,
-                                   skel_t *skel,
-                                   apr_pool_t *pool)
+svn_fs_base__parse_representation_skel (representation_t **rep_p,
+                                        skel_t *skel,
+                                        apr_pool_t *pool)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
   skel_t *header_skel;
 
   /* Validate the skel. */
@@ -483,17 +482,17 @@
 
   /* Create the returned structure */
   rep = apr_pcalloc (pool, sizeof (*rep));
-  
+
   /* KIND */
-  if (svn_fs__matches_atom (header_skel->children, "fulltext"))
-    rep->kind = svn_fs__rep_kind_fulltext;
+  if (svn_fs_base__matches_atom (header_skel->children, "fulltext"))
+    rep->kind = rep_kind_fulltext;
   else
-    rep->kind = svn_fs__rep_kind_delta;
+    rep->kind = rep_kind_delta;
 
   /* TXN */
   rep->txn_id = apr_pstrmemdup (pool, header_skel->children->next->data,
                                 header_skel->children->next->len);
-  
+
   /* CHECKSUM */
   if (header_skel->children->next->next)
     {
@@ -506,13 +505,13 @@
       /* Older repository, no checksum, so manufacture an all-zero checksum */
       memset (rep->checksum, 0, APR_MD5_DIGESTSIZE);
     }
-  
+
   /* KIND-SPECIFIC stuff */
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  if (rep->kind == rep_kind_fulltext)
     {
       /* "fulltext"-specific. */
-      rep->contents.fulltext.string_key 
-        = apr_pstrmemdup (pool, 
+      rep->contents.fulltext.string_key
+        = apr_pstrmemdup (pool,
                           skel->children->next->data,
                           skel->children->next->len);
     }
@@ -520,11 +519,11 @@
     {
       /* "delta"-specific. */
       skel_t *chunk_skel = skel->children->next;
-      svn_fs__rep_delta_chunk_t *chunk;
+      rep_delta_chunk_t *chunk;
       apr_array_header_t *chunks;
-      
+
       /* Alloc the chunk array. */
-      chunks = apr_array_make (pool, svn_fs__list_length (skel) - 1, 
+      chunks = apr_array_make (pool, svn_fs_base__list_length (skel) - 1,
                                sizeof (chunk));
 
       /* Process the chunks. */
@@ -537,30 +536,30 @@
           chunk = apr_palloc (pool, sizeof (*chunk));
 
           /* Populate the window */
-          chunk->version 
-            = (apr_byte_t)atoi (apr_pstrmemdup 
+          chunk->version
+            = (apr_byte_t)atoi (apr_pstrmemdup
                                 (pool,
                                  diff_skel->children->next->data,
                                  diff_skel->children->next->len));
-          chunk->string_key 
+          chunk->string_key
             = apr_pstrmemdup (pool,
                               diff_skel->children->next->next->data,
                               diff_skel->children->next->next->len);
-          chunk->size 
+          chunk->size
             = atoi (apr_pstrmemdup (pool,
                                     window_skel->children->next->data,
                                     window_skel->children->next->len));
-          chunk->rep_key 
-            = apr_pstrmemdup (pool, 
+          chunk->rep_key
+            = apr_pstrmemdup (pool,
                               window_skel->children->next->next->data,
                               window_skel->children->next->next->len);
-          chunk->offset = 
+          chunk->offset =
             svn__atoui64 (apr_pstrmemdup (pool,
                                          chunk_skel->children->data,
                                          chunk_skel->children->len));
 
           /* Add this chunk to the array. */
-          (*((svn_fs__rep_delta_chunk_t **)(apr_array_push (chunks)))) = chunk;
+          (*((rep_delta_chunk_t **)(apr_array_push (chunks)))) = chunk;
 
           /* Next... */
           chunk_skel = chunk_skel->next;
@@ -577,11 +576,11 @@
 
 
 svn_error_t *
-svn_fs__parse_node_revision_skel (svn_fs__node_revision_t **noderev_p,
-                                  skel_t *skel,
-                                  apr_pool_t *pool)
+svn_fs_base__parse_node_revision_skel (node_revision_t **noderev_p,
+                                       skel_t *skel,
+                                       apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   skel_t *header_skel;
 
   /* Validate the skel. */
@@ -591,22 +590,22 @@
 
   /* Create the returned structure */
   noderev = apr_pcalloc (pool, sizeof (*noderev));
-  
+
   /* KIND */
-  if (svn_fs__matches_atom (header_skel->children, "dir"))
+  if (svn_fs_base__matches_atom (header_skel->children, "dir"))
     noderev->kind = svn_node_dir;
   else
     noderev->kind = svn_node_file;
 
   /* CREATED-PATH */
-  noderev->created_path = apr_pstrmemdup (pool, 
+  noderev->created_path = apr_pstrmemdup (pool,
                                           header_skel->children->next->data,
                                           header_skel->children->next->len);
 
   /* PREDECESSOR-ID */
   if (header_skel->children->next->next)
     {
-      noderev->predecessor_id 
+      noderev->predecessor_id
         = svn_fs_parse_id (header_skel->children->next->next->data,
                            header_skel->children->next->next->len, pool);
 
@@ -618,7 +617,7 @@
                                 header_skel->children->next->next->next->data,
                                 header_skel->children->next->next->next->len));
     }
-      
+
   /* PROP-KEY */
   if (skel->children->next->len)
     noderev->prop_key = apr_pstrmemdup (pool, skel->children->next->data,
@@ -630,10 +629,10 @@
                                         skel->children->next->next->len);
 
   /* EDIT-DATA-KEY (optional, files only) */
-  if ((noderev->kind == svn_node_file) 
+  if ((noderev->kind == svn_node_file)
       && skel->children->next->next->next
       && skel->children->next->next->next->len)
-    noderev->edit_key 
+    noderev->edit_key
       = apr_pstrmemdup (pool, skel->children->next->next->next->data,
                         skel->children->next->next->next->len);
 
@@ -644,11 +643,11 @@
 
 
 svn_error_t *
-svn_fs__parse_copy_skel (svn_fs__copy_t **copy_p,
-                         skel_t *skel,
-                         apr_pool_t *pool)
+svn_fs_base__parse_copy_skel (copy_t **copy_p,
+                              skel_t *skel,
+                              apr_pool_t *pool)
 {
-  svn_fs__copy_t *copy;
+  copy_t *copy;
 
   /* Validate the skel. */
   if (! is_valid_copy_skel (skel))
@@ -658,10 +657,10 @@
   copy = apr_pcalloc (pool, sizeof (*copy));
 
   /* KIND */
-  if (svn_fs__matches_atom (skel->children, "soft-copy"))
-    copy->kind = svn_fs__copy_kind_soft;
+  if (svn_fs_base__matches_atom (skel->children, "soft-copy"))
+    copy->kind = copy_kind_soft;
   else
-    copy->kind = svn_fs__copy_kind_real;
+    copy->kind = copy_kind_real;
 
   /* SRC-PATH */
   copy->src_path = apr_pstrmemdup (pool,
@@ -674,7 +673,7 @@
                                      skel->children->next->next->len);
 
   /* DST-NODE-ID */
-  copy->dst_noderev_id 
+  copy->dst_noderev_id
     = svn_fs_parse_id (skel->children->next->next->next->data,
                        skel->children->next->next->next->len, pool);
 
@@ -685,22 +684,22 @@
 
 
 svn_error_t *
-svn_fs__parse_entries_skel (apr_hash_t **entries_p,
-                            skel_t *skel,
-                            apr_pool_t *pool)
+svn_fs_base__parse_entries_skel (apr_hash_t **entries_p,
+                                 skel_t *skel,
+                                 apr_pool_t *pool)
 {
   apr_hash_t *entries = NULL;
-  int len = svn_fs__list_length (skel);
+  int len = svn_fs_base__list_length (skel);
   skel_t *elt;
 
   if (! (len >= 0))
     return skel_err ("entries");
-    
+
   if (len > 0)
     {
       /* Else, allocate a hash and populate it. */
       entries = apr_hash_make (pool);
-      
+
       /* Check entries are well-formed as we go along. */
       for (elt = skel->children; elt; elt = elt->next)
         {
@@ -708,13 +707,13 @@
           svn_fs_id_t *id;
 
           /* ENTRY must be a list of two elements. */
-          if (svn_fs__list_length (elt) != 2)
+          if (svn_fs_base__list_length (elt) != 2)
             return skel_err ("entries");
 
           /* Get the entry's name and ID. */
-          name = apr_pstrmemdup (pool, elt->children->data, 
+          name = apr_pstrmemdup (pool, elt->children->data,
                                  elt->children->len);
-          id = svn_fs_parse_id (elt->children->next->data, 
+          id = svn_fs_parse_id (elt->children->next->data,
                                 elt->children->next->len, pool);
 
           /* Add the entry to the hash. */
@@ -729,11 +728,11 @@
 
 
 svn_error_t *
-svn_fs__parse_change_skel (svn_fs__change_t **change_p,
-                           skel_t *skel,
-                           apr_pool_t *pool)
+svn_fs_base__parse_change_skel (change_t **change_p,
+                                skel_t *skel,
+                                apr_pool_t *pool)
 {
-  svn_fs__change_t *change;
+  change_t *change;
   svn_fs_path_change_kind_t kind;
 
   /* Validate the skel. */
@@ -750,7 +749,7 @@
   /* NODE-REV-ID */
   if (skel->children->next->next->len)
     change->noderev_id = svn_fs_parse_id (skel->children->next->next->data,
-                                          skel->children->next->next->len, 
+                                          skel->children->next->next->len,
                                           pool);
 
   /* KIND */
@@ -774,11 +773,11 @@
 /*** Unparsing (conversion from native FS type to skeleton) ***/
 
 svn_error_t *
-svn_fs__unparse_proplist_skel (skel_t **skel_p,
-                               apr_hash_t *proplist,
-                               apr_pool_t *pool)
+svn_fs_base__unparse_proplist_skel (skel_t **skel_p,
+                                    apr_hash_t *proplist,
+                                    apr_pool_t *pool)
 {
-  skel_t *skel = svn_fs__make_empty_list (pool);
+  skel_t *skel = svn_fs_base__make_empty_list (pool);
   apr_hash_index_t *hi;
 
   /* Create the skel. */
@@ -791,19 +790,20 @@
           void *val;
           apr_ssize_t klen;
           svn_string_t *value;
-          
+
           apr_hash_this (hi, &key, &klen, &val);
           value = val;
-          
+
           /* VALUE */
-          svn_fs__prepend (svn_fs__mem_atom (value->data, value->len, pool), 
-                           skel);
-          
+          svn_fs_base__prepend (svn_fs_base__mem_atom (value->data, \
+                                                       value->len, pool),
+                                skel);
+
           /* NAME */
-          svn_fs__prepend (svn_fs__mem_atom (key, klen, pool), skel);
+          svn_fs_base__prepend (svn_fs_base__mem_atom (key, klen, pool), skel);
         }
     }
-     
+
   /* Validate and return the skel. */
   if (! is_valid_proplist_skel (skel))
     return skel_err ("proplist");
@@ -813,20 +813,20 @@
 
 
 svn_error_t *
-svn_fs__unparse_revision_skel (skel_t **skel_p,
-                               const svn_fs__revision_t *revision,
-                               apr_pool_t *pool)
+svn_fs_base__unparse_revision_skel (skel_t **skel_p,
+                                    const revision_t *revision,
+                                    apr_pool_t *pool)
 {
   skel_t *skel;
 
   /* Create the skel. */
-  skel = svn_fs__make_empty_list (pool);
+  skel = svn_fs_base__make_empty_list (pool);
 
   /* TXN_ID */
-  svn_fs__prepend (svn_fs__str_atom (revision->txn_id, pool), skel);
+  svn_fs_base__prepend (svn_fs_base__str_atom (revision->txn_id, pool), skel);
 
   /* "revision" */
-  svn_fs__prepend (svn_fs__str_atom ("revision", pool), skel);
+  svn_fs_base__prepend (svn_fs_base__str_atom ("revision", pool), skel);
 
   /* Validate and return the skel. */
   if (! is_valid_revision_skel (skel))
@@ -837,35 +837,35 @@
 
 
 svn_error_t *
-svn_fs__unparse_transaction_skel (skel_t **skel_p,
-                                  const svn_fs__transaction_t *transaction,
-                                  apr_pool_t *pool)
+svn_fs_base__unparse_transaction_skel (skel_t **skel_p,
+                                       const transaction_t *transaction,
+                                       apr_pool_t *pool)
 {
   skel_t *skel;
   skel_t *proplist_skel, *copies_skel, *header_skel;
   svn_string_t *id_str;
-  svn_fs__transaction_kind_t kind;
+  transaction_kind_t kind;
 
   /* Create the skel. */
-  skel = svn_fs__make_empty_list (pool);
+  skel = svn_fs_base__make_empty_list (pool);
 
   switch (transaction->kind)
     {
-    case svn_fs__transaction_kind_committed:
-      header_skel = svn_fs__str_atom ("committed", pool);
-      if ((transaction->base_id) 
+    case transaction_kind_committed:
+      header_skel = svn_fs_base__str_atom ("committed", pool);
+      if ((transaction->base_id)
           || (! SVN_IS_VALID_REVNUM (transaction->revision)))
         return skel_err ("transaction");
       break;
-    case svn_fs__transaction_kind_dead:
-      header_skel = svn_fs__str_atom ("dead", pool);
-      if ((! transaction->base_id) 
+    case transaction_kind_dead:
+      header_skel = svn_fs_base__str_atom ("dead", pool);
+      if ((! transaction->base_id)
           || (SVN_IS_VALID_REVNUM (transaction->revision)))
         return skel_err ("transaction");
       break;
-    case svn_fs__transaction_kind_normal:
-      header_skel = svn_fs__str_atom ("transaction", pool);
-      if ((! transaction->base_id) 
+    case transaction_kind_normal:
+      header_skel = svn_fs_base__str_atom ("transaction", pool);
+      if ((! transaction->base_id)
           || (SVN_IS_VALID_REVNUM (transaction->revision)))
         return skel_err ("transaction");
       break;
@@ -875,47 +875,49 @@
 
 
   /* COPIES */
-  copies_skel = svn_fs__make_empty_list (pool);
-  if (transaction->copies && transaction->copies->nelts) 
+  copies_skel = svn_fs_base__make_empty_list (pool);
+  if (transaction->copies && transaction->copies->nelts)
     {
       int i;
       for (i = transaction->copies->nelts - 1; i >= 0; i--)
         {
-          svn_fs__prepend (svn_fs__str_atom 
-                           (APR_ARRAY_IDX (transaction->copies, i, 
-                                           const char *), pool), 
+          svn_fs_base__prepend (svn_fs_base__str_atom
+                           (APR_ARRAY_IDX (transaction->copies, i,
+                                           const char *), pool),
                            copies_skel);
         }
     }
-  svn_fs__prepend (copies_skel, skel);
-  
+  svn_fs_base__prepend (copies_skel, skel);
+
   /* PROPLIST */
-  SVN_ERR (svn_fs__unparse_proplist_skel (&proplist_skel,
+  SVN_ERR (svn_fs_base__unparse_proplist_skel (&proplist_skel,
                                           transaction->proplist, pool));
-  svn_fs__prepend (proplist_skel, skel);
+  svn_fs_base__prepend (proplist_skel, skel);
 
   /* REVISION or BASE-ID */
-  if (transaction->kind == svn_fs__transaction_kind_committed)
+  if (transaction->kind == transaction_kind_committed)
     {
       /* Committed transactions have a revision number... */
-      svn_fs__prepend (svn_fs__str_atom 
-                       (apr_psprintf (pool, "%" SVN_REVNUM_T_FMT, 
-                                      transaction->revision), pool), skel);
-    }  
-  else  
+      svn_fs_base__prepend (svn_fs_base__str_atom
+                            (apr_psprintf (pool, "%" SVN_REVNUM_T_FMT,
+                                           transaction->revision), pool), \
+                            skel);
+    }
+  else
     {
       /* ...where other transactions have a base node revision ID. */
       id_str = svn_fs_unparse_id (transaction->base_id, pool);
-      svn_fs__prepend (svn_fs__mem_atom (id_str->data, id_str->len, pool),
-                       skel);
+      svn_fs_base__prepend (svn_fs_base__mem_atom (id_str->data, id_str->len, \
+                                                   pool), skel);
     }
-  
+
   /* ROOT-ID */
   id_str = svn_fs_unparse_id (transaction->root_id, pool);
-  svn_fs__prepend (svn_fs__mem_atom (id_str->data, id_str->len, pool), skel);
-  
+  svn_fs_base__prepend (svn_fs_base__mem_atom (id_str->data, id_str->len,
+                                               pool), skel);
+
   /* KIND (see above) */
-  svn_fs__prepend (header_skel, skel);
+  svn_fs_base__prepend (header_skel, skel);
 
   /* Validate and return the skel. */
   if (! is_valid_transaction_skel (skel, &kind))
@@ -928,54 +930,56 @@
 
 
 svn_error_t *
-svn_fs__unparse_representation_skel (skel_t **skel_p,
-                                     const svn_fs__representation_t *rep,
-                                     apr_pool_t *pool)
+svn_fs_base__unparse_representation_skel (skel_t **skel_p,
+                                          const representation_t *rep,
+                                          apr_pool_t *pool)
 {
-  skel_t *skel = svn_fs__make_empty_list (pool);
-  skel_t *header_skel = svn_fs__make_empty_list (pool);
+  skel_t *skel = svn_fs_base__make_empty_list (pool);
+  skel_t *header_skel = svn_fs_base__make_empty_list (pool);
 
   /** Some parts of the header are common to all representations; do
       those parts first. **/
-  
+
   /* CHECKSUM */
   {
-    skel_t *checksum_skel = svn_fs__make_empty_list (pool);
-    svn_fs__prepend (svn_fs__mem_atom
+    skel_t *checksum_skel = svn_fs_base__make_empty_list (pool);
+    svn_fs_base__prepend (svn_fs_base__mem_atom
                      (rep->checksum,
                       APR_MD5_DIGESTSIZE / sizeof (*(rep->checksum)), pool),
                      checksum_skel);
-    svn_fs__prepend (svn_fs__str_atom ("md5", pool), checksum_skel);
-    svn_fs__prepend (checksum_skel, header_skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("md5", pool), checksum_skel);
+    svn_fs_base__prepend (checksum_skel, header_skel);
   }
-  
+
   /* TXN */
   if (rep->txn_id)
-    svn_fs__prepend (svn_fs__str_atom (rep->txn_id, pool), header_skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (rep->txn_id, pool),
+                          header_skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), header_skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), header_skel);
 
   /** Do the kind-specific stuff. **/
 
-  if (rep->kind == svn_fs__rep_kind_fulltext)
+  if (rep->kind == rep_kind_fulltext)
     {
       /*** Fulltext Representation. ***/
 
       /* STRING-KEY */
-      if ((! rep->contents.fulltext.string_key) 
+      if ((! rep->contents.fulltext.string_key)
           || (! *rep->contents.fulltext.string_key))
-        svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+        svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
       else
-        svn_fs__prepend (svn_fs__str_atom 
-                         (rep->contents.fulltext.string_key, pool), skel);
-      
+        svn_fs_base__prepend (svn_fs_base__str_atom
+                              (rep->contents.fulltext.string_key, pool), skel);
+
       /* "fulltext" */
-      svn_fs__prepend (svn_fs__str_atom ("fulltext", pool), header_skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("fulltext", pool),
+                            header_skel);
 
       /* header */
-      svn_fs__prepend (header_skel, skel);
+      svn_fs_base__prepend (header_skel, skel);
     }
-  else if (rep->kind == svn_fs__rep_kind_delta)
+  else if (rep->kind == rep_kind_delta)
     {
       /*** Delta Representation. ***/
       int i;
@@ -984,12 +988,12 @@
       /* Loop backwards through the windows, creating and prepending skels. */
       for (i = chunks->nelts; i > 0; i--)
         {
-          skel_t *window_skel = svn_fs__make_empty_list (pool);
-          skel_t *chunk_skel = svn_fs__make_empty_list (pool);
-          skel_t *diff_skel = svn_fs__make_empty_list (pool);
+          skel_t *window_skel = svn_fs_base__make_empty_list (pool);
+          skel_t *chunk_skel = svn_fs_base__make_empty_list (pool);
+          skel_t *diff_skel = svn_fs_base__make_empty_list (pool);
           const char *size_str, *offset_str, *version_str;
-          svn_fs__rep_delta_chunk_t *chunk = 
-            (((svn_fs__rep_delta_chunk_t **) chunks->elts)[i - 1]);
+          rep_delta_chunk_t *chunk =
+            (((rep_delta_chunk_t **) chunks->elts)[i - 1]);
 
           /* OFFSET */
           offset_str = apr_psprintf (pool, "%" SVN_FILESIZE_T_FMT,
@@ -1003,35 +1007,43 @@
 
           /* DIFF */
           if ((! chunk->string_key) || (! *chunk->string_key))
-            svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), diff_skel);
+            svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool),
+                                  diff_skel);
           else
-            svn_fs__prepend (svn_fs__str_atom (chunk->string_key,
-                                               pool), diff_skel);
-          svn_fs__prepend (svn_fs__str_atom (version_str, pool), diff_skel);
-          svn_fs__prepend (svn_fs__str_atom ("svndiff", pool), diff_skel);
-        
+            svn_fs_base__prepend (svn_fs_base__str_atom (chunk->string_key,
+                                                         pool), diff_skel);
+          svn_fs_base__prepend (svn_fs_base__str_atom (version_str, pool),
+                                diff_skel);
+          svn_fs_base__prepend (svn_fs_base__str_atom ("svndiff", pool),
+                                diff_skel);
+
           /* REP-KEY */
           if ((! chunk->rep_key) || (! *(chunk->rep_key)))
-            svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), window_skel);
+            svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool),
+                                  window_skel);
           else
-            svn_fs__prepend (svn_fs__str_atom (chunk->rep_key, pool), 
-                             window_skel);
-          svn_fs__prepend (svn_fs__str_atom (size_str, pool), window_skel);
-          svn_fs__prepend (diff_skel, window_skel);
-          
+            svn_fs_base__prepend (svn_fs_base__str_atom (chunk->rep_key,
+                                                         pool),
+                                  window_skel);
+          svn_fs_base__prepend (svn_fs_base__str_atom (size_str, pool),
+                                window_skel);
+          svn_fs_base__prepend (diff_skel, window_skel);
+
           /* window header. */
-          svn_fs__prepend (window_skel, chunk_skel);
-          svn_fs__prepend (svn_fs__str_atom (offset_str, pool), chunk_skel);
-          
+          svn_fs_base__prepend (window_skel, chunk_skel);
+          svn_fs_base__prepend (svn_fs_base__str_atom (offset_str, pool),
+                                chunk_skel);
+
           /* Add this window item to the main skel. */
-          svn_fs__prepend (chunk_skel, skel);
+          svn_fs_base__prepend (chunk_skel, skel);
         }
-      
+
       /* "delta" */
-      svn_fs__prepend (svn_fs__str_atom ("delta", pool), header_skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("delta", pool),
+                            header_skel);
 
       /* header */
-      svn_fs__prepend (header_skel, skel);
+      svn_fs_base__prepend (header_skel, skel);
     }
   else /* unknown kind */
     abort();
@@ -1045,44 +1057,46 @@
 
 
 svn_error_t *
-svn_fs__unparse_node_revision_skel (skel_t **skel_p,
-                                    const svn_fs__node_revision_t *noderev,
-                                    apr_pool_t *pool)
+svn_fs_base__unparse_node_revision_skel (skel_t **skel_p,
+                                         const node_revision_t *noderev,
+                                         apr_pool_t *pool)
 {
   skel_t *skel;
   skel_t *header_skel;
 
   /* Create the skel. */
-  skel = svn_fs__make_empty_list (pool);
-  header_skel = svn_fs__make_empty_list (pool);
+  skel = svn_fs_base__make_empty_list (pool);
+  header_skel = svn_fs_base__make_empty_list (pool);
 
   /* PREDECESSOR-COUNT */
   if (noderev->predecessor_count != -1)
     {
       const char *count_str = apr_psprintf(pool, "%d",
                                            noderev->predecessor_count);
-      svn_fs__prepend (svn_fs__str_atom (count_str, pool), header_skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom (count_str, pool),
+                            header_skel);
     }
 
   /* PREDECESSOR-ID */
   if (noderev->predecessor_id)
     {
       svn_string_t *id_str = svn_fs_unparse_id (noderev->predecessor_id, pool);
-      svn_fs__prepend (svn_fs__mem_atom (id_str->data, id_str->len, pool), 
-                       header_skel);
+      svn_fs_base__prepend (svn_fs_base__mem_atom (id_str->data, id_str->len,
+                                                   pool),
+                            header_skel);
     }
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), header_skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), header_skel);
 
   /* CREATED-PATH */
-  svn_fs__prepend (svn_fs__str_atom (noderev->created_path, pool), 
+  svn_fs_base__prepend (svn_fs_base__str_atom (noderev->created_path, pool),
                    header_skel);
 
   /* KIND */
   if (noderev->kind == svn_node_file)
-    svn_fs__prepend (svn_fs__str_atom ("file", pool), header_skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("file", pool), header_skel);
   else if (noderev->kind == svn_node_dir)
-    svn_fs__prepend (svn_fs__str_atom ("dir", pool), header_skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("dir", pool), header_skel);
   else
     abort ();
 
@@ -1091,22 +1105,25 @@
 
   /* EDIT-DATA-KEY (optional) */
   if ((noderev->edit_key) && (*noderev->edit_key))
-    svn_fs__prepend (svn_fs__str_atom (noderev->edit_key, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (noderev->edit_key, pool),
+                          skel);
 
   /* DATA-KEY */
   if ((noderev->data_key) && (*noderev->data_key))
-    svn_fs__prepend (svn_fs__str_atom (noderev->data_key, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (noderev->data_key, pool),
+                          skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
-  
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
+
   /* PROP-KEY */
   if ((noderev->prop_key) && (*noderev->prop_key))
-    svn_fs__prepend (svn_fs__str_atom (noderev->prop_key, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (noderev->prop_key, pool),
+                          skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
 
   /* HEADER */
-  svn_fs__prepend (header_skel, skel);
+  svn_fs_base__prepend (header_skel, skel);
 
   /* Validate and return the skel. */
   if (! is_valid_node_revision_skel (skel))
@@ -1117,37 +1134,39 @@
 
 
 svn_error_t *
-svn_fs__unparse_copy_skel (skel_t **skel_p,
-                           const svn_fs__copy_t *copy,
-                           apr_pool_t *pool)
+svn_fs_base__unparse_copy_skel (skel_t **skel_p,
+                                const copy_t *copy,
+                                apr_pool_t *pool)
 {
   skel_t *skel;
   svn_string_t *tmp_str;
 
   /* Create the skel. */
-  skel = svn_fs__make_empty_list (pool);
+  skel = svn_fs_base__make_empty_list (pool);
 
   /* DST-NODE-ID */
   tmp_str = svn_fs_unparse_id (copy->dst_noderev_id, pool);
-  svn_fs__prepend (svn_fs__mem_atom (tmp_str->data, tmp_str->len, pool), skel);
+  svn_fs_base__prepend (svn_fs_base__mem_atom (tmp_str->data, tmp_str->len,
+                                               pool), skel);
 
   /* SRC-TXN-ID */
   if ((copy->src_txn_id) && (*copy->src_txn_id))
-    svn_fs__prepend (svn_fs__str_atom (copy->src_txn_id, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (copy->src_txn_id, pool),
+                          skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
 
   /* SRC-PATH */
   if ((copy->src_path) && (*copy->src_path))
-    svn_fs__prepend (svn_fs__str_atom (copy->src_path, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom (copy->src_path, pool), skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
 
   /* "copy" */
-  if (copy->kind == svn_fs__copy_kind_real)
-    svn_fs__prepend (svn_fs__str_atom ("copy", pool), skel);
+  if (copy->kind == copy_kind_real)
+    svn_fs_base__prepend (svn_fs_base__str_atom ("copy", pool), skel);
   else
-    svn_fs__prepend (svn_fs__str_atom ("soft-copy", pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("soft-copy", pool), skel);
 
   /* Validate and return the skel. */
   if (! is_valid_copy_skel (skel))
@@ -1158,11 +1177,11 @@
 
 
 svn_error_t *
-svn_fs__unparse_entries_skel (skel_t **skel_p,
-                              apr_hash_t *entries,
-                              apr_pool_t *pool)
+svn_fs_base__unparse_entries_skel (skel_t **skel_p,
+                                   apr_hash_t *entries,
+                                   apr_pool_t *pool)
 {
-  skel_t *skel = svn_fs__make_empty_list (pool);
+  skel_t *skel = svn_fs_base__make_empty_list (pool);
   apr_hash_index_t *hi;
 
   /* Create the skel. */
@@ -1176,24 +1195,26 @@
           apr_ssize_t klen;
           svn_fs_id_t *value;
           svn_string_t *id_str;
-          skel_t *entry_skel = svn_fs__make_empty_list (pool);
+          skel_t *entry_skel = svn_fs_base__make_empty_list (pool);
 
           apr_hash_this (hi, &key, &klen, &val);
           value = val;
-          
+
           /* VALUE */
           id_str = svn_fs_unparse_id (value, pool);
-          svn_fs__prepend (svn_fs__mem_atom (id_str->data, id_str->len, pool), 
+          svn_fs_base__prepend (svn_fs_base__mem_atom (id_str->data,
+                                                       id_str->len, pool),
                            entry_skel);
-          
+
           /* NAME */
-          svn_fs__prepend (svn_fs__mem_atom (key, klen, pool), entry_skel);
+          svn_fs_base__prepend (svn_fs_base__mem_atom (key, klen, pool),
+                                entry_skel);
 
           /* Add entry to the entries skel. */
-          svn_fs__prepend (entry_skel, skel);
+          svn_fs_base__prepend (entry_skel, skel);
         }
     }
-     
+
   /* Return the skel. */
   *skel_p = skel;
   return SVN_NO_ERROR;
@@ -1201,47 +1222,47 @@
 
 
 svn_error_t *
-svn_fs__unparse_change_skel (skel_t **skel_p,
-                             const svn_fs__change_t *change,
-                             apr_pool_t *pool)
+svn_fs_base__unparse_change_skel (skel_t **skel_p,
+                                  const change_t *change,
+                                  apr_pool_t *pool)
 {
   skel_t *skel;
   svn_string_t *tmp_str;
   svn_fs_path_change_kind_t kind;
 
   /* Create the skel. */
-  skel = svn_fs__make_empty_list (pool);
+  skel = svn_fs_base__make_empty_list (pool);
 
   /* PROP-MOD */
   if (change->prop_mod)
-    svn_fs__prepend (svn_fs__str_atom ("1", pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("1", pool), skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
 
   /* TEXT-MOD */
   if (change->text_mod)
-    svn_fs__prepend (svn_fs__str_atom ("1", pool), skel);
+    svn_fs_base__prepend (svn_fs_base__str_atom ("1", pool), skel);
   else
-    svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+    svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
 
   /* KIND */
   switch (change->kind)
     {
     case svn_fs_path_change_reset:
-      svn_fs__prepend (svn_fs__str_atom ("reset", pool), skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("reset", pool), skel);
       break;
     case svn_fs_path_change_add:
-      svn_fs__prepend (svn_fs__str_atom ("add", pool), skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("add", pool), skel);
       break;
     case svn_fs_path_change_delete:
-      svn_fs__prepend (svn_fs__str_atom ("delete", pool), skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("delete", pool), skel);
       break;
     case svn_fs_path_change_replace:
-      svn_fs__prepend (svn_fs__str_atom ("replace", pool), skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("replace", pool), skel);
       break;
     case svn_fs_path_change_modify:
     default:
-      svn_fs__prepend (svn_fs__str_atom ("modify", pool), skel);
+      svn_fs_base__prepend (svn_fs_base__str_atom ("modify", pool), skel);
       break;
     }
 
@@ -1249,19 +1270,20 @@
   if (change->noderev_id)
     {
       tmp_str = svn_fs_unparse_id (change->noderev_id, pool);
-      svn_fs__prepend (svn_fs__mem_atom (tmp_str->data, tmp_str->len, pool), 
-                       skel);
+      svn_fs_base__prepend (svn_fs_base__mem_atom (tmp_str->data,
+                                                   tmp_str->len, pool),
+                            skel);
     }
   else
     {
-      svn_fs__prepend (svn_fs__mem_atom (NULL, 0, pool), skel);
+      svn_fs_base__prepend (svn_fs_base__mem_atom (NULL, 0, pool), skel);
     }
 
   /* PATH */
-  svn_fs__prepend (svn_fs__str_atom (change->path, pool), skel);
+  svn_fs_base__prepend (svn_fs_base__str_atom (change->path, pool), skel);
 
   /* "change" */
-  svn_fs__prepend (svn_fs__str_atom ("change", pool), skel);
+  svn_fs_base__prepend (svn_fs_base__str_atom ("change", pool), skel);
 
   /* Validate and return the skel. */
   if (! is_valid_change_skel (skel, &kind))

Modified: trunk/subversion/libsvn_fs_base/util/fs_skels.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/util/fs_skels.h	(original)
+++ trunk/subversion/libsvn_fs_base/util/fs_skels.h	Thu Apr 29 18:17:29 2004
@@ -42,58 +42,58 @@
    svn_string_t * values, or NULL if SKEL contains no properties.  Use
    POOL for all allocations.  */
 svn_error_t *
-svn_fs__parse_proplist_skel (apr_hash_t **proplist_p,
-                             skel_t *skel,
-                             apr_pool_t *pool);
+svn_fs_base__parse_proplist_skel (apr_hash_t **proplist_p,
+                                  skel_t *skel,
+                                  apr_pool_t *pool);
 
 /* Parse a `REVISION' SKEL into *REVISION_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__parse_revision_skel (svn_fs__revision_t **revision_p, 
-                             skel_t *skel,
-                             apr_pool_t *pool);
+svn_fs_base__parse_revision_skel (revision_t **revision_p,
+                                  skel_t *skel,
+                                  apr_pool_t *pool);
 
 /* Parse a `TRANSACTION' SKEL into *TRANSACTION_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__parse_transaction_skel (svn_fs__transaction_t **transaction_p, 
-                                skel_t *skel,
-                                apr_pool_t *pool);
+svn_fs_base__parse_transaction_skel (transaction_t **transaction_p,
+                                     skel_t *skel,
+                                     apr_pool_t *pool);
 
 /* Parse a `REPRESENTATION' SKEL into *REP_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__parse_representation_skel (svn_fs__representation_t **rep_p,
-                                   skel_t *skel,
-                                   apr_pool_t *pool);
+svn_fs_base__parse_representation_skel (representation_t **rep_p,
+                                        skel_t *skel,
+                                        apr_pool_t *pool);
 
 /* Parse a `NODE-REVISION' SKEL into *NODEREV_P.  Use POOL for all
    allocations. */
 svn_error_t *
-svn_fs__parse_node_revision_skel (svn_fs__node_revision_t **noderev_p,
-                                  skel_t *skel,
-                                  apr_pool_t *pool);
+svn_fs_base__parse_node_revision_skel (node_revision_t **noderev_p,
+                                       skel_t *skel,
+                                       apr_pool_t *pool);
 
 /* Parse a `COPY' SKEL into *COPY_P.  Use POOL for all allocations. */
 svn_error_t *
-svn_fs__parse_copy_skel (svn_fs__copy_t **copy_p,
-                         skel_t *skel,
-                         apr_pool_t *pool);
+svn_fs_base__parse_copy_skel (copy_t **copy_p,
+                              skel_t *skel,
+                              apr_pool_t *pool);
 
 /* Parse an `ENTRIES' SKEL into *ENTRIES_P, which is a hash with const
    char * names (the directory entry name) and svn_fs_id_t * values
-   (the node-id of the entry), or NULL if SKEL contains no entries.  
+   (the node-id of the entry), or NULL if SKEL contains no entries.
    Use POOL for all allocations. */
 svn_error_t *
-svn_fs__parse_entries_skel (apr_hash_t **entries_p,
-                            skel_t *skel,
-                            apr_pool_t *pool);
+svn_fs_base__parse_entries_skel (apr_hash_t **entries_p,
+                                 skel_t *skel,
+                                 apr_pool_t *pool);
 
 /* Parse a `CHANGE' SKEL into *CHANGE_P.  Use POOL for all allocations. */
 svn_error_t *
-svn_fs__parse_change_skel (svn_fs__change_t **change_p,
-                           skel_t *skel,
-                           apr_pool_t *pool);
+svn_fs_base__parse_change_skel (change_t **change_p,
+                                skel_t *skel,
+                                apr_pool_t *pool);
 
 
 /*** Unparsing (conversion from native FS type to skeleton) ***/
@@ -103,60 +103,60 @@
    svn_stringbuf_t * values) into a `PROPLIST' skel *SKEL_P.  Use POOL
    for all allocations.  */
 svn_error_t *
-svn_fs__unparse_proplist_skel (skel_t **skel_p,
-                               apr_hash_t *proplist,
-                               apr_pool_t *pool);
+svn_fs_base__unparse_proplist_skel (skel_t **skel_p,
+                                    apr_hash_t *proplist,
+                                    apr_pool_t *pool);
 
 /* Unparse REVISION into a `REVISION' skel *SKEL_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__unparse_revision_skel (skel_t **skel_p,
-                               const svn_fs__revision_t *revision,
-                               apr_pool_t *pool);
+svn_fs_base__unparse_revision_skel (skel_t **skel_p,
+                                    const revision_t *revision,
+                                    apr_pool_t *pool);
 
 /* Unparse TRANSACTION into a `TRANSACTION' skel *SKEL_P.  Use POOL
    for all allocations.  */
 svn_error_t *
-svn_fs__unparse_transaction_skel (skel_t **skel_p,
-                                  const svn_fs__transaction_t *transaction,
-                                  apr_pool_t *pool);
+svn_fs_base__unparse_transaction_skel (skel_t **skel_p,
+                                       const transaction_t *transaction,
+                                       apr_pool_t *pool);
 
 /* Unparse REP into a `REPRESENTATION' skel *SKEL_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__unparse_representation_skel (skel_t **skel_p,
-                                     const svn_fs__representation_t *rep,
-                                     apr_pool_t *pool);
+svn_fs_base__unparse_representation_skel (skel_t **skel_p,
+                                          const representation_t *rep,
+                                          apr_pool_t *pool);
 
 
 /* Unparse NODEREV into a `NODE-REVISION' skel *SKEL_P.  Use POOL for
    all allocations.  */
 svn_error_t *
-svn_fs__unparse_node_revision_skel (skel_t **skel_p,
-                                    const svn_fs__node_revision_t *noderev,
-                                    apr_pool_t *pool);
+svn_fs_base__unparse_node_revision_skel (skel_t **skel_p,
+                                         const node_revision_t *noderev,
+                                         apr_pool_t *pool);
 
 /* Unparse COPY into a `COPY' skel *SKEL_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__unparse_copy_skel (skel_t **skel_p,
-                           const svn_fs__copy_t *copy,
-                           apr_pool_t *pool);
+svn_fs_base__unparse_copy_skel (skel_t **skel_p,
+                                const copy_t *copy,
+                                apr_pool_t *pool);
 
 /* Unparse an ENTRIES hash, which has const char * names (the entry
    name) and svn_fs_id_t * values (the node-id of the entry) into an
    `ENTRIES' skel *SKEL_P.  Use POOL for all allocations.  */
 svn_error_t *
-svn_fs__unparse_entries_skel (skel_t **skel_p,
-                              apr_hash_t *entries,
-                              apr_pool_t *pool);
+svn_fs_base__unparse_entries_skel (skel_t **skel_p,
+                                   apr_hash_t *entries,
+                                   apr_pool_t *pool);
 
 /* Unparse CHANGE into a `CHANGE' skel *SKEL_P.  Use POOL for all
    allocations.  */
 svn_error_t *
-svn_fs__unparse_change_skel (skel_t **skel_p,
-                             const svn_fs__change_t *change,
-                             apr_pool_t *pool);
+svn_fs_base__unparse_change_skel (skel_t **skel_p,
+                                  const change_t *change,
+                                  apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/util/skel.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/util/skel.c	(original)
+++ trunk/subversion/libsvn_fs_base/util/skel.c	Thu Apr 29 18:17:29 2004
@@ -73,9 +73,9 @@
 
 
 skel_t *
-svn_fs__parse_skel (const char *data,
-                    apr_size_t len,
-                    apr_pool_t *pool)
+svn_fs_base__parse_skel (const char *data,
+                         apr_size_t len,
+                         apr_pool_t *pool)
 {
   return parse (data, len, pool);
 }
@@ -104,7 +104,7 @@
     return implicit_atom (data, len, pool);
 
   /* Otherwise, we assume it's a string with an explicit length;
-     svn_fs__getsize will catch the error.  */
+     svn_fs_base__getsize will catch the error.  */
   else
     return explicit_atom (data, len, pool);
 }
@@ -230,7 +230,7 @@
   skel_t *s;
 
   /* Parse the length.  */
-  size = svn_fs__getsize (data, end - data, &next, end - data);
+  size = svn_fs_base__getsize (data, end - data, &next, end - data);
   data = next;
 
   /* Exit if we overflowed, or there wasn't a valid number there.  */
@@ -264,10 +264,10 @@
 
 
 svn_stringbuf_t *
-svn_fs__unparse_skel (skel_t *skel, apr_pool_t *pool)
+svn_fs_base__unparse_skel (skel_t *skel, apr_pool_t *pool)
 {
   svn_stringbuf_t *str;
-  
+
   /* Allocate a string to hold the data.  */
   str = apr_palloc (pool, sizeof (*str));
   str->pool = pool;
@@ -290,7 +290,7 @@
     {
       if (skel->len < 100)
         /* If we have to use the explicit-length form, that'll be
-           two bytes for the length, one byte for the space, and 
+           two bytes for the length, one byte for the space, and
            the contents.  */
         return skel->len + 3;
       else
@@ -312,7 +312,7 @@
 }
 
 
-/* Return non-zero iff we should use the implicit-length form for SKEL.  
+/* Return non-zero iff we should use the implicit-length form for SKEL.
    Assume that SKEL is an atom.  */
 static svn_boolean_t
 use_implicit (skel_t *skel)
@@ -360,7 +360,7 @@
           char buf[200];
           int length_len;
 
-          length_len = svn_fs__putsize (buf, sizeof (buf), skel->len);
+          length_len = svn_fs_base__putsize (buf, sizeof (buf), skel->len);
           if (! length_len)
             abort ();
 
@@ -380,7 +380,7 @@
       /* Emit an opening parenthesis.  */
       svn_stringbuf_ensure (str, str->len + 1);
       str->data[str->len++] = '(';
-      
+
       /* Append each element.  Emit a space between each pair of elements.  */
       for (child = skel->children; child; child = child->next)
         {
@@ -405,7 +405,7 @@
 
 
 skel_t *
-svn_fs__str_atom (const char *str, apr_pool_t *pool)
+svn_fs_base__str_atom (const char *str, apr_pool_t *pool)
 {
   skel_t *skel = apr_pcalloc (pool, sizeof (*skel));
   skel->is_atom = TRUE;
@@ -417,9 +417,9 @@
 
 
 skel_t *
-svn_fs__mem_atom (const void *addr, 
-                  apr_size_t len,
-                  apr_pool_t *pool)
+svn_fs_base__mem_atom (const void *addr,
+                       apr_size_t len,
+                       apr_pool_t *pool)
 {
   skel_t *skel = apr_pcalloc (pool, sizeof (*skel));
   skel->is_atom = TRUE;
@@ -431,7 +431,7 @@
 
 
 skel_t *
-svn_fs__make_empty_list (apr_pool_t *pool)
+svn_fs_base__make_empty_list (apr_pool_t *pool)
 {
   skel_t *skel = apr_pcalloc (pool, sizeof (*skel));
   return skel;
@@ -439,7 +439,7 @@
 
 
 void
-svn_fs__prepend (skel_t *skel, skel_t *list_skel)
+svn_fs_base__prepend (skel_t *skel, skel_t *list_skel)
 {
   /* If list_skel isn't even a list, somebody's not using this
      function properly. */
@@ -452,7 +452,7 @@
 
 
 void
-svn_fs__append (skel_t *skel, skel_t *list_skel)
+svn_fs_base__append (skel_t *skel, skel_t *list_skel)
 {
   /* If list_skel isn't even a list, somebody's not using this
      function properly. */
@@ -467,7 +467,7 @@
   else
     {
       skel_t *tmp = list_skel->children;
-      
+
       /* Find the last child... */
       while (tmp->next)
         {
@@ -484,7 +484,7 @@
 
 
 svn_boolean_t
-svn_fs__matches_atom (skel_t *skel, const char *str)
+svn_fs_base__matches_atom (skel_t *skel, const char *str)
 {
   if (skel && skel->is_atom)
     {
@@ -498,7 +498,7 @@
 
 
 int
-svn_fs__atom_matches_string (skel_t *skel, const svn_string_t *str)
+svn_fs_base__atom_matches_string (skel_t *skel, const svn_string_t *str)
 {
   if (skel && skel->is_atom)
     {
@@ -510,7 +510,7 @@
 
 
 int
-svn_fs__list_length (skel_t *skel)
+svn_fs_base__list_length (skel_t *skel)
 {
   int len = 0;
   skel_t *child;
@@ -529,7 +529,7 @@
 /* Comparing skels. */
 
 svn_boolean_t
-svn_fs__skels_are_equal (skel_t *skel1, skel_t *skel2)
+svn_fs_base__skels_are_equal (skel_t *skel1, skel_t *skel2)
 {
   if (skel1 == skel2)
     return TRUE;
@@ -545,14 +545,15 @@
         return FALSE;
     }
   else if (((! skel1->is_atom) && (! skel2->is_atom))
-           && ((svn_fs__list_length (skel1)) == (svn_fs__list_length (skel2))))
+           && ((svn_fs_base__list_length (skel1))
+               == (svn_fs_base__list_length (skel2))))
     {
-      int len = svn_fs__list_length (skel1);
+      int len = svn_fs_base__list_length (skel1);
       int i;
-      
+
       for (i = 0; i < len; i++)
-        if (! svn_fs__skels_are_equal ((skel1->children) + i,
-                                       (skel2->children) + i))
+        if (! svn_fs_base__skels_are_equal ((skel1->children) + i,
+                                            (skel2->children) + i))
           return FALSE;
 
       return TRUE;
@@ -567,7 +568,7 @@
 
 
 skel_t *
-svn_fs__copy_skel (skel_t *skel, apr_pool_t *pool)
+svn_fs_base__copy_skel (skel_t *skel, apr_pool_t *pool)
 {
   skel_t *copy = apr_pcalloc (pool, sizeof (*copy));
 
@@ -594,7 +595,7 @@
            skel_child;
            skel_child = skel_child->next)
         {
-          *copy_child_ptr = svn_fs__copy_skel (skel_child, pool);
+          *copy_child_ptr = svn_fs_base__copy_skel (skel_child, pool);
           copy_child_ptr = &(*copy_child_ptr)->next;
         }
       *copy_child_ptr = 0;

Modified: trunk/subversion/libsvn_fs_base/util/skel.h
==============================================================================
--- trunk/subversion/libsvn_fs_base/util/skel.h	(original)
+++ trunk/subversion/libsvn_fs_base/util/skel.h	Thu Apr 29 18:17:29 2004
@@ -110,61 +110,62 @@
 
    The returned skel objects point into the block indicated by DATA
    and LEN; we don't copy the contents. */
-skel_t *svn_fs__parse_skel (const char *data, apr_size_t len,
-                            apr_pool_t *pool);
+skel_t *svn_fs_base__parse_skel (const char *data, apr_size_t len,
+                                 apr_pool_t *pool);
 
 
 /* Create an atom skel whose contents are the C string STR, allocated
    from POOL.  */
-skel_t *svn_fs__str_atom (const char *str, apr_pool_t *pool);
+skel_t *svn_fs_base__str_atom (const char *str, apr_pool_t *pool);
 
 
 /* Create an atom skel whose contents are the LEN bytes at ADDR,
    allocated from POOL.  */
-skel_t *svn_fs__mem_atom (const void *addr, apr_size_t len, apr_pool_t *pool);
+skel_t *svn_fs_base__mem_atom (const void *addr, apr_size_t len,
+                               apr_pool_t *pool);
 
 
 /* Create an empty list skel, allocated from POOL.  */
-skel_t *svn_fs__make_empty_list (apr_pool_t *pool);
+skel_t *svn_fs_base__make_empty_list (apr_pool_t *pool);
 
 
 /* Prepend SKEL to LIST.  */
-void svn_fs__prepend (skel_t *skel, skel_t *list);
+void svn_fs_base__prepend (skel_t *skel, skel_t *list);
 
 
 /* Append SKEL to LIST.  This is not as efficient as prepending skels,
    so prepend in places where you can sensibly do so, and you want to
    save a couple clock cycles. */
-void svn_fs__append (skel_t *skel, skel_t *list);
+void svn_fs_base__append (skel_t *skel, skel_t *list);
 
 
 /* Return a string whose contents are a concrete representation of
    SKEL.  Allocate the string from POOL.  */
-svn_stringbuf_t *svn_fs__unparse_skel (skel_t *skel, apr_pool_t *pool);
+svn_stringbuf_t *svn_fs_base__unparse_skel (skel_t *skel, apr_pool_t *pool);
 
 
 /* Return true iff SKEL is an atom whose data is the same as STR.  */
-svn_boolean_t svn_fs__matches_atom (skel_t *skel, const char *str);
+svn_boolean_t svn_fs_base__matches_atom (skel_t *skel, const char *str);
 
 
 /* Return true iff SKEL is an atom whose data is the same as STR.  */
-svn_boolean_t svn_fs__atom_matches_string (skel_t *skel, 
-                                           const svn_string_t *str);
+svn_boolean_t svn_fs_base__atom_matches_string (skel_t *skel,
+                                                const svn_string_t *str);
 
 
 /* Return the length of the list skel SKEL.  Atoms have a length of -1.  */
-int svn_fs__list_length (skel_t *skel);
+int svn_fs_base__list_length (skel_t *skel);
 
 
 /* Return TRUE if SKEL1 and SKEL2 are the same in structure and contents,
    or 0 if they are not.  This is like a lisp `equal' not `eq': atoms
    are equal if their lengths and contents are the same, lists are
    equal if they have the same number and order of equal elements. */
-svn_boolean_t svn_fs__skels_are_equal (skel_t *skel1, skel_t *skel2);
+svn_boolean_t svn_fs_base__skels_are_equal (skel_t *skel1, skel_t *skel2);
 
 
 /* Make a copy of SKEL and its data in POOL.  */
-skel_t *svn_fs__copy_skel (skel_t *skel, apr_pool_t *pool);
+skel_t *svn_fs_base__copy_skel (skel_t *skel, apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_base/uuid.c
==============================================================================
--- trunk/subversion/libsvn_fs_base/uuid.c	(original)
+++ trunk/subversion/libsvn_fs_base/uuid.c	Thu Apr 29 18:17:29 2004
@@ -20,10 +20,12 @@
 #include "fs.h"
 #include "trail.h"
 #include "err.h"
+#include "uuid.h"
 #include "bdb/uuids-table.h"
+#include "../libsvn_fs/fs-loader.h"
 
 
-struct get_uuid_args 
+struct get_uuid_args
 {
   int idx;
   const char **uuid;
@@ -34,40 +36,42 @@
 txn_body_get_uuid (void *baton, trail_t *trail)
 {
   struct get_uuid_args *args = baton;
-  return svn_fs__bdb_get_uuid (trail->fs, args->idx, args->uuid, trail);
+  return svn_fs_bdb__get_uuid (trail->fs, args->idx, args->uuid, trail);
 }
 
 
 svn_error_t *
-svn_fs_get_uuid (svn_fs_t *fs,
-                 const char **uuid,
-                 apr_pool_t *pool)
+svn_fs_base__get_uuid (svn_fs_t *fs,
+                       const char **uuid,
+                       apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__check_fs (fs));
+  base_fs_data_t *bfd = fs->fsap_data;
+
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   /* Check for a cached UUID first.  Failing that, we hit the
      database. */
-  if (fs->uuid)
+  if (bfd->uuid)
     {
-      *uuid = apr_pstrdup (pool, fs->uuid);
+      *uuid = apr_pstrdup (pool, bfd->uuid);
     }
   else
     {
       struct get_uuid_args args;
       args.idx = 1;
       args.uuid = uuid;
-      SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_uuid, &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_uuid, &args, pool));
 
       /* Toss what we find into the cache. */
       if (*uuid)
-        fs->uuid = apr_pstrdup (fs->pool, *uuid);
+        bfd->uuid = apr_pstrdup (fs->pool, *uuid);
     }
 
   return SVN_NO_ERROR;
 }
 
 
-struct set_uuid_args 
+struct set_uuid_args
 {
   int idx;
   const char *uuid;
@@ -78,26 +82,27 @@
 txn_body_set_uuid (void *baton, trail_t *trail)
 {
   struct set_uuid_args *args = baton;
-  return svn_fs__bdb_set_uuid (trail->fs, args->idx, args->uuid, trail);
+  return svn_fs_bdb__set_uuid (trail->fs, args->idx, args->uuid, trail);
 }
 
 
 svn_error_t *
-svn_fs_set_uuid (svn_fs_t *fs,
-                 const char *uuid,
-                 apr_pool_t *pool)
+svn_fs_base__set_uuid (svn_fs_t *fs,
+                       const char *uuid,
+                       apr_pool_t *pool)
 {
   struct set_uuid_args args;
+  base_fs_data_t *bfd = fs->fsap_data;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_base__check_fs (fs));
 
   args.idx = 1;
   args.uuid = uuid;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_set_uuid, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_set_uuid, &args, pool));
 
   /* Toss our value into the cache. */
   if (uuid)
-    fs->uuid = apr_pstrdup (fs->pool, uuid);
+    bfd->uuid = apr_pstrdup (fs->pool, uuid);
 
   return SVN_NO_ERROR;
 }

Modified: trunk/subversion/libsvn_fs_fs/dag.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/dag.c	(original)
+++ trunk/subversion/libsvn_fs_fs/dag.c	Thu Apr 29 18:17:29 2004
@@ -29,10 +29,11 @@
 #include "err.h"
 #include "fs.h"
 #include "key-gen.h"
-#include "id.h"
 #include "revs-txns.h"
 #include "fs_fs.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
 /* Initializing a filesystem.  */
 
@@ -60,7 +61,7 @@
      this yourself, but you're probably better off just calling
      `get_node_revision' and `set_node_revision', which take care of
      things for you.  */
-  svn_fs__node_revision_t *node_revision;
+  node_revision_t *node_revision;
 
   /* the path at which this node was created. */
   const char *created_path;
@@ -69,39 +70,39 @@
 
 
 /* Trivial helper/accessor functions. */
-svn_node_kind_t svn_fs__dag_node_kind (dag_node_t *node)
+svn_node_kind_t svn_fs_fs__dag_node_kind (dag_node_t *node)
 {
   return node->kind;
 }
 
 
 const svn_fs_id_t *
-svn_fs__dag_get_id (dag_node_t *node)
+svn_fs_fs__dag_get_id (dag_node_t *node)
 {
   return node->id;
 }
 
 
 const char *
-svn_fs__dag_get_created_path (dag_node_t *node)
+svn_fs_fs__dag_get_created_path (dag_node_t *node)
 {
   return node->created_path;
 }
 
 
 svn_fs_t *
-svn_fs__dag_get_fs (dag_node_t *node)
+svn_fs_fs__dag_get_fs (dag_node_t *node)
 {
   return node->fs;
 }
 
 
 /* Dup NODEREV and all associated data into POOL */
-static svn_fs__node_revision_t *
-copy_node_revision (svn_fs__node_revision_t *noderev,
+static node_revision_t *
+copy_node_revision (node_revision_t *noderev,
                     apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *nr = apr_pcalloc (pool, sizeof (*nr));
+  node_revision_t *nr = apr_pcalloc (pool, sizeof (*nr));
   nr->kind = noderev->kind;
   if (noderev->predecessor_id)
     nr->predecessor_id = svn_fs__id_copy (noderev->predecessor_id, pool);
@@ -112,8 +113,8 @@
   nr->copyroot_path = apr_pstrdup (pool, noderev->copyroot_path);
   nr->copyroot_rev = noderev->copyroot_rev;
   nr->predecessor_count = noderev->predecessor_count;
-  nr->data_rep = svn_fs__fs_rep_copy (noderev->data_rep, pool);
-  nr->prop_rep = svn_fs__fs_rep_copy (noderev->prop_rep, pool);
+  nr->data_rep = svn_fs_fs__rep_copy (noderev->data_rep, pool);
+  nr->prop_rep = svn_fs_fs__rep_copy (noderev->prop_rep, pool);
   
   if (noderev->edit_key)
     nr->edit_key = apr_pstrdup (pool, noderev->edit_key);
@@ -135,16 +136,16 @@
    changes that never got committed.  It's probably best not to change
    the structure at all.  */
 static svn_error_t *
-get_node_revision (svn_fs__node_revision_t **noderev_p,
+get_node_revision (node_revision_t **noderev_p,
                    dag_node_t *node,
                    apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* If we've already got a copy, there's no need to read it in.  */
   if (! node->node_revision)
     {
-      SVN_ERR (svn_fs__fs_get_node_revision (&noderev, node->fs,
+      SVN_ERR (svn_fs_fs__get_node_revision (&noderev, node->fs,
                                              node->id, pool));
       node->node_revision = noderev;
     }
@@ -155,21 +156,21 @@
 }
 
 
-svn_boolean_t svn_fs__dag_check_mutable (dag_node_t *node, 
-                                         const char *txn_id)
+svn_boolean_t svn_fs_fs__dag_check_mutable (dag_node_t *node, 
+                                            const char *txn_id)
 {
-  return (svn_fs__id_txn_id (svn_fs__dag_get_id (node)) != NULL);
+  return (svn_fs_fs__get_id_txn (svn_fs_fs__dag_get_id (node)) != NULL);
 }
 
 
 svn_error_t *
-svn_fs__dag_get_node (dag_node_t **node,
-                      svn_fs_t *fs,
-                      const svn_fs_id_t *id,
-                      apr_pool_t *pool)
+svn_fs_fs__dag_get_node (dag_node_t **node,
+                         svn_fs_t *fs,
+                         const svn_fs_id_t *id,
+                         apr_pool_t *pool)
 {
   dag_node_t *new_node;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Construct the node. */
   new_node = apr_pcalloc (pool, sizeof (*new_node));
@@ -191,23 +192,23 @@
 
 
 svn_error_t *
-svn_fs__dag_get_revision (svn_revnum_t *rev,
-                          dag_node_t *node,
-                          apr_pool_t *pool)
+svn_fs_fs__dag_get_revision (svn_revnum_t *rev,
+                             dag_node_t *node,
+                             apr_pool_t *pool)
 {
   /* Look up the committed revision from the Node-ID. */
-  *rev = svn_fs__id_rev (node->id);
+  *rev = svn_fs_fs__get_id_rev (node->id);
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
-                                dag_node_t *node,
-                                apr_pool_t *pool)
+svn_fs_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
+                                   dag_node_t *node,
+                                   apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   
   SVN_ERR (get_node_revision (&noderev, node, pool));
   *id_p = noderev->predecessor_id;
@@ -216,11 +217,11 @@
 
 
 svn_error_t *
-svn_fs__dag_get_predecessor_count (int *count,
-                                   dag_node_t *node,
-                                   apr_pool_t *pool)
+svn_fs_fs__dag_get_predecessor_count (int *count,
+                                      dag_node_t *node,
+                                      apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   
   SVN_ERR (get_node_revision (&noderev, node, pool));
   *count = noderev->predecessor_count;
@@ -229,19 +230,19 @@
 
 
 svn_error_t *
-svn_fs__dag_walk_predecessors (dag_node_t *node,
-                               svn_fs__dag_pred_func_t callback,
-                               void *baton,
-                               apr_pool_t *pool)
+svn_fs_fs__dag_walk_predecessors (dag_node_t *node,
+                                  dag_pred_func_t callback,
+                                  void *baton,
+                                  apr_pool_t *pool)
 {
-  svn_fs_t *fs = svn_fs__dag_get_fs (node);
+  svn_fs_t *fs = svn_fs_fs__dag_get_fs (node);
   dag_node_t *this_node;
   svn_boolean_t done = FALSE;
 
   this_node = node;
   while ((! done) && this_node)
     {
-      svn_fs__node_revision_t *noderev;
+      node_revision_t *noderev;
 
       /* Get the node revision for THIS_NODE so we can examine its
          predecessor id.  */
@@ -250,8 +251,8 @@
       /* If THIS_NODE has a predecessor, replace THIS_NODE with the
          precessor, else set it to NULL.  */
       if (noderev->predecessor_id)
-        SVN_ERR (svn_fs__dag_get_node (&this_node, fs, 
-                                       noderev->predecessor_id, pool));
+        SVN_ERR (svn_fs_fs__dag_get_node (&this_node, fs, 
+                                          noderev->predecessor_id, pool));
       else
         this_node = NULL;
 
@@ -266,17 +267,18 @@
 
 
 svn_error_t *
-svn_fs__dag_init_fs (svn_fs_t *fs)
+svn_fs_fs__dag_init_fs (svn_fs_t *fs)
 {
   svn_string_t date;
   
   /* Write out a rev file for revision 0. */
-  SVN_ERR (svn_fs__fs_write_revision_zero (fs));
+  SVN_ERR (svn_fs_fs__write_revision_zero (fs));
 
   /* Set a date on revision 0. */
   date.data = svn_time_to_cstring (apr_time_now(), fs->pool);
   date.len = strlen (date.data);
-  return svn_fs__set_rev_prop (fs, 0, SVN_PROP_REVISION_DATE, &date, fs->pool);
+  return svn_fs_fs__set_rev_prop (fs, 0, SVN_PROP_REVISION_DATE, &date,
+                                  fs->pool);
 }
 
 
@@ -293,7 +295,7 @@
 static svn_error_t *
 get_dir_entries (apr_hash_t **entries_p,
                  svn_fs_t *fs,
-                 svn_fs__node_revision_t *noderev,
+                 node_revision_t *noderev,
                  apr_pool_t *pool)
 {
   apr_hash_t *entries;
@@ -303,7 +305,7 @@
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
        "Attempted to create entry in non-directory parent");
 
-  SVN_ERR (svn_fs__fs_rep_contents_dir (&entries, fs,
+  SVN_ERR (svn_fs_fs__rep_contents_dir (&entries, fs,
                                         noderev, pool));
 
   *entries_p = entries;
@@ -326,7 +328,7 @@
   apr_hash_t *entries;
   svn_fs_dirent_t *dirent;
 
-  SVN_ERR (svn_fs__dag_dir_entries (&entries, parent, pool));
+  SVN_ERR (svn_fs_fs__dag_dir_entries (&entries, parent, pool));
   if (entries)
     dirent = apr_hash_get (entries, name, APR_HASH_KEY_STRING);
   else
@@ -353,13 +355,13 @@
            const char *txn_id,
            apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *parent_noderev;
+  node_revision_t *parent_noderev;
 
   /* Get the parent's node-revision. */
   SVN_ERR (get_node_revision (&parent_noderev, parent, pool));
 
   /* Set the new entry. */
-  SVN_ERR (svn_fs__fs_set_entry (parent->fs, txn_id, parent_noderev, name, id,
+  SVN_ERR (svn_fs_fs__set_entry (parent->fs, txn_id, parent_noderev, name, id,
                                  kind, pool));
   
   return SVN_NO_ERROR;
@@ -380,7 +382,7 @@
             apr_pool_t *pool)
 {
   const svn_fs_id_t *new_node_id;
-  svn_fs__node_revision_t new_noderev, *parent_noderev;
+  node_revision_t new_noderev, *parent_noderev;
 
   /* Make sure that NAME is a single path component. */
   if (! svn_path_is_single_path_component (name))
@@ -395,7 +397,7 @@
        "Attempted to create entry in non-directory parent");
 
   /* Check that the parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (parent, txn_id))
     return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to clone child of non-mutable node");
@@ -419,19 +421,19 @@
   new_noderev.copyfrom_rev = SVN_INVALID_REVNUM;
   new_noderev.copyfrom_path = NULL;
   
-  SVN_ERR (svn_fs__fs_create_node
-           (&new_node_id, svn_fs__dag_get_fs (parent),
-            &new_noderev, svn_fs__id_copy_id (svn_fs__dag_get_id (parent)),
+  SVN_ERR (svn_fs_fs__create_node
+           (&new_node_id, svn_fs_fs__dag_get_fs (parent),
+            &new_noderev, svn_fs__id_copy_id (svn_fs_fs__dag_get_id (parent)),
             txn_id, pool));
 
   /* Create a new dag_node_t for our new node */
-  SVN_ERR (svn_fs__dag_get_node (child_p, svn_fs__dag_get_fs (parent),
-                                 new_node_id, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (child_p, svn_fs_fs__dag_get_fs (parent),
+                                    new_node_id, pool));
 
   /* We can safely call set_entry because we already know that
-          PARENT is mutable, and we just created CHILD, so we know it has
-          no ancestors (therefore, PARENT cannot be an ancestor of CHILD) */
-  SVN_ERR (set_entry (parent, name, svn_fs__dag_get_id (*child_p),
+     PARENT is mutable, and we just created CHILD, so we know it has
+     no ancestors (therefore, PARENT cannot be an ancestor of CHILD) */
+  SVN_ERR (set_entry (parent, name, svn_fs_fs__dag_get_id (*child_p),
                       new_noderev.kind, txn_id, pool));
 
   return SVN_NO_ERROR;
@@ -439,23 +441,24 @@
 
 
 svn_error_t *
-svn_fs__dag_dir_entries (apr_hash_t **entries,
-                         dag_node_t *node,
-                         apr_pool_t *pool)
+svn_fs_fs__dag_dir_entries (apr_hash_t **entries,
+                            dag_node_t *node,
+                            apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   SVN_ERR (get_node_revision (&noderev, node, pool));
-  return get_dir_entries (entries, svn_fs__dag_get_fs (node), noderev, pool);
+  return get_dir_entries (entries, svn_fs_fs__dag_get_fs (node), noderev,
+                          pool);
 }
 
 
 svn_error_t *
-svn_fs__dag_set_entry (dag_node_t *node,
-                       const char *entry_name,
-                       const svn_fs_id_t *id,
-                       const char *txn_id,
-                       apr_pool_t *pool)
+svn_fs_fs__dag_set_entry (dag_node_t *node,
+                          const char *entry_name,
+                          const svn_fs_id_t *id,
+                          const char *txn_id,
+                          apr_pool_t *pool)
 {
   /* Check it's a directory. */
   if (node->kind != svn_node_dir)
@@ -464,7 +467,7 @@
        "Attempted to set entry in non-directory node");
   
   /* Check it's mutable. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (node, txn_id))
     return svn_error_create
       (SVN_ERR_FS_NOT_DIRECTORY, NULL,
        "Attempted to set entry in immutable node");
@@ -477,16 +480,16 @@
 /*** Proplists. ***/
 
 svn_error_t *
-svn_fs__dag_get_proplist (apr_hash_t **proplist_p,
-                          dag_node_t *node,
-                          apr_pool_t *pool)
+svn_fs_fs__dag_get_proplist (apr_hash_t **proplist_p,
+                             dag_node_t *node,
+                             apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   apr_hash_t *proplist = NULL;
 
   SVN_ERR (get_node_revision (&noderev, node, pool));
 
-  SVN_ERR (svn_fs__fs_get_proplist (&proplist, node->fs,
+  SVN_ERR (svn_fs_fs__get_proplist (&proplist, node->fs,
                                     noderev, pool));
 
   *proplist_p = proplist;
@@ -496,27 +499,28 @@
 
 
 svn_error_t *
-svn_fs__dag_set_proplist (dag_node_t *node,
-                          apr_hash_t *proplist,
-                          const char *txn_id,
-                          apr_pool_t *pool)
+svn_fs_fs__dag_set_proplist (dag_node_t *node,
+                             apr_hash_t *proplist,
+                             const char *txn_id,
+                             apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Sanity check: this node better be mutable! */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (node, txn_id))
     {
       svn_string_t *idstr = svn_fs_unparse_id (node->id, node->pool);
-            return svn_error_createf
-              (SVN_ERR_FS_NOT_MUTABLE, NULL,
-               "Can't set proplist on *immutable* node-revision %s", idstr->data);
+      return svn_error_createf
+        (SVN_ERR_FS_NOT_MUTABLE, NULL,
+         "Can't set proplist on *immutable* node-revision %s",
+         idstr->data);
     }
 
   /* Go get a fresh NODE-REVISION for this node. */
   SVN_ERR (get_node_revision (&noderev, node, pool));
 
   /* Set the new proplist. */
-  SVN_ERR (svn_fs__fs_set_proplist (node->fs, noderev, proplist, pool));
+  SVN_ERR (svn_fs_fs__set_proplist (node->fs, noderev, proplist, pool));
 
   return SVN_NO_ERROR;
 }
@@ -526,60 +530,60 @@
 /*** Roots. ***/
 
 svn_error_t *
-svn_fs__dag_revision_root (dag_node_t **node_p,
-                           svn_fs_t *fs,
-                           svn_revnum_t rev,
-                           apr_pool_t *pool)
+svn_fs_fs__dag_revision_root (dag_node_t **node_p,
+                              svn_fs_t *fs,
+                              svn_revnum_t rev,
+                              apr_pool_t *pool)
 {
   svn_fs_id_t *root_id;
 
-  SVN_ERR (svn_fs__fs_rev_get_root (&root_id, fs, rev, pool));
-  return svn_fs__dag_get_node (node_p, fs, root_id, pool);
+  SVN_ERR (svn_fs_fs__rev_get_root (&root_id, fs, rev, pool));
+  return svn_fs_fs__dag_get_node (node_p, fs, root_id, pool);
 }
 
 
 svn_error_t *
-svn_fs__dag_txn_root (dag_node_t **node_p,
-                      svn_fs_t *fs,
-                      const char *txn_id,
-                      apr_pool_t *pool)
+svn_fs_fs__dag_txn_root (dag_node_t **node_p,
+                         svn_fs_t *fs,
+                         const char *txn_id,
+                         apr_pool_t *pool)
 {
   const svn_fs_id_t *root_id, *ignored;
   
-  SVN_ERR (svn_fs__get_txn_ids (&root_id, &ignored, fs, txn_id, pool));
-  return svn_fs__dag_get_node (node_p, fs, root_id, pool);
+  SVN_ERR (svn_fs_fs__get_txn_ids (&root_id, &ignored, fs, txn_id, pool));
+  return svn_fs_fs__dag_get_node (node_p, fs, root_id, pool);
 }
 
 
 svn_error_t *
-svn_fs__dag_txn_base_root (dag_node_t **node_p,
-                           svn_fs_t *fs,
-                           const char *txn_id,
-                           apr_pool_t *pool)
+svn_fs_fs__dag_txn_base_root (dag_node_t **node_p,
+                              svn_fs_t *fs,
+                              const char *txn_id,
+                              apr_pool_t *pool)
 {
   const svn_fs_id_t *base_root_id, *ignored;
   
-  SVN_ERR (svn_fs__get_txn_ids (&ignored, &base_root_id, fs, txn_id, pool));
-  return svn_fs__dag_get_node (node_p, fs, base_root_id, pool);
+  SVN_ERR (svn_fs_fs__get_txn_ids (&ignored, &base_root_id, fs, txn_id, pool));
+  return svn_fs_fs__dag_get_node (node_p, fs, base_root_id, pool);
 }
 
 
 svn_error_t *
-svn_fs__dag_clone_child (dag_node_t **child_p,
-                         dag_node_t *parent,
-                         const char *parent_path,
-                         const char *name,
-                         const char *copy_id,
-                         const char *txn_id,
-                         svn_boolean_t is_parent_copyroot,
-                         apr_pool_t *pool)
+svn_fs_fs__dag_clone_child (dag_node_t **child_p,
+                            dag_node_t *parent,
+                            const char *parent_path,
+                            const char *name,
+                            const char *copy_id,
+                            const char *txn_id,
+                            svn_boolean_t is_parent_copyroot,
+                            apr_pool_t *pool)
 {
   dag_node_t *cur_entry; /* parent's current entry named NAME */
   const svn_fs_id_t *new_node_id; /* node id we'll put into NEW_NODE */
-  svn_fs_t *fs = svn_fs__dag_get_fs (parent);
+  svn_fs_t *fs = svn_fs_fs__dag_get_fs (parent);
 
   /* First check that the parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (parent, txn_id))
     return svn_error_createf 
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to clone child of non-mutable node");
@@ -591,18 +595,18 @@
        "Attempted to make a child clone with an illegal name '%s'", name);
 
   /* Find the node named NAME in PARENT's entries list if it exists. */
-  SVN_ERR (svn_fs__dag_open (&cur_entry, parent, name, pool));
+  SVN_ERR (svn_fs_fs__dag_open (&cur_entry, parent, name, pool));
 
   /* Check for mutability in the node we found.  If it's mutable, we
      don't need to clone it. */
-  if (svn_fs__dag_check_mutable (cur_entry, txn_id))
+  if (svn_fs_fs__dag_check_mutable (cur_entry, txn_id))
     {
       /* This has already been cloned */
       new_node_id = cur_entry->id;
     }
   else
     {
-      svn_fs__node_revision_t *noderev, *parent_noderev;
+      node_revision_t *noderev, *parent_noderev;
       
       /* Go get a fresh NODE-REVISION for current child node. */
       SVN_ERR (get_node_revision (&noderev, cur_entry, pool));
@@ -623,7 +627,7 @@
         noderev->predecessor_count++;
       noderev->created_path = svn_path_join (parent_path, name, pool);
       
-      SVN_ERR (svn_fs__fs_create_successor (&new_node_id, fs, cur_entry->id, 
+      SVN_ERR (svn_fs_fs__create_successor (&new_node_id, fs, cur_entry->id, 
                                             noderev, copy_id, txn_id, pool));
 
       /* Replace the ID in the parent's ENTRY list with the ID which
@@ -633,22 +637,22 @@
     }
 
   /* Initialize the youngster. */
-  return svn_fs__dag_get_node (child_p, fs, new_node_id, pool);
+  return svn_fs_fs__dag_get_node (child_p, fs, new_node_id, pool);
 }
 
 
 
 svn_error_t *
-svn_fs__dag_clone_root (dag_node_t **root_p,
-                        svn_fs_t *fs,
-                        const char *txn_id,
-                        apr_pool_t *pool)
+svn_fs_fs__dag_clone_root (dag_node_t **root_p,
+                           svn_fs_t *fs,
+                           const char *txn_id,
+                           apr_pool_t *pool)
 {
   const svn_fs_id_t *base_root_id, *root_id;
   
   /* Get the node ID's of the root directories of the transaction and
      its base revision.  */
-  SVN_ERR (svn_fs__get_txn_ids (&root_id, &base_root_id, fs, txn_id, pool));
+  SVN_ERR (svn_fs_fs__get_txn_ids (&root_id, &base_root_id, fs, txn_id, pool));
 
   /* Oh, give me a clone...
      (If they're the same, we haven't cloned the transaction's root
@@ -659,7 +663,7 @@
     }
 
   /* One way or another, root_id now identifies a cloned root node. */
-  SVN_ERR (svn_fs__dag_get_node (root_p, fs, root_id, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (root_p, fs, root_id, pool));
 
   /*
    * (Sung to the tune of "Home, Home on the Range", with thanks to
@@ -678,12 +682,12 @@
    If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
    PARENT.  */
 svn_error_t *
-svn_fs__dag_delete (dag_node_t *parent,
-                    const char *name,
-                    const char *txn_id,
-                    apr_pool_t *pool)
+svn_fs_fs__dag_delete (dag_node_t *parent,
+                       const char *name,
+                       const char *txn_id,
+                       apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *parent_noderev;
+  node_revision_t *parent_noderev;
   apr_hash_t *entries;
   svn_fs_t *fs = parent->fs;
   svn_fs_dirent_t *dirent;
@@ -696,7 +700,7 @@
        "Attempted to delete entry '%s' from *non*-directory node", name);
 
   /* Make sure parent is mutable. */
-  if (! svn_fs__dag_check_mutable (parent, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (parent, txn_id))
     return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to delete entry '%s' from immutable directory node", name);
@@ -711,28 +715,29 @@
   SVN_ERR (get_node_revision (&parent_noderev, parent, pool));
 
   /* Get a dirent hash for this directory. */
-  SVN_ERR (svn_fs__fs_rep_contents_dir (&entries, fs, parent_noderev, pool));
+  SVN_ERR (svn_fs_fs__rep_contents_dir (&entries, fs, parent_noderev, pool));
 
   /* Find name in the ENTRIES hash. */
   dirent = apr_hash_get (entries, name, APR_HASH_KEY_STRING);
 
   /* If we never found ID in ENTRIES (perhaps because there are no
-          ENTRIES, perhaps because ID just isn't in the existing ENTRIES
-          ... it doesn't matter), return an error.  */
+     ENTRIES, perhaps because ID just isn't in the existing ENTRIES
+     ... it doesn't matter), return an error.  */
   if (! dirent)
     return svn_error_createf
       (SVN_ERR_FS_NO_SUCH_ENTRY, NULL,
        "Delete failed--directory has no entry '%s'", name);
   
   /* Use the ID of this ENTRY to get the entry's node.  */
-  SVN_ERR (svn_fs__dag_get_node (&node, svn_fs__dag_get_fs (parent),
-                                 dirent->id, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (&node, svn_fs_fs__dag_get_fs (parent),
+                                    dirent->id, pool));
 
   /* If mutable, remove it and any mutable children from db. */
-  SVN_ERR (svn_fs__dag_delete_if_mutable (parent->fs, dirent->id, txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_delete_if_mutable (parent->fs, dirent->id, txn_id,
+                                             pool));
 
   /* Remove this entry from its parent's entries list. */
-  SVN_ERR (svn_fs__fs_set_entry (parent->fs, txn_id, parent_noderev, name,
+  SVN_ERR (svn_fs_fs__set_entry (parent->fs, txn_id, parent_noderev, name,
                                  NULL, svn_node_unknown, pool));
     
   return SVN_NO_ERROR;
@@ -740,55 +745,55 @@
 
 
 svn_error_t *
-svn_fs__dag_remove_node (svn_fs_t *fs,
-                         const svn_fs_id_t *id,
-                         const char *txn_id,
-                         apr_pool_t *pool)
+svn_fs_fs__dag_remove_node (svn_fs_t *fs,
+                            const svn_fs_id_t *id,
+                            const char *txn_id,
+                            apr_pool_t *pool)
 {
   dag_node_t *node;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Fetch the node. */
-  SVN_ERR (svn_fs__dag_get_node (&node, fs, id, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (&node, fs, id, pool));
 
   /* If immutable, do nothing and return immediately. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (node, txn_id))
     return svn_error_createf (SVN_ERR_FS_NOT_MUTABLE, NULL,
                               "Attempted removal of immutable node");
 
   /* Get a fresh node-revision. */
-  SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, id, pool));
+  SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, id, pool));
 
   /* Delete any mutable property representation. */
   if (noderev->prop_rep)
-    SVN_ERR (svn_fs__fs_delete_rep_if_mutable (fs, id, noderev->prop_rep,
+    SVN_ERR (svn_fs_fs__delete_rep_if_mutable (fs, id, noderev->prop_rep,
                                                txn_id, pool));
 
   /* Delete any mutable data representation. */
   if (noderev->data_rep)
-    SVN_ERR (svn_fs__fs_delete_rep_if_mutable (fs, id, noderev->data_rep,
+    SVN_ERR (svn_fs_fs__delete_rep_if_mutable (fs, id, noderev->data_rep,
                                                txn_id, pool));
 
   /* Delete the node revision itself. */
-  SVN_ERR (svn_fs__fs_delete_node_revision (fs, id, pool));
+  SVN_ERR (svn_fs_fs__delete_node_revision (fs, id, pool));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_delete_if_mutable (svn_fs_t *fs,
-                               const svn_fs_id_t *id,
-                               const char *txn_id,
-                               apr_pool_t *pool)
+svn_fs_fs__dag_delete_if_mutable (svn_fs_t *fs,
+                                  const svn_fs_id_t *id,
+                                  const char *txn_id,
+                                  apr_pool_t *pool)
 {
   dag_node_t *node;
 
   /* Get the node. */
-  SVN_ERR (svn_fs__dag_get_node (&node, fs, id, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (&node, fs, id, pool));
 
   /* If immutable, do nothing and return immediately. */
-  if (! svn_fs__dag_check_mutable (node, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (node, txn_id))
     return SVN_NO_ERROR;
 
   /* Else it's mutable.  Recurse on directories... */
@@ -798,7 +803,7 @@
       apr_hash_index_t *hi;
 
       /* Loop over hash entries */
-      SVN_ERR (svn_fs__dag_dir_entries (&entries, node, pool));
+      SVN_ERR (svn_fs_fs__dag_dir_entries (&entries, node, pool));
       if (entries)
         {
           for (hi = apr_hash_first (pool, entries);
@@ -810,26 +815,26 @@
 
               apr_hash_this (hi, NULL, NULL, &val);
               dirent = val;
-              SVN_ERR (svn_fs__dag_delete_if_mutable (fs, dirent->id,
-                                                      txn_id, pool));
+              SVN_ERR (svn_fs_fs__dag_delete_if_mutable (fs, dirent->id,
+                                                         txn_id, pool));
             }
         }
     }
 
   /* ... then delete the node itself, after deleting any mutable
      representations and strings it points to. */
-  SVN_ERR (svn_fs__dag_remove_node (fs, id, txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_remove_node (fs, id, txn_id, pool));
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_fs__dag_make_file (dag_node_t **child_p,
-                       dag_node_t *parent,
-                       const char *parent_path,
-                       const char *name,
-                       const char *txn_id, 
-                       apr_pool_t *pool)
+svn_fs_fs__dag_make_file (dag_node_t **child_p,
+                          dag_node_t *parent,
+                          const char *parent_path,
+                          const char *name,
+                          const char *txn_id, 
+                          apr_pool_t *pool)
 {
   /* Call our little helper function */
   return make_entry (child_p, parent, parent_path, name, FALSE, txn_id, pool);
@@ -837,12 +842,12 @@
 
 
 svn_error_t *
-svn_fs__dag_make_dir (dag_node_t **child_p,
-                      dag_node_t *parent,
-                      const char *parent_path,
-                      const char *name,
-                      const char *txn_id, 
-                      apr_pool_t *pool)
+svn_fs_fs__dag_make_dir (dag_node_t **child_p,
+                         dag_node_t *parent,
+                         const char *parent_path,
+                         const char *name,
+                         const char *txn_id, 
+                         apr_pool_t *pool)
 {
   /* Call our little helper function */
   return make_entry (child_p, parent, parent_path, name, TRUE, txn_id, pool);
@@ -850,11 +855,11 @@
 
 
 svn_error_t *
-svn_fs__dag_get_contents (svn_stream_t **contents_p,
-                          dag_node_t *file,
-                          apr_pool_t *pool)
+svn_fs_fs__dag_get_contents (svn_stream_t **contents_p,
+                             dag_node_t *file,
+                             apr_pool_t *pool)
 { 
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   svn_stream_t *contents;
 
   /* Make sure our node is a file. */
@@ -867,7 +872,7 @@
   SVN_ERR (get_node_revision (&noderev, file, pool));
 
   /* Get a stream to the contents. */
-  SVN_ERR (svn_fs__fs_get_contents (&contents, file->fs,
+  SVN_ERR (svn_fs_fs__get_contents (&contents, file->fs,
                                     noderev, pool));
 
   *contents_p = contents;
@@ -877,11 +882,11 @@
 
 
 svn_error_t *
-svn_fs__dag_file_length (svn_filesize_t *length,
-                         dag_node_t *file,
-                         apr_pool_t *pool)
+svn_fs_fs__dag_file_length (svn_filesize_t *length,
+                            dag_node_t *file,
+                            apr_pool_t *pool)
 { 
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Make sure our node is a file. */
   if (file->kind != svn_node_file)
@@ -892,18 +897,18 @@
   /* Go get a fresh node-revision for FILE, and . */
   SVN_ERR (get_node_revision (&noderev, file, pool));
 
-  SVN_ERR (svn_fs__fs_file_length (length, noderev, pool));
+  SVN_ERR (svn_fs_fs__file_length (length, noderev, pool));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_file_checksum (unsigned char digest[],
-                           dag_node_t *file,
-                           apr_pool_t *pool)
+svn_fs_fs__dag_file_checksum (unsigned char digest[],
+                              dag_node_t *file,
+                              apr_pool_t *pool)
 { 
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   if (file->kind != svn_node_file)
     return svn_error_createf 
@@ -912,19 +917,19 @@
 
   SVN_ERR (get_node_revision (&noderev, file, pool));
 
-  SVN_ERR (svn_fs__fs_file_checksum (digest, noderev, pool));
+  SVN_ERR (svn_fs_fs__file_checksum (digest, noderev, pool));
 
   return SVN_NO_ERROR;
 }
 
 
 svn_error_t *
-svn_fs__dag_get_edit_stream (svn_stream_t **contents,
-                             dag_node_t *file,
-                             const char *txn_id,
-                             apr_pool_t *pool)
+svn_fs_fs__dag_get_edit_stream (svn_stream_t **contents,
+                                dag_node_t *file,
+                                const char *txn_id,
+                                apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   svn_stream_t *ws;
 
   /* Make sure our node is a file. */
@@ -934,7 +939,7 @@
        "Attempted to set textual contents of a *non*-file node");
   
   /* Make sure our node is mutable. */
-  if (! svn_fs__dag_check_mutable (file, txn_id))
+  if (! svn_fs_fs__dag_check_mutable (file, txn_id))
     return svn_error_createf 
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Attempted to set textual contents of an immutable node");
@@ -942,7 +947,7 @@
   /* Get the node revision. */
   SVN_ERR (get_node_revision (&noderev, file, pool));
 
-  SVN_ERR (svn_fs__fs_set_contents (&ws, file->fs, noderev, pool));
+  SVN_ERR (svn_fs_fs__set_contents (&ws, file->fs, noderev, pool));
 
   *contents = ws;
   
@@ -952,10 +957,10 @@
 
 
 svn_error_t *
-svn_fs__dag_finalize_edits (dag_node_t *file,
-                            const char *checksum,
-                            const char *txn_id, 
-                            apr_pool_t *pool)
+svn_fs_fs__dag_finalize_edits (dag_node_t *file,
+                               const char *checksum,
+                               const char *txn_id, 
+                               apr_pool_t *pool)
 {
   /* A big no-op for FSFS. */
   
@@ -964,8 +969,8 @@
 
 
 dag_node_t *
-svn_fs__dag_dup (dag_node_t *node,
-                 apr_pool_t *pool)
+svn_fs_fs__dag_dup (dag_node_t *node,
+                    apr_pool_t *pool)
 {
   /* Allocate our new node. */
   dag_node_t *new_node = apr_pcalloc (pool, sizeof (*new_node));
@@ -984,10 +989,10 @@
 
 
 svn_error_t *
-svn_fs__dag_open (dag_node_t **child_p,
-                  dag_node_t *parent,
-                  const char *name,
-                  apr_pool_t *pool)
+svn_fs_fs__dag_open (dag_node_t **child_p,
+                     dag_node_t *parent,
+                     const char *name,
+                     apr_pool_t *pool)
 {
   const svn_fs_id_t *node_id;
 
@@ -1005,36 +1010,36 @@
        "Attempted to open node with an illegal name '%s'", name);
 
   /* Now get the node that was requested. */
-  return svn_fs__dag_get_node (child_p, svn_fs__dag_get_fs (parent),
-                               node_id, pool);
+  return svn_fs_fs__dag_get_node (child_p, svn_fs_fs__dag_get_fs (parent),
+                                  node_id, pool);
 }
 
 
 svn_error_t *
-svn_fs__dag_copy (dag_node_t *to_node,
-                  const char *entry,
-                  dag_node_t *from_node,
-                  svn_boolean_t preserve_history,
-                  svn_revnum_t from_rev,
-                  const char *from_path,
-                  const char *txn_id, 
-                  apr_pool_t *pool)
+svn_fs_fs__dag_copy (dag_node_t *to_node,
+                     const char *entry,
+                     dag_node_t *from_node,
+                     svn_boolean_t preserve_history,
+                     svn_revnum_t from_rev,
+                     const char *from_path,
+                     const char *txn_id, 
+                     apr_pool_t *pool)
 {
   const svn_fs_id_t *id;
   
   if (preserve_history)
     {
-      svn_fs__node_revision_t *from_noderev, *to_noderev;
+      node_revision_t *from_noderev, *to_noderev;
       const char *copy_id;
-      const svn_fs_id_t *src_id = svn_fs__dag_get_id (from_node);
-      svn_fs_t *fs = svn_fs__dag_get_fs (from_node);
+      const svn_fs_id_t *src_id = svn_fs_fs__dag_get_id (from_node);
+      svn_fs_t *fs = svn_fs_fs__dag_get_fs (from_node);
       
       /* Make a copy of the original node revision. */
       SVN_ERR (get_node_revision (&from_noderev, from_node, pool));
       to_noderev = copy_node_revision (from_noderev, pool);
 
       /* Reserve a copy ID for this new copy. */
-      SVN_ERR (svn_fs__fs_reserve_copy_id (&copy_id, fs, txn_id, pool));
+      SVN_ERR (svn_fs_fs__reserve_copy_id (&copy_id, fs, txn_id, pool));
 
       /* Create a successor with it's predecessor pointing at the copy
          source. */
@@ -1042,7 +1047,7 @@
       if (to_noderev->predecessor_count != -1)
         to_noderev->predecessor_count++;
       to_noderev->created_path =
-        svn_path_join (svn_fs__dag_get_created_path (to_node), entry,
+        svn_path_join (svn_fs_fs__dag_get_created_path (to_node), entry,
                        pool);
       to_noderev->copyfrom_path = apr_pstrdup (pool, from_path);
       to_noderev->copyfrom_rev = from_rev;
@@ -1050,17 +1055,17 @@
       /* Set the copyroot equal to our own id. */
       to_noderev->copyroot_path = NULL;
 
-      SVN_ERR (svn_fs__fs_create_successor (&id, fs, src_id, to_noderev,
+      SVN_ERR (svn_fs_fs__create_successor (&id, fs, src_id, to_noderev,
                                             copy_id, txn_id, pool));
 
     }
   else  /* don't preserve history */
     {
-      id = svn_fs__dag_get_id (from_node);
+      id = svn_fs_fs__dag_get_id (from_node);
     }
       
   /* Set the entry in to_node to the new id. */
-  SVN_ERR (svn_fs__dag_set_entry (to_node, entry, id, txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_set_entry (to_node, entry, id, txn_id, pool));
 
   return SVN_NO_ERROR;
 }
@@ -1070,13 +1075,13 @@
 /*** Comparison. ***/
 
 svn_error_t *
-svn_fs__things_different (svn_boolean_t *props_changed,
-                          svn_boolean_t *contents_changed,
-                          dag_node_t *node1,
-                          dag_node_t *node2,
-                          apr_pool_t *pool)
+svn_fs_fs__things_different (svn_boolean_t *props_changed,
+                             svn_boolean_t *contents_changed,
+                             dag_node_t *node1,
+                             dag_node_t *node2,
+                             apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev1, *noderev2;
+  node_revision_t *noderev1, *noderev2;
 
   /* If we have no place to store our results, don't bother doing
      anything. */
@@ -1089,13 +1094,13 @@
 
   /* Compare property keys. */
   if (props_changed != NULL)
-    *props_changed = (! svn_fs__fs_noderev_same_rep_key (noderev1->prop_rep,
+    *props_changed = (! svn_fs_fs__noderev_same_rep_key (noderev1->prop_rep,
                                                          noderev2->prop_rep));
 
   /* Compare contents keys. */
   if (contents_changed != NULL)
     *contents_changed = 
-      (! svn_fs__fs_noderev_same_rep_key (noderev1->data_rep,
+      (! svn_fs_fs__noderev_same_rep_key (noderev1->data_rep,
                                           noderev2->data_rep));
   
   return SVN_NO_ERROR;
@@ -1125,7 +1130,7 @@
   if (node)
     {
       /* ... compare NODE's ID with the ID we're looking for. */
-      if (svn_fs__id_eq (b->node1_id, svn_fs__dag_get_id (node)))
+      if (svn_fs__id_eq (b->node1_id, svn_fs_fs__dag_get_id (node)))
         b->is_ancestor = TRUE;
 
       /* Now, if we only are interested in parenthood, we don't care
@@ -1138,15 +1143,15 @@
 }
 
 svn_error_t *
-svn_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
-                         dag_node_t *node1,
-                         dag_node_t *node2,
-                         apr_pool_t *pool)
+svn_fs_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
+                            dag_node_t *node1,
+                            dag_node_t *node2,
+                            apr_pool_t *pool)
 {
   struct is_ancestor_baton baton;
   const svn_fs_id_t 
-    *id1 = svn_fs__dag_get_id (node1),
-    *id2 = svn_fs__dag_get_id (node2);
+    *id1 = svn_fs_fs__dag_get_id (node1),
+    *id2 = svn_fs_fs__dag_get_id (node2);
 
   /* Pessimism. */
   *is_ancestor = FALSE;
@@ -1159,8 +1164,8 @@
   baton.need_parent = FALSE;
   baton.node1_id = id1;
 
-  SVN_ERR (svn_fs__dag_walk_predecessors (node2, is_ancestor_callback,
-                                          &baton, pool));
+  SVN_ERR (svn_fs_fs__dag_walk_predecessors (node2, is_ancestor_callback,
+                                             &baton, pool));
   if (baton.is_ancestor)
     *is_ancestor = TRUE;
 
@@ -1169,15 +1174,15 @@
 
 
 svn_error_t *
-svn_fs__dag_is_parent (svn_boolean_t *is_parent,
-                       dag_node_t *node1,
-                       dag_node_t *node2,
-                       apr_pool_t *pool)
+svn_fs_fs__dag_is_parent (svn_boolean_t *is_parent,
+                          dag_node_t *node1,
+                          dag_node_t *node2,
+                          apr_pool_t *pool)
 {
   struct is_ancestor_baton baton;
   const svn_fs_id_t 
-    *id1 = svn_fs__dag_get_id (node1),
-    *id2 = svn_fs__dag_get_id (node2);
+    *id1 = svn_fs_fs__dag_get_id (node1),
+    *id2 = svn_fs_fs__dag_get_id (node2);
 
   /* Pessimism. */
   *is_parent = FALSE;
@@ -1190,8 +1195,8 @@
   baton.need_parent = TRUE;
   baton.node1_id = id1;
 
-  SVN_ERR (svn_fs__dag_walk_predecessors (node2, is_ancestor_callback,
-                                          &baton, pool));
+  SVN_ERR (svn_fs_fs__dag_walk_predecessors (node2, is_ancestor_callback,
+                                             &baton, pool));
   if (baton.is_ancestor)
     *is_parent = TRUE;
 
@@ -1199,12 +1204,12 @@
 }
 
 svn_error_t *
-svn_fs__dag_get_copyroot (svn_revnum_t *rev,
-                          const char **path,
-                          dag_node_t *node,
-                          apr_pool_t *pool)
+svn_fs_fs__dag_get_copyroot (svn_revnum_t *rev,
+                             const char **path,
+                             dag_node_t *node,
+                             apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   
   /* Go get a fresh node-revision for FILE. */
   SVN_ERR (get_node_revision (&noderev, node, pool));
@@ -1216,11 +1221,11 @@
 }
 
 svn_error_t *
-svn_fs__dag_get_copyfrom_rev (svn_revnum_t *rev,
-                              dag_node_t *node,
-                              apr_pool_t *pool)
+svn_fs_fs__dag_get_copyfrom_rev (svn_revnum_t *rev,
+                                 dag_node_t *node,
+                                 apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   
   /* Go get a fresh node-revision for FILE. */
   SVN_ERR (get_node_revision (&noderev, node, pool));
@@ -1231,11 +1236,11 @@
 }
 
 svn_error_t *
-svn_fs__dag_get_copyfrom_path (const char **path,
-                               dag_node_t *node,
-                               apr_pool_t *pool)
+svn_fs_fs__dag_get_copyfrom_path (const char **path,
+                                  dag_node_t *node,
+                                  apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   
   /* Go get a fresh node-revision for FILE. */
   SVN_ERR (get_node_revision (&noderev, node, pool));

Modified: trunk/subversion/libsvn_fs_fs/dag.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/dag.h	(original)
+++ trunk/subversion/libsvn_fs_fs/dag.h	Thu Apr 29 18:17:29 2004
@@ -55,7 +55,7 @@
 
 /* Given a filesystem FS, which contains all the necessary tables,
    create the initial revision 0, and the initial root directory.  */
-svn_error_t *svn_fs__dag_init_fs (svn_fs_t *fs);
+svn_error_t *svn_fs_fs__dag_init_fs (svn_fs_t *fs);
 
 
 
@@ -67,7 +67,7 @@
 /* Fill *NODE with a dag_node_t representing node revision ID in FS,
    allocating in POOL.  */
 svn_error_t *
-svn_fs__dag_get_node (dag_node_t **node,
+svn_fs_fs__dag_get_node (dag_node_t **node,
                       svn_fs_t *fs,
                       const svn_fs_id_t *id,
                       apr_pool_t *pool);
@@ -78,48 +78,48 @@
    trail that wants to refer to dag nodes that may have been allocated
    elsewhere, you can call this function, passing "trail->pool", and
    avoid inter-pool pointers.  */
-dag_node_t *svn_fs__dag_dup (dag_node_t *node,
+dag_node_t *svn_fs_fs__dag_dup (dag_node_t *node,
                              apr_pool_t *pool);
 
 
 /* Return the filesystem containing NODE.  */
-svn_fs_t *svn_fs__dag_get_fs (dag_node_t *node);
+svn_fs_t *svn_fs_fs__dag_get_fs (dag_node_t *node);
 
 
 /* Set *REV to NODE's revision number, allocating in POOL.  If NODE
    has never been committed as part of a revision, set *REV to
    SVN_INVALID_REVNUM.  */
-svn_error_t *svn_fs__dag_get_revision (svn_revnum_t *rev,
+svn_error_t *svn_fs_fs__dag_get_revision (svn_revnum_t *rev,
                                        dag_node_t *node,
                                        apr_pool_t *pool);
 
 
 /* Return the node revision ID of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
-const svn_fs_id_t *svn_fs__dag_get_id (dag_node_t *node);
+const svn_fs_id_t *svn_fs_fs__dag_get_id (dag_node_t *node);
 
 
 /* Return the created path of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
-const char *svn_fs__dag_get_created_path (dag_node_t *node);
+const char *svn_fs_fs__dag_get_created_path (dag_node_t *node);
 
 
 /* Set *ID_P to the node revision ID of NODE's immediate predecessor,
    or NULL if NODE has no predecessor, allocating from POOL. */
-svn_error_t *svn_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
+svn_error_t *svn_fs_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
                                              dag_node_t *node,
                                              apr_pool_t *pool);
 
 
 /* Set *COUNT to the number of predecessors NODE has (recursively), or
    -1 if not known, allocating from POOL.  */
-svn_error_t *svn_fs__dag_get_predecessor_count (int *count,
+svn_error_t *svn_fs_fs__dag_get_predecessor_count (int *count,
                                                 dag_node_t *node,
                                                 apr_pool_t *pool);
 
 
-/* Callback function type for svn_fs__dag_walk_predecessors() */
-typedef svn_error_t *(*svn_fs__dag_pred_func_t) (void *baton,
+/* Callback function type for svn_fs_fs__dag_walk_predecessors() */
+typedef svn_error_t *(*dag_pred_func_t) (void *baton,
                                                  dag_node_t *node,
                                                  svn_boolean_t *done,
                                                  apr_pool_t *pool);
@@ -133,18 +133,18 @@
    complete.
 
    Do all allocations in POOL.  */
-svn_error_t *svn_fs__dag_walk_predecessors (dag_node_t *node,
-                                            svn_fs__dag_pred_func_t callback,
+svn_error_t *svn_fs_fs__dag_walk_predecessors (dag_node_t *node,
+                                            dag_pred_func_t callback,
                                             void *baton,
                                             apr_pool_t *pool);
 
 /* Return non-zero IFF NODE is currently mutable under Subversion
    transaction TXN_ID.  */
-svn_boolean_t svn_fs__dag_check_mutable (dag_node_t *node,
+svn_boolean_t svn_fs_fs__dag_check_mutable (dag_node_t *node,
                                          const char *txn_id);
 
 /* Return the node kind of NODE. */
-svn_node_kind_t svn_fs__dag_node_kind (dag_node_t *node);
+svn_node_kind_t svn_fs_fs__dag_node_kind (dag_node_t *node);
 
 /* Set *PROPLIST_P to a PROPLIST hash representing the entire property
    list of NODE, allocating from POOL.  The hash has const char *
@@ -153,14 +153,14 @@
 
    If properties do not exist on NODE, *PROPLIST_P will be set to
    NULL. */
-svn_error_t *svn_fs__dag_get_proplist (apr_hash_t **proplist_p,
+svn_error_t *svn_fs_fs__dag_get_proplist (apr_hash_t **proplist_p,
                                        dag_node_t *node,
                                        apr_pool_t *pool);
 
 /* Set the property list of NODE to PROPLIST, allocating from POOL.
    The node being changed must be mutable.  TXN_ID is the Subversion
    transaction under which this occurs.  */
-svn_error_t *svn_fs__dag_set_proplist (dag_node_t *node,
+svn_error_t *svn_fs_fs__dag_set_proplist (dag_node_t *node,
                                        apr_hash_t *proplist,
                                        const char *txn_id, 
                                        apr_pool_t *pool);
@@ -172,7 +172,7 @@
 
 /* Open the root of revision REV of filesystem FS, allocating from
    POOL.  Set *NODE_P to the new node.  */
-svn_error_t *svn_fs__dag_revision_root (dag_node_t **node_p,
+svn_error_t *svn_fs_fs__dag_revision_root (dag_node_t **node_p,
                                         svn_fs_t *fs,
                                         svn_revnum_t rev,
                                         apr_pool_t *pool);
@@ -184,8 +184,8 @@
    Note that the root node of TXN_ID is not necessarily mutable.  If
    no changes have been made in the transaction, then it may share its
    root directory with its base revision.  To get a mutable root node
-   for a transaction, call svn_fs__dag_clone_root.  */
-svn_error_t *svn_fs__dag_txn_root (dag_node_t **node_p,
+   for a transaction, call svn_fs_fs__dag_clone_root.  */
+svn_error_t *svn_fs_fs__dag_txn_root (dag_node_t **node_p,
                                    svn_fs_t *fs,
                                    const char *txn_id,
                                    apr_pool_t *pool);
@@ -193,7 +193,7 @@
 
 /* Set *NODE_P to the base root of transaction TXN_ID in FS,
    allocating from POOL.  Allocate the node in TRAIL->pool.  */
-svn_error_t *svn_fs__dag_txn_base_root (dag_node_t **node_p,
+svn_error_t *svn_fs_fs__dag_txn_base_root (dag_node_t **node_p,
                                         svn_fs_t *fs,
                                         const char *txn_id,
                                         apr_pool_t *pool);
@@ -203,7 +203,7 @@
    `transactions' table entry to point to it, unless this has been
    done already.  In either case, set *ROOT_P to a reference to the
    root directory clone.  Allocate *ROOT_P in POOL.  */
-svn_error_t *svn_fs__dag_clone_root (dag_node_t **root_p,
+svn_error_t *svn_fs_fs__dag_clone_root (dag_node_t **root_p,
                                      svn_fs_t *fs,
                                      const char *txn_id,
                                      apr_pool_t *pool);
@@ -216,7 +216,7 @@
 /* Open the node named NAME in the directory PARENT.  Set *CHILD_P to
    the new node, allocated in POOL.  NAME must be a single path
    component; it cannot be a slash-separated directory path.  */
-svn_error_t *svn_fs__dag_open (dag_node_t **child_p,
+svn_error_t *svn_fs_fs__dag_open (dag_node_t **child_p,
                                dag_node_t *parent,
                                const char *name,
                                apr_pool_t *pool);
@@ -235,7 +235,7 @@
    svn_node_unknown by this function -- callers that need in
    interesting value in these slots should fill them in using a new
    invocation, since the list of entries can be arbitrarily large.  */
-svn_error_t *svn_fs__dag_dir_entries (apr_hash_t **entries_p,
+svn_error_t *svn_fs_fs__dag_dir_entries (apr_hash_t **entries_p,
                                       dag_node_t *node,
                                       apr_pool_t *pool);
 
@@ -244,7 +244,7 @@
    must be a mutable directory.  ID can refer to a mutable or
    immutable node.  If ENTRY_NAME does not exist, it will be created.
    TXN_ID is the Subversion transaction under which this occurs.*/
-svn_error_t *svn_fs__dag_set_entry (dag_node_t *node,
+svn_error_t *svn_fs_fs__dag_set_entry (dag_node_t *node,
                                     const char *entry_name,
                                     const svn_fs_id_t *id,
                                     const char *txn_id, 
@@ -267,7 +267,7 @@
    created.
 
    TXN_ID is the Subversion transaction under which this occurs.  */
-svn_error_t *svn_fs__dag_clone_child (dag_node_t **child_p,
+svn_error_t *svn_fs_fs__dag_clone_child (dag_node_t **child_p,
                                       dag_node_t *parent,
                                       const char *parent_path,
                                       const char *name,
@@ -286,7 +286,7 @@
 
    If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
    PARENT.  */
-svn_error_t *svn_fs__dag_delete (dag_node_t *parent,
+svn_error_t *svn_fs_fs__dag_delete (dag_node_t *parent,
                                  const char *name,
                                  const char *txn_id,
                                  apr_pool_t *pool);
@@ -302,7 +302,7 @@
    children, you risk orphaning those children by leaving them
    dangling, disconnected from all DAG trees.  It is assumed that
    callers of this interface know what in the world they are doing.  */
-svn_error_t *svn_fs__dag_remove_node (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__dag_remove_node (svn_fs_t *fs,
                                       const svn_fs_id_t *id,
                                       const char *txn_id,
                                       apr_pool_t *pool);
@@ -314,7 +314,7 @@
    node revision.  ID may refer to a file or directory, which may be
    mutable or immutable.  TXN_ID is the Subversion transaction under
    which this occurs.  */
-svn_error_t *svn_fs__dag_delete_if_mutable (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__dag_delete_if_mutable (svn_fs_t *fs,
                                             const svn_fs_id_t *id,
                                             const char *txn_id,
                                             apr_pool_t *pool);
@@ -329,7 +329,7 @@
    not currently have an entry named NAME.  Do any temporary
    allocation in POOL.  TXN_ID is the Subversion transaction under
    which this occurs.  */
-svn_error_t *svn_fs__dag_make_dir (dag_node_t **child_p,
+svn_error_t *svn_fs_fs__dag_make_dir (dag_node_t **child_p,
                                    dag_node_t *parent,
                                    const char *parent_path,
                                    const char *name,
@@ -345,7 +345,7 @@
    contents of FILE.  Allocate the stream in POOL.
    
    If FILE is not a file, return SVN_ERR_FS_NOT_FILE.  */
-svn_error_t *svn_fs__dag_get_contents (svn_stream_t **contents,
+svn_error_t *svn_fs_fs__dag_get_contents (svn_stream_t **contents,
                                        dag_node_t *file,
                                        apr_pool_t *pool);
 
@@ -356,14 +356,14 @@
 
    Any previous edits on the file will be deleted, and a new edit
    stream will be constructed.  */
-svn_error_t *svn_fs__dag_get_edit_stream (svn_stream_t **contents,
+svn_error_t *svn_fs_fs__dag_get_edit_stream (svn_stream_t **contents,
                                           dag_node_t *file,
                                           const char *txn_id,
                                           apr_pool_t *pool);
 
 
 /* Signify the completion of edits to FILE made using the stream
-   returned by svn_fs__dag_get_edit_stream, allocating from POOL.
+   returned by svn_fs_fs__dag_get_edit_stream, allocating from POOL.
    TXN_ID is the Subversion transaction under which this occurs.
 
    If CHECKSUM is non-null, it must match the checksum for FILE's
@@ -371,7 +371,7 @@
    used), else the error SVN_ERR_CHECKSUM_MISMATCH is returned.
 
    This operation is a no-op if no edits are present.  */
-svn_error_t *svn_fs__dag_finalize_edits (dag_node_t *file,
+svn_error_t *svn_fs_fs__dag_finalize_edits (dag_node_t *file,
                                          const char *checksum,
                                          const char *txn_id, 
                                          apr_pool_t *pool);
@@ -379,7 +379,7 @@
 
 /* Set *LENGTH to the length of the contents of FILE, allocating from
    POOL. */
-svn_error_t *svn_fs__dag_file_length (svn_filesize_t *length,
+svn_error_t *svn_fs_fs__dag_file_length (svn_filesize_t *length,
                                       dag_node_t *file,
                                       apr_pool_t *pool);
 
@@ -390,7 +390,7 @@
  * just put all 0's into DIGEST.
  */
 svn_error_t *
-svn_fs__dag_file_checksum (unsigned char digest[],
+svn_fs_fs__dag_file_checksum (unsigned char digest[],
                            dag_node_t *file,
                            apr_pool_t *pool);
 
@@ -401,7 +401,7 @@
    be a slash-separated directory path.  PARENT_PATH must be the
    canonicalized absolute path of the parent directory.  TXN_ID is the
    Subversion transaction under which this occurs.  */
-svn_error_t *svn_fs__dag_make_file (dag_node_t **child_p,
+svn_error_t *svn_fs_fs__dag_make_file (dag_node_t **child_p,
                                     dag_node_t *parent,
                                     const char *parent_path,
                                     const char *name,
@@ -423,7 +423,7 @@
    here.
 
    If PRESERVE_HISTORY is false, FROM_PATH and FROM_REV are ignored.  */
-svn_error_t *svn_fs__dag_copy (dag_node_t *to_node,
+svn_error_t *svn_fs_fs__dag_copy (dag_node_t *to_node,
                                const char *entry,
                                dag_node_t *from_node,
                                svn_boolean_t preserve_history,
@@ -451,7 +451,7 @@
    may leave us with a slight chance of a false positive, though I
    don't really see how that would happen in practice.  Nevertheless,
    it should probably be fixed.  */
-svn_error_t *svn_fs__things_different (svn_boolean_t *props_changed,
+svn_error_t *svn_fs_fs__things_different (svn_boolean_t *props_changed,
                                        svn_boolean_t *contents_changed,
                                        dag_node_t *node1,
                                        dag_node_t *node2,
@@ -460,7 +460,7 @@
 
 /* Set *IS_ANCESTOR to non-zero IFF NODE1 is an ancestor of NODE2.
    Get any temporary allocations from POOL.  */
-svn_error_t *svn_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
+svn_error_t *svn_fs_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
                                       dag_node_t *node1,
                                       dag_node_t *node2,
                                       apr_pool_t *pool);
@@ -468,27 +468,27 @@
 
 /* Set *IS_PARENT to non-zero IFF NODE1 is the parent of NODE2.
    Get any temporary allocations from POOL.  */
-svn_error_t *svn_fs__dag_is_parent (svn_boolean_t *is_ancestor,
+svn_error_t *svn_fs_fs__dag_is_parent (svn_boolean_t *is_ancestor,
                                     dag_node_t *node1,
                                     dag_node_t *node2,
                                     apr_pool_t *pool);
 
 /* Set *NODE_ID to the node-id of the coyproot of node NODE, or NULL
    if no copyroot exists.  Get any temporary allocations from POOL. */
-svn_error_t *svn_fs__dag_get_copyroot (svn_revnum_t *rev,
+svn_error_t *svn_fs_fs__dag_get_copyroot (svn_revnum_t *rev,
                                        const char **path,
                                        dag_node_t *node,
                                        apr_pool_t *pool);
 
 /* Set *REV to the copyfrom revision associated with NODE.  Get any
    temporary allocations from POOL. */
-svn_error_t *svn_fs__dag_get_copyfrom_rev (svn_revnum_t *rev,
+svn_error_t *svn_fs_fs__dag_get_copyfrom_rev (svn_revnum_t *rev,
                                            dag_node_t *node,
                                            apr_pool_t *pool);
 
 /* Set *PATH to the copyfrom path associated with NODE.  Get any
    temporary allocations from POOL. */
-svn_error_t *svn_fs__dag_get_copyfrom_path (const char **path,
+svn_error_t *svn_fs_fs__dag_get_copyfrom_path (const char **path,
                                             dag_node_t *node,
                                             apr_pool_t *pool);
 

Modified: trunk/subversion/libsvn_fs_fs/err.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/err.c	(original)
+++ trunk/subversion/libsvn_fs_fs/err.c	Thu Apr 29 18:17:29 2004
@@ -26,10 +26,12 @@
 #include "fs.h"
 #include "err.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 svn_error_t *
-svn_fs__check_fs (svn_fs_t *fs)
+svn_fs_fs__check_fs (svn_fs_t *fs)
 {
-  if (fs->fs_path)
+  if (fs->path)
     return SVN_NO_ERROR;
   else
     return svn_error_create (SVN_ERR_FS_NOT_OPEN, 0,
@@ -51,7 +53,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_node_revision (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_fs__err_corrupt_node_revision (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   return
     corrupt_id ("Corrupt node revision for node '%s' in filesystem '%s'",
@@ -60,7 +62,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_fs_revision (svn_fs_t *fs, svn_revnum_t rev)
+svn_fs_fs__err_corrupt_fs_revision (svn_fs_t *fs, svn_revnum_t rev)
 {
   return svn_error_createf
     (SVN_ERR_FS_CORRUPT, 0,
@@ -70,9 +72,9 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_clone (svn_fs_t *fs,
-                           const char *svn_txn,
-                           const char *base_path)
+svn_fs_fs__err_corrupt_clone (svn_fs_t *fs,
+                              const char *svn_txn,
+                              const char *base_path)
 {
   return
     svn_error_createf
@@ -83,7 +85,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   return
     corrupt_id ("Corrupt node revision id '%s' appears in filesystem '%s'",
@@ -92,7 +94,7 @@
 
 
 svn_error_t *
-svn_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id)
+svn_fs_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id)
 {
   svn_string_t *id_str = svn_fs_unparse_id (id, fs->pool);
   return svn_error_createf
@@ -103,7 +105,7 @@
 
 
 svn_error_t *
-svn_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev)
+svn_fs_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev)
 {
   return svn_error_createf
     (SVN_ERR_FS_NO_SUCH_REVISION, 0,
@@ -115,7 +117,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_nodes_key (svn_fs_t *fs)
+svn_fs_fs__err_corrupt_nodes_key (svn_fs_t *fs)
 {
   return
     svn_error_createf
@@ -125,7 +127,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table)
+svn_fs_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table)
 {
   return
     svn_error_createf
@@ -136,8 +138,8 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_txn (svn_fs_t *fs,
-                         const char *txn)
+svn_fs_fs__err_corrupt_txn (svn_fs_t *fs,
+                            const char *txn)
 {
   return
     svn_error_createf
@@ -148,7 +150,7 @@
 
 
 svn_error_t *
-svn_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id)
+svn_fs_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id)
 {
   return
     svn_error_createf
@@ -159,7 +161,7 @@
 
 
 svn_error_t *
-svn_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev, const char *path)
+svn_fs_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev, const char *path)
 {
   return
     svn_error_createf
@@ -170,7 +172,7 @@
 
 
 svn_error_t *
-svn_fs__err_path_syntax (svn_fs_t *fs, const char *path)
+svn_fs_fs__err_path_syntax (svn_fs_t *fs, const char *path)
 {
   return
     svn_error_createf
@@ -181,7 +183,7 @@
 
 
 svn_error_t *
-svn_fs__err_no_such_txn (svn_fs_t *fs, const char *txn)
+svn_fs_fs__err_no_such_txn (svn_fs_t *fs, const char *txn)
 {
   return
     svn_error_createf
@@ -192,7 +194,7 @@
 
 
 svn_error_t *
-svn_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn)
+svn_fs_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn)
 {
   return
     svn_error_createf
@@ -203,7 +205,7 @@
 
 
 svn_error_t *
-svn_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id)
+svn_fs_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id)
 {
   return
     svn_error_createf
@@ -213,7 +215,7 @@
 
 
 svn_error_t *
-svn_fs__err_not_directory (svn_fs_t *fs, const char *path)
+svn_fs_fs__err_not_directory (svn_fs_t *fs, const char *path)
 {
   return
     svn_error_createf

Modified: trunk/subversion/libsvn_fs_fs/err.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/err.h	(original)
+++ trunk/subversion/libsvn_fs_fs/err.h	Thu Apr 29 18:17:29 2004
@@ -32,7 +32,7 @@
 
 /* Verify that FS refers to an open database; return an appropriate
    error if this is not the case.  */
-svn_error_t *svn_fs__check_fs (svn_fs_t *fs);
+svn_error_t *svn_fs_fs__check_fs (svn_fs_t *fs);
 
 
 
@@ -40,68 +40,68 @@
 
 
 /* SVN_ERR_FS_CORRUPT: the REPRESENTATION skel of node ID in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_representation (svn_fs_t *fs,
-                                                 const svn_fs_id_t *id);
+svn_error_t *svn_fs_fs__err_corrupt_representation (svn_fs_t *fs,
+                                                    const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the NODE-REVISION skel of node ID in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_node_revision (svn_fs_t *fs,
-                                                const svn_fs_id_t *id);
+svn_error_t *svn_fs_fs__err_corrupt_node_revision (svn_fs_t *fs,
+                                                   const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the REVISION skel of revision REV in FS is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_fs_revision (svn_fs_t *fs,
-                                              svn_revnum_t rev);
+svn_error_t *svn_fs_fs__err_corrupt_fs_revision (svn_fs_t *fs,
+                                                 svn_revnum_t rev);
 
 /* SVN_ERR_FS_CORRUPT: ID is a node ID, not a node revision ID.  */
-svn_error_t *svn_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id);
+svn_error_t *svn_fs_fs__err_corrupt_id (svn_fs_t *fs, const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: the clone record for BASE_PATH in SVN_TXN in FS
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_clone (svn_fs_t *fs,
-                                        const char *svn_txn,
-                                        const char *base_path);
+svn_error_t *svn_fs_fs__err_corrupt_clone (svn_fs_t *fs,
+                                           const char *svn_txn,
+                                           const char *base_path);
 
 /* SVN_ERR_FS_ID_NOT_FOUND: something in FS refers to node revision
    ID, but that node revision doesn't exist.  */
-svn_error_t *svn_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id);
+svn_error_t *svn_fs_fs__err_dangling_id (svn_fs_t *fs, const svn_fs_id_t *id);
 
 /* SVN_ERR_FS_CORRUPT: something in FS refers to filesystem revision REV,
    but that filesystem revision doesn't exist.  */
-svn_error_t *svn_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev);
+svn_error_t *svn_fs_fs__err_dangling_rev (svn_fs_t *fs, svn_revnum_t rev);
 
 /* SVN_ERR_FS_CORRUPT: a key in FS's `nodes' table is bogus.  */
-svn_error_t *svn_fs__err_corrupt_nodes_key (svn_fs_t *fs);
+svn_error_t *svn_fs_fs__err_corrupt_nodes_key (svn_fs_t *fs);
 
 /* SVN_ERR_FS_CORRUPT: the `next-id' value in TABLE is bogus.  */
-svn_error_t *svn_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table);
+svn_error_t *svn_fs_fs__err_corrupt_next_id (svn_fs_t *fs, const char *table);
 
 /* SVN_ERR_FS_CORRUPT: the entry for TXN in the `transactions' table
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_txn (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_fs__err_corrupt_txn (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_CORRUPT: the entry for COPY_ID in the `copies' table
    is corrupt.  */
-svn_error_t *svn_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id);
+svn_error_t *svn_fs_fs__err_corrupt_copy (svn_fs_t *fs, const char *copy_id);
 
 /* SVN_ERR_FS_NOT_MUTABLE: the caller attempted to change a node
    outside of a transaction.  */
-svn_error_t *svn_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev,
-                                      const char *path);
+svn_error_t *svn_fs_fs__err_not_mutable (svn_fs_t *fs, svn_revnum_t rev,
+                                         const char *path);
 
 /* SVN_ERR_FS_PATH_SYNTAX: PATH is not a valid path name.  */
-svn_error_t *svn_fs__err_path_syntax (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_fs__err_path_syntax (svn_fs_t *fs, const char *path);
 
 /* SVN_ERR_FS_NO_SUCH_TRANSACTION: there is no transaction named TXN in FS.  */
-svn_error_t *svn_fs__err_no_such_txn (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_fs__err_no_such_txn (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_TRANSACTION_NOT_MUTABLE: trying to change the
    unchangeable transaction named TXN in FS.  */
-svn_error_t *svn_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn);
+svn_error_t *svn_fs_fs__err_txn_not_mutable (svn_fs_t *fs, const char *txn);
 
 /* SVN_ERR_FS_NO_SUCH_COPY: there is no copy with id COPY_ID in FS.  */
-svn_error_t *svn_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id);
+svn_error_t *svn_fs_fs__err_no_such_copy (svn_fs_t *fs, const char *copy_id);
 
 /* SVN_ERR_FS_NOT_DIRECTORY: PATH does not refer to a directory in FS.  */
-svn_error_t *svn_fs__err_not_directory (svn_fs_t *fs, const char *path);
+svn_error_t *svn_fs_fs__err_not_directory (svn_fs_t *fs, const char *path);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_fs/fs.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/fs.c	(original)
+++ trunk/subversion/libsvn_fs_fs/fs.c	Thu Apr 29 18:17:29 2004
@@ -32,104 +32,116 @@
 #include "err.h"
 #include "dag.h"
 #include "fs_fs.h"
+#include "revs-txns.h"
+#include "tree.h"
 #include "svn_private_config.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
-/* A default warning handling function.  */
 
-static void
-default_warning_func (void *baton, svn_error_t *err)
+/* If filesystem FS is already open, then return an
+   SVN_ERR_FS_ALREADY_OPEN error.  Otherwise, return zero.  */
+static svn_error_t *
+check_already_open (svn_fs_t *fs)
 {
-  /* The one unforgiveable sin is to fail silently.  Dumping to stderr
-     or /dev/tty is not acceptable default behavior for server
-     processes, since those may both be equivalent to /dev/null.  */
-  abort ();
+  if (fs->fsap_data)
+    return svn_error_create (SVN_ERR_FS_ALREADY_OPEN, 0,
+                             "Filesystem object already open");
+  else
+    return SVN_NO_ERROR;
 }
 
+
 
-/* Allocating and freeing filesystem objects.  */
 
-svn_fs_t *
-svn_fs_new (apr_hash_t *fs_config, apr_pool_t *parent_pool)
+/* This function is provided for Subversion 1.0.x compatibility.  It
+   has no effect for fsfs backed Subversion filesystems. */
+static svn_error_t *
+fs_set_errcall (svn_fs_t *fs,
+                void (*db_errcall_fcn) (const char *errpfx, char *msg))
 {
-  svn_fs_t *new_fs;
-  apr_pool_t *pool = svn_pool_create (parent_pool);
-
-  /* Allocate a new filesystem object in its own pool, which is a
-     subpool of POOL.  */
-  new_fs = apr_pcalloc (pool, sizeof (svn_fs_t));
-  new_fs->pool = pool;
-  new_fs->warning = default_warning_func;
-  new_fs->config = fs_config;
-
-  /*
-  apr_pool_cleanup_register (new_fs->pool, new_fs,
-                             cleanup_fs_apr,
-                             apr_pool_cleanup_null);
-  */
-  return new_fs;
-}
-
 
-void
-svn_fs_set_warning_func (svn_fs_t *fs,
-                         svn_fs_warning_callback_t warning,
-                         void *warning_baton)
-{
-  fs->warning = warning;
-  fs->warning_baton = warning_baton;
+  return SVN_NO_ERROR;
 }
 
+/* The vtable associated with a specific open filesystem. */
+static fs_vtable_t fs_vtable = {
+  svn_fs_fs__youngest_rev,
+  svn_fs_fs__revision_prop,
+  svn_fs_fs__revision_proplist,
+  svn_fs_fs__change_rev_prop,
+  svn_fs_fs__get_uuid,
+  svn_fs_fs__set_uuid,
+  svn_fs_fs__revision_root,
+  svn_fs_fs__begin_txn,
+  svn_fs_fs__open_txn,
+  svn_fs_fs__purge_txn,
+  svn_fs_fs__list_transactions,
+  svn_fs_fs__deltify
+};
 
 
-/* Filesystem creation/opening. */
-const char *
-svn_fs_berkeley_path (svn_fs_t *fs, apr_pool_t *pool)
-{
-  return apr_pstrdup (pool, fs->fs_path);
-}
+/* Creating a new filesystem. */
 
-svn_error_t *
-svn_fs_create_berkeley (svn_fs_t *fs, const char *path)
+/* Create a new fsfs backed Subversion filesystem at path PATH and
+   link it to the filesystem FS.  Perform temporary allocations in
+   POOL. */
+static svn_error_t *
+fs_create (svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__fs_create (fs, path, fs->pool));
+  SVN_ERR (check_already_open (fs));
+
+  fs->vtable = &fs_vtable;
+  fs->fsap_data = NULL;
+
+  SVN_ERR (svn_fs_fs__create (fs, path, pool));
 
   return SVN_NO_ERROR;
 }
 
-
-/* Gaining access to an existing Berkeley DB-based filesystem.  */
 
+
+/* Gaining access to an existing filesystem.  */
 
-svn_error_t *
-svn_fs_open_berkeley (svn_fs_t *fs, const char *path)
+/* Implements the svn_fs_open API.  Opens a Subversion filesystem
+   located at PATH and sets FS to point to the correct vtable for the
+   fsfs filesystem.  All allocations are from POOL. */
+static svn_error_t *
+fs_open (svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__fs_open (fs, path, fs->pool));
+  SVN_ERR (svn_fs_fs__open (fs, path, fs->pool));
+
+  fs->vtable = &fs_vtable;
+  fs->fsap_data = NULL;
 
   return SVN_NO_ERROR;
 }
 
 
-/* Copying a live FSFS filesystem. (Despite the name.) */
 
-svn_error_t *
-svn_fs_hotcopy_berkeley (const char *src_path, 
-                         const char *dest_path, 
-                         svn_boolean_t clean_logs, 
-                         apr_pool_t *pool)
+/* Copy a possibly live Subversion filesystem from SRC_PATH to
+   DEST_PATH.  The CLEAN_LOGS argument is ignored and included for
+   Subversion 1.0.x compatibility.  Perform all temporary allocations
+   in POOL. */
+static svn_error_t *
+fs_hotcopy (const char *src_path, 
+            const char *dest_path, 
+            svn_boolean_t clean_logs, 
+            apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__fs_hotcopy (src_path, dest_path, pool));
+  SVN_ERR (svn_fs_fs__hotcopy (src_path, dest_path, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-/* Running recovery on a Berkeley DB-based filesystem.  */
-
 
-svn_error_t *
-svn_fs_berkeley_recover (const char *path,
-                         apr_pool_t *pool)
+/* This function is included for Subversion 1.0.x compability.  It has
+   no effect for fsfs backed Subversion filesystems. */
+static svn_error_t *
+fs_recover (const char *path,
+            apr_pool_t *pool)
 {
   /* This is a no-op for FSFS. */
 
@@ -138,13 +150,14 @@
 
 
 
-/* Running the 'archive' command on a Berkeley DB-based filesystem.  */
 
-
-svn_error_t *svn_fs_berkeley_logfiles (apr_array_header_t **logfiles,
-                                       const char *path,
-                                       svn_boolean_t only_unused,
-                                       apr_pool_t *pool)
+/* This function is included for Subversion 1.0.x compatability.  It
+   has no effect for fsfs backed Subversion filesystems. */
+static svn_error_t *
+fs_logfiles (apr_array_header_t **logfiles,
+             const char *path,
+             svn_boolean_t only_unused,
+             apr_pool_t *pool)
 {
   /* A no-op for FSFS. */
   *logfiles = NULL;
@@ -155,12 +168,12 @@
 
 
 
-/* Deleting a Berkeley DB-based filesystem.  */
-
 
-svn_error_t *
-svn_fs_delete_berkeley (const char *path,
-                        apr_pool_t *pool)
+/* Delete the filesystem located at path PATH.  Perform any temporary
+   allocations in POOL. */
+static svn_error_t *
+fs_delete_fs (const char *path,
+              apr_pool_t *pool)
 {
   /* Remove everything. */
   SVN_ERR (svn_io_remove_dir (path, pool));
@@ -170,62 +183,14 @@
 
 
 
-/* Miscellany */
+/* Base FS library vtable, used by the FS loader library. */
 
-const char *
-svn_fs__canonicalize_abspath (const char *path, apr_pool_t *pool)
-{
-  char *newpath;
-  int path_len;
-  int path_i = 0, newpath_i = 0;
-  svn_boolean_t eating_slashes = FALSE;
-
-  /* No PATH?  No problem. */
-  if (! path)
-    return NULL;
-  
-  /* Empty PATH?  That's just "/". */
-  if (! *path)
-    return apr_pstrdup (pool, "/");
-
-  /* Now, the fun begins.  Alloc enough room to hold PATH with an
-     added leading '/'. */
-  path_len = strlen (path);
-  newpath = apr_pcalloc (pool, path_len + 2);
-
-  /* No leading slash?  Fix that. */
-  if (*path != '/')
-    {
-      newpath[newpath_i++] = '/';
-    }
-  
-  for (path_i = 0; path_i < path_len; path_i++)
-    {
-      if (path[path_i] == '/')
-        {
-          /* The current character is a '/'.  If we are eating up
-             extra '/' characters, skip this character.  Else, note
-             that we are now eating slashes. */
-          if (eating_slashes)
-            continue;
-          eating_slashes = TRUE;
-        }
-      else
-        {
-          /* The current character is NOT a '/'.  If we were eating
-             slashes, we need not do that any more. */
-          if (eating_slashes)
-            eating_slashes = FALSE;
-        }
-
-      /* Copy the current character into our new buffer. */
-      newpath[newpath_i++] = path[path_i];
-    }
-  
-  /* Did we leave a '/' attached to the end of NEWPATH (other than in
-     the root directory case)? */
-  if ((newpath[newpath_i - 1] == '/') && (newpath_i > 1))
-    newpath[newpath_i - 1] = '\0';
-
-  return newpath;
-}
+fs_library_vtable_t svn_fs_fs__vtable = {
+  fs_create,
+  fs_open,
+  fs_delete_fs,
+  fs_hotcopy,
+  fs_set_errcall,
+  fs_recover,
+  fs_logfiles
+};

Modified: trunk/subversion/libsvn_fs_fs/fs.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/fs.h	(original)
+++ trunk/subversion/libsvn_fs_fs/fs.h	Thu Apr 29 18:17:29 2004
@@ -30,30 +30,11 @@
 
 /*** The filesystem structure.  ***/
 
-struct svn_fs_t 
+typedef struct
 {
-  /* A pool managing this filesystem.  Freeing this pool must
-     completely clean up the filesystem, including any database
-     or system resources it holds.  */
-  apr_pool_t *pool;
-
-  /* The path to the repository's top-level directory. */
-  char *path;
-
-  /* The path to the repository's revision directory. */
-  char *fs_path;
-
-  /* A callback function for printing warning messages, and a baton to
-     pass through to it.  */
-  svn_fs_warning_callback_t warning;
-  void *warning_baton;
-
-  /* The filesystem configuration. */
-  apr_hash_t *config;
-
   /* The filesystem UUID (or NULL if not-yet-known; see svn_fs_get_uuid). */
   const char *uuid;
-};
+} fs_fs_data_t;
 
 
 /* Return a canonicalized version of a filesystem PATH, allocated in
@@ -75,24 +56,24 @@
      revision. */
   const char *txn_id;
 
-} svn_fs__revision_t;
+} revision_t;
 
 
 /*** Transaction Kind ***/
 typedef enum
 {
-  svn_fs__transaction_kind_normal = 1,  /* normal, uncommitted */
-  svn_fs__transaction_kind_committed,   /* committed */
-  svn_fs__transaction_kind_dead         /* uncommitted and dead */
+  transaction_kind_normal = 1,  /* normal, uncommitted */
+  transaction_kind_committed,   /* committed */
+  transaction_kind_dead         /* uncommitted and dead */
 
-} svn_fs__transaction_kind_t;
+} transaction_kind_t;
 
 
 /*** Filesystem Transaction ***/
 typedef struct
 {
   /* kind of transaction. */
-  svn_fs__transaction_kind_t kind;
+  transaction_kind_t kind;
 
   /* revision which this transaction was committed to create, or an
      invalid revision number if this transaction was never committed. */
@@ -113,15 +94,15 @@
      no copies in this transaction.  */
   apr_array_header_t *copies;
 
-} svn_fs__transaction_t;
+} transaction_t;
 
 /*** Copy Kind ***/
 typedef enum
 {
-  svn_fs__copy_kind_real = 1, /* real copy */
-  svn_fs__copy_kind_soft      /* soft copy */
+  copy_kind_real = 1, /* real copy */
+  copy_kind_soft      /* soft copy */
 
-} svn_fs__copy_kind_t;
+} copy_kind_t;
 
 
 /*** Representation ***/
@@ -158,7 +139,7 @@
   /* Is this a data rep? */
   svn_boolean_t is_data_rep;
   
-} svn_fs__representation_t;
+} representation_t;
 
 
 /*** Node-Revision ***/
@@ -189,11 +170,11 @@
 
   /* representation key for this node's properties.  may be NULL if
      there are no properties.  */
-  svn_fs__representation_t *prop_rep;
+  representation_t *prop_rep;
 
   /* representation for this node's data.  may be NULL if there is
      no data. */
-  svn_fs__representation_t *data_rep;
+  representation_t *data_rep;
   
   /* representation key for this node's text-data-in-progess (files
      only).  NULL if no edits are currently in-progress.  This field
@@ -203,16 +184,16 @@
   /* path at which this node first came into existence.  */
   const char *created_path;
 
-} svn_fs__node_revision_t;
+} node_revision_t;
 
 
 /*** Representation Kind ***/
 typedef enum
 {
-  svn_fs__rep_kind_fulltext = 1, /* fulltext */
-  svn_fs__rep_kind_delta         /* delta */
+  rep_kind_fulltext = 1, /* fulltext */
+  rep_kind_delta         /* delta */
 
-} svn_fs__rep_kind_t;
+} rep_kind_t;
 
 
 /*** "Delta" Offset/Window Chunk ***/
@@ -237,7 +218,7 @@
 
   /* apr_off_t rep_offset;  ### not implemented */
 
-} svn_fs__rep_delta_chunk_t;
+} rep_delta_chunk_t;
 
 
 
@@ -246,7 +227,7 @@
 typedef struct
 {
   /* What kind of copy occurred. */
-  svn_fs__copy_kind_t kind;
+  copy_kind_t kind;
 
   /* Path of copy source. */
   const char *src_path;
@@ -257,7 +238,7 @@
   /* Node-revision of copy destination. */
   const svn_fs_id_t *dst_noderev_id;
 
-} svn_fs__copy_t;
+} copy_t;
 
 
 /*** Change ***/
@@ -276,7 +257,11 @@
   svn_boolean_t text_mod;
   svn_boolean_t prop_mod;
 
-} svn_fs__change_t;
+  /* Copyfrom revision and path. */
+  svn_revnum_t copyfrom_rev;
+  const char * copyfrom_path;
+
+} change_t;
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_fs/fs_fs.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/fs_fs.c	(original)
+++ trunk/subversion/libsvn_fs_fs/fs_fs.c	Thu Apr 29 18:17:29 2004
@@ -35,7 +35,6 @@
 #include "svn_md5.h"
 #include "../libsvn_delta/delta.h"
 
-#include "id.h"
 #include "fs.h"
 #include "err.h"
 #include "dag.h"
@@ -43,15 +42,17 @@
 #include "key-gen.h"
 #include "fs_fs.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 /* Notes:
 
-   To avoid opening and closing the rev-files all the time, it would
-   probably be advantageous to keep each rev-file open for the
-   lifetime of the transaction object.  I'll leave that as a later
-   optimization for now.
+To avoid opening and closing the rev-files all the time, it would
+probably be advantageous to keep each rev-file open for the
+lifetime of the transaction object.  I'll leave that as a later
+optimization for now.
 
-   I didn't keep track of pool lifetimes at all in this code.  There
-   are likely some errors because of that.
+I didn't keep track of pool lifetimes at all in this code.  There
+are likely some errors because of that.
    
 */
 
@@ -201,6 +202,48 @@
   return SVN_NO_ERROR;
 }
 
+/* Given a node-id ID, return the revision it is associated with. */
+svn_revnum_t
+svn_fs_fs__get_id_rev (const svn_fs_id_t *id)
+{
+  if ((! id->txn_id) || (id->txn_id[0] != 'r'))
+    return SVN_INVALID_REVNUM;
+
+  return atol (id->txn_id + 1);
+}
+
+apr_off_t
+svn_fs_fs__get_id_offset (const svn_fs_id_t *id)
+{
+  char *str;
+  
+  if ((! id->txn_id) || (id->txn_id[0] != 'r'))
+    return -1;
+
+  str = strchr (id->txn_id, '/');
+  if (! str || ((* (str + 1)) == '\0'))
+    return -1;
+
+  return apr_atoi64 (str + 1);
+}
+
+const char *
+svn_fs_fs__get_id_txn (const svn_fs_id_t *txn)
+{
+  if ((! txn->txn_id) || (txn->txn_id[0] != 't'))
+    return NULL;
+
+  return txn->txn_id + 1;
+}
+
+svn_error_t *
+svn_fs_fs__set_id_txn (svn_fs_id_t *id, const char *txn_id, apr_pool_t *pool)
+{
+  id->txn_id = apr_pstrcat (pool, "t", txn_id, NULL);
+
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *
 get_file_offset (apr_off_t *offset_p, apr_file_t *file, apr_pool_t *pool)
 {
@@ -214,7 +257,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_open (svn_fs_t *fs, const char *path, apr_pool_t *pool)
+svn_fs_fs__open (svn_fs_t *fs, const char *path, apr_pool_t *pool)
 {
   apr_file_t *current_file;
 
@@ -222,11 +265,11 @@
      isn't much need for specific state associated with an open fs_fs
      repository. */
 
-  fs->fs_path = apr_pstrdup (pool, path);
+  fs->path = apr_pstrdup (pool, path);
 
   SVN_ERR (svn_io_file_open (&current_file,
                              svn_path_join (path, SVN_FS_FS__CURRENT, pool),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED , APR_OS_DEFAULT, pool));
 
   SVN_ERR (svn_io_file_close (current_file, pool));
   
@@ -248,7 +291,7 @@
   SVN_ERR (svn_io_file_open (&revision_file,
                              svn_path_join (fs_path, SVN_FS_FS__CURRENT,
                                             pool),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   len = sizeof (buf);
   SVN_ERR (svn_io_file_read (revision_file, buf, &len, pool));
@@ -262,7 +305,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_hotcopy (const char *src_path,
+svn_fs_fs__hotcopy (const char *src_path,
                     const char *dst_path,
                     apr_pool_t *pool)
 {
@@ -270,7 +313,8 @@
   svn_revnum_t youngest, rev;
 
   /* Copy the current file. */
-  SVN_ERR (svn_io_dir_file_copy (src_path, dst_path, SVN_FS_FS__CURRENT, pool));
+  SVN_ERR (svn_io_dir_file_copy (src_path, dst_path, SVN_FS_FS__CURRENT,
+                                 pool));
 
   /* Copy the uuid. */
   SVN_ERR (svn_io_dir_file_copy (src_path, dst_path, SVN_FS_FS__UUID, pool));
@@ -285,10 +329,10 @@
   SVN_ERR (svn_io_make_dir_recursively (dst_subdir, pool));
   
   for (rev = 0; rev <= youngest; rev++)
-      SVN_ERR (svn_io_dir_file_copy (src_subdir, dst_subdir,
-                                     apr_psprintf (pool, "%"
-                                                   SVN_REVNUM_T_FMT, rev),
-                                     pool));
+    SVN_ERR (svn_io_dir_file_copy (src_subdir, dst_subdir,
+                                   apr_psprintf (pool, "%"
+                                                 SVN_REVNUM_T_FMT, rev),
+                                   pool));
 
   /* Copy the necessary revprop files. */
   src_subdir = svn_path_join (src_path, SVN_FS_FS__REVPROPS_DIR, pool);
@@ -313,11 +357,11 @@
 
 
 svn_error_t *
-svn_fs__fs_youngest_revision (svn_revnum_t *youngest_p,
-                              svn_fs_t *fs,
-                              apr_pool_t *pool)
+svn_fs_fs__youngest_rev (svn_revnum_t *youngest_p,
+                         svn_fs_t *fs,
+                         apr_pool_t *pool)
 {
-  SVN_ERR (get_youngest (youngest_p, fs->fs_path, pool));
+  SVN_ERR (get_youngest (youngest_p, fs->path, pool));
   
   return SVN_NO_ERROR;
 }
@@ -397,11 +441,11 @@
 
   SVN_ERR (svn_io_file_open (&rev_file,
                              svn_path_join_many (pool, 
-                                                 fs->fs_path,
+                                                 fs->path,
                                                  SVN_FS_FS__REVS_DIR,
                                                  rev_filename,
                                                  NULL),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   SVN_ERR (svn_io_file_seek (rev_file, APR_SET, &offset, pool));
 
@@ -417,12 +461,12 @@
 get_txn_representation_filename (svn_fs_t *fs,
                                  const char *txn_id,
                                  const svn_fs_id_t *id,
-                                 svn_fs__representation_t *rep,
+                                 representation_t *rep,
                                  apr_pool_t *pool)
 {
   const char *filename;
 
-  filename = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  filename = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                  apr_pstrcat (pool, txn_id,
                                               SVN_FS_FS__TXNS_EXT, NULL),
                                  NULL);
@@ -463,7 +507,7 @@
                            svn_fs_t *fs,
                            const svn_fs_id_t *id,
                            const char *txn_id,
-                           svn_fs__representation_t *rep,
+                           representation_t *rep,
                            apr_pool_t *pool)
 {
   apr_file_t *rev_file;
@@ -473,7 +517,7 @@
   filename = get_txn_representation_filename (fs, txn_id, id, rep, pool);
   
   SVN_ERR (svn_io_file_open (&rev_file, filename,
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   offset = rep->offset;
   SVN_ERR (svn_io_file_seek (rev_file, APR_SET, &offset, pool));
@@ -490,7 +534,7 @@
 open_and_seek_representation (apr_file_t **file_p,
                               svn_fs_t *fs,
                               const svn_fs_id_t *id,
-                              svn_fs__representation_t *rep,
+                              representation_t *rep,
                               apr_pool_t *pool)
 {
   if (! rep->txn_id)
@@ -512,12 +556,12 @@
    expanded size are stored in *REVISION_P, *OFFSET_P, *SIZE_P, and
    *EXPANDED_SIZE_P respectively. */
 static svn_error_t *
-read_rep_offsets (svn_fs__representation_t **rep_p,
+read_rep_offsets (representation_t **rep_p,
                   char *string,
                   const char *txn_id,
                   apr_pool_t *pool)
 {
-  svn_fs__representation_t *rep;
+  representation_t *rep;
   char *str, *last_str;
   int i;
 
@@ -531,7 +575,7 @@
 
   rep->revision = atoi (str);
   if (rep->revision == SVN_INVALID_REVNUM)
-      rep->txn_id = txn_id;
+    rep->txn_id = txn_id;
   
   str = apr_strtok (NULL, " ", &last_str);
   if (str == NULL)
@@ -595,13 +639,13 @@
   char *filename;
   apr_file_t *file;
 
-  filename = svn_path_join_many (pool, fs->fs_path,
+  filename = svn_path_join_many (pool, fs->path,
                                  SVN_FS_FS__TXNS_DIR,
                                  apr_pstrcat (pool, txn_id, ".txn", NULL),
                                  apr_pstrcat (pool, node_id, ".",
                                               copy_id, NULL), NULL);
 
-  SVN_ERR (svn_io_file_open (&file, filename, APR_READ,
+  SVN_ERR (svn_io_file_open (&file, filename, APR_READ | APR_BUFFERED,
                              APR_OS_DEFAULT, pool));
 
   *file_p = file;
@@ -610,30 +654,30 @@
 }
 
 svn_error_t *
-svn_fs__fs_get_node_revision (svn_fs__node_revision_t **noderev_p,
+svn_fs_fs__get_node_revision (node_revision_t **noderev_p,
                               svn_fs_t *fs,
                               const svn_fs_id_t *id,
                               apr_pool_t *pool)
 {
   apr_file_t *revision_file;
   apr_hash_t *headers;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   char *value;
   svn_error_t *err;
   
-  if (id->txn_id)
-      {
-        /* This is a transaction node-rev. */
-        err = open_txn_node_rev (&revision_file, fs, svn_fs__id_node_id (id),
-                                 svn_fs__id_copy_id (id),
-                                 svn_fs__id_txn_id (id), pool);
-      }
+  if (svn_fs_fs__get_id_txn (id))
+    {
+      /* This is a transaction node-rev. */
+      err = open_txn_node_rev (&revision_file, fs, svn_fs__id_node_id (id),
+                               svn_fs__id_copy_id (id),
+                               svn_fs_fs__get_id_txn (id), pool);
+    }
   else
     {
       /* This is a revision node-rev. */
       err = open_and_seek_revision (&revision_file, fs,
-                                    svn_fs__id_rev (id),
-                                    svn_fs__id_offset (id),
+                                    svn_fs_fs__get_id_rev (id),
+                                    svn_fs_fs__get_id_offset (id),
                                     pool);
     }
 
@@ -642,7 +686,7 @@
       if (APR_STATUS_IS_ENOENT (err->apr_err))
         {
           svn_error_clear (err);
-          return svn_fs__err_dangling_id (fs, id);
+          return svn_fs_fs__err_dangling_id (fs, id);
         }
       
       return err;
@@ -691,7 +735,8 @@
   value = apr_hash_get (headers, SVN_FS_FS__PROPS, APR_HASH_KEY_STRING);
   if (value)
     {
-      SVN_ERR (read_rep_offsets (&noderev->prop_rep, value, id->txn_id, pool));
+      SVN_ERR (read_rep_offsets (&noderev->prop_rep, value,
+                                 svn_fs_fs__get_id_txn (id), pool));
       noderev->prop_rep->is_directory_contents = FALSE;
       noderev->prop_rep->is_data_rep = FALSE;
     }
@@ -700,7 +745,8 @@
   value = apr_hash_get (headers, SVN_FS_FS__TEXT, APR_HASH_KEY_STRING);
   if (value)
     {
-      SVN_ERR (read_rep_offsets (&noderev->data_rep, value, id->txn_id, pool));
+      SVN_ERR (read_rep_offsets (&noderev->data_rep, value,
+                                 svn_fs_fs__get_id_txn (id), pool));
       noderev->data_rep->is_data_rep = TRUE;
     }
 
@@ -728,7 +774,7 @@
   if (value == NULL)
     {
       noderev->copyroot_path = apr_pstrdup (pool, noderev->created_path);
-      noderev->copyroot_rev = svn_fs__id_rev (noderev->id);
+      noderev->copyroot_rev = svn_fs_fs__get_id_rev (noderev->id);
     }
   else
     {
@@ -736,8 +782,8 @@
 
       str = apr_strtok (value, " ", &last_str);
       if (str == NULL)
-          return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
-                                   "Malformed copyroot line in node-rev");
+        return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                                 "Malformed copyroot line in node-rev");
 
       noderev->copyroot_rev = atoi (str);
       
@@ -760,8 +806,8 @@
 
       str = apr_strtok (value, " ", &last_str);
       if (str == NULL)
-          return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
-                                   "Malformed copyfrom line in node-rev");
+        return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                                 "Malformed copyfrom line in node-rev");
 
       noderev->copyfrom_rev = atoi (str);
       
@@ -782,7 +828,7 @@
 /* Return a formatted string that represents the location of
    representation REP.  Perform the allocation from POOL. */
 static char *
-representation_string (svn_fs__representation_t *rep,
+representation_string (representation_t *rep,
                        apr_pool_t *pool)
 {
   const char *rev;
@@ -799,7 +845,7 @@
    allocations are from POOL. */
 static svn_error_t *
 write_noderev_txn (apr_file_t *file,
-                   svn_fs__node_revision_t *noderev,
+                   node_revision_t *noderev,
                    apr_pool_t *pool)
 {
   svn_stream_t *outfile;
@@ -840,7 +886,7 @@
                                 noderev->copyfrom_rev,
                                 noderev->copyfrom_path));
 
-  if ((noderev->copyroot_rev != svn_fs__id_rev (noderev->id)) ||
+  if ((noderev->copyroot_rev != svn_fs_fs__get_id_rev (noderev->id)) ||
       (strcmp (noderev->copyroot_path, noderev->created_path) != 0))
     SVN_ERR (svn_stream_printf (outfile, pool, SVN_FS_FS__COPYROOT ": %"
                                 SVN_REVNUM_T_FMT " %s\n",
@@ -853,21 +899,22 @@
 }
 
 svn_error_t *
-svn_fs__fs_put_node_revision (svn_fs_t *fs,
+svn_fs_fs__put_node_revision (svn_fs_t *fs,
                               const svn_fs_id_t *id,
-                              svn_fs__node_revision_t *noderev,
+                              node_revision_t *noderev,
                               apr_pool_t *pool)
 {
   const char *dirname;
   apr_file_t *noderev_file;
 
-  if (! id->txn_id)
+  if (! svn_fs_fs__get_id_txn (id))
     return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
                              "Attempted to write to non-transaction.");
 
   /* Write out the new node-rev file in this transaction. */
-  dirname = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
-                                apr_pstrcat (pool, id->txn_id, ".txn", NULL),
+  dirname = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
+                                apr_pstrcat (pool, svn_fs_fs__get_id_txn (id),
+                                             ".txn", NULL),
                                 apr_psprintf (pool, "%s.%s", id->node_id,
                                               id->copy_id),
                                 NULL);
@@ -1012,9 +1059,12 @@
   
   /* We will assume that the last line containing the two offsets
      will never be longer than 64 characters. */
-  offset = -64;
+  offset = 0;
   SVN_ERR (svn_io_file_seek (rev_file, APR_END, &offset, pool));
 
+  offset -= 64;
+  SVN_ERR (svn_io_file_seek (rev_file, APR_SET, &offset, pool));
+
   /* Read in this last block, from which we will identify the last line. */
   num_bytes=64;
   SVN_ERR (svn_io_file_read (rev_file, buf, &num_bytes, pool));
@@ -1059,7 +1109,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_rev_get_root (svn_fs_id_t **root_id_p,
+svn_fs_fs__rev_get_root (svn_fs_id_t **root_id_p,
                          svn_fs_t *fs,
                          svn_revnum_t rev,
                          apr_pool_t *pool)
@@ -1073,11 +1123,11 @@
 
   SVN_ERR (svn_io_file_open (&revision_file,
                              svn_path_join_many (pool, 
-                                                 fs->fs_path,
+                                                 fs->path,
                                                  SVN_FS_FS__REVS_DIR,
                                                  revision_filename,
                                                  NULL),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   SVN_ERR (get_root_changes_offset (&root_offset, NULL, revision_file, pool));
 
@@ -1091,7 +1141,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_set_revision_proplist (svn_fs_t *fs,
+svn_fs_fs__set_revision_proplist (svn_fs_t *fs,
                                   svn_revnum_t rev,
                                   apr_hash_t *proplist,
                                   apr_pool_t *pool)
@@ -1103,7 +1153,7 @@
 
   SVN_ERR (svn_io_file_open (&revprop_file,
                              svn_path_join_many (pool,
-                                                 fs->fs_path,
+                                                 fs->path,
                                                  SVN_FS_FS__REVPROPS_DIR, 
                                                  revprop_filename,
                                                  NULL),
@@ -1118,7 +1168,7 @@
 }  
 
 svn_error_t *
-svn_fs__fs_revision_proplist (apr_hash_t **proplist_p,
+svn_fs_fs__revision_proplist (apr_hash_t **proplist_p,
                               svn_fs_t *fs,
                               svn_revnum_t rev,
                               apr_pool_t *pool)
@@ -1131,7 +1181,7 @@
 
   SVN_ERR (svn_io_file_open (&revprop_file,
                              svn_path_join_many (pool,
-                                                 fs->fs_path,
+                                                 fs->path,
                                                  SVN_FS_FS__REVPROPS_DIR, 
                                                  revprop_filename,
                                                  NULL),
@@ -1172,10 +1222,10 @@
                 struct rep_state **src_state,
                 svn_fs_t *fs,
                 const svn_fs_id_t *id,
-                svn_fs__representation_t *first_rep,
+                representation_t *first_rep,
                 apr_pool_t *pool)
 {
-  svn_fs__representation_t rep;
+  representation_t rep;
   struct rep_state *rs;
   struct rep_args_t *rep_args;
   apr_file_t *file;
@@ -1264,7 +1314,7 @@
 rep_read_get_baton (struct rep_read_baton **rb_p,
                     svn_fs_t *fs,
                     const svn_fs_id_t *id,
-                    svn_fs__representation_t *rep,
+                    representation_t *rep,
                     apr_pool_t *pool)
 {
   struct rep_read_baton *b;
@@ -1390,7 +1440,8 @@
       rs = rb->src_state;
       if (copy_len > rs->end - rs->off)
         copy_len = rs->end - rs->off;
-      SVN_ERR (svn_io_file_read_full (rs->file, cur, copy_len, NULL, rb->pool));
+      SVN_ERR (svn_io_file_read_full (rs->file, cur, copy_len, NULL,
+                                      rb->pool));
       rs->off += copy_len;
       *len = copy_len;
       return SVN_NO_ERROR;
@@ -1485,7 +1536,7 @@
 get_representation_at_offset (svn_stream_t **contents_p,
                               svn_fs_t *fs,
                               const svn_fs_id_t *id,
-                              svn_fs__representation_t *rep,
+                              representation_t *rep,
                               apr_pool_t *pool)
 {
   struct rep_read_baton *rb;
@@ -1506,9 +1557,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_get_contents (svn_stream_t **contents_p,
+svn_fs_fs__get_contents (svn_stream_t **contents_p,
                          svn_fs_t *fs,
-                         svn_fs__node_revision_t *noderev,
+                         node_revision_t *noderev,
                          apr_pool_t *pool)
 {
   SVN_ERR (get_representation_at_offset (contents_p, fs, noderev->id,
@@ -1518,9 +1569,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_rep_contents_dir (apr_hash_t **entries_p,
+svn_fs_fs__rep_contents_dir (apr_hash_t **entries_p,
                              svn_fs_t *fs,
-                             svn_fs__node_revision_t *noderev,
+                             node_revision_t *noderev,
                              apr_pool_t *pool)
 {
   svn_stream_t *rep;
@@ -1530,7 +1581,7 @@
   entries = apr_hash_make (pool);
 
   /* Read in the directory hash. */
-  SVN_ERR (svn_fs__fs_get_contents (&rep, fs, noderev, pool));
+  SVN_ERR (svn_fs_fs__get_contents (&rep, fs, noderev, pool));
   SVN_ERR (hash_read (entries, rep, pool));
   SVN_ERR (svn_stream_close (rep));
 
@@ -1552,8 +1603,8 @@
 
       str = apr_strtok (str_val, " ", &last_str);
       if (str == NULL)
-          return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
-                                   "Directory entry corrupt");
+        return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                                 "Directory entry corrupt");
       
       if (strcmp (str, SVN_FS_FS__FILE) == 0)
         {
@@ -1583,9 +1634,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_get_proplist (apr_hash_t **proplist_p,
+svn_fs_fs__get_proplist (apr_hash_t **proplist_p,
                          svn_fs_t *fs,
-                         svn_fs__node_revision_t *noderev,
+                         node_revision_t *noderev,
                          apr_pool_t *pool)
 {
   apr_hash_t *proplist;
@@ -1606,8 +1657,8 @@
 }
 
 svn_error_t *
-svn_fs__fs_file_length (svn_filesize_t *length,
-                        svn_fs__node_revision_t *noderev,
+svn_fs_fs__file_length (svn_filesize_t *length,
+                        node_revision_t *noderev,
                         apr_pool_t *pool)
 {
   *length = noderev->data_rep->expanded_size;
@@ -1616,8 +1667,8 @@
 }
 
 svn_boolean_t
-svn_fs__fs_noderev_same_rep_key (svn_fs__representation_t *a,
-                                 svn_fs__representation_t *b)
+svn_fs_fs__noderev_same_rep_key (representation_t *a,
+                                 representation_t *b)
 {
   if (a == b)
     return TRUE;
@@ -1638,8 +1689,8 @@
 }
 
 svn_error_t *
-svn_fs__fs_file_checksum (unsigned char digest[],
-                          svn_fs__node_revision_t *noderev,
+svn_fs_fs__file_checksum (unsigned char digest[],
+                          node_revision_t *noderev,
                           apr_pool_t *pool)
 {
   memcpy (digest, noderev->data_rep->checksum, APR_MD5_DIGESTSIZE);
@@ -1647,11 +1698,11 @@
   return SVN_NO_ERROR;
 }
 
-svn_fs__representation_t *
-svn_fs__fs_rep_copy (svn_fs__representation_t *rep,
+representation_t *
+svn_fs_fs__rep_copy (representation_t *rep,
                      apr_pool_t *pool)
 {
-  svn_fs__representation_t *rep_new;
+  representation_t *rep_new;
   
   if (rep == NULL)
     return NULL;
@@ -1665,29 +1716,41 @@
 
 /* Merge the internal-use-only CHANGE into a hash of public-FS
    svn_fs_path_change_t CHANGES, collapsing multiple changes into a
-   single summarical (is that real word?) change per path. */
+   single summarical (is that real word?) change per path.  Also keep
+   the COPYFROM_HASH up to date with new adds and replaces.  */
 static svn_error_t *
 fold_change (apr_hash_t *changes,
-             const svn_fs__change_t *change)
+             const change_t *change,
+             apr_hash_t *copyfrom_hash)
 {
   apr_pool_t *pool = apr_hash_pool_get (changes);
+  apr_pool_t *copyfrom_pool = apr_hash_pool_get (copyfrom_hash);
   svn_fs_path_change_t *old_change, *new_change;
-  const char *path;
+  const char *path, *copyfrom_string, *copyfrom_path = NULL;
 
   if ((old_change = apr_hash_get (changes, change->path, APR_HASH_KEY_STRING)))
     {
       /* This path already exists in the hash, so we have to merge
          this change into the already existing one. */
 
+      /* Get the existing copyfrom entry for this path. */
+      copyfrom_string = apr_hash_get (copyfrom_hash, change->path,
+                                      APR_HASH_KEY_STRING);
+
+      /* If this entry existed in the copyfrom hash, we don't need to
+         copy it. */
+      if (copyfrom_string)
+        copyfrom_path = change->path;
+
       /* Since the path already exists in the hash, we don't have to
          dup the allocation for the path itself. */
       path = change->path;
       /* Sanity check:  only allow NULL node revision ID in the
          `reset' case. */
       if ((! change->noderev_id) && (change->kind != svn_fs_path_change_reset))
-                return svn_error_create
-                  (SVN_ERR_FS_CORRUPT, NULL,
-                   "Missing required node revision ID");
+        return svn_error_create
+          (SVN_ERR_FS_CORRUPT, NULL,
+           "Missing required node revision ID");
 
       /* Sanity check: we should be talking about the same node
          revision ID as our last change except where the last change
@@ -1695,9 +1758,10 @@
       if (change->noderev_id
           && (! svn_fs__id_eq (old_change->node_rev_id, change->noderev_id))
           && (old_change->change_kind != svn_fs_path_change_delete))
-                return svn_error_create
-                  (SVN_ERR_FS_CORRUPT, NULL,
-                   "Invalid change ordering: new node revision ID without delete");
+        return svn_error_create
+          (SVN_ERR_FS_CORRUPT, NULL,
+           "Invalid change ordering: new node revision ID "
+           "without delete");
 
       /* Sanity check: an add, replacement, or reset must be the first
          thing to follow a deletion. */
@@ -1705,9 +1769,9 @@
           && (! ((change->kind == svn_fs_path_change_replace)
                  || (change->kind == svn_fs_path_change_reset)
                  || (change->kind == svn_fs_path_change_add))))
-                return svn_error_create
-                  (SVN_ERR_FS_CORRUPT, NULL,
-                   "Invalid change ordering: non-add change on deleted path");
+        return svn_error_create
+          (SVN_ERR_FS_CORRUPT, NULL,
+           "Invalid change ordering: non-add change on deleted path");
 
       /* Now, merge that change in. */
       switch (change->kind)
@@ -1716,6 +1780,7 @@
           /* A reset here will simply remove the path change from the
              hash. */
           old_change = NULL;
+          copyfrom_string = NULL;
           break;
 
         case svn_fs_path_change_delete:
@@ -1733,6 +1798,7 @@
               old_change->text_mod = change->text_mod;
               old_change->prop_mod = change->prop_mod;
             }
+          copyfrom_string = NULL;
           break;
 
         case svn_fs_path_change_add:
@@ -1743,6 +1809,17 @@
           old_change->node_rev_id = svn_fs__id_copy (change->noderev_id, pool);
           old_change->text_mod = change->text_mod;
           old_change->prop_mod = change->prop_mod;
+          if (change->copyfrom_rev == SVN_INVALID_REVNUM)
+            {
+              copyfrom_string = apr_pstrdup (copyfrom_pool, "");
+            }
+          else
+            {
+              copyfrom_string = apr_psprintf (copyfrom_pool,
+                                              "%" SVN_REVNUM_T_FMT " %s",
+                                              change->copyfrom_rev,
+                                              change->copyfrom_path);
+            }
           break;
 
         case svn_fs_path_change_modify:
@@ -1767,27 +1844,50 @@
       new_change->change_kind = change->kind;
       new_change->text_mod = change->text_mod;
       new_change->prop_mod = change->prop_mod;
+      if (change->copyfrom_rev != SVN_INVALID_REVNUM)
+        {
+          copyfrom_string = apr_psprintf (copyfrom_pool, "%" SVN_REVNUM_T_FMT
+                                          " %s", change->copyfrom_rev,
+                                          change->copyfrom_path);
+        }
+      else
+        {
+          copyfrom_string = apr_pstrdup (copyfrom_pool, "");
+        }
       path = apr_pstrdup (pool, change->path);
     }
 
   /* Add (or update) this path. */
   apr_hash_set (changes, path, APR_HASH_KEY_STRING, new_change);
 
+  /* If we don't yet have a path string allocated in the copyfrom_hash
+     get something to use.  If we are adding an entry, allocate
+     something new, otherwise we just need a key and the one allocated
+     for the changes hash will work. */
+  if (! copyfrom_path)
+    {
+      copyfrom_path = copyfrom_string ? apr_pstrdup (copyfrom_pool, path)
+        : path;
+    }
+  
+  apr_hash_set (copyfrom_hash, copyfrom_path, APR_HASH_KEY_STRING,
+                copyfrom_string);
+
   return SVN_NO_ERROR;
 }
 
 
-/* Read the next line in the changes record from file FILE and store
+/* Read the next entry in the changes record from file FILE and store
    the resulting change in *CHANGE_P.  If there is no next record,
    store NULL there.  Perform all allocations from POOL. */
 static svn_error_t *
-read_change (svn_fs__change_t **change_p,
+read_change (change_t **change_p,
              apr_file_t *file,
              apr_pool_t *pool)
 {
   char buf[4096];
   apr_size_t len = sizeof (buf);
-  svn_fs__change_t *change;
+  change_t *change;
   char *str, *last_str;
   svn_error_t *err;
 
@@ -1894,21 +1994,52 @@
   /* Get the changed path. */
   change->path = apr_pstrdup (pool, last_str);
 
+
+  /* Read the next line, the copyfrom line. */
+  SVN_ERR (svn_io_read_length_line (file, buf, &len, pool));
+
+  if (len == 0)
+    {
+      change->copyfrom_rev = SVN_INVALID_REVNUM;
+      change->copyfrom_path = NULL;
+    }
+  else
+    {
+      str = apr_strtok (buf, " ", &last_str);
+      if (! str)
+        return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                                 "Invalid changes line in rev-file");
+      change->copyfrom_rev = atol (str);
+
+      if (! last_str)
+        return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                                 "Invalid changes line in rev-file");
+
+      change->copyfrom_path = apr_pstrdup (pool, last_str);
+    }
+  
   *change_p = change;
 
   return SVN_NO_ERROR;
 }
 
 /* Fetch all the changed path entries from FILE and store then in
-   *CHANGED_PATHS.  Folding is done to remove redundant or unnecessary
-   *data.  Do all allocations in POOL. */
+ *CHANGED_PATHS.  Folding is done to remove redundant or unnecessary
+ *data.  Store a hash of paths to copyfrom revisions/paths in
+ COPYFROM_HASH if it is non-NULL.  Do all allocations in POOL. */
 static svn_error_t *
 fetch_all_changes (apr_hash_t *changed_paths,
+                   apr_hash_t *copyfrom_hash,
                    apr_file_t *file,
                    apr_pool_t *pool)
 {
-  svn_fs__change_t *change;
+  change_t *change;
   apr_pool_t *iterpool = svn_pool_create (pool);
+  apr_hash_t *my_hash;
+
+  /* If we are passed a NULL copyfrom hash, manufacture one for the
+     duration of this call. */
+  my_hash = copyfrom_hash ? copyfrom_hash : apr_hash_make (pool);
   
   /* Read in the changes one by one, folding them into our local hash
      as necessary. */
@@ -1917,14 +2048,14 @@
 
   while (change)
     {
-      SVN_ERR (fold_change (changed_paths, change));
+      SVN_ERR (fold_change (changed_paths, change, my_hash));
 
       /* Now, if our change was a deletion or replacement, we have to
          blow away any changes thus far on paths that are (or, were)
          children of this path.
          ### i won't bother with another iteration pool here -- at
-             most we talking about a few extra dups of paths into what
-             is already a temporary subpool.
+         most we talking about a few extra dups of paths into what
+         is already a temporary subpool.
       */
 
       if ((change->kind == svn_fs_path_change_delete)
@@ -1964,7 +2095,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_txn_changes_fetch (apr_hash_t **changed_paths_p,
+svn_fs_fs__txn_changes_fetch (apr_hash_t **changed_paths_p,
                               svn_fs_t *fs,
                               const char *txn_id,
                               apr_pool_t *pool)
@@ -1973,16 +2104,17 @@
   apr_file_t *file;
   apr_hash_t *changed_paths = apr_hash_make (pool);
 
-  changes = svn_path_join_many (pool, fs->fs_path,
+  changes = svn_path_join_many (pool, fs->path,
                                 SVN_FS_FS__TXNS_DIR,
                                 apr_pstrcat (pool, txn_id,
                                              SVN_FS_FS__TXNS_EXT,
                                              NULL),
                                 SVN_FS_FS__CHANGES, NULL);
 
-  SVN_ERR (svn_io_file_open (&file, changes, APR_READ, APR_OS_DEFAULT, pool));
+  SVN_ERR (svn_io_file_open (&file, changes, APR_READ | APR_BUFFERED,
+                             APR_OS_DEFAULT, pool));
 
-  SVN_ERR (fetch_all_changes (changed_paths, file, pool));
+  SVN_ERR (fetch_all_changes (changed_paths, NULL, file, pool));
 
   SVN_ERR (svn_io_file_close (file, pool));
 
@@ -1992,9 +2124,10 @@
 }
 
 svn_error_t *
-svn_fs__fs_paths_changed (apr_hash_t **changed_paths_p,
+svn_fs_fs__paths_changed (apr_hash_t **changed_paths_p,
                           svn_fs_t *fs,
                           svn_revnum_t rev,
+                          apr_hash_t *copyfrom_cache,
                           apr_pool_t *pool)
 {
   char *revision_filename;
@@ -2006,11 +2139,11 @@
 
   SVN_ERR (svn_io_file_open (&revision_file,
                              svn_path_join_many (pool, 
-                                                 fs->fs_path,
+                                                 fs->path,
                                                  SVN_FS_FS__REVS_DIR,
                                                  revision_filename,
                                                  NULL),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   SVN_ERR (get_root_changes_offset (NULL, &changes_offset, revision_file,
                                     pool));
@@ -2019,7 +2152,8 @@
 
   changed_paths = apr_hash_make (pool);
 
-  SVN_ERR (fetch_all_changes (changed_paths, revision_file, pool));
+  SVN_ERR (fetch_all_changes (changed_paths, copyfrom_cache, revision_file,
+                              pool));
   
   /* Close the revision file. */
   SVN_ERR (svn_io_file_close (revision_file, pool));
@@ -2037,12 +2171,12 @@
                                  svn_fs_id_t *src,
                                  apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   svn_fs_id_t *my_id;
 
-  SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, src, pool));
+  SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, src, pool));
 
-  if (svn_fs__id_txn_id (noderev->id))
+  if (svn_fs_fs__get_id_txn (noderev->id))
     return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
                              "Copying from transactions not allowed.");
 
@@ -2054,25 +2188,25 @@
   /* For the transaction root, the copyroot never changes. */
 
   my_id = svn_fs__id_copy (noderev->id, pool);
-  my_id->txn_id = apr_pstrdup (pool, txn_id);
-  my_id->rev = SVN_INVALID_REVNUM;
+  SVN_ERR (svn_fs_fs__set_id_txn (my_id, txn_id, pool));
   noderev->id = my_id;
 
-  SVN_ERR (svn_fs__fs_put_node_revision (fs, noderev->id, noderev, pool));
+  SVN_ERR (svn_fs_fs__put_node_revision (fs, noderev->id, noderev, pool));
 
   return SVN_NO_ERROR;
 }
 
-svn_error_t *svn_fs__fs_begin_txn (svn_fs_txn_t **txn_p,
-                                   svn_fs_t *fs,
-                                   svn_revnum_t rev,
-                                   apr_pool_t *pool)
+svn_error_t *
+svn_fs_fs__create_txn (svn_fs_txn_t **txn_p,
+                       svn_fs_t *fs,
+                       svn_revnum_t rev,
+                       apr_pool_t *pool)
 {
   apr_file_t *txn_file, *next_ids_file;
   svn_stream_t *next_ids_stream;
   svn_fs_txn_t *txn;
   svn_fs_id_t *root_id;
-  char *txn_filename = svn_path_join_many (pool, fs->fs_path,
+  char *txn_filename = svn_path_join_many (pool, fs->path,
                                            SVN_FS_FS__TXNS_DIR, "XXXXXX",
                                            NULL);
   char *txn_dirname;
@@ -2101,7 +2235,7 @@
   *txn_p = txn;
   
   /* Create a new root node for this transaction. */
-  SVN_ERR (svn_fs__fs_rev_get_root (&root_id, fs, rev, pool));
+  SVN_ERR (svn_fs_fs__rev_get_root (&root_id, fs, rev, pool));
   SVN_ERR (create_new_txn_noderev_from_rev (fs, txn->id, root_id, pool));
 
   /* Create an empty rev file. */
@@ -2143,7 +2277,7 @@
   apr_file_t *txn_prop_file;
   const char *prop_filename;
 
-  prop_filename = svn_path_join_many (pool, fs->fs_path,
+  prop_filename = svn_path_join_many (pool, fs->path,
                                       SVN_FS_FS__TXNS_DIR,
                                       apr_pstrcat (pool, txn_id,
                                                    SVN_FS_FS__TXNS_EXT, NULL),
@@ -2165,7 +2299,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_change_txn_prop (svn_fs_txn_t *txn,
+svn_fs_fs__change_txn_prop (svn_fs_txn_t *txn,
                             const char *name,
                             const svn_string_t *value,
                             apr_pool_t *pool)
@@ -2182,7 +2316,7 @@
   /* Create a new version of the file and write out the new props. */
   /* Open the transaction properties file. */
   SVN_ERR (svn_io_file_open (&txn_prop_file, prop_filename,
-                             APR_READ | APR_WRITE | APR_CREATE | APR_TRUNCATE,
+                             APR_WRITE | APR_CREATE | APR_TRUNCATE,
                              APR_OS_DEFAULT, pool));
 
   SVN_ERR (svn_hash_write (txn_prop, txn_prop_file, pool));
@@ -2193,13 +2327,13 @@
 }
 
 svn_error_t *
-svn_fs__fs_get_txn (svn_fs__transaction_t **txn_p,
+svn_fs_fs__get_txn (transaction_t **txn_p,
                     svn_fs_t *fs,
                     const char *txn_id,
                     apr_pool_t *pool)
 {
-  svn_fs__transaction_t *txn;
-  svn_fs__node_revision_t *noderev;
+  transaction_t *txn;
+  node_revision_t *noderev;
   svn_fs_id_t *root_id;
 
   txn = apr_pcalloc (pool, sizeof (*txn));
@@ -2211,13 +2345,13 @@
                                apr_pstrcat (pool, "t", txn_id, NULL),
                                pool);
 
-  SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, root_id, pool));
+  SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, root_id, pool));
 
   txn->root_id = svn_fs__id_copy (noderev->id, pool);
   txn->base_id = svn_fs__id_copy (noderev->predecessor_id, pool);
   txn->copies = NULL;
 
-  txn->kind = svn_fs__transaction_kind_normal;
+  txn->kind = transaction_kind_normal;
 
   *txn_p = txn;
 
@@ -2238,7 +2372,7 @@
   apr_file_t *file;
   svn_stream_t *out_stream;
 
-  id_filename = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  id_filename = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                     apr_pstrcat (pool, txn_id,
                                                  SVN_FS_FS__TXNS_EXT, NULL),
                                     SVN_FS_FS__NEXT_IDS, NULL);
@@ -2267,17 +2401,17 @@
 {
   apr_file_t *file;
   const char *id_filename;
-  char buf[SVN_FS__MAX_KEY_SIZE*2+3];
+  char buf[MAX_KEY_SIZE*2+3];
   apr_size_t limit;
   char *str, *last_str;
 
-  id_filename = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  id_filename = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                     apr_pstrcat (pool, txn_id,
                                                  SVN_FS_FS__TXNS_EXT, NULL),
                                     SVN_FS_FS__NEXT_IDS, NULL);
 
-  SVN_ERR (svn_io_file_open (&file, id_filename, APR_READ, APR_OS_DEFAULT,
-                             pool));
+  SVN_ERR (svn_io_file_open (&file, id_filename, APR_READ | APR_BUFFERED,
+                             APR_OS_DEFAULT, pool));
 
   limit = sizeof (buf);
   SVN_ERR (svn_io_read_length_line (file, buf, &limit, pool));
@@ -2322,7 +2456,7 @@
   node_id = apr_pcalloc (pool, strlen (cur_node_id) + 2);
 
   len = strlen(cur_node_id);
-  svn_fs__next_key (cur_node_id, &len, node_id);
+  svn_fs_fs__next_key (cur_node_id, &len, node_id);
 
   SVN_ERR (write_next_ids (fs, txn_id, node_id, cur_copy_id, pool));
 
@@ -2332,9 +2466,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_create_node (const svn_fs_id_t **id_p,
+svn_fs_fs__create_node (const svn_fs_id_t **id_p,
                         svn_fs_t *fs,
-                        svn_fs__node_revision_t *noderev,
+                        node_revision_t *noderev,
                         const char *copy_id,
                         const char *txn_id,
                         apr_pool_t *pool)
@@ -2351,7 +2485,7 @@
 
   noderev->id = id;
 
-  SVN_ERR (svn_fs__fs_put_node_revision (fs, noderev->id, noderev, pool));
+  SVN_ERR (svn_fs_fs__put_node_revision (fs, noderev->id, noderev, pool));
 
   *id_p = id;
 
@@ -2359,14 +2493,14 @@
 }
 
 svn_error_t *
-svn_fs__fs_purge_txn (svn_fs_t *fs,
+svn_fs_fs__purge_txn (svn_fs_t *fs,
                       const char *txn_id,
                       apr_pool_t *pool)
 {
   const char *txn_dir;
   svn_error_t *err;
   
-  txn_dir = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  txn_dir = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                 apr_pstrcat (pool, txn_id,
                                              SVN_FS_FS__TXNS_EXT, NULL), NULL);
 
@@ -2379,16 +2513,16 @@
   if (err && APR_STATUS_IS_ENOENT (err->apr_err))
     {
       svn_error_clear (err);
-      return svn_fs__err_txn_not_mutable (fs, txn_id);
+      return svn_fs_fs__err_txn_not_mutable (fs, txn_id);
     }
   
   return err;
 }
 
 /* Given a hash ENTRIES of dirent structions, return a hash in
-   *STR_ENTRIES_P, that has svn_string_t as the values in the format
-   specified by the fs_fs directory contents file.  Perform
-   allocations in POOL. */
+ *STR_ENTRIES_P, that has svn_string_t as the values in the format
+ specified by the fs_fs directory contents file.  Perform
+ allocations in POOL. */
 static svn_error_t *
 unparse_dir_entries (apr_hash_t **str_entries_p,
                      apr_hash_t *entries,
@@ -2424,9 +2558,9 @@
 
 
 svn_error_t *
-svn_fs__fs_set_entry (svn_fs_t *fs,
+svn_fs_fs__set_entry (svn_fs_t *fs,
                       const char *txn_id,
-                      svn_fs__node_revision_t *parent_noderev,
+                      node_revision_t *parent_noderev,
                       const char *name,
                       const svn_fs_id_t *id,
                       svn_node_kind_t kind,
@@ -2437,7 +2571,7 @@
   svn_stream_t *out_stream;
 
   /* First read in the existing directory entry. */
-  SVN_ERR (svn_fs__fs_rep_contents_dir (&entries, fs, parent_noderev, pool));
+  SVN_ERR (svn_fs_fs__rep_contents_dir (&entries, fs, parent_noderev, pool));
 
   if (id)
     {
@@ -2448,7 +2582,7 @@
   apr_hash_set (entries, name, APR_HASH_KEY_STRING, dirent);
 
   SVN_ERR (unparse_dir_entries (&str_entries, entries, pool));
-  SVN_ERR (svn_fs__fs_set_contents (&out_stream, fs, parent_noderev, pool));
+  SVN_ERR (svn_fs_fs__set_contents (&out_stream, fs, parent_noderev, pool));
   SVN_ERR (hash_write (str_entries, out_stream, pool));
   SVN_ERR (svn_stream_close (out_stream));
 
@@ -2456,13 +2590,15 @@
 }
 
 svn_error_t *
-svn_fs__fs_add_change (svn_fs_t *fs,
+svn_fs_fs__add_change (svn_fs_t *fs,
                        const char *txn_id,
                        const char *path,
                        const svn_fs_id_t *id,
                        svn_fs_path_change_kind_t change_kind,
                        svn_boolean_t text_mod,
                        svn_boolean_t prop_mod,
+                       svn_revnum_t copyfrom_rev,
+                       const char *copyfrom_path,
                        apr_pool_t *pool)
 {
   apr_file_t *file;
@@ -2470,7 +2606,7 @@
   const char *txn_dir, *change_string;
   const char *idstr;
 
-  txn_dir = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  txn_dir = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                 apr_pstrcat (pool, txn_id,
                                              SVN_FS_FS__TXNS_EXT, NULL),
                                 NULL);
@@ -2517,6 +2653,16 @@
                               prop_mod ? SVN_FS_FS__TRUE : SVN_FS_FS__FALSE,
                               path));
 
+  if (copyfrom_rev != SVN_INVALID_REVNUM)
+    {
+      SVN_ERR (svn_stream_printf (stream, pool, "%" SVN_REVNUM_T_FMT " %s\n",
+                                  copyfrom_rev, copyfrom_path));
+    }
+  else
+    {
+      SVN_ERR (svn_stream_printf (stream, pool, "\n"));
+    }
+
   SVN_ERR (svn_stream_close (stream));
 
   return SVN_NO_ERROR;
@@ -2547,7 +2693,7 @@
   svn_filesize_t rep_size;
 
   /* The node revision for which we're writing out info. */
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
   /* Is this the data representation? */
   svn_boolean_t is_data_rep;
@@ -2606,8 +2752,8 @@
   apr_off_t offset;
   int open_flag;
 
-  txn_dir = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
-                                apr_pstrcat (pool, id->txn_id,
+  txn_dir = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
+                                apr_pstrcat (pool, svn_fs_fs__get_id_txn (id),
                                              SVN_FS_FS__TXNS_EXT, NULL),
                                 NULL);
 
@@ -2658,13 +2804,13 @@
    representation in *REP to use as the base for a text representation
    delta.  Perform temporary allocations in *POOL. */
 static svn_error_t *
-choose_delta_base (svn_fs__representation_t **rep,
+choose_delta_base (representation_t **rep,
                    svn_fs_t *fs,
-                   svn_fs__node_revision_t *noderev,
+                   node_revision_t *noderev,
                    apr_pool_t *pool)
 {
   int count, i;
-  svn_fs__node_revision_t *base;
+  node_revision_t *base;
 
   /* If we have no predecessors, then use the empty stream as a
      base. */
@@ -2683,8 +2829,8 @@
   base = noderev;
 
   while ((count++) < noderev->predecessor_count)
-      SVN_ERR (svn_fs__fs_get_node_revision (&base, fs,
-                                             base->predecessor_id, pool));
+    SVN_ERR (svn_fs_fs__get_node_revision (&base, fs,
+                                           base->predecessor_id, pool));
 
   *rep = base->data_rep;
   
@@ -2697,14 +2843,14 @@
 static svn_error_t *
 rep_write_get_baton (struct rep_write_baton **wb_p,
                      svn_fs_t *fs,
-                     svn_fs__node_revision_t *noderev,
+                     node_revision_t *noderev,
                      svn_boolean_t is_data_rep,
                      apr_pool_t *pool)
 {
   struct rep_write_baton *b;
   apr_file_t *file;
   svn_boolean_t is_directory_contents;
-  svn_fs__representation_t *base_rep;
+  representation_t *base_rep;
   svn_stream_t *source;
 
   is_directory_contents = (is_data_rep) && (noderev->kind == svn_node_dir);
@@ -2752,8 +2898,9 @@
       /* Write out the rep header. */
       if (base_rep)
         {
-          header = apr_psprintf (b->pool, SVN_FS_FS__DELTA " %" SVN_REVNUM_T_FMT
-                                 " %" APR_OFF_T_FMT " %" APR_SIZE_T_FMT "\n",
+          header = apr_psprintf (b->pool, SVN_FS_FS__DELTA " %"
+                                 SVN_REVNUM_T_FMT " %" APR_OFF_T_FMT " %"
+                                 APR_SIZE_T_FMT "\n",
                                  base_rep->revision, base_rep->offset,
                                  base_rep->size);
         }
@@ -2784,7 +2931,7 @@
 rep_write_contents_close (void *baton)
 {
   struct rep_write_baton *b = baton;
-  svn_fs__representation_t *rep;
+  representation_t *rep;
   apr_off_t offset;
 
   rep = apr_pcalloc (b->parent_pool, sizeof (*rep));
@@ -2801,7 +2948,7 @@
 
   /* Fill in the rest of the representation field. */
   rep->expanded_size = b->rep_size;
-  rep->txn_id = b->noderev->id->txn_id;
+  rep->txn_id = svn_fs_fs__get_id_txn (b->noderev->id);
   rep->revision = SVN_INVALID_REVNUM;
   if ((b->noderev->kind == svn_node_dir) && b->is_data_rep)
     rep->is_directory_contents = TRUE;
@@ -2822,7 +2969,7 @@
     }
 
   /* Write out the new node-rev information. */
-  SVN_ERR (svn_fs__fs_put_node_revision (b->fs, b->noderev->id, b->noderev,
+  SVN_ERR (svn_fs_fs__put_node_revision (b->fs, b->noderev->id, b->noderev,
                                          b->pool));
 
   svn_pool_destroy (b->pool);
@@ -2837,12 +2984,16 @@
 static svn_error_t *
 set_representation (svn_stream_t **contents_p,
                     svn_fs_t *fs,
-                    svn_fs__node_revision_t *noderev,
+                    node_revision_t *noderev,
                     svn_boolean_t is_data_rep,
                     apr_pool_t *pool)
 {
   struct rep_write_baton *wb;
 
+  if (! svn_fs_fs__get_id_txn (noderev->id))
+    return svn_error_create (SVN_ERR_FS_CORRUPT, NULL,
+                             "Attempted to write to non-transaction.");
+
   SVN_ERR (rep_write_get_baton (&wb, fs, noderev, is_data_rep, pool));
 
   *contents_p = svn_stream_create (wb, pool);
@@ -2853,9 +3004,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_set_contents (svn_stream_t **stream,
+svn_fs_fs__set_contents (svn_stream_t **stream,
                          svn_fs_t *fs,
-                         svn_fs__node_revision_t *noderev,
+                         node_revision_t *noderev,
                          apr_pool_t *pool)
 {
   SVN_ERR (set_representation (stream, fs, noderev, TRUE, pool));
@@ -2864,10 +3015,10 @@
 }
 
 svn_error_t *
-svn_fs__fs_create_successor (const svn_fs_id_t **new_id_p,
+svn_fs_fs__create_successor (const svn_fs_id_t **new_id_p,
                              svn_fs_t *fs,
                              const svn_fs_id_t *old_idp,
-                             svn_fs__node_revision_t *new_noderev,
+                             node_revision_t *new_noderev,
                              const char *copy_id,
                              const char *txn_id,
                              apr_pool_t *pool)
@@ -2883,11 +3034,12 @@
 
   if (! new_noderev->copyroot_path)
     {
-    new_noderev->copyroot_path = apr_pstrdup (pool, new_noderev->created_path);
-    new_noderev->copyroot_rev = svn_fs__id_rev (new_noderev->id);
+      new_noderev->copyroot_path = apr_pstrdup (pool,
+                                                new_noderev->created_path);
+      new_noderev->copyroot_rev = svn_fs_fs__get_id_rev (new_noderev->id);
     }
 
-  SVN_ERR (svn_fs__fs_put_node_revision (fs, new_noderev->id, new_noderev,
+  SVN_ERR (svn_fs_fs__put_node_revision (fs, new_noderev->id, new_noderev,
                                          pool));
 
   *new_id_p = id;
@@ -2896,8 +3048,8 @@
 }
 
 svn_error_t *
-svn_fs__fs_set_proplist (svn_fs_t *fs,
-                         svn_fs__node_revision_t *noderev,
+svn_fs_fs__set_proplist (svn_fs_t *fs,
+                         node_revision_t *noderev,
                          apr_hash_t *proplist,
                          apr_pool_t *pool)
 {
@@ -2925,9 +3077,9 @@
   char *str, *last_str;
 
   SVN_ERR (svn_io_file_open (&revision_file,
-                             svn_path_join (fs->fs_path, SVN_FS_FS__CURRENT,
+                             svn_path_join (fs->path, SVN_FS_FS__CURRENT,
                                             pool),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   len = sizeof (buf);
   SVN_ERR (svn_io_read_length_line (revision_file, buf, &len, pool));
@@ -3033,20 +3185,20 @@
                  const char *start_copy_id,
                  apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   apr_off_t my_offset;
-  char my_node_id[SVN_FS__MAX_KEY_SIZE + 2];
-  char my_copy_id[SVN_FS__MAX_KEY_SIZE + 2];
+  char my_node_id[MAX_KEY_SIZE + 2];
+  char my_copy_id[MAX_KEY_SIZE + 2];
   const char *my_txn_id;
   const svn_fs_id_t *new_id;
 
   *new_id_p = NULL;
   
   /* Check to see if this is a transaction node. */
-  if (! id->txn_id)
+  if (! svn_fs_fs__get_id_txn (id))
     return SVN_NO_ERROR;
 
-  SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, id, pool));
+  SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, id, pool));
 
   if (noderev->kind == svn_node_dir)
     {
@@ -3059,7 +3211,7 @@
       /* This is a directory.  Write out all the children first. */
       subpool = svn_pool_create (pool);
 
-      SVN_ERR (svn_fs__fs_rep_contents_dir (&entries, fs, noderev, pool));
+      SVN_ERR (svn_fs_fs__rep_contents_dir (&entries, fs, noderev, pool));
 
       for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi))
         {
@@ -3068,8 +3220,8 @@
           dirent = val;
           SVN_ERR (write_final_rev (&new_id, file, rev, fs, dirent->id,
                                     start_node_id, start_copy_id, subpool));
-          if (new_id && (new_id->rev == rev))
-              dirent->id = svn_fs__id_copy (new_id, pool);
+          if (new_id && (svn_fs_fs__get_id_rev (new_id) == rev))
+            dirent->id = svn_fs__id_copy (new_id, pool);
         }
       svn_pool_destroy (subpool);
 
@@ -3105,7 +3257,7 @@
     {
       apr_hash_t *proplist;
       
-      SVN_ERR (svn_fs__fs_get_proplist (&proplist, fs, noderev, pool));
+      SVN_ERR (svn_fs_fs__get_proplist (&proplist, fs, noderev, pool));
       SVN_ERR (get_file_offset (&noderev->prop_rep->offset, file, pool));
       SVN_ERR (write_hash_rep (&noderev->prop_rep->size,
                                noderev->prop_rep->checksum, file,
@@ -3121,7 +3273,8 @@
   
   if (noderev->id->node_id[0] == '_')
     {
-      svn_fs__add_keys (start_node_id, &noderev->id->node_id[1], my_node_id);
+      svn_fs_fs__add_keys (start_node_id, &noderev->id->node_id[1],
+                           my_node_id);
     }
   else
     {
@@ -3130,7 +3283,8 @@
 
   if (noderev->id->copy_id[0] == '_')
     {
-      svn_fs__add_keys (start_copy_id, &noderev->id->copy_id[1], my_copy_id);
+      svn_fs_fs__add_keys (start_copy_id, &noderev->id->copy_id[1],
+                           my_copy_id);
     }
   else
     {
@@ -3150,7 +3304,7 @@
   /* Write out our new node-revision. */
   SVN_ERR (write_noderev_txn (file, noderev, pool));
 
-  SVN_ERR (svn_fs__fs_put_node_revision (fs, id, noderev, pool));
+  SVN_ERR (svn_fs_fs__put_node_revision (fs, id, noderev, pool));
 
   /* Return our ID that references the revision file. */
   *new_id_p = noderev->id;
@@ -3177,7 +3331,7 @@
   
   SVN_ERR (get_file_offset (&offset, file, pool));
   
-  txn_dir = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__TXNS_DIR,
+  txn_dir = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                 apr_pstrcat (pool, txn_id,
                                              SVN_FS_FS__TXNS_EXT, NULL),
                                 NULL);
@@ -3185,7 +3339,7 @@
   SVN_ERR (svn_io_file_open (&changes_file, svn_path_join (txn_dir,
                                                            SVN_FS_FS__CHANGES,
                                                            pool),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   changes_stream = svn_stream_from_aprfile (changes_file, pool);
   
@@ -3196,12 +3350,13 @@
       char *str, *last_str;
       svn_stringbuf_t *line, *buf;
       svn_boolean_t eof;
-      svn_fs__node_revision_t *noderev;
+      node_revision_t *noderev;
       svn_fs_id_t *id;
 
       svn_pool_clear (iterpool);
       
-      SVN_ERR (svn_stream_readline (changes_stream, &line, "\n", &eof, iterpool));
+      SVN_ERR (svn_stream_readline (changes_stream, &line, "\n", &eof,
+                                    iterpool));
 
       /* Check of end of file. */
       if (eof)
@@ -3218,7 +3373,7 @@
         {
           id = svn_fs_parse_id (str, strlen (str), iterpool);
           
-          SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, id, iterpool));
+          SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, id, iterpool));
 
           /* noderev has the permanent node-id at this point, so we just
              substitute it for the temporary one. */
@@ -3236,6 +3391,15 @@
 
       SVN_ERR (svn_io_file_write_full (file, buf->data, buf->len, NULL,
                                        iterpool));
+
+      /* Read the copyfrom line. */
+      SVN_ERR (svn_stream_readline (changes_stream, &line, "\n", &eof,
+                                    iterpool));
+      
+      SVN_ERR (svn_io_file_write_full (file, line->data, line->len, NULL,
+                                       iterpool));
+
+      SVN_ERR (svn_io_file_write_full (file, "\n", 1, NULL, iterpool));
     }
 
   svn_pool_destroy (iterpool);
@@ -3259,8 +3423,8 @@
                      apr_pool_t *pool)
 {
   const char *txn_node_id, *txn_copy_id;
-  char new_node_id[SVN_FS__MAX_KEY_SIZE + 2];
-  char new_copy_id[SVN_FS__MAX_KEY_SIZE + 2];
+  char new_node_id[MAX_KEY_SIZE + 2];
+  char new_copy_id[MAX_KEY_SIZE + 2];
   char *buf;
   apr_file_t *file;
   
@@ -3268,17 +3432,18 @@
      the current file, to the next ids from the transaction file. */
   SVN_ERR (read_next_ids (&txn_node_id, &txn_copy_id, fs, txn_id, pool));
 
-  svn_fs__add_keys (start_node_id, txn_node_id, new_node_id);
-  svn_fs__add_keys (start_copy_id, txn_copy_id, new_copy_id);
+  svn_fs_fs__add_keys (start_node_id, txn_node_id, new_node_id);
+  svn_fs_fs__add_keys (start_copy_id, txn_copy_id, new_copy_id);
 
   /* Now we can just write out this line. */
   buf = apr_psprintf (pool, "%" SVN_REVNUM_T_FMT " %s %s\n", rev, new_node_id,
                       new_copy_id);
 
   SVN_ERR (svn_io_file_open (&file,
-                             svn_path_join (fs->fs_path, SVN_FS_FS__CURRENT,
+                             svn_path_join (fs->path, SVN_FS_FS__CURRENT,
                                             pool),
-                             APR_WRITE | APR_TRUNCATE, APR_OS_DEFAULT, pool));
+                             APR_WRITE | APR_TRUNCATE,
+                             APR_OS_DEFAULT, pool));
 
   SVN_ERR (svn_io_file_write_full (file, buf, strlen (buf), NULL, pool));
 
@@ -3296,7 +3461,7 @@
   const char *lock_filename;
   svn_node_kind_t kind;
   
-  lock_filename = svn_path_join (fs->fs_path, SVN_FS_FS__LOCK_FILE, pool);
+  lock_filename = svn_path_join (fs->path, SVN_FS_FS__LOCK_FILE, pool);
 
   SVN_ERR (svn_io_check_path (lock_filename, &kind, pool));
   if ((kind == svn_node_unknown) || (kind == svn_node_none))
@@ -3307,17 +3472,50 @@
   return SVN_NO_ERROR;
 }
 
+/* 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 POOL. */
+static svn_error_t *
+move_into_place (const char *old_filename, const char *new_filename,
+                 const char *perms_reference, apr_pool_t *pool)
+{
+  apr_status_t status;
+  apr_finfo_t finfo;
+  svn_error_t *err;
+
+#ifndef WIN32
+  /* Match the perms on the old file to the perms reference file. */
+  status = apr_stat (&finfo, perms_reference, APR_FINFO_PROT, pool);
+  if (! APR_STATUS_IS_SUCCESS (status))
+    return svn_error_wrap_apr (status, "Can't stat '%s'", perms_reference);
+  status = apr_file_perms_set (old_filename, finfo.protection);
+  if (! APR_STATUS_IS_SUCCESS (status))
+    return svn_error_wrap_apr (status, "Can't chmod '%s'", old_filename);
+#endif
+
+  /* Move the file into place. */
+  err = svn_io_file_rename (old_filename, new_filename, pool);
+  if (err && APR_STATUS_IS_EXDEV (err->apr_err))
+    {
+      /* Can't rename across devices; fall back to copying. */
+      svn_error_clear (err);
+      err = svn_io_copy_file (old_filename, new_filename, TRUE, pool);
+    }
+  return err;
+}
+
 svn_error_t *
-svn_fs__fs_commit (svn_revnum_t *new_rev_p,
+svn_fs_fs__commit (svn_revnum_t *new_rev_p,
                    svn_fs_t *fs,
                    svn_fs_txn_t *txn,
                    apr_pool_t *pool)
 {
-  const char *rev_filename, *proto_filename;
+  const char *old_rev_filename, *rev_filename, *proto_filename;
   const char *revprop_filename, *final_revprop;
   const svn_fs_id_t *root_id, *new_root_id;
   const char *start_node_id, *start_copy_id;
-  svn_revnum_t new_rev;
+  svn_revnum_t old_rev, new_rev;
   apr_pool_t *subpool = svn_pool_create (pool);
   apr_file_t *rev_file;
   apr_off_t  changed_path_offset, offset;
@@ -3327,32 +3525,41 @@
   SVN_ERR (get_write_lock (fs, subpool));
 
   /* Get the current youngest revision. */
-  SVN_ERR (svn_fs__fs_youngest_revision (&new_rev, fs, subpool));
+  SVN_ERR (svn_fs_fs__youngest_rev (&old_rev, fs, subpool));
 
   /* Get the next node_id and copy_id to use. */
   SVN_ERR (get_next_revision_ids (&start_node_id, &start_copy_id, fs,
                                   subpool));
 
   /* We are going to be one better than this puny old revision. */
-  new_rev++;
+  new_rev = old_rev + 1;
 
-  /* Copy the proto revision file into place. */
-  rev_filename = svn_path_join_many (subpool, fs->fs_path, SVN_FS_FS__REVS_DIR,
-                                     apr_psprintf (subpool, "%" SVN_REVNUM_T_FMT,
+  old_rev_filename = svn_path_join_many (subpool, fs->path,
+                                         SVN_FS_FS__REVS_DIR,
+                                         apr_psprintf (subpool, "%"
+                                                       SVN_REVNUM_T_FMT,
+                                                       old_rev),
+                                         NULL);
+
+  rev_filename = svn_path_join_many (subpool, fs->path, SVN_FS_FS__REVS_DIR,
+                                     apr_psprintf (subpool, "%"
+                                                   SVN_REVNUM_T_FMT,
                                                    new_rev),
                                      NULL);
 
-  proto_filename = svn_path_join_many (subpool, fs->fs_path,
+  proto_filename = svn_path_join_many (subpool, fs->path,
                                        SVN_FS_FS__TXNS_DIR,
                                        apr_pstrcat (subpool, txn->id,
                                                     SVN_FS_FS__TXNS_EXT, NULL),
                                        SVN_FS_FS__REV, NULL);
 
-  SVN_ERR (svn_io_copy_file (proto_filename, rev_filename, TRUE, subpool));
+  SVN_ERR (move_into_place (proto_filename, rev_filename, old_rev_filename,
+                            subpool));
 
   /* Get a write handle on the proto revision file. */
   SVN_ERR (svn_io_file_open (&rev_file, rev_filename,
-                             APR_WRITE | APR_APPEND, APR_OS_DEFAULT, subpool));
+                             APR_WRITE | APR_APPEND,
+                             APR_OS_DEFAULT, subpool));
 
   offset = 0;
   SVN_ERR (svn_io_file_seek (rev_file, APR_END, &offset, pool));
@@ -3370,33 +3577,35 @@
 
   /* Write the final line. */
   buf = apr_psprintf(subpool, "\n%" APR_OFF_T_FMT " %" APR_OFF_T_FMT "\n",
-                     new_root_id->offset, changed_path_offset);
+                     svn_fs_fs__get_id_offset (new_root_id),
+                     changed_path_offset);
   SVN_ERR (svn_io_file_write_full (rev_file, buf, strlen (buf), NULL,
                                    subpool));
   
   SVN_ERR (svn_io_file_close (rev_file, subpool));
 
-  /* Move the revision properties into place. */
-  revprop_filename = svn_path_join_many (subpool, fs->fs_path,
+  revprop_filename = svn_path_join_many (subpool, fs->path,
                                          SVN_FS_FS__TXNS_DIR,
                                          apr_pstrcat (subpool, txn->id,
-                                                      SVN_FS_FS__TXNS_EXT, NULL),
+                                                      SVN_FS_FS__TXNS_EXT,
+                                                      NULL),
                                          SVN_FS_FS__PROPS, NULL);
 
-  final_revprop = svn_path_join_many (subpool, fs->fs_path,
+  final_revprop = svn_path_join_many (subpool, fs->path,
                                       SVN_FS_FS__REVPROPS_DIR,
                                       apr_psprintf (pool, "%" SVN_REVNUM_T_FMT,
                                                     new_rev),
                                       NULL);
 
-  SVN_ERR (svn_io_copy_file (revprop_filename, final_revprop, TRUE, subpool));
+  SVN_ERR (move_into_place (revprop_filename, final_revprop, old_rev_filename,
+                            subpool));
   
   /* Update the 'current' file. */
   SVN_ERR (write_final_current (fs, txn->id, new_rev, start_node_id,
                                 start_copy_id, pool));
 
   /* Remove this transaction directory. */
-  SVN_ERR (svn_fs__fs_purge_txn (fs, txn->id, pool));
+  SVN_ERR (svn_fs_fs__purge_txn (fs, txn->id, pool));
   
   /* Destroy our subpool and release the lock. */
   svn_pool_destroy (subpool);
@@ -3407,7 +3616,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_reserve_copy_id (const char **copy_id_p,
+svn_fs_fs__reserve_copy_id (const char **copy_id_p,
                             svn_fs_t *fs,
                             const char *txn_id,
                             apr_pool_t *pool)
@@ -3422,7 +3631,7 @@
   copy_id = apr_pcalloc (pool, strlen (cur_copy_id) + 2);
 
   len = strlen(cur_copy_id);
-  svn_fs__next_key (cur_copy_id, &len, copy_id);
+  svn_fs_fs__next_key (cur_copy_id, &len, copy_id);
 
   SVN_ERR (write_next_ids (fs, txn_id, cur_node_id, copy_id, pool));
 
@@ -3432,7 +3641,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_create (svn_fs_t *fs,
+svn_fs_fs__create (svn_fs_t *fs,
                    const char *path,
                    apr_pool_t *pool)
 {
@@ -3457,20 +3666,20 @@
                                               SVN_FS_FS__CURRENT, pool),
                                "0 1 1\n", pool));
 
-  fs->fs_path = apr_pstrdup (pool, path);
+  fs->path = apr_pstrdup (pool, path);
 
   apr_uuid_get (&uuid);
   apr_uuid_format (buffer, &uuid);
-  svn_fs__fs_set_uuid (fs, buffer, pool);
+  svn_fs_fs__set_uuid (fs, buffer, pool);
   
-  SVN_ERR (svn_fs__dag_init_fs (fs));
+  SVN_ERR (svn_fs_fs__dag_init_fs (fs));
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_fs__fs_get_uuid (const char **uuid_p,
-                     svn_fs_t *fs,
+svn_fs_fs__get_uuid (svn_fs_t *fs,
+                     const char **uuid_p,
                      apr_pool_t *pool)
 {
   apr_file_t *uuid_file;
@@ -3478,9 +3687,9 @@
   apr_size_t limit;
 
   SVN_ERR (svn_io_file_open (&uuid_file,
-                             svn_path_join (fs->fs_path, SVN_FS_FS__UUID,
+                             svn_path_join (fs->path, SVN_FS_FS__UUID,
                                             pool),
-                             APR_READ, APR_OS_DEFAULT, pool));
+                             APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
   limit = sizeof (buf);
   SVN_ERR (svn_io_read_length_line (uuid_file, buf, &limit, pool));
@@ -3492,14 +3701,14 @@
 }
 
 svn_error_t *
-svn_fs__fs_set_uuid (svn_fs_t *fs,
+svn_fs_fs__set_uuid (svn_fs_t *fs,
                      const char *uuid,
                      apr_pool_t *pool)
 {
   apr_file_t *uuid_file;
 
   SVN_ERR (svn_io_file_open (&uuid_file,
-                             svn_path_join (fs->fs_path, SVN_FS_FS__UUID,
+                             svn_path_join (fs->path, SVN_FS_FS__UUID,
                                             pool),
                              APR_WRITE | APR_CREATE | APR_TRUNCATE,
                              APR_OS_DEFAULT, pool));
@@ -3514,13 +3723,13 @@
 }
 
 svn_error_t *
-svn_fs__fs_write_revision_zero (svn_fs_t *fs)
+svn_fs_fs__write_revision_zero (svn_fs_t *fs)
 {
   apr_pool_t *pool = fs->pool;
   const char *rev_filename;
 
   /* Create the revision 0 rev-file. */
-  rev_filename = svn_path_join_many (pool, fs->fs_path, SVN_FS_FS__REVS_DIR,
+  rev_filename = svn_path_join_many (pool, fs->path, SVN_FS_FS__REVS_DIR,
                                      "0", NULL);
 
   SVN_ERR (svn_io_file_create (rev_filename, "PLAIN\nEND\nENDREP\n"
@@ -3536,7 +3745,7 @@
 }
 
 svn_error_t *
-svn_fs__fs_list_transactions (apr_array_header_t **names_p,
+svn_fs_fs__list_transactions (apr_array_header_t **names_p,
                               svn_fs_t *fs,
                               apr_pool_t *pool)
 {
@@ -3548,14 +3757,15 @@
   names = apr_array_make (pool, 1, sizeof (const char *));
   
   /* Get the transactions directory. */
-  txn_dir = svn_path_join (fs->fs_path, SVN_FS_FS__TXNS_DIR, pool);
+  txn_dir = svn_path_join (fs->path, SVN_FS_FS__TXNS_DIR, pool);
 
   /* Now find a listing of this directory. */
   SVN_ERR (svn_io_get_dirents (&dirents, txn_dir, pool));
 
   /* Loop through all the entries, and return anything that ends with
      a '.txn' and has the correct length. */
-  for (this = apr_hash_first (pool, dirents); this; this = apr_hash_next (this))
+  for (this = apr_hash_first (pool, dirents); this;
+       this = apr_hash_next (this))
     {
       const void *key;
       void *val;
@@ -3587,15 +3797,15 @@
 }
 
 svn_error_t *
-svn_fs__fs_open_txn (svn_fs_txn_t **txn_p,
+svn_fs_fs__open_txn (svn_fs_txn_t **txn_p,
                      svn_fs_t *fs,
                      const char *name,
                      apr_pool_t *pool)
 {
   svn_fs_txn_t *txn;
   svn_node_kind_t kind;
-  svn_fs__transaction_t *local_txn;
-  char *txn_dirname = svn_path_join_many (pool, fs->fs_path,
+  transaction_t *local_txn;
+  char *txn_dirname = svn_path_join_many (pool, fs->path,
                                           SVN_FS_FS__TXNS_DIR,
                                           apr_pstrcat (pool, name,
                                                        SVN_FS_FS__TXNS_EXT,
@@ -3607,8 +3817,8 @@
 
   /* Did we find it? */
   if (kind != svn_node_dir)
-      return svn_error_create (SVN_ERR_FS_NO_SUCH_TRANSACTION, NULL,
-                               "No such transaction.");
+    return svn_error_create (SVN_ERR_FS_NO_SUCH_TRANSACTION, NULL,
+                             "No such transaction.");
       
   txn = apr_pcalloc (pool, sizeof (*txn));
 
@@ -3616,7 +3826,7 @@
   txn->id = apr_pstrdup (pool, name);
   txn->fs = fs;
 
-  SVN_ERR (svn_fs__fs_get_txn (&local_txn, fs, name, pool));
+  SVN_ERR (svn_fs_fs__get_txn (&local_txn, fs, name, pool));
 
   txn->base_rev = local_txn->revision;
 
@@ -3626,7 +3836,7 @@
 }
   
 svn_error_t *
-svn_fs__fs_txn_proplist (apr_hash_t **table_p,
+svn_fs_fs__txn_proplist (apr_hash_t **table_p,
                          svn_fs_txn_t *txn,
                          apr_pool_t *pool)
 {
@@ -3638,9 +3848,9 @@
 }
 
 svn_error_t *
-svn_fs__fs_delete_rep_if_mutable (svn_fs_t *fs,
+svn_fs_fs__delete_rep_if_mutable (svn_fs_t *fs,
                                   const svn_fs_id_t *id,
-                                  svn_fs__representation_t *rep,
+                                  representation_t *rep,
                                   const char *txn_id,
                                   apr_pool_t *pool)
 {
@@ -3670,15 +3880,17 @@
 }
 
 svn_error_t *
-svn_fs__fs_delete_node_revision (svn_fs_t *fs,
+svn_fs_fs__delete_node_revision (svn_fs_t *fs,
                                  const svn_fs_id_t *id,
                                  apr_pool_t *pool)
 {
   char *filename;
 
-  filename = svn_path_join_many (pool, fs->fs_path,
+  filename = svn_path_join_many (pool, fs->path,
                                  SVN_FS_FS__TXNS_DIR,
-                                 apr_pstrcat (pool, id->txn_id, ".txn", NULL),
+                                 apr_pstrcat (pool,
+                                              svn_fs_fs__get_id_txn (id),
+                                              ".txn", NULL),
                                  apr_pstrcat (pool, id->node_id, ".",
                                               id->copy_id, NULL), NULL);
 

Modified: trunk/subversion/libsvn_fs_fs/fs_fs.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/fs_fs.h	(original)
+++ trunk/subversion/libsvn_fs_fs/fs_fs.h	Thu Apr 29 18:17:29 2004
@@ -18,41 +18,64 @@
 #ifndef SVN_LIBSVN_FS__FS_FS_H
 #define SVN_LIBSVN_FS__FS_FS_H
 
-/* Open the fs_fs filesystem pointed to by PATH and associate it with
+/* Given a node-id ID that corresponds to a node in an fsfs backed
+   filesystem, return the revision in which this node was committed,
+   or SVN_INVALID_REVNUM if the node is within an uncommitted
+   transaction. */
+svn_revnum_t svn_fs_fs__get_id_rev (const svn_fs_id_t *id);
+
+/* Given a node-id ID that corresponds to a node in an fsfs backed
+   filesystem, return the offset into the permanent revision file
+   where the node-revision is located.  If this node-revision is
+   located in an uncommitted transaction, return 0. */
+apr_off_t svn_fs_fs__get_id_offset (const svn_fs_id_t *id);
+
+/* Given a node-id ID that corresponds to a node in an fsfs backed
+   filesystem, return the transaction id in which the node is located.
+   If the node is located in a committed revision, return NULL. */
+const char *svn_fs_fs__get_id_txn (const svn_fs_id_t *id);
+
+/* Set the transaction id of node-id ID backed by a fsfs filesystem to
+   TXN_ID.  Allocate any necessary storage from POOL. */
+svn_error_t * svn_fs_fs__set_id_txn (svn_fs_id_t *id,
+                                     const char *txn_id,
+                                     apr_pool_t *pool);
+
+/* Open the fsfs filesystem pointed to by PATH and associate it with
    filesystem object FS.  Use POOL for temporary allocations. */
-svn_error_t *svn_fs__fs_open (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__open (svn_fs_t *fs,
                               const char *path,
                               apr_pool_t *pool);
 
-/* Copy the fs_fs filesystem at SRC_PATH into a new copy at DST_PATH.
+/* Copy the fsfs filesystem at SRC_PATH into a new copy at DST_PATH.
    Use POOL for temporary allocations. */
-svn_error_t *svn_fs__fs_hotcopy (const char *src_path,
+svn_error_t *svn_fs_fs__hotcopy (const char *src_path,
                                  const char *dst_path,
                                  apr_pool_t *pool);
 
 /* Set *NODEREV_P to the node-revision for the node ID in FS.  Do any
    allocations in POOL. */
-svn_error_t *svn_fs__fs_get_node_revision (svn_fs__node_revision_t **noderev_p,
+svn_error_t *svn_fs_fs__get_node_revision (node_revision_t **noderev_p,
                                            svn_fs_t *fs,
                                            const svn_fs_id_t *id,
                                            apr_pool_t *pool);
 
 /* Store NODEREV as the node-revision for the node whose id is ID in
    FS.  Do any necessary temporary allocation in POOL. */
-svn_error_t *svn_fs__fs_put_node_revision (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__put_node_revision (svn_fs_t *fs,
                                            const svn_fs_id_t *id,
-                                           svn_fs__node_revision_t *noderev,
+                                           node_revision_t *noderev,
                                            apr_pool_t *pool);
 
 /* Set *YOUNGEST to the youngest revision in filesystem FS.  Do any
    temporary allocation in POOL. */
-svn_error_t *svn_fs__fs_youngest_revision (svn_revnum_t *youngest,
-                                           svn_fs_t *fs,
-                                           apr_pool_t *pool);
+svn_error_t *svn_fs_fs__youngest_rev (svn_revnum_t *youngest,
+                                      svn_fs_t *fs,
+                                      apr_pool_t *pool);
 
 /* Set *ROOT_ID to the node-id for the root of revision REV in
    filesystem FS.  Do any allocations in POOL. */
-svn_error_t *svn_fs__fs_rev_get_root (svn_fs_id_t **root_id,
+svn_error_t *svn_fs_fs__rev_get_root (svn_fs_id_t **root_id,
                                       svn_fs_t *fs,
                                       svn_revnum_t rev,
                                       apr_pool_t *pool);
@@ -60,30 +83,30 @@
 /* Set *ENTRIES to an apr_hash_t of dirent structs that contain the
    directory entries of node-revision NODEREV in filesystem FS.  Use
    POOL for temporary allocations. */
-svn_error_t *svn_fs__fs_rep_contents_dir (apr_hash_t **entries,
+svn_error_t *svn_fs_fs__rep_contents_dir (apr_hash_t **entries,
                                           svn_fs_t *fs,
-                                          svn_fs__node_revision_t *noderev,
+                                          node_revision_t *noderev,
                                           apr_pool_t *pool);
 
 /* Set *CONTENTS to be a readable svn_stream_t that receives the text
    representation of node-revision NODEREV as seen in filesystem FS.
    Use POOL for temporary allocations. */
-svn_error_t *svn_fs__fs_get_contents (svn_stream_t **contents,
+svn_error_t *svn_fs_fs__get_contents (svn_stream_t **contents,
                                       svn_fs_t *fs,
-                                      svn_fs__node_revision_t *noderev,
+                                      node_revision_t *noderev,
                                       apr_pool_t *pool);
 
 /* Set *PROPLIST to be an apr_hash_t containing the property list of
    node-revision NODEREV as seen in filesystem FS.  Use POOL for
    temporary allocations. */
-svn_error_t *svn_fs__fs_get_proplist (apr_hash_t **proplist,
+svn_error_t *svn_fs_fs__get_proplist (apr_hash_t **proplist,
                                       svn_fs_t *fs,
-                                      svn_fs__node_revision_t *noderev,
+                                      node_revision_t *noderev,
                                       apr_pool_t *pool);
 
 /* Set the revision property list of revision REV in filesystem FS to
    PROPLIST.  Use POOL for temporary allocations. */
-svn_error_t *svn_fs__fs_set_revision_proplist (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__set_revision_proplist (svn_fs_t *fs,
                                                svn_revnum_t rev,
                                                apr_hash_t *proplist,
                                                apr_pool_t *pool);
@@ -91,61 +114,63 @@
 /* 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__fs_revision_proplist (apr_hash_t **proplist,
+svn_error_t *svn_fs_fs__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__fs_file_length (svn_filesize_t *length,
-                                     svn_fs__node_revision_t *noderev,
+svn_error_t *svn_fs_fs__file_length (svn_filesize_t *length,
+                                     node_revision_t *noderev,
                                      apr_pool_t *pool);
 
 /* Return TRUE if the representation keys in A and B both point to the
    same representation, else return FALSE. */
-svn_boolean_t svn_fs__fs_noderev_same_rep_key (svn_fs__representation_t *a,
-                                               svn_fs__representation_t *b);
+svn_boolean_t svn_fs_fs__noderev_same_rep_key (representation_t *a,
+                                               representation_t *b);
 
 
 /* Return a copy of the representation REP allocated from POOL. */
-svn_fs__representation_t *svn_fs__fs_rep_copy (svn_fs__representation_t *rep,
+representation_t *svn_fs_fs__rep_copy (representation_t *rep,
                                                apr_pool_t *pool);
 
 
 /* Return the record MD5 checksum of the text representation of NODREV
    into DIGEST, allocating from POOL.  If no stored checksum is
    available, put all 0's into DIGEST. */
-svn_error_t *svn_fs__fs_file_checksum (unsigned char digest[],
-                                       svn_fs__node_revision_t *noderev,
+svn_error_t *svn_fs_fs__file_checksum (unsigned char digest[],
+                                       node_revision_t *noderev,
                                        apr_pool_t *pool);
 
 /* Find the paths which were changed in revision REV of filesystem FS
-   and store them in *CHANGED_PATHS_P.  Get any temporary allocations
+   and store them in *CHANGED_PATHS_P.  Cached copyfrom information
+   will be stored in *COPYFROM_CACHE.  Get any temporary allocations
    from POOL. */
-svn_error_t *svn_fs__fs_paths_changed (apr_hash_t **changed_paths_p,
+svn_error_t *svn_fs_fs__paths_changed (apr_hash_t **changed_paths_p,
                                        svn_fs_t *fs,
                                        svn_revnum_t rev,
+                                       apr_hash_t *copyfrom_cache,
                                        apr_pool_t *pool);
 
 /* Create a new transaction in filesystem FS, based on revision REV,
    and store it in *TXN_P.  Allocate all necessary variables from
    POOL. */
-svn_error_t *svn_fs__fs_begin_txn  (svn_fs_txn_t **txn_p,
-                                    svn_fs_t *fs,
-                                    svn_revnum_t rev,
-                                    apr_pool_t *pool);
+svn_error_t *svn_fs_fs__create_txn  (svn_fs_txn_t **txn_p,
+                                     svn_fs_t *fs,
+                                     svn_revnum_t rev,
+                                     apr_pool_t *pool);
 
 /* Set the transaction property NAME to the value VALUE in transaction
    TXN.  Perform temporary allocations from POOL. */
-svn_error_t *svn_fs__fs_change_txn_prop (svn_fs_txn_t *txn,
+svn_error_t *svn_fs_fs__change_txn_prop (svn_fs_txn_t *txn,
                                          const char *name,
                                          const svn_string_t *value,
                                          apr_pool_t *pool);
 
 /* Store a transaction record in *TXN_P for the transaction identified
    by TXN_ID in filesystem FS.  Allocate everything from POOL. */
-svn_error_t *svn_fs__fs_get_txn (svn_fs__transaction_t **txn_p,
+svn_error_t *svn_fs_fs__get_txn (transaction_t **txn_p,
                                  svn_fs_t *fs,
                                  const char *txn_id,
                                  apr_pool_t *pool);
@@ -155,25 +180,25 @@
    Use POOL for any temporary allocation.  COPY_ID is the copy_id to
    use in the node revision ID.  TXN_ID is the Subversion transaction
    under which this occurs. */
-svn_error_t *svn_fs__fs_create_node (const svn_fs_id_t **id_p,
+svn_error_t *svn_fs_fs__create_node (const svn_fs_id_t **id_p,
                                      svn_fs_t *fs,
-                                     svn_fs__node_revision_t *noderev,
+                                     node_revision_t *noderev,
                                      const char *copy_id,
                                      const char *txn_id,
                                      apr_pool_t *pool);
 
 /* Remove all references to the transaction TXN_ID from filesystem FS.
    Temporary allocations are from POOL. */
-svn_error_t *svn_fs__fs_purge_txn (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__purge_txn (svn_fs_t *fs,
                                    const char *txn_id,
                                    apr_pool_t *pool);
 
 /* Add or set in filesystem FS, transaction TXN_ID, in directory
    PARENT_NODEREV a directory entry for NAME pointing to ID of type
    KIND.  Allocations are done in POOL. */
-svn_error_t *svn_fs__fs_set_entry (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__set_entry (svn_fs_t *fs,
                                    const char *txn_id,
-                                   svn_fs__node_revision_t *parent_noderev,
+                                   node_revision_t *parent_noderev,
                                    const char *name,
                                    const svn_fs_id_t *id,
                                    svn_node_kind_t kind,
@@ -182,23 +207,28 @@
 /* Add a change to the changes record for filesystem FS in transaction
    TXN_ID.  Mark path PATH, having node-id ID, as changed according to
    the type in CHANGE_KIND.  If the text representation was changed
-   set TEXT_MOD to TRUE, and likewise for PROP_MOD.  Perform any
-   temporary allocations from POOL. */
-svn_error_t *svn_fs__fs_add_change (svn_fs_t *fs,
+   set TEXT_MOD to TRUE, and likewise for PROP_MOD.  If this change
+   was the result of a copy, set COPYFROM_REV and COPYFROM_PATH to the
+   revision and path of the copy source, otherwise they should be set
+   to SVN_INVALID_REVNUM and NULL.  Perform any temporary allocations
+   from POOL. */
+svn_error_t *svn_fs_fs__add_change (svn_fs_t *fs,
                                     const char *txn_id,
                                     const char *path,
                                     const svn_fs_id_t *id,
                                     svn_fs_path_change_kind_t change_kind,
                                     svn_boolean_t text_mod,
                                     svn_boolean_t prop_mod,
+                                    svn_revnum_t copyfrom_rev,
+                                    const char *copyfrom_path,
                                     apr_pool_t *pool);
 
 /* Return a writable stream in *STREAM that allows storing the text
    representation of node-revision NODEREV in filesystem FS.
    Allocations are from POOL. */
-svn_error_t *svn_fs__fs_set_contents (svn_stream_t **stream,
+svn_error_t *svn_fs_fs__set_contents (svn_stream_t **stream,
                                       svn_fs_t *fs,
-                                      svn_fs__node_revision_t *noderev,
+                                      node_revision_t *noderev,
                                       apr_pool_t *pool);
 
 /* Create a node revision in FS which is an immediate successor of
@@ -215,18 +245,18 @@
    After this call, the deltification code assumes that the new node's
    contents will change frequently, and will avoid representing other
    nodes as deltas against this node's contents.  */
-svn_error_t *svn_fs__fs_create_successor (const svn_fs_id_t **new_id_p,
+svn_error_t *svn_fs_fs__create_successor (const svn_fs_id_t **new_id_p,
                                           svn_fs_t *fs,
                                           const svn_fs_id_t *old_idp,
-                                          svn_fs__node_revision_t *new_noderev,
+                                          node_revision_t *new_noderev,
                                           const char *copy_id,
                                           const char *txn_id,
                                           apr_pool_t *pool);
 
 /* Write a new property list PROPLIST for node-revision NODEREV in
    filesystem FS.  Perform any temporary allocations in POOL. */
-svn_error_t *svn_fs__fs_set_proplist (svn_fs_t *fs,
-                                      svn_fs__node_revision_t *noderev,
+svn_error_t *svn_fs_fs__set_proplist (svn_fs_t *fs,
+                                      node_revision_t *noderev,
                                       apr_hash_t *proplist,
                                       apr_pool_t *pool);
 
@@ -234,72 +264,72 @@
    revision number in *REV.  If the transaction is out of date, return
    the error SVN_ERR_FS_TXN_OUT_OF_DATE.  Use POOL for temporary
    allocations. */
-svn_error_t *svn_fs__fs_commit (svn_revnum_t *new_rev_p,
+svn_error_t *svn_fs_fs__commit (svn_revnum_t *new_rev_p,
                                 svn_fs_t *fs,
                                 svn_fs_txn_t *txn,
                                 apr_pool_t *pool);
 
 /* Return the next available copy_id in *COPY_ID for the transaction
    TXN_ID in filesystem FS.  Allocate space in POOL. */
-svn_error_t *svn_fs__fs_reserve_copy_id (const char **copy_id,
+svn_error_t *svn_fs_fs__reserve_copy_id (const char **copy_id,
                                          svn_fs_t *fs,
                                          const char *txn_id,
                                          apr_pool_t *pool);
 
 /* Create a fs_fs fileysystem referenced by FS at path PATH.  Get any
    temporary allocations from POOL. */
-svn_error_t *svn_fs__fs_create (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__create (svn_fs_t *fs,
                                 const char *path,
                                 apr_pool_t *pool);
 
 /* Store the uuid of the repository FS in *UUID.  Allocate space in
    POOL. */
-svn_error_t *svn_fs__fs_get_uuid (const char **uuid,
-                                  svn_fs_t *fs,
+svn_error_t *svn_fs_fs__get_uuid (svn_fs_t *fs,
+                                  const char **uuid,
                                   apr_pool_t *pool);
 
 /* Set the uuid of repository FS to UUID.  Perform temporary
    allocations in POOL. */
-svn_error_t *svn_fs__fs_set_uuid (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__set_uuid (svn_fs_t *fs,
                                   const char *uuid,
                                   apr_pool_t *pool);
 
 /* Write out the zeroth revision for filesystem FS. */
-svn_error_t *svn_fs__fs_write_revision_zero (svn_fs_t *fs);
+svn_error_t *svn_fs_fs__write_revision_zero (svn_fs_t *fs);
 
 /* Set *NAMES_P to an array of names which are all the active
    transactions in filesystem FS.  Allocate the array from POOL. */
-svn_error_t *svn_fs__fs_list_transactions (apr_array_header_t **names_p,
+svn_error_t *svn_fs_fs__list_transactions (apr_array_header_t **names_p,
                                            svn_fs_t *fs,
                                            apr_pool_t *pool);
 
 /* Open the transaction named NAME in filesystem FS.  Set *TXN_P to
  * the transaction. If there is no such transaction, return
- * SVN_ERR_FS_NO_SUCH_TRANSACTION.  Allocate the new transaction in
+` * SVN_ERR_FS_NO_SUCH_TRANSACTION.  Allocate the new transaction in
  * POOL. */
-svn_error_t *svn_fs__fs_open_txn (svn_fs_txn_t **txn_p,
+svn_error_t *svn_fs_fs__open_txn (svn_fs_txn_t **txn_p,
                                   svn_fs_t *fs,
                                   const char *name,
                                   apr_pool_t *pool);
 
 /* Return the property list from transaction TXN and store it in
    *PROPLIST.  Allocate the property list from POOL. */
-svn_error_t *svn_fs__fs_txn_proplist (apr_hash_t **proplist,
+svn_error_t *svn_fs_fs__txn_proplist (apr_hash_t **proplist,
                                       svn_fs_txn_t *txn,
                                       apr_pool_t *pool);
 
 /* If the representation REP is mutable in transaction TXN_ID as part
    of filesystem FS, remove it.  Perform temporary allocations in
    POOL. */
-svn_error_t *svn_fs__fs_delete_rep_if_mutable (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__delete_rep_if_mutable (svn_fs_t *fs,
                                                const svn_fs_id_t *id,
-                                               svn_fs__representation_t *rep,
+                                               representation_t *rep,
                                                const char *txn_id,
                                                apr_pool_t *pool);
 
 /* If the node-revision referenced by ID is mutable in fileystem FS,
    delete it.  Perform temporary allocations in POOL. */
-svn_error_t *svn_fs__fs_delete_node_revision (svn_fs_t *fs,
+svn_error_t *svn_fs_fs__delete_node_revision (svn_fs_t *fs,
                                               const svn_fs_id_t *id,
                                               apr_pool_t *pool);
 
@@ -307,7 +337,7 @@
 /* Find the paths which were changed in transaction TXN_ID of
    filesystem FS and store them in *CHANGED_PATHS_P.  Get any
    temporary allocations from POOL. */
-svn_error_t *svn_fs__fs_txn_changes_fetch (apr_hash_t **changes,
+svn_error_t *svn_fs_fs__txn_changes_fetch (apr_hash_t **changes,
                                            svn_fs_t *fs,
                                            const char *txn_id,
                                            apr_pool_t *pool);

Modified: trunk/subversion/libsvn_fs_fs/key-gen.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/key-gen.c	(original)
+++ trunk/subversion/libsvn_fs_fs/key-gen.c	Thu Apr 29 18:17:29 2004
@@ -28,9 +28,9 @@
 /* Converting text to numbers.  */
 
 apr_size_t
-svn_fs__getsize (const char *data, apr_size_t len,
-                 const char **endptr,
-                 apr_size_t max)
+svn_fs_fs__getsize (const char *data, apr_size_t len,
+                    const char **endptr,
+                    apr_size_t max)
 {
   /* We can't detect overflow by simply comparing value against max,
      since multiplying value by ten can overflow in strange ways if
@@ -85,7 +85,7 @@
 /* Converting numbers to text.  */
 
 int
-svn_fs__putsize (char *data, apr_size_t len, apr_size_t value)
+svn_fs_fs__putsize (char *data, apr_size_t len, apr_size_t value)
 {
   apr_size_t i = 0;
 
@@ -121,14 +121,14 @@
 /*** Keys for reps and strings. ***/
 
 void
-svn_fs__add_keys (const char *key1, const char *key2, char *result)
+svn_fs_fs__add_keys (const char *key1, const char *key2, char *result)
 {
   int i1 = strlen (key1) - 1;
   int i2 = strlen (key2) - 1;
   int i3 = 0;
   int val;
   int carry = 0;
-  char buf[SVN_FS__MAX_KEY_SIZE + 2];
+  char buf[MAX_KEY_SIZE + 2];
 
   while ((i1 >= 0) || (i2 >= 0) || (carry > 0))
     {
@@ -158,11 +158,11 @@
 }
       
 
-const char svn_fs__next_key_key[] = "next-key";
+const char NEXT_KEY_KEY[] = "next-key";
 
 
 void
-svn_fs__next_key (const char *this, apr_size_t *len, char *next)
+svn_fs_fs__next_key (const char *this, apr_size_t *len, char *next)
 {
   apr_size_t olen = *len;     /* remember the first length */
   int i = olen - 1;           /* initial index; we work backwards */
@@ -212,9 +212,9 @@
   *len = olen + (carry ? 1 : 0);
 
   /* Ensure that we haven't overrun the (ludicrous) bound on key length.
-     Note that SVN_FS__MAX_KEY_SIZE is a bound on the size *including*
+     Note that MAX_KEY_SIZE is a bound on the size *including*
      the trailing null byte. */
-  assert (*len < SVN_FS__MAX_KEY_SIZE);
+  assert (*len < MAX_KEY_SIZE);
 
   /* Now we know it's safe to add the null terminator. */
   next[*len] = '\0';
@@ -229,7 +229,7 @@
 
 
 int
-svn_fs__key_compare (const char *a, const char *b)
+svn_fs_fs__key_compare (const char *a, const char *b)
 {
   int a_len = strlen (a);
   int b_len = strlen (b);
@@ -245,7 +245,7 @@
 
 
 svn_boolean_t
-svn_fs__same_keys (const char *a, const char *b)
+svn_fs_fs__same_keys (const char *a, const char *b)
 {
   if (! (a || b))
     return TRUE;

Modified: trunk/subversion/libsvn_fs_fs/key-gen.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/key-gen.h	(original)
+++ trunk/subversion/libsvn_fs_fs/key-gen.h	Thu Apr 29 18:17:29 2004
@@ -27,10 +27,10 @@
 #endif /* __cplusplus */
 
 
-/* The alphanumeric keys passed in and out of svn_fs__next_key
+/* The alphanumeric keys passed in and out of svn_fs_fs__next_key
    are guaranteed never to be longer than this many bytes,
    *including* the trailing null byte.  It is therefore safe
-   to declare a key as "char key[SVN_FS__MAX_KEY_SIZE]".
+   to declare a key as "char key[MAX_KEY_SIZE]".
 
    Note that this limit will be a problem if the number of
    keys in a table ever exceeds
@@ -44,7 +44,7 @@
        947748581376,
 
    but that's a risk we'll live with for now. */
-#define SVN_FS__MAX_KEY_SIZE 200
+#define MAX_KEY_SIZE 200
 
 
 /* Return the value of the string of digits at DATA as an ASCII
@@ -57,19 +57,19 @@
    locale-dependent, whereas we're trying to parse data in a
    local-independent format.  */
 
-apr_size_t svn_fs__getsize (const char *data, apr_size_t len,
+apr_size_t svn_fs_fs__getsize (const char *data, apr_size_t len,
                             const char **endptr, apr_size_t max);
 
 
 /* Store the ASCII decimal representation of VALUE at DATA.  Return
    the length of the representation if all goes well; return zero if
    the result doesn't fit in LEN bytes.  */
-int svn_fs__putsize (char *data, apr_size_t len, apr_size_t value);
+int svn_fs_fs__putsize (char *data, apr_size_t len, apr_size_t value);
 
 
 /* In the `representations' and `strings', the value at this key is
    the key to use when storing a new rep or string. */
-extern const char svn_fs__next_key_key[];
+extern const char NEXT_KEY_KEY[];
 
 
 /* Generate the next key after a given alphanumeric key.
@@ -90,7 +90,7 @@
  * string "0", then *LEN is set to zero and the effect on NEXT
  * is undefined.
  */
-void svn_fs__next_key (const char *this, apr_size_t *len, char *next);
+void svn_fs_fs__next_key (const char *this, apr_size_t *len, char *next);
 
 
 /* Compare two strings A and B as base-36 alphanumeric keys.
@@ -98,17 +98,17 @@
  * Return -1, 0, or 1 if A is less than, equal to, or greater than B,
  * respectively.
  */
-int svn_fs__key_compare (const char *a, const char *b);
+int svn_fs_fs__key_compare (const char *a, const char *b);
 
 /* Compare two strings A and B as base-36 alphanumber keys.
  *
  * Return TRUE iff both keys are NULL or both keys have the same
  * contents.
  */
-svn_boolean_t svn_fs__same_keys (const char *a, const char *b);
+svn_boolean_t svn_fs_fs__same_keys (const char *a, const char *b);
 
 /* Add two base-36 alphanumeric keys to get a third, the result. */
-void svn_fs__add_keys (const char *key1, const char *key2, char *result);
+void svn_fs_fs__add_keys (const char *key1, const char *key2, char *result);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_fs_fs/revs-txns.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/revs-txns.c	(original)
+++ trunk/subversion/libsvn_fs_fs/revs-txns.c	Thu Apr 29 18:17:29 2004
@@ -29,12 +29,13 @@
 #include "fs.h"
 #include "dag.h"
 #include "err.h"
-#include "id.h"
 #include "tree.h"
 #include "revs-txns.h"
 #include "key-gen.h"
 #include "fs_fs.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
 /*** Helpers ***/
 
@@ -44,18 +45,18 @@
    EXPECT_DEAD is not set, an error is thrown if the transaction is
    *not* dead. */
 static svn_error_t *
-get_txn (svn_fs__transaction_t **txn_p,
+get_txn (transaction_t **txn_p,
          svn_fs_t *fs,
          const char *txn_id,
          svn_boolean_t expect_dead,
          apr_pool_t *pool)
 {
-  svn_fs__transaction_t *txn;
-  SVN_ERR (svn_fs__fs_get_txn (&txn, fs, txn_id, pool));
-  if (expect_dead && (txn->kind != svn_fs__transaction_kind_dead))
+  transaction_t *txn;
+  SVN_ERR (svn_fs_fs__get_txn (&txn, fs, txn_id, pool));
+  if (expect_dead && (txn->kind != transaction_kind_dead))
     return svn_error_createf (SVN_ERR_FS_TRANSACTION_NOT_DEAD, 0,
                               "Transaction is not dead: '%s'", txn_id);
-  if ((! expect_dead) && (txn->kind == svn_fs__transaction_kind_dead))
+  if ((! expect_dead) && (txn->kind == transaction_kind_dead))
     return svn_error_createf (SVN_ERR_FS_TRANSACTION_NOT_DEAD, 0,
                               "Transaction is dead: '%s'", txn_id);
   *txn_p = txn;
@@ -66,48 +67,16 @@
 /*** Revisions ***/
 
 svn_error_t *
-svn_fs_youngest_rev (svn_revnum_t *youngest_p,
-                     svn_fs_t *fs,
-                     apr_pool_t *pool)
-{
-  svn_revnum_t youngest;
-  
-  SVN_ERR (svn_fs__check_fs (fs));
-  SVN_ERR (svn_fs__fs_youngest_revision (&youngest, fs, pool));
-  
-  *youngest_p = youngest;
-  
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_fs_revision_proplist (apr_hash_t **table_p,
+svn_fs_fs__revision_prop (svn_string_t **value_p,
                           svn_fs_t *fs,
                           svn_revnum_t rev,
+                          const char *propname,
                           apr_pool_t *pool)
 {
   apr_hash_t *table;
 
-  SVN_ERR (svn_fs__check_fs (fs));
-  SVN_ERR (svn_fs__fs_revision_proplist (&table, fs, rev, pool));
-
-  *table_p = table;
-  
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_revision_prop (svn_string_t **value_p,
-                      svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      const char *propname,
-                      apr_pool_t *pool)
-{
-  apr_hash_t *table;
-
-  SVN_ERR (svn_fs__check_fs (fs));
-  SVN_ERR (svn_fs__fs_revision_proplist (&table, fs, rev, pool));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__revision_proplist (&table, fs, rev, pool));
 
   *value_p = NULL;
   if (table)
@@ -118,32 +87,32 @@
 
 
 svn_error_t *
-svn_fs__set_rev_prop (svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      const char *name,
-                      const svn_string_t *value,
-                      apr_pool_t *pool)
+svn_fs_fs__set_rev_prop (svn_fs_t *fs,
+                         svn_revnum_t rev,
+                         const char *name,
+                         const svn_string_t *value,
+                         apr_pool_t *pool)
 {
   apr_hash_t *table;
 
-  SVN_ERR (svn_fs__fs_revision_proplist (&table, fs, rev, pool));
+  SVN_ERR (svn_fs_fs__revision_proplist (&table, fs, rev, pool));
 
   apr_hash_set (table, name, APR_HASH_KEY_STRING, value);
 
-  SVN_ERR (svn_fs__fs_set_revision_proplist (fs, rev, table, pool));
+  SVN_ERR (svn_fs_fs__set_revision_proplist (fs, rev, table, pool));
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_fs_change_rev_prop (svn_fs_t *fs,
-                        svn_revnum_t rev,
-                        const char *name,
-                        const svn_string_t *value,
-                        apr_pool_t *pool)
+svn_fs_fs__change_rev_prop (svn_fs_t *fs,
+                            svn_revnum_t rev,
+                            const char *name,
+                            const svn_string_t *value,
+                            apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__check_fs (fs));
-  SVN_ERR (svn_fs__set_rev_prop (fs, rev, name, value, pool));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__set_rev_prop (fs, rev, name, value, pool));
 
   return SVN_NO_ERROR;
 }
@@ -153,30 +122,17 @@
 /*** Transactions ***/
 
 svn_error_t *
-svn_fs__txn_get_revision (svn_revnum_t *revision,
-                          svn_fs_t *fs,
-                          const char *txn_name,
-                          apr_pool_t *pool)
-{
-  svn_fs__transaction_t *txn;
-  SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, pool));
-  *revision = txn->revision;
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
-                     const svn_fs_id_t **base_root_id_p,
-                     svn_fs_t *fs,
-                     const char *txn_name,
-                     apr_pool_t *pool)
+svn_fs_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
+                        const svn_fs_id_t **base_root_id_p,
+                        svn_fs_t *fs,
+                        const char *txn_name,
+                        apr_pool_t *pool)
 {
-  svn_fs__transaction_t *txn;
+  transaction_t *txn;
   
   SVN_ERR (get_txn (&txn, fs, txn_name, FALSE, pool));
-  if (txn->kind != svn_fs__transaction_kind_normal)
-    return svn_fs__err_txn_not_mutable (fs, txn_name);
+  if (txn->kind != transaction_kind_normal)
+    return svn_fs_fs__err_txn_not_mutable (fs, txn_name);
 
   *root_id_p = txn->root_id;
   *base_root_id_p = txn->base_id;
@@ -187,32 +143,17 @@
 /* Generic transaction operations.  */
 
 svn_error_t *
-svn_fs_txn_proplist (apr_hash_t **table_p,
+svn_fs_fs__txn_prop (svn_string_t **value_p,
                      svn_fs_txn_t *txn,
+                     const char *propname,
                      apr_pool_t *pool)
 {
-  svn_fs_t *fs = txn->fs;
-
-  SVN_ERR (svn_fs__check_fs (fs));
-
-  SVN_ERR (svn_fs__fs_txn_proplist (table_p, txn, pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_txn_prop (svn_string_t **value_p,
-                 svn_fs_txn_t *txn,
-                 const char *propname,
-                 apr_pool_t *pool)
-{
   apr_hash_t *table;
   svn_fs_t *fs = txn->fs;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
 
-  SVN_ERR (svn_fs_txn_proplist (&table, txn, pool));
+  SVN_ERR (svn_fs_fs__txn_proplist (&table, txn, pool));
 
   /* And then the prop from that list (if there was a list). */
   *value_p = NULL;
@@ -221,35 +162,33 @@
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_change_txn_prop (svn_fs_txn_t *txn,
-                        const char *name,
-                        const svn_string_t *value,
-                        apr_pool_t *pool)
-{
-  svn_fs_t *fs = txn->fs;
-
-  SVN_ERR (svn_fs__check_fs (fs));
-
-  SVN_ERR (svn_fs__fs_change_txn_prop (txn, name, value, pool));
-
-  return SVN_NO_ERROR;
-}
+/* The vtable associated with an open transaction object. */
+static txn_vtable_t txn_vtable = {
+  svn_fs_fs__commit_txn,
+  svn_fs_fs__abort_txn,
+  svn_fs_fs__txn_prop,
+  svn_fs_fs__txn_proplist,
+  svn_fs_fs__change_txn_prop,
+  svn_fs_fs__txn_root
+};
 
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
 svn_error_t *
-svn_fs_begin_txn (svn_fs_txn_t **txn_p,
-                  svn_fs_t *fs,
-                  svn_revnum_t rev,
-                  apr_pool_t *pool)
+svn_fs_fs__begin_txn (svn_fs_txn_t **txn_p,
+                      svn_fs_t *fs,
+                      svn_revnum_t rev,
+                      apr_pool_t *pool)
 {
   svn_string_t date;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
 
-  SVN_ERR (svn_fs__fs_begin_txn (txn_p, fs, rev, pool));
+  SVN_ERR (svn_fs_fs__create_txn (txn_p, fs, rev, pool));
 
+  (*txn_p)->vtable = &txn_vtable;
+  (*txn_p)->fsap_data = NULL;
+  
   /* Put a datestamp on the newly created txn, so we always know
      exactly how old it is.  (This will help sysadmins identify
      long-abandoned txns that may need to be manually removed.)  When
@@ -259,60 +198,17 @@
   date.len = strlen (date.data);
   SVN_ERR (svn_fs_change_txn_prop (*txn_p, SVN_PROP_REVISION_DATE, 
                                    &date, pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_txn_name (const char **name_p,
-                 svn_fs_txn_t *txn,
-                 apr_pool_t *pool)
-{
-  *name_p = apr_pstrdup (pool, txn->id);
-  return SVN_NO_ERROR;
-}
-
-
-svn_revnum_t
-svn_fs_txn_base_revision (svn_fs_txn_t *txn)
-{
-  return txn->base_rev;
-}
-
-svn_error_t *
-svn_fs_open_txn (svn_fs_txn_t **txn_p,
-                 svn_fs_t *fs,
-                 const char *name,
-                 apr_pool_t *pool)
-{
-  svn_fs_txn_t *txn;
-
-  SVN_ERR (svn_fs__check_fs (fs));
-
-  SVN_ERR (svn_fs__fs_open_txn (&txn, fs, name, pool));
   
-  *txn_p = txn;
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_fs_purge_txn (svn_fs_t *fs,
-                  const char *txn_id,
-                  apr_pool_t *pool)
-{
-  SVN_ERR (svn_fs__check_fs (fs));
 
-  SVN_ERR (svn_fs__fs_purge_txn (fs, txn_id, pool));
-  
   return SVN_NO_ERROR;
 }
 
+
 svn_error_t *
-svn_fs_abort_txn (svn_fs_txn_t *txn,
-                  apr_pool_t *pool)
+svn_fs_fs__abort_txn (svn_fs_txn_t *txn,
+                      apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__check_fs (txn->fs));
+  SVN_ERR (svn_fs_fs__check_fs (txn->fs));
 
   /* Now, purge it. */
   SVN_ERR_W (svn_fs_purge_txn (txn->fs, txn->id, pool),
@@ -321,17 +217,3 @@
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_list_transactions (apr_array_header_t **names_p,
-                          svn_fs_t *fs,
-                          apr_pool_t *pool)
-{
-  apr_array_header_t *names;
-
-  SVN_ERR (svn_fs__check_fs (fs));
-
-  SVN_ERR (svn_fs__fs_list_transactions (&names, fs, pool));
-
-  *names_p = names;
-  return SVN_NO_ERROR;
-}

Modified: trunk/subversion/libsvn_fs_fs/revs-txns.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/revs-txns.h	(original)
+++ trunk/subversion/libsvn_fs_fs/revs-txns.h	Thu Apr 29 18:17:29 2004
@@ -26,35 +26,32 @@
 extern "C" {
 #endif /* __cplusplus */
 
-
-
-/* The private structure underlying the public svn_fs_txn_t typedef.  */
-
-struct svn_fs_txn_t
-{
-  /* The filesystem to which this transaction belongs.  */
-  svn_fs_t *fs;
-
-  /* The revision on which this transaction is based, or
-     SVN_INVALID_REVISION if the transaction is not based on a
-     revision at all. */
-  svn_revnum_t base_rev;
-
-  /* The ID of this transaction --- a null-terminated string.
-     This is the key into the `transactions' table.  */
-  const char *id;
-};
-
-
 
 /*** Revisions ***/
 
 /* Set property NAME to VALUE on REV in FS, allocation from POOL.  */
-svn_error_t *svn_fs__set_rev_prop (svn_fs_t *fs,
-                                   svn_revnum_t rev,
-                                   const char *name,
-                                   const svn_string_t *value,
-                                   apr_pool_t *pool);
+svn_error_t *svn_fs_fs__set_rev_prop (svn_fs_t *fs,
+                                      svn_revnum_t rev,
+                                      const char *name,
+                                      const svn_string_t *value,
+                                      apr_pool_t *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_fs__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.  Do any temporary allocation in POOL.  */
+svn_error_t *svn_fs_fs__change_rev_prop (svn_fs_t *fs, svn_revnum_t rev,
+                                         const char *name,
+                                         const svn_string_t *value,
+                                         apr_pool_t *pool);
 
 
 
@@ -63,10 +60,10 @@
 /* Set *REVISION to the revision which was created when FS transaction
    TXN_NAME was committed, or to SVN_INVALID_REVNUM if the transaction
    has not been committed.  Do all allocations in POOL.  */
-svn_error_t *svn_fs__txn_get_revision (svn_revnum_t *revision,
-                                       svn_fs_t *fs,
-                                       const char *txn_name,
-                                       apr_pool_t *pool);
+svn_error_t *svn_fs_fs__txn_get_revision (svn_revnum_t *revision,
+                                          svn_fs_t *fs,
+                                          const char *txn_name,
+                                          apr_pool_t *pool);
 
 
 /* Retrieve information about the Subversion transaction SVN_TXN from
@@ -82,12 +79,27 @@
    transaction that has already been committed.
 
    Allocate *ROOT_ID_P and *BASE_ROOT_ID_P in POOL.  */
-svn_error_t *svn_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
-                                  const svn_fs_id_t **base_root_id_p,
-                                  svn_fs_t *fs,
-                                  const char *txn_name,
-                                  apr_pool_t *pool);
-
+svn_error_t *svn_fs_fs__get_txn_ids (const svn_fs_id_t **root_id_p,
+                                     const svn_fs_id_t **base_root_id_p,
+                                     svn_fs_t *fs,
+                                     const char *txn_name,
+                                     apr_pool_t *pool);
+
+/* Begin a new transaction in filesystem FS, based on existing
+   revision REV.  The new transaction is returned in *TXN_P.  Allocate
+   the new transaction structure from POOL. */
+svn_error_t *svn_fs_fs__begin_txn (svn_fs_txn_t **txn_p, svn_fs_t *fs,
+                                   svn_revnum_t rev, apr_pool_t *pool);
+
+/* Abort the existing transaction TXN, performing any temporary
+   allocations in POOL. */
+svn_error_t *svn_fs_fs__abort_txn (svn_fs_txn_t *txn, apr_pool_t *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_fs__txn_prop (svn_string_t **value_p, svn_fs_txn_t *txn,
+                                  const char *propname, apr_pool_t *pool);
 
 #ifdef __cplusplus
 }

Modified: trunk/subversion/libsvn_fs_fs/tree.c
==============================================================================
--- trunk/subversion/libsvn_fs_fs/tree.c	(original)
+++ trunk/subversion/libsvn_fs_fs/tree.c	Thu Apr 29 18:17:29 2004
@@ -40,7 +40,6 @@
 #include "svn_fs.h"
 #include "svn_hash.h"
 #include "svn_sorts.h"
-#include "id.h"
 #include "fs.h"
 #include "err.h"
 #include "key-gen.h"
@@ -49,6 +48,8 @@
 #include "revs-txns.h"
 #include "fs_fs.h"
 
+#include "../libsvn_fs/fs-loader.h"
+
 
 /* ### I believe this constant will become internal to reps-strings.c.
    ### see the comment in window_consumer() for more information. */
@@ -92,28 +93,8 @@
 } root_kind_t;
 
 
-struct svn_fs_root_t
+typedef struct
 {
-
-  /* What filesystem does this root belong to?  */
-  svn_fs_t *fs;
-
-  /* All data belonging to this root is allocated in this pool.
-     Destroying this pool will correctly free all resources the root
-     holds.  */
-  apr_pool_t *pool;
-
-  /* What kind of root is this?  */
-  root_kind_t kind;
-
-  /* For transaction roots (i.e., KIND == transaction_root), the name of
-     that transaction, allocated in POOL.  */
-  const char *txn;
-
-  /* For revision roots (i.e., KIND == revision_root), the number of
-     that revision.  */
-  svn_revnum_t rev;
-
   /* For revision roots, this is a dag node for the revision's root
      directory.  For transaction roots, we open the root directory
      afresh every time, since the root may have been cloned, or
@@ -135,70 +116,24 @@
   apr_hash_t *node_cache;
   const char *node_cache_keys[SVN_FS_NODE_CACHE_MAX_KEYS];
   int node_cache_idx;
-};
 
-/* Declared here to resolve the circular dependency in
-   get_copy_inheritance. */
+  /* Cache structure for mapping const char * PATH to const char
+     *COPYFROM_STRING, so that paths_changed can remember all the
+     copyfrom information in the changes file. */
+  apr_hash_t *copyfrom_cache;
+  
+} fs_root_data_t;
+
+/* Declared here to resolve the circular dependencies. */
 static svn_error_t * get_dag (dag_node_t **dag_node_p, svn_fs_root_t *root,
                               const char *path, apr_pool_t *pool);
 
+static svn_fs_root_t *make_revision_root (svn_fs_t *fs, svn_revnum_t rev,
+                                          dag_node_t *root_dir,
+                                          apr_pool_t *pool);
 
-
-/* Creating root objects.  */
-
-
-/* Construct a new root object in FS, allocated from POOL.  */
-static svn_fs_root_t *
-make_root (svn_fs_t *fs,
-           apr_pool_t *pool)
-{
-  /* We create a subpool for each root object to allow us to implement
-     svn_fs_close_root.  */
-  apr_pool_t *subpool = svn_pool_create (pool);
-  svn_fs_root_t *root = apr_pcalloc (subpool, sizeof (*root));
-
-  root->fs = fs;
-  root->pool = subpool;
-
-  /* Init the node ID cache. */
-  root->node_cache = apr_hash_make (pool);
-  root->node_cache_idx = 0;
-
-  return root;
-}
-
-
-/* Construct a root object referring to the root of REVISION in FS,
-   whose root directory is ROOT_DIR.  Create the new root in POOL.  */
-static svn_fs_root_t *
-make_revision_root (svn_fs_t *fs,
-                    svn_revnum_t rev,
-                    dag_node_t *root_dir,
-                    apr_pool_t *pool)
-{
-  svn_fs_root_t *root = make_root (fs, pool);
-  root->kind = revision_root;
-  root->rev = rev;
-  root->root_dir = root_dir;
-
-  return root;
-}
-
-
-/* Construct a root object referring to the root of the transaction
-   named TXN in FS.  Create the new root in POOL.  */
-static svn_fs_root_t *
-make_txn_root (svn_fs_t *fs,
-               const char *txn,
-               apr_pool_t *pool)
-{
-  svn_fs_root_t *root = make_root (fs, pool);
-  root->kind = transaction_root;
-  root->txn = apr_pstrdup (root->pool, txn);
-
-  return root;
-}
-
+static svn_fs_root_t *make_txn_root (svn_fs_t *fs, const char *txn,
+                                     apr_pool_t *pool);
 
 
 /*** Node Caching in the Roots. ***/
@@ -210,19 +145,20 @@
                     const char *path,
                     apr_pool_t *pool)
 {
+  fs_root_data_t *frd = root->fsap_data;
   struct dag_node_cache_t *cache_item;
 
   /* Assert valid input. */
   assert (*path == '/');
 
   /* Only allow revision roots. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return NULL;
 
   /* Look in the cache for our desired item. */
-  cache_item = apr_hash_get (root->node_cache, path, APR_HASH_KEY_STRING);
+  cache_item = apr_hash_get (frd->node_cache, path, APR_HASH_KEY_STRING);
   if (cache_item)
-    return svn_fs__dag_dup (cache_item->node, pool);
+    return svn_fs_fs__dag_dup (cache_item->node, pool);
 
   return NULL;
 }
@@ -237,10 +173,11 @@
                     const char *path,
                     dag_node_t *node)
 {
+  fs_root_data_t *frd = root->fsap_data;
   const char *cache_path;
   apr_pool_t *cache_pool;
   struct dag_node_cache_t *cache_item;
-  int num_keys = apr_hash_count (root->node_cache);
+  int num_keys = apr_hash_count (frd->node_cache);
 
   /* What?  No POOL passed to this function?
 
@@ -254,11 +191,11 @@
 
   /* Assert valid input and state. */
   assert (*path == '/');
-  assert ((root->node_cache_idx <= num_keys)
+  assert ((frd->node_cache_idx <= num_keys)
           && (num_keys <= SVN_FS_NODE_CACHE_MAX_KEYS));
 
   /* Only allow revision roots. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return;
 
   /* Special case: the caller wants us to replace an existing cached
@@ -267,7 +204,7 @@
      root, and that only happens once under that root.  So, we'll be a
      little bit sloppy here, and count on callers doing the right
      thing. */
-  cache_item = apr_hash_get (root->node_cache, path, APR_HASH_KEY_STRING);
+  cache_item = apr_hash_get (frd->node_cache, path, APR_HASH_KEY_STRING);
   if (cache_item)
     {
       /* ### This section is somehow broken.  I don't know how, but it
@@ -278,9 +215,9 @@
 
 #if 0
       int cache_index = cache_item->idx;
-      cache_path = root->node_cache_keys[cache_index];
+      cache_path = frd->node_cache_keys[cache_index];
       cache_pool = cache_item->pool;
-      cache_item->node = svn_fs__dag_dup (node, cache_pool);
+      cache_item->node = svn_fs_fs__dag_dup (node, cache_pool);
 
       /* Now, move the cache key reference to the end of the keys in
          the keys array (unless it's already at the end).  ### Yes,
@@ -289,29 +226,29 @@
       if (cache_index != (num_keys - 1))
         {
           int move_num = SVN_FS_NODE_CACHE_MAX_KEYS - cache_index - 1;
-          memmove (root->node_cache_keys + cache_index,
-                   root->node_cache_keys + cache_index + 1,
+          memmove (frd->node_cache_keys + cache_index,
+                   frd->node_cache_keys + cache_index + 1,
                    move_num * sizeof (const char *));
           cache_index = num_keys - 1;
-          root->node_cache_keys[cache_index] = cache_path;
+          frd->node_cache_keys[cache_index] = cache_path;
         }
 
       /* Advance the cache pointers. */
       cache_item->idx = cache_index;
-      root->node_cache_idx = (cache_index + 1) % SVN_FS_NODE_CACHE_MAX_KEYS;
+      frd->node_cache_idx = (cache_index + 1) % SVN_FS_NODE_CACHE_MAX_KEYS;
       return;
 #endif
     }
 
   /* We're adding a new cache item.  First, see if we have room for it
      (otherwise, make some room). */
-  if (apr_hash_count (root->node_cache) == SVN_FS_NODE_CACHE_MAX_KEYS)
+  if (apr_hash_count (frd->node_cache) == SVN_FS_NODE_CACHE_MAX_KEYS)
     {
       /* No room.  Expire the oldest thing. */
-      cache_path = root->node_cache_keys[root->node_cache_idx];
-      cache_item = apr_hash_get (root->node_cache, cache_path,
+      cache_path = frd->node_cache_keys[frd->node_cache_idx];
+      cache_item = apr_hash_get (frd->node_cache, cache_path,
                                  APR_HASH_KEY_STRING);
-      apr_hash_set (root->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
+      apr_hash_set (frd->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
       cache_pool = cache_item->pool;
       svn_pool_clear (cache_pool);
     }
@@ -322,18 +259,18 @@
 
   /* Make the cache item, allocated in its own pool. */
   cache_item = apr_palloc (cache_pool, sizeof (*cache_item));
-  cache_item->node = svn_fs__dag_dup (node, cache_pool);
-  cache_item->idx = root->node_cache_idx;
+  cache_item->node = svn_fs_fs__dag_dup (node, cache_pool);
+  cache_item->idx = frd->node_cache_idx;
   cache_item->pool = cache_pool;
 
   /* Now add it to the cache. */
   cache_path = apr_pstrdup (cache_pool, path);
-  apr_hash_set (root->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
-  root->node_cache_keys[root->node_cache_idx] = cache_path;
+  apr_hash_set (frd->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
+  frd->node_cache_keys[frd->node_cache_idx] = cache_path;
           
   /* Advance the cache pointer. */
-  root->node_cache_idx = (root->node_cache_idx + 1) 
-                           % SVN_FS_NODE_CACHE_MAX_KEYS;
+  frd->node_cache_idx = (frd->node_cache_idx + 1) 
+    % SVN_FS_NODE_CACHE_MAX_KEYS;
 }
 
 
@@ -342,9 +279,9 @@
 /* Creating transaction and revision root nodes.  */
 
 svn_error_t *
-svn_fs_txn_root (svn_fs_root_t **root_p,
-                 svn_fs_txn_t *txn,
-                 apr_pool_t *pool)
+svn_fs_fs__txn_root (svn_fs_root_t **root_p,
+                     svn_fs_txn_t *txn,
+                     apr_pool_t *pool)
 {
   svn_fs_root_t *root;
 
@@ -357,16 +294,16 @@
 
 
 svn_error_t *
-svn_fs_revision_root (svn_fs_root_t **root_p,
-                      svn_fs_t *fs,
-                      svn_revnum_t rev,
-                      apr_pool_t *pool)
+svn_fs_fs__revision_root (svn_fs_root_t **root_p,
+                          svn_fs_t *fs,
+                          svn_revnum_t rev,
+                          apr_pool_t *pool)
 {
   dag_node_t *root_dir;
 
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
 
-  SVN_ERR (svn_fs__dag_revision_root (&root_dir, fs, rev, pool));
+  SVN_ERR (svn_fs_fs__dag_revision_root (&root_dir, fs, rev, pool));
 
   *root_p = make_revision_root (fs, rev, root_dir, pool);
   
@@ -382,20 +319,18 @@
 static svn_error_t *
 not_found (svn_fs_root_t *root, const char *path)
 {
-  if (root->kind == transaction_root)
+  if (root->is_txn_root)
     return
       svn_error_createf
       (SVN_ERR_FS_NOT_FOUND, 0,
        "File not found: transaction '%s', path '%s'",
        root->txn, path);
-  else if (root->kind == revision_root)
+  else
     return
       svn_error_createf
       (SVN_ERR_FS_NOT_FOUND, 0,
        "File not found: revision '%" SVN_REVNUM_T_FMT "', path '%s'",
        root->rev, path);
-  else
-    abort ();
 }
 
 
@@ -405,20 +340,18 @@
 {
   svn_fs_t *fs = root->fs;
 
-  if (root->kind == transaction_root)
+  if (root->is_txn_root)
     return
       svn_error_createf
       (SVN_ERR_FS_ALREADY_EXISTS, 0,
        "File already exists: filesystem '%s', transaction '%s', path '%s'",
        fs->path, root->txn, path);
-  else if (root->kind == revision_root)
+  else
     return
       svn_error_createf
       (SVN_ERR_FS_ALREADY_EXISTS, 0,
        "File already exists: filesystem '%s', revision '%" SVN_REVNUM_T_FMT
        "', path '%s'", fs->path, root->rev, path);
-  else
-    abort ();
 }
 
 
@@ -432,58 +365,6 @@
 
 
 
-/* Simple root operations.  */
-
-void
-svn_fs_close_root (svn_fs_root_t *root)
-{
-  svn_pool_destroy (root->pool);
-}
-
-
-svn_fs_t *
-svn_fs_root_fs (svn_fs_root_t *root)
-{
-  return root->fs;
-}
-
-
-svn_boolean_t
-svn_fs_is_txn_root (svn_fs_root_t *root)
-{
-  return root->kind == transaction_root;
-}
-
-
-svn_boolean_t
-svn_fs_is_revision_root (svn_fs_root_t *root)
-{
-  return root->kind == revision_root;
-}
-
-
-const char *
-svn_fs_txn_root_name (svn_fs_root_t *root,
-                      apr_pool_t *pool)
-{
-  if (root->kind == transaction_root)
-    return apr_pstrdup (pool, root->txn);
-  else
-    return NULL;
-}
-
-
-svn_revnum_t
-svn_fs_revision_root_revision (svn_fs_root_t *root)
-{
-  if (root->kind == revision_root)
-    return root->rev;
-  else
-    return SVN_INVALID_REVNUM;
-}
-
-
-
 /* Getting dag nodes for roots.  */
 
 
@@ -494,20 +375,20 @@
            svn_fs_root_t *root,
            apr_pool_t *pool)
 {
-  if (root->kind == revision_root)
+  fs_root_data_t *frd = root->fsap_data;
+  
+  if (! root->is_txn_root)
     {
       /* It's a revision root, so we already have its root directory
          opened.  */
-      *node_p = svn_fs__dag_dup (root->root_dir, pool);
+      *node_p = svn_fs_fs__dag_dup (frd->root_dir, pool);
       return SVN_NO_ERROR;
     }
-  else if (root->kind == transaction_root)
+  else
     {
       /* It's a transaction root.  Open a fresh copy.  */
-      return svn_fs__dag_txn_root (node_p, root->fs, root->txn, pool);
+      return svn_fs_fs__dag_txn_root (node_p, root->fs, root->txn, pool);
     }
-  else
-    abort ();
 }
 
 
@@ -520,13 +401,13 @@
                    const char *error_path,
                    apr_pool_t *pool)
 {
-  if (root->kind == transaction_root)
-    return svn_fs__dag_clone_root (node_p, root->fs, 
-                                   svn_fs_txn_root_name (root, pool),
-                                   pool);
+  if (root->is_txn_root)
+    return svn_fs_fs__dag_clone_root (node_p, root->fs, 
+                                      svn_fs_txn_root_name (root, pool),
+                                      pool);
   else
     /* If it's not a transaction root, we can't change its contents.  */
-    return svn_fs__err_not_mutable (root->fs, root->rev, error_path);
+    return svn_fs_fs__err_not_mutable (root->fs, root->rev, error_path);
 }
 
 
@@ -539,7 +420,7 @@
   copy_id_inherit_self,
   copy_id_inherit_parent,
   copy_id_inherit_new
-
+    
 } copy_id_inherit_t;
 
 /* A linked list representing the path from a node up to a root
@@ -571,7 +452,8 @@
 
 } parent_path_t;
 
-
+/* Return a text string describing the absolute path of parent_path
+   PARENT_PATH.  It will be allocated in POOL. */
 static const char *
 parent_path_path (parent_path_t *parent_path,
                   apr_pool_t *pool)
@@ -580,8 +462,8 @@
   if (parent_path->parent)
     path_so_far = parent_path_path (parent_path->parent, pool);
   return parent_path->entry 
-         ? svn_path_join (path_so_far, parent_path->entry, pool) 
-         : path_so_far;
+    ? svn_path_join (path_so_far, parent_path->entry, pool) 
+    : path_so_far;
 }
 
 
@@ -612,13 +494,13 @@
   assert (child && child->parent && txn_id);
 
   /* Initialize some convenience variables. */
-  child_id = svn_fs__dag_get_id (child->node);
-  parent_id = svn_fs__dag_get_id (child->parent->node);
+  child_id = svn_fs_fs__dag_get_id (child->node);
+  parent_id = svn_fs_fs__dag_get_id (child->parent->node);
   child_copy_id = svn_fs__id_copy_id (child_id);
   parent_copy_id = svn_fs__id_copy_id (parent_id);
 
   /* If this child is already mutable, we have nothing to do. */
-  if (svn_fs__id_txn_id (child_id))
+  if (svn_fs_fs__get_id_txn (child_id))
     {
       *inherit_p = copy_id_inherit_self;
       *copy_src_path = NULL;
@@ -639,7 +521,7 @@
      the same, then the child is already on the same branch as the
      parent, and should use the same mutability copy ID that the
      parent will use. */
-  if (svn_fs__key_compare (child_copy_id, parent_copy_id) == 0)
+  if (svn_fs_fs__key_compare (child_copy_id, parent_copy_id) == 0)
     return SVN_NO_ERROR;
 
   /* If the child is on the same branch that the parent is on, the
@@ -649,18 +531,18 @@
      branch as its parent if the child itself is not a branch point,
      or if it is a branch point that we are accessing via its original
      copy destination path. */
-  SVN_ERR (svn_fs__dag_get_copyroot (&copyroot_rev, &copyroot_path,
-                                     child->node,pool));
+  SVN_ERR (svn_fs_fs__dag_get_copyroot (&copyroot_rev, &copyroot_path,
+                                        child->node,pool));
   SVN_ERR (svn_fs_revision_root (&copyroot_root, fs, copyroot_rev, pool));
   SVN_ERR (get_dag (&copyroot_node, copyroot_root, copyroot_path, pool));
-  copyroot_id = svn_fs__dag_get_id (copyroot_node);
+  copyroot_id = svn_fs_fs__dag_get_id (copyroot_node);
   
   if (svn_fs_compare_ids (copyroot_id, child_id) == -1)
     return SVN_NO_ERROR;
 
   /* Determine if we are looking at the child via its original path or
      as a subtree item of a copied tree. */
-  id_path = svn_fs__dag_get_created_path (child->node);
+  id_path = svn_fs_fs__dag_get_created_path (child->node);
   if (strcmp (id_path, parent_path_path (child, pool)) == 0)
     {
       *inherit_p = copy_id_inherit_self;
@@ -771,7 +653,7 @@
    them, and tell them whether the entry exists already.
 
    NOTE: Public interfaces which only *read* from the filesystem
-   should not call this function directly, but should instead use 
+   should not call this function directly, but should instead use
    get_dag().
 */
 static svn_error_t *
@@ -793,7 +675,7 @@
   /* Make a parent_path item for the root node, using its own current
      copy id.  */
   SVN_ERR (root_node (&here, root, pool));
-  id = svn_fs__dag_get_id (here);
+  id = svn_fs_fs__dag_get_id (here);
   parent_path = make_parent_path (here, 0, 0, pool);
   parent_path->copy_inherit = copy_id_inherit_self;
   
@@ -838,7 +720,7 @@
           if (cached_node)
             child = cached_node;
           else
-            err = svn_fs__dag_open (&child, here, entry, pool);
+            err = svn_fs_fs__dag_open (&child, here, entry, pool);
           
           /* "file not found" requires special handling.  */
           if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -858,7 +740,7 @@
                 }
               else
                 {
-                  /* Build a better error message than svn_fs__dag_open
+                  /* Build a better error message than svn_fs_fs__dag_open
                      can provide, giving the root and full path name.  */
                   return not_found (root, path);
                 }
@@ -887,8 +769,8 @@
         break;
       
       /* The path isn't finished yet; we'd better be in a directory.  */
-      if (svn_fs__dag_node_kind (child) != svn_node_dir)
-        SVN_ERR_W (svn_fs__err_not_directory (fs, path_so_far),
+      if (svn_fs_fs__dag_node_kind (child) != svn_node_dir)
+        SVN_ERR_W (svn_fs_fs__err_not_directory (fs, path_so_far),
                    apr_pstrcat (pool, "Failure opening '", path, "'", NULL));
       
       rest = next;
@@ -915,7 +797,7 @@
   const char *txn_id = svn_fs_txn_root_name (root, pool);
 
   /* Is the node mutable already?  */
-  if (svn_fs__dag_check_mutable (parent_path->node, txn_id))
+  if (svn_fs_fs__dag_check_mutable (parent_path->node, txn_id))
     return SVN_NO_ERROR;
 
   /* Are we trying to clone the root, or somebody's child node?  */
@@ -938,12 +820,12 @@
       switch (inherit)
         {
         case copy_id_inherit_parent:
-          parent_id = svn_fs__dag_get_id (parent_path->parent->node);
+          parent_id = svn_fs_fs__dag_get_id (parent_path->parent->node);
           copy_id = svn_fs__id_copy_id (parent_id);
           break;
           
         case copy_id_inherit_new:
-          SVN_ERR (svn_fs__fs_reserve_copy_id (&copy_id, root->fs, txn_id,
+          SVN_ERR (svn_fs_fs__reserve_copy_id (&copy_id, root->fs, txn_id,
                                                pool));
           break;
 
@@ -958,27 +840,27 @@
         }
 
       /* Determine what copyroot our new child node should use. */
-      SVN_ERR (svn_fs__dag_get_copyroot (&copyroot_rev, &copyroot_path,
-                                         parent_path->node, pool));
+      SVN_ERR (svn_fs_fs__dag_get_copyroot (&copyroot_rev, &copyroot_path,
+                                            parent_path->node, pool));
       SVN_ERR (svn_fs_revision_root (&copyroot_root, root->fs, copyroot_rev,
                                      pool));
       SVN_ERR (get_dag (&copyroot_node, copyroot_root, copyroot_path, pool));
 
-      child_id = svn_fs__dag_get_id (parent_path->node);
-      copyroot_id = svn_fs__dag_get_id (copyroot_node);
+      child_id = svn_fs_fs__dag_get_id (parent_path->node);
+      copyroot_id = svn_fs_fs__dag_get_id (copyroot_node);
       if (strcmp (svn_fs__id_node_id (child_id),
                   svn_fs__id_node_id (copyroot_id)) != 0)
         is_parent_copyroot = TRUE;
       
       /* Now make this node mutable.  */
       clone_path = parent_path_path (parent_path->parent, pool);
-      SVN_ERR (svn_fs__dag_clone_child (&clone,
-                                        parent_path->parent->node,
-                                        clone_path,
-                                        parent_path->entry, 
-                                        copy_id, txn_id,
-                                        is_parent_copyroot, 
-                                        pool));
+      SVN_ERR (svn_fs_fs__dag_clone_child (&clone,
+                                           parent_path->parent->node,
+                                           clone_path,
+                                           parent_path->entry, 
+                                           copy_id, txn_id,
+                                           is_parent_copyroot, 
+                                           pool));
     }
   else
     {
@@ -994,8 +876,8 @@
 
 
 /* Open the node identified by PATH in ROOT.  Set DAG_NODE_P to the
-   *node we find, allocated in POOL.  Return the error
-   *SVN_ERR_FS_NOT_FOUND if this node doesn't exist. */
+ *node we find, allocated in POOL.  Return the error
+ *SVN_ERR_FS_NOT_FOUND if this node doesn't exist. */
 static svn_error_t *
 get_dag (dag_node_t **dag_node_p,
          svn_fs_root_t *root,
@@ -1032,7 +914,10 @@
    TXN_ID, and indicated that a change of kind CHANGE_KIND occurred on
    PATH (whose node revision id is--or was, in the case of a
    deletion--NODEREV_ID), and optionally that TEXT_MODs or PROP_MODs
-   occurred.  Do all this as part of POOL.  */
+   occurred.  If the change resulted from a copy, COPYFROM_REV and
+   COPYFROM_PATH specify under which revision and path the node was
+   copied from.  If this was not part of a copy, COPYFROM_REV should
+   be SVN_INVALID_REVNUM.  Do all this as part of POOL.  */
 static svn_error_t *
 add_change (svn_fs_t *fs,
             const char *txn_id,
@@ -1041,11 +926,14 @@
             svn_fs_path_change_kind_t change_kind,
             svn_boolean_t text_mod,
             svn_boolean_t prop_mod,
+            svn_revnum_t copyfrom_rev,
+            const char *copyfrom_path,
             apr_pool_t *pool)
 {
-  SVN_ERR (svn_fs__fs_add_change (fs, txn_id,
+  SVN_ERR (svn_fs_fs__add_change (fs, txn_id,
                                   svn_fs__canonicalize_abspath (path, pool),
                                   noderev_id, change_kind, text_mod, prop_mod,
+                                  copyfrom_rev, copyfrom_path,
                                   pool));
 
   return SVN_NO_ERROR;
@@ -1055,70 +943,73 @@
 
 /* Generic node operations.  */
 
-
-svn_error_t *
-svn_fs_node_id (const svn_fs_id_t **id_p,
-                svn_fs_root_t *root,
-                const char *path,
-                apr_pool_t *pool)
+/* Get the id of a node referenced by path PATH in ROOT.  Return the
+   id in *ID_P allocated in POOL. */
+static svn_error_t *
+fs_node_id (const svn_fs_id_t **id_p,
+            svn_fs_root_t *root,
+            const char *path,
+            apr_pool_t *pool)
 {
-  if ((root->kind == revision_root)
+  fs_root_data_t *frd = root->fsap_data;
+  
+  if ((! root->is_txn_root)
       && (path[0] == '\0' || ((path[0] == '/') && (path[1] == '\0'))))
     {
       /* Optimize the case where we don't need any db access at all. 
          The root directory ("" or "/") node is stored in the
          svn_fs_root_t object, and never changes when it's a revision
          root, so we can just reach in and grab it directly. */
-      *id_p = svn_fs__id_copy (svn_fs__dag_get_id (root->root_dir), pool);
+      *id_p = svn_fs__id_copy (svn_fs_fs__dag_get_id (frd->root_dir), pool);
     }
   else
     {
       dag_node_t *node;
 
       SVN_ERR (get_dag (&node, root, path, pool));
-      *id_p = svn_fs__id_copy (svn_fs__dag_get_id (node), pool);
+      *id_p = svn_fs__id_copy (svn_fs_fs__dag_get_id (node), pool);
     }
   return SVN_NO_ERROR;
 }
 
 
-struct node_created_rev_args {
-  svn_revnum_t revision;
-  svn_fs_root_t *root;
-  const char *path;
-};
-
-
-svn_error_t *
-svn_fs_node_created_rev (svn_revnum_t *revision,
-                         svn_fs_root_t *root,
-                         const char *path,
-                         apr_pool_t *pool)
+/* Set *REVISION to the revision in which PATH under ROOT was created.
+   Use POOL for any temporary allocations.  If PATH is in an
+   uncommitted transaction, *REVISION will be set to
+   SVN_INVALID_REVNUM. */
+static svn_error_t *
+fs_node_created_rev (svn_revnum_t *revision,
+                     svn_fs_root_t *root,
+                     const char *path,
+                     apr_pool_t *pool)
 {
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, root, path, pool));
-  SVN_ERR (svn_fs__dag_get_revision (revision, node, pool));
+  SVN_ERR (svn_fs_fs__dag_get_revision (revision, node, pool));
 
   return SVN_NO_ERROR;
 }
 
-
-svn_error_t *
-svn_fs_node_created_path (const char **created_path,
-                          svn_fs_root_t *root,
-                          const char *path,
-                          apr_pool_t *pool)
+/* Set *CREATED_PATH to the path at which PATH under ROOT was created.
+   Return a string allocated in POOL. */
+static svn_error_t *
+fs_node_created_path (const char **created_path,
+                      svn_fs_root_t *root,
+                      const char *path,
+                      apr_pool_t *pool)
 {
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, root, path, pool));
-  *created_path = svn_fs__dag_get_created_path (node);
+  *created_path = svn_fs_fs__dag_get_created_path (node);
   
   return SVN_NO_ERROR;
 }
 
 
+/* Set *KIND_P to the type of node located at PATH under ROOT.
+   Perform temporary allocations in POOL. */
 static svn_error_t *
 node_kind (svn_node_kind_t *kind_p,
            svn_fs_root_t *root,
@@ -1132,18 +1023,21 @@
   SVN_ERR (svn_fs_node_id (&node_id, root, path, pool));
     
   /* Use the node id to get the real kind. */
-  SVN_ERR (svn_fs__dag_get_node (&node, root->fs, node_id, pool));
-  *kind_p = svn_fs__dag_node_kind (node);
+  SVN_ERR (svn_fs_fs__dag_get_node (&node, root->fs, node_id, pool));
+  *kind_p = svn_fs_fs__dag_node_kind (node);
   
   return SVN_NO_ERROR;
 }
 
-  
-svn_error_t *
-svn_fs_check_path (svn_node_kind_t *kind_p,
-                   svn_fs_root_t *root,
-                   const char *path,
-                   apr_pool_t *pool)
+
+/* Set *KIND_P to the type of node present at PATH under ROOT.  If
+   PATH does not exist under ROOT, set *KIND_P to svn_node_none.  Use
+   POOL for temporary allocation. */
+static svn_error_t *
+fs_check_path (svn_node_kind_t *kind_p,
+               svn_fs_root_t *root,
+               const char *path,
+               apr_pool_t *pool)
 {
   svn_error_t *err = node_kind (kind_p, root, path, pool);
   if (err && (err->apr_err == SVN_ERR_FS_NOT_FOUND))
@@ -1158,45 +1052,21 @@
   return SVN_NO_ERROR;
 }
 
-
-svn_error_t *
-svn_fs_is_dir (svn_boolean_t *is_dir,
-               svn_fs_root_t *root,
-               const char *path,
-               apr_pool_t *pool)
-{
-  svn_node_kind_t kind;
-  SVN_ERR (node_kind (&kind, root, path, pool));
-  *is_dir = (kind == svn_node_dir);
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_is_file (svn_boolean_t *is_file,
-                svn_fs_root_t *root,
-                const char *path,
-                apr_pool_t *pool)
-{
-  svn_node_kind_t kind;
-  SVN_ERR (node_kind (&kind, root, path, pool));
-  *is_file = (kind == svn_node_file);
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_node_prop (svn_string_t **value_p,
-                  svn_fs_root_t *root,
-                  const char *path,
-                  const char *propname,
-                  apr_pool_t *pool)
+/* Set *VALUE_P to the value of the property named PROPNAME of PATH in
+   ROOT.  If the node has no property by that name, set *VALUE_P to
+   zero.  Allocate the result in POOL. */
+static svn_error_t *
+fs_node_prop (svn_string_t **value_p,
+              svn_fs_root_t *root,
+              const char *path,
+              const char *propname,
+              apr_pool_t *pool)
 {
   dag_node_t *node;
   apr_hash_t *proplist;
 
   SVN_ERR (get_dag (&node, root, path, pool));
-  SVN_ERR (svn_fs__dag_get_proplist (&proplist, node, pool));
+  SVN_ERR (svn_fs_fs__dag_get_proplist (&proplist, node, pool));
   *value_p = NULL;
   if (proplist)
     *value_p = apr_hash_get (proplist, propname, APR_HASH_KEY_STRING);
@@ -1205,29 +1075,38 @@
 }
 
 
-svn_error_t *
-svn_fs_node_proplist (apr_hash_t **table_p,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *pool)
+/* Set *TABLE_P to the entire property list of PATH under ROOT, as an
+   APR hash table allocated in POOL.  The resulting property table
+   maps property names to pointers to svn_string_t objects containing
+   the property value. */
+static svn_error_t *
+fs_node_proplist (apr_hash_t **table_p,
+                  svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   apr_hash_t *table;
   dag_node_t *node;
 
   SVN_ERR (get_dag (&node, root, path, pool));
-  SVN_ERR (svn_fs__dag_get_proplist (&table, node, pool));
+  SVN_ERR (svn_fs_fs__dag_get_proplist (&table, node, pool));
   *table_p = table ? table : apr_hash_make (pool);
   
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_change_node_prop (svn_fs_root_t *root,
-                         const char *path,
-                         const char *name,
-                         const svn_string_t *value,
-                         apr_pool_t *pool)
+/* Change, add, or delete a node's property value.  The node affect is
+   PATH under ROOT, the property value to modify is NAME, and VALUE
+   points to either a string value to set the new contents to, or NULL
+   if the property should be deleted.  Perform temporary allocations
+   in POOL. */
+static svn_error_t *
+fs_change_node_prop (svn_fs_root_t *root,
+                     const char *path,
+                     const char *name,
+                     const svn_string_t *value,
+                     apr_pool_t *pool)
 {
   parent_path_t *parent_path;
   apr_hash_t *proplist;
@@ -1239,7 +1118,7 @@
 
   SVN_ERR (open_path (&parent_path, root, path, 0, txn_id, pool));
   SVN_ERR (make_path_mutable (root, parent_path, path, pool));
-  SVN_ERR (svn_fs__dag_get_proplist (&proplist, parent_path->node, pool));
+  SVN_ERR (svn_fs_fs__dag_get_proplist (&proplist, parent_path->node, pool));
 
   /* If there's no proplist, but we're just deleting a property, exit now. */
   if ((! proplist) && (! value))
@@ -1253,25 +1132,30 @@
   apr_hash_set (proplist, name, APR_HASH_KEY_STRING, value);
 
   /* Overwrite the node's proplist. */
-  SVN_ERR (svn_fs__dag_set_proplist (parent_path->node, proplist, 
-                                     txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_set_proplist (parent_path->node, proplist, 
+                                        txn_id, pool));
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (parent_path->node),
-                       svn_fs_path_change_modify, 0, 1, pool));
+                       path, svn_fs_fs__dag_get_id (parent_path->node),
+                       svn_fs_path_change_modify, 0, 1, SVN_INVALID_REVNUM,
+                       NULL, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_props_changed (svn_boolean_t *changed_p,
-                      svn_fs_root_t *root1,
-                      const char *path1,
-                      svn_fs_root_t *root2,
-                      const char *path2,
-                      apr_pool_t *pool)
+/* Determine if the properties of two path/root combinations are
+   different.  Set *CHANGED_P to TRUE if the properties at PATH1 under
+   ROOT1 differ from those at PATH2 under ROOT2, or FALSE otherwise.
+   Both roots must be in the same filesystem. */
+static svn_error_t *
+fs_props_changed (svn_boolean_t *changed_p,
+                  svn_fs_root_t *root1,
+                  const char *path1,
+                  svn_fs_root_t *root2,
+                  const char *path2,
+                  apr_pool_t *pool)
 {
   dag_node_t *node1, *node2;
   
@@ -1283,8 +1167,8 @@
   
   SVN_ERR (get_dag (&node1, root1, path1, pool));
   SVN_ERR (get_dag (&node2, root2, path2, pool));
-  SVN_ERR (svn_fs__things_different (changed_p, NULL, 
-                                     node1, node2, pool));
+  SVN_ERR (svn_fs_fs__things_different (changed_p, NULL, 
+                                        node1, node2, pool));
   
   return SVN_NO_ERROR;
 }
@@ -1314,12 +1198,12 @@
   dag_node_t *node1, *node2;
 
   /* Get the nodes. */
-  SVN_ERR (svn_fs__dag_get_node (&node1, fs, id1, pool));
-  SVN_ERR (svn_fs__dag_get_node (&node2, fs, id2, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (&node1, fs, id1, pool));
+  SVN_ERR (svn_fs_fs__dag_get_node (&node2, fs, id2, pool));
   
   /* Do the test.  If the test fails, we'll just go with "not an
      ancestor" for now.  ### better come back and check this out.  */
-  return svn_fs__dag_is_ancestor (is_ancestor, node1, node2, pool);
+  return svn_fs_fs__dag_is_ancestor (is_ancestor, node1, node2, pool);
 }
 
 
@@ -1332,19 +1216,19 @@
                  int source_pred_count,
                  apr_pool_t *pool)
 {
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
 
-  if (svn_fs__id_txn_id (target_id) == NULL)
+  if (svn_fs_fs__get_id_txn (target_id) == NULL)
     return svn_error_createf
       (SVN_ERR_FS_NOT_MUTABLE, NULL,
        "Unexpected immutable node at '%s'", target_path);
 
-  SVN_ERR (svn_fs__fs_get_node_revision (&noderev, fs, target_id, pool));
+  SVN_ERR (svn_fs_fs__get_node_revision (&noderev, fs, target_id, pool));
   noderev->predecessor_id = source_id;
   noderev->predecessor_count = source_pred_count;
   if (noderev->predecessor_count != -1)
     noderev->predecessor_count++;
-  SVN_ERR (svn_fs__fs_put_node_revision (fs, target_id, noderev, pool));
+  SVN_ERR (svn_fs_fs__put_node_revision (fs, target_id, noderev, pool));
 
   return SVN_NO_ERROR;
 }
@@ -1364,7 +1248,7 @@
   path = svn_fs__canonicalize_abspath (path, pool);
 
   /* First, get the changes associated with TXN_ID. */
-  SVN_ERR (svn_fs__fs_txn_changes_fetch (&changes, fs, txn_id, pool));
+  SVN_ERR (svn_fs_fs__txn_changes_fetch (&changes, fs, txn_id, pool));
 
   /* Now, do any of those changes apply to path and indicate deletion? */
   this_change = apr_hash_get (changes, path, APR_HASH_KEY_STRING);
@@ -1375,11 +1259,13 @@
       /* If so, reset the changes and re-add everything except the
          deletion. */
       SVN_ERR (add_change (fs, txn_id, path, NULL,
-                           svn_fs_path_change_reset, 0, 0, pool));
+                           svn_fs_path_change_reset, 0, 0, SVN_INVALID_REVNUM,
+                           NULL, pool));
       if (this_change->change_kind == svn_fs_path_change_replace)
         {
           SVN_ERR (add_change (fs, txn_id, path, NULL,
-                               svn_fs_path_change_reset, 0, 0, pool));
+                               svn_fs_path_change_reset, 0, 0,
+                               SVN_INVALID_REVNUM, NULL, pool));
         }
     }
   else
@@ -1448,9 +1334,9 @@
   svn_fs_t *fs;
 
   /* Make sure everyone comes from the same filesystem. */
-  fs = svn_fs__dag_get_fs (ancestor);
-  if ((fs != svn_fs__dag_get_fs (source))
-      || (fs != svn_fs__dag_get_fs (target)))
+  fs = svn_fs_fs__dag_get_fs (ancestor);
+  if ((fs != svn_fs_fs__dag_get_fs (source))
+      || (fs != svn_fs_fs__dag_get_fs (target)))
     {
       return svn_error_create
         (SVN_ERR_FS_CORRUPT, NULL,
@@ -1458,11 +1344,11 @@
     }
 
   /* We have the same fs, now check it. */
-  SVN_ERR (svn_fs__check_fs (fs));
+  SVN_ERR (svn_fs_fs__check_fs (fs));
 
-  source_id   = svn_fs__dag_get_id (source);
-  target_id   = svn_fs__dag_get_id (target);
-  ancestor_id = svn_fs__dag_get_id (ancestor);
+  source_id   = svn_fs_fs__dag_get_id (source);
+  target_id   = svn_fs_fs__dag_get_id (target);
+  ancestor_id = svn_fs_fs__dag_get_id (ancestor);
 
   /* It's improper to call this function with ancestor == target. */
   if (svn_fs__id_eq (ancestor_id, target_id))
@@ -1590,9 +1476,9 @@
    * See the following message for the full details:
    * http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=166183 */
 
-  if ((svn_fs__dag_node_kind (source) != svn_node_dir)
-      || (svn_fs__dag_node_kind (target) != svn_node_dir)
-      || (svn_fs__dag_node_kind (ancestor) != svn_node_dir))
+  if ((svn_fs_fs__dag_node_kind (source) != svn_node_dir)
+      || (svn_fs_fs__dag_node_kind (target) != svn_node_dir)
+      || (svn_fs_fs__dag_node_kind (ancestor) != svn_node_dir))
     {
       return conflict_err (conflict_p, target_path);
     }
@@ -1604,12 +1490,12 @@
 
      ### TODO: Please see issue #418 about the inelegance of this. */
   {
-    svn_fs__node_revision_t *tgt_nr, *anc_nr;
+    node_revision_t *tgt_nr, *anc_nr;
 
     /* Get node revisions for our id's. */
     
-    SVN_ERR (svn_fs__fs_get_node_revision (&tgt_nr, fs, target_id, pool));
-    SVN_ERR (svn_fs__fs_get_node_revision (&anc_nr, fs, ancestor_id, pool));
+    SVN_ERR (svn_fs_fs__get_node_revision (&tgt_nr, fs, target_id, pool));
+    SVN_ERR (svn_fs_fs__get_node_revision (&anc_nr, fs, ancestor_id, pool));
     
     /* Now compare the prop-keys of the skels.  Note that just because
        the keys are different -doesn't- mean the proplists have
@@ -1617,7 +1503,7 @@
        it doesn't do a brute-force comparison on textual contents, so
        it won't do that here either.  Checking to see if the propkey
        atoms are `equal' is enough. */
-    if (! svn_fs__fs_noderev_same_rep_key (tgt_nr->prop_rep, anc_nr->prop_rep))
+    if (! svn_fs_fs__noderev_same_rep_key (tgt_nr->prop_rep, anc_nr->prop_rep))
       {
         return conflict_err (conflict_p, target_path);
       }
@@ -1626,13 +1512,13 @@
   /* ### todo: it would be more efficient to simply check for a NULL
      entries hash where necessary below than to allocate an empty hash
      here, but another day, another day... */
-  SVN_ERR (svn_fs__dag_dir_entries (&s_entries, source, pool));
+  SVN_ERR (svn_fs_fs__dag_dir_entries (&s_entries, source, pool));
   if (! s_entries)
     s_entries = apr_hash_make (pool);
-  SVN_ERR (svn_fs__dag_dir_entries (&t_entries, target, pool));
+  SVN_ERR (svn_fs_fs__dag_dir_entries (&t_entries, target, pool));
   if (! t_entries)
     t_entries = apr_hash_make (pool);
-  SVN_ERR (svn_fs__dag_dir_entries (&a_entries, ancestor, pool));
+  SVN_ERR (svn_fs_fs__dag_dir_entries (&a_entries, ancestor, pool));
   if (! a_entries)
     a_entries = apr_hash_make (pool);
 
@@ -1717,12 +1603,12 @@
               if (logic_case == 1)
                 {
                   /* ... target takes source. */
-                  if (! svn_fs__dag_check_mutable (target, txn_id))
+                  if (! svn_fs_fs__dag_check_mutable (target, txn_id))
                     return svn_error_createf
                       (SVN_ERR_FS_NOT_MUTABLE, NULL,
                        "Unexpected immutable node at '%s'", target_path);
 
-                  SVN_ERR (svn_fs__dag_set_entry
+                  SVN_ERR (svn_fs_fs__dag_set_entry
                            (target, t_entry->name, s_entry->id, 
                             txn_id, pool));
                 }
@@ -1734,17 +1620,21 @@
                   dag_node_t *s_ent_node, *t_ent_node, *a_ent_node;
                   const char *new_tpath;
                   int pred_count;
+                  svn_node_kind_t s_kind, t_kind, a_kind;
                       
-                  SVN_ERR (svn_fs__dag_get_node (&s_ent_node, fs,
-                                                 s_entry->id, pool));
-                  SVN_ERR (svn_fs__dag_get_node (&t_ent_node, fs,
-                                                 t_entry->id, pool));
-                  SVN_ERR (svn_fs__dag_get_node (&a_ent_node, fs,
-                                                 a_entry->id, pool));
+                  SVN_ERR (svn_fs_fs__dag_get_node (&s_ent_node, fs,
+                                                    s_entry->id, pool));
+                  SVN_ERR (svn_fs_fs__dag_get_node (&t_ent_node, fs,
+                                                    t_entry->id, pool));
+                  SVN_ERR (svn_fs_fs__dag_get_node (&a_ent_node, fs,
+                                                    a_entry->id, pool));
+
+                  s_kind = svn_fs_fs__dag_node_kind (s_ent_node);
+                  t_kind = svn_fs_fs__dag_node_kind (t_ent_node);
+                  a_kind = svn_fs_fs__dag_node_kind (a_ent_node);
                       
-                  if ((svn_fs__dag_node_kind (s_ent_node) != svn_node_dir)
-                      || (svn_fs__dag_node_kind (t_ent_node) != svn_node_dir)
-                      || (svn_fs__dag_node_kind (a_ent_node) != svn_node_dir))
+                  if ((s_kind != svn_node_dir) || (t_kind != svn_node_dir)
+                      || (a_kind != svn_node_dir))
                     {
                       /* Not all of these entries is a directory. Conflict. */
                       return conflict_err (conflict_p,
@@ -1760,9 +1650,9 @@
                                   t_ent_node, s_ent_node, a_ent_node,
                                   txn_id, pool));
 
-                  SVN_ERR (svn_fs__dag_get_predecessor_count (&pred_count,
-                                                              s_ent_node,
-                                                              pool));
+                  SVN_ERR (svn_fs_fs__dag_get_predecessor_count (&pred_count,
+                                                                 s_ent_node,
+                                                                 pool));
 
                   /* If target is an immediate descendant of ancestor,
                      and source is also a descendant of ancestor, we
@@ -1805,13 +1695,13 @@
               /* If E is same in target as ancestor, then it has not
                  changed, and the deletion in source should be
                  honored. */
-              if (! svn_fs__dag_check_mutable (target, txn_id))
+              if (! svn_fs_fs__dag_check_mutable (target, txn_id))
                 return svn_error_createf
                   (SVN_ERR_FS_NOT_MUTABLE, NULL,
                    "Unexpected immutable node at '%s'", target_path);
               
-              SVN_ERR (svn_fs__dag_delete (target, t_entry->name, 
-                                           txn_id, pool));
+              SVN_ERR (svn_fs_fs__dag_delete (target, t_entry->name, 
+                                              txn_id, pool));
 
               /* Seems cleanest to remove it from the target entries
                  hash now, even though no code would break if we
@@ -1899,12 +1789,12 @@
       if (! t_entry)
         {
           /* target takes source */
-          if (! svn_fs__dag_check_mutable (target, txn_id))
+          if (! svn_fs_fs__dag_check_mutable (target, txn_id))
             return svn_error_createf
               (SVN_ERR_FS_NOT_MUTABLE, NULL,
                "Unexpected immutable node at '%s'", target_path);
               
-          SVN_ERR (svn_fs__dag_set_entry
+          SVN_ERR (svn_fs_fs__dag_set_entry
                    (target, s_entry->name, s_entry->id, txn_id, pool));
         }
       /* E exists in target but is different from E in source */
@@ -1951,18 +1841,18 @@
   svn_fs_t *fs = txn->fs;
   const char *txn_id = txn->id;
 
-  source_id = svn_fs__dag_get_id (source_node);
+  source_id = svn_fs_fs__dag_get_id (source_node);
   
-  SVN_ERR (svn_fs__dag_txn_root (&txn_root_node, fs, txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_txn_root (&txn_root_node, fs, txn_id, pool));
 
   if (ancestor_node == NULL)
     {
-      SVN_ERR (svn_fs__dag_txn_base_root (&ancestor_node, fs,
-                                          txn_id, pool));
+      SVN_ERR (svn_fs_fs__dag_txn_base_root (&ancestor_node, fs,
+                                             txn_id, pool));
     }
   
-  if (svn_fs__id_eq (svn_fs__dag_get_id (ancestor_node),
-                    svn_fs__dag_get_id (txn_root_node)))
+  if (svn_fs__id_eq (svn_fs_fs__dag_get_id (ancestor_node),
+                     svn_fs_fs__dag_get_id (txn_root_node)))
     {
       /* If no changes have been made in TXN since its current base,
          then it can't conflict with any changes since that base.  So
@@ -1981,15 +1871,15 @@
       SVN_ERR (merge (conflict, "/", txn_root_node,
                       source_node, ancestor_node, txn_id, pool));
 
-      SVN_ERR (svn_fs__dag_get_predecessor_count (&pred_count, source_node,
-                                                  pool));
+      SVN_ERR (svn_fs_fs__dag_get_predecessor_count (&pred_count, source_node,
+                                                     pool));
 
       /* After the merge, txn's new "ancestor" is now really the node
          at source_id, so record that fact.  Think of this as
          ratcheting the txn forward in time, so it can't backslide and
          forget the merging work that's already been done. */
       SVN_ERR (update_ancestry (fs, source_id, 
-                                svn_fs__dag_get_id (txn_root_node),
+                                svn_fs_fs__dag_get_id (txn_root_node),
                                 txn_id, "/", pred_count, pool));
     }
   
@@ -2000,10 +1890,10 @@
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
 svn_error_t *
-svn_fs_commit_txn (const char **conflict_p,
-                   svn_revnum_t *new_rev_p, 
-                   svn_fs_txn_t *txn,
-                   apr_pool_t *pool)
+svn_fs_fs__commit_txn (const char **conflict_p,
+                       svn_revnum_t *new_rev_p, 
+                       svn_fs_txn_t *txn,
+                       apr_pool_t *pool)
 {
   /* How do commits work in Subversion?
    *
@@ -2092,7 +1982,7 @@
         }
       
       /* Try to commit. */
-      err = svn_fs__fs_commit (&new_rev, fs, txn, pool);
+      err = svn_fs_fs__commit (&new_rev, fs, txn, pool);
       if (err && (err->apr_err == SVN_ERR_FS_TXN_OUT_OF_DATE))
         {
           /* Did someone else finish committing a new revision while we
@@ -2123,17 +2013,22 @@
 }
 
 
-/* Note:  it is acceptable for this function to call back into
-   public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_merge (const char **conflict_p,
-              svn_fs_root_t *source_root,
-              const char *source_path,
-              svn_fs_root_t *target_root,
-              const char *target_path,
-              svn_fs_root_t *ancestor_root,
-              const char *ancestor_path,
-              apr_pool_t *pool)
+/* Merge changes between two nodes into a third node.  Given nodes
+   SOURCE_PATH under SOURCE_ROOT, TARGET_PATH under TARGET_ROOT and
+   ANCESTOR_PATH under ANCESTOR_ROOT, modify target to contain all the
+   changes between the ancestor and source.  If there are conflicts,
+   return SVN_ERR_FS_CONFLICT and set *CONFLICT_P to a textual
+   description of the offending changes.  Perform any temporary
+   allocations in POOL. */
+static svn_error_t *
+fs_merge (const char **conflict_p,
+          svn_fs_root_t *source_root,
+          const char *source_path,
+          svn_fs_root_t *target_root,
+          const char *target_path,
+          svn_fs_root_t *ancestor_root,
+          const char *ancestor_path,
+          apr_pool_t *pool)
 {
   dag_node_t *source, *ancestor;
   svn_fs_txn_t *txn;
@@ -2187,9 +2082,9 @@
 }
 
 svn_error_t *
-svn_fs_deltify_revision (svn_fs_t *fs,
-                         svn_revnum_t revision,
-                         apr_pool_t *pool)
+svn_fs_fs__deltify (svn_fs_t *fs,
+                    svn_revnum_t revision,
+                    apr_pool_t *pool)
 {
   /* Deltify is a no-op for fs_fs. */
 
@@ -2200,6 +2095,9 @@
 
 /* Directories.  */
 
+/* Set *TABLE_P to an APR hash of dirent_t structures corresponding to
+   the subdirectories of PATH under ROOT.  If PATH is not a directory,
+   *TABLE_P is set to NULL.  The return hash is allocated in POOL. */
 static svn_error_t *
 get_dir_entries (apr_hash_t **table_p,
                  svn_fs_root_t *root,
@@ -2212,7 +2110,7 @@
   SVN_ERR (get_dag (&node, root, path, pool));
 
   /* Get the entries for PARENT_PATH. */
-  SVN_ERR (svn_fs__dag_dir_entries (&entries, node, pool));
+  SVN_ERR (svn_fs_fs__dag_dir_entries (&entries, node, pool));
 
   /* Potentially initialize the return value to an empty hash. */
   *table_p = entries ? entries : apr_hash_make (pool);
@@ -2220,11 +2118,16 @@
 }
 
 
-svn_error_t *
-svn_fs_dir_entries (apr_hash_t **table_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+/* Set *TABLE_P to a newly allocated APR hash table containing the
+   entries of the directory at PATH in ROOT.  The keys of the table
+   are entry names, as byte strings, excluding the final null
+   character; the table's values are pointers to svn_fs_dirent_t
+   structures.  allocate the table and its contents in POOL. */
+static svn_error_t *
+fs_dir_entries (apr_hash_t **table_p,
+                svn_fs_root_t *root,
+                const char *path,
+                apr_pool_t *pool)
 {
   apr_hash_t *table;
 
@@ -2247,8 +2150,8 @@
           entry = val;
 
           /* Use the node id to get the real kind. */
-          SVN_ERR (svn_fs__dag_get_node (&node, root->fs, entry->id, pool));
-          entry->kind = svn_fs__dag_node_kind (node);
+          SVN_ERR (svn_fs_fs__dag_get_node (&node, root->fs, entry->id, pool));
+          entry->kind = svn_fs_fs__dag_node_kind (node);
         }
     }
   else
@@ -2261,10 +2164,14 @@
 }
 
 
-svn_error_t *
-svn_fs_make_dir (svn_fs_root_t *root,
-                 const char *path,
-                 apr_pool_t *pool)
+/* Create a new directory named PATH in ROOT.  The new directory has
+   no entries, and no properties.  ROOT must be the root of a
+   transaction, not a revision.  Do any necessary temporary allocation
+   in POOL.  */
+static svn_error_t *
+fs_make_dir (svn_fs_root_t *root,
+             const char *path,
+             apr_pool_t *pool)
 {
   parent_path_t *parent_path;
   dag_node_t *sub_dir;
@@ -2280,27 +2187,30 @@
 
   /* Create the subdirectory.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, pool));
-  SVN_ERR (svn_fs__dag_make_dir (&sub_dir,
-                                 parent_path->parent->node, 
-                                 parent_path_path (parent_path->parent, 
-                                                   pool),
-                                 parent_path->entry,
-                                 txn_id,
-                                 pool));
+  SVN_ERR (svn_fs_fs__dag_make_dir (&sub_dir,
+                                    parent_path->parent->node, 
+                                    parent_path_path (parent_path->parent, 
+                                                      pool),
+                                    parent_path->entry,
+                                    txn_id,
+                                    pool));
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (sub_dir),
-                       svn_fs_path_change_add, 0, 0, pool));
+                       path, svn_fs_fs__dag_get_id (sub_dir),
+                       svn_fs_path_change_add, 0, 0, SVN_INVALID_REVNUM, NULL,
+                       pool));
 
   return SVN_NO_ERROR;
 }
                               
 
-svn_error_t *
-svn_fs_delete (svn_fs_root_t *root,
-               const char *path,
-               apr_pool_t *pool)
+/* Delete the node at PATH under ROOT.  ROOT must be a transaction
+   root.  Perform temporary allocations in POOL. */
+static svn_error_t *
+fs_delete_node (svn_fs_root_t *root,
+                const char *path,
+                apr_pool_t *pool)
 {
   parent_path_t *parent_path;
   const char *txn_id = svn_fs_txn_root_name (root, pool);
@@ -2317,19 +2227,23 @@
 
   /* Make the parent directory mutable, and do the deletion.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, pool));
-  SVN_ERR (svn_fs__dag_delete (parent_path->parent->node,
-                               parent_path->entry,
-                               txn_id, pool));
+  SVN_ERR (svn_fs_fs__dag_delete (parent_path->parent->node,
+                                  parent_path->entry,
+                                  txn_id, pool));
   
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (parent_path->node),
-                       svn_fs_path_change_delete, 0, 0, pool));
+                       path, svn_fs_fs__dag_get_id (parent_path->node),
+                       svn_fs_path_change_delete, 0, 0, SVN_INVALID_REVNUM,
+                       NULL, pool));
   
   return SVN_NO_ERROR;
 }
 
 
+/* Copy the node at FROM_PATH under FROM_ROOT to TO_PATH under
+   TO_ROOT.  If PRESERVE_HISTORY is set, then the copy is recorded in
+   the copies table.  Perform temporary allocations in POOL. */
 static svn_error_t *
 copy_helper (svn_fs_root_t *from_root,
              const char *from_path,
@@ -2359,9 +2273,9 @@
      source (in other words, this operation would result in nothing
      happening at all), just do nothing an return successfully,
      proud that you saved yourself from a tiresome task. */
-  if ((to_parent_path->node)
-      && (svn_fs_compare_ids (svn_fs__dag_get_id (from_node),
-                              svn_fs__dag_get_id (to_parent_path->node)) == 0))
+  if ((to_parent_path->node) &&
+      (svn_fs_compare_ids (svn_fs_fs__dag_get_id (from_node),
+                           svn_fs_fs__dag_get_id (to_parent_path->node)) == 0))
     return SVN_NO_ERROR;
 
   if (svn_fs_is_revision_root (from_root))
@@ -2380,19 +2294,22 @@
       SVN_ERR (make_path_mutable (to_root, to_parent_path->parent, 
                                   to_path, pool));
 
-      SVN_ERR (svn_fs__dag_copy (to_parent_path->parent->node,
-                                 to_parent_path->entry,
-                                 from_node,
-                                 preserve_history,
-                                 svn_fs_revision_root_revision (from_root),
-                                 svn_fs__canonicalize_abspath (from_path, pool),
-                                 txn_id, pool));
+      SVN_ERR (svn_fs_fs__dag_copy (to_parent_path->parent->node,
+                                    to_parent_path->entry,
+                                    from_node,
+                                    preserve_history,
+                                    svn_fs_revision_root_revision (from_root),
+                                    svn_fs__canonicalize_abspath (from_path,
+                                                                  pool),
+                                    txn_id, pool));
 
       /* Make a record of this modification in the changes table. */
       SVN_ERR (get_dag (&new_node, to_root, to_path, pool));
       SVN_ERR (add_change (svn_fs_root_fs (to_root), txn_id, 
-                           to_path, svn_fs__dag_get_id (new_node),
-                           kind, 0, 0, pool));
+                           to_path, svn_fs_fs__dag_get_id (new_node),
+                           kind, 0, 0,
+                           svn_fs_revision_root_revision (from_root),
+                           from_path, pool));
     }
   else
     {
@@ -2414,22 +2331,29 @@
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_copy (svn_fs_root_t *from_root,
-             const char *from_path,
-             svn_fs_root_t *to_root,
-             const char *to_path,
-             apr_pool_t *pool)
+
+/* Create a copy of FROM_PATH in FROM_ROOT named TO_PATH in TO_ROOT.
+   If FROM_PATH is a directory, copy it recursively.  Temporary
+   allocations are from POOL.*/
+static svn_error_t *
+fs_copy (svn_fs_root_t *from_root,
+         const char *from_path,
+         svn_fs_root_t *to_root,
+         const char *to_path,
+         apr_pool_t *pool)
 {
   return copy_helper (from_root, from_path, to_root, to_path, TRUE, pool);
 }
 
 
-svn_error_t *
-svn_fs_revision_link (svn_fs_root_t *from_root,
-                      svn_fs_root_t *to_root,
-                      const char *path,
-                      apr_pool_t *pool)
+/* Create a copy of FROM_PATH in FROM_ROOT named TO_PATH in TO_ROOT.
+   If FROM_PATH is a directory, copy it recursively.  No history is
+   preserved.  Temporary allocations are from POOL. */
+static svn_error_t *
+fs_revision_link (svn_fs_root_t *from_root,
+                  svn_fs_root_t *to_root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   if (! svn_fs_is_txn_root (to_root))
     return not_txn (to_root);
@@ -2438,21 +2362,52 @@
 }
 
 
-svn_error_t *
-svn_fs_copied_from (svn_revnum_t *rev_p,
-                    const char **path_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+/* Discover the copy ancestry of PATH under ROOT.  Return a relevant
+   ancestor/revision combination in *PATH_P and *REV_P.  Temporary
+   allocations are in POOL. */
+static svn_error_t *
+fs_copied_from (svn_revnum_t *rev_p,
+                const char **path_p,
+                svn_fs_root_t *root,
+                const char *path,
+                apr_pool_t *pool)
 {
   dag_node_t *node;
-  const char *copyfrom_path;
+  const char *copyfrom_path, *copyfrom_str;
   svn_revnum_t copyfrom_rev;
+  fs_root_data_t *frd = root->fsap_data;
+  char *str, *last_str, *buf;
 
-  SVN_ERR (get_dag (&node, root, path, pool));
-  SVN_ERR (svn_fs__dag_get_copyfrom_rev (&copyfrom_rev, node, pool));
-  SVN_ERR (svn_fs__dag_get_copyfrom_path (&copyfrom_path, node, pool));
-
+  /* Check to see if there is a cached version of this copyfrom
+     entry. */
+  copyfrom_str = apr_hash_get (frd->copyfrom_cache, path, APR_HASH_KEY_STRING);
+  if (copyfrom_str)
+    {
+      if (strlen (copyfrom_str) == 0)
+        {
+          /* We have a cached entry that says there is no copyfrom
+             here. */
+          copyfrom_rev = SVN_INVALID_REVNUM;
+          copyfrom_path = NULL;
+        }
+      else
+        {
+          /* Parse the copyfrom string for our cached entry. */
+          buf = apr_pstrdup (pool, copyfrom_str);
+          str = apr_strtok (buf, " ", &last_str);
+          copyfrom_rev = atol (str);
+          copyfrom_path = last_str;
+        }
+    }
+  else
+    {
+      /* There is no cached entry, look it up the old-fashioned
+         way. */
+      SVN_ERR (get_dag (&node, root, path, pool));
+      SVN_ERR (svn_fs_fs__dag_get_copyfrom_rev (&copyfrom_rev, node, pool));
+      SVN_ERR (svn_fs_fs__dag_get_copyfrom_path (&copyfrom_path, node, pool));
+    }
+      
   *rev_p  = copyfrom_rev;
   *path_p = copyfrom_path;
 
@@ -2463,10 +2418,12 @@
 
 /* Files.  */
 
-svn_error_t *
-svn_fs_make_file (svn_fs_root_t *root,
-                  const char *path,
-                  apr_pool_t *pool)
+/* Create the empty file PATH under ROOT.  Temporary allocations are
+   in POOL. */
+static svn_error_t *
+fs_make_file (svn_fs_root_t *root,
+              const char *path,
+              apr_pool_t *pool)
 {
   parent_path_t *parent_path;
   dag_node_t *child;
@@ -2482,27 +2439,31 @@
 
   /* Create the file.  */
   SVN_ERR (make_path_mutable (root, parent_path->parent, path, pool));
-  SVN_ERR (svn_fs__dag_make_file (&child,
-                                  parent_path->parent->node, 
-                                  parent_path_path (parent_path->parent,
-                                                    pool),
-                                  parent_path->entry,
-                                  txn_id,
-                                  pool));
+  SVN_ERR (svn_fs_fs__dag_make_file (&child,
+                                     parent_path->parent->node, 
+                                     parent_path_path (parent_path->parent,
+                                                       pool),
+                                     parent_path->entry,
+                                     txn_id,
+                                     pool));
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (root), txn_id, 
-                       path, svn_fs__dag_get_id (child),
-                       svn_fs_path_change_add, 0, 0, pool));
+                       path, svn_fs_fs__dag_get_id (child),
+                       svn_fs_path_change_add, 0, 0, SVN_INVALID_REVNUM, NULL,
+                       pool));
 
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_fs_file_length (svn_filesize_t *length_p,
-                    svn_fs_root_t *root,
-                    const char *path,
-                    apr_pool_t *pool)
+
+/* Set *LENGTH_P to the size of the file PATH under ROOT.  Temporary
+   allocations are in POOL. */
+static svn_error_t *
+fs_file_length (svn_filesize_t *length_p,
+                svn_fs_root_t *root,
+                const char *path,
+                apr_pool_t *pool)
 {
   dag_node_t *file;
   
@@ -2510,32 +2471,36 @@
   SVN_ERR (get_dag (&file, root, path, pool));
 
   /* Now fetch its length */
-  SVN_ERR (svn_fs__dag_file_length (length_p, file, pool));
+  SVN_ERR (svn_fs_fs__dag_file_length (length_p, file, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_file_md5_checksum (unsigned char digest[],
-                          svn_fs_root_t *root,
-                          const char *path,
-                          apr_pool_t *pool)
+/* Set DIGEST to the MD5 checksum of PATH under ROOT.  Temporary
+   allocations are from POOL. */
+static svn_error_t *
+fs_file_md5_checksum (unsigned char digest[],
+                      svn_fs_root_t *root,
+                      const char *path,
+                      apr_pool_t *pool)
 {
   dag_node_t *file;
   
   SVN_ERR (get_dag (&file, root, path, pool));
-  return svn_fs__dag_file_checksum (digest, file, pool);
+  return svn_fs_fs__dag_file_checksum (digest, file, pool);
 }
 
 
 /* --- Machinery for svn_fs_file_contents() ---  */
 
-svn_error_t *
-svn_fs_file_contents (svn_stream_t **contents,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *pool)
+/* Set *CONTENTS to a readable stream that will return the contents of
+   PATH under ROOT.  The stream is allocated in POOL. */
+static svn_error_t *
+fs_file_contents (svn_stream_t **contents,
+                  svn_fs_root_t *root,
+                  const char *path,
+                  apr_pool_t *pool)
 {
   dag_node_t *node;
   svn_stream_t *file_stream;
@@ -2544,7 +2509,7 @@
   SVN_ERR (get_dag (&node, root, path, pool));
   
   /* Then create a readable stream from the dag_node_t. */
-  SVN_ERR (svn_fs__dag_get_contents (&file_stream, node, pool));
+  SVN_ERR (svn_fs_fs__dag_get_contents (&file_stream, node, pool));
   
   *contents = file_stream;
   return SVN_NO_ERROR;
@@ -2655,17 +2620,18 @@
          Berkeley DB transaction -- scandalous! */
       SVN_ERR (svn_stream_close (tb->target_stream));
 
-      SVN_ERR (svn_fs__dag_finalize_edits (tb->node, 
-                                           tb->result_checksum,
-                                           svn_fs_txn_root_name (tb->root,
-                                                                 tb->pool),
-                                           tb->pool));
+      SVN_ERR (svn_fs_fs__dag_finalize_edits (tb->node, 
+                                              tb->result_checksum,
+                                              svn_fs_txn_root_name (tb->root,
+                                                                    tb->pool),
+                                              tb->pool));
     }
 
   return SVN_NO_ERROR;
 }
 
-
+/* Helper function for fs_apply_textdelta.  BATON is of type
+   txdelta_baton_t. */
 static svn_error_t *
 apply_textdelta (void *baton, apr_pool_t *pool)
 {
@@ -2688,7 +2654,7 @@
 
       /* Until we finalize the node, its data_key points to the old
          contents, in other words, the base text. */
-      SVN_ERR (svn_fs__dag_file_checksum (digest, tb->node, pool));
+      SVN_ERR (svn_fs_fs__dag_file_checksum (digest, tb->node, pool));
       hex = svn_md5_digest_to_cstring (digest, pool);
       if (hex && (strcmp (tb->base_checksum, hex) != 0))
         return svn_error_createf
@@ -2703,12 +2669,12 @@
   /* Make a readable "source" stream out of the current contents of
      ROOT/PATH; obviously, this must done in the context of a db_txn.
      The stream is returned in tb->source_stream. */
-  SVN_ERR (svn_fs__dag_get_contents (&(tb->source_stream),
-                                     tb->node, tb->pool));
+  SVN_ERR (svn_fs_fs__dag_get_contents (&(tb->source_stream),
+                                        tb->node, tb->pool));
 
   /* Make a writable "target" stream */
-  SVN_ERR (svn_fs__dag_get_edit_stream (&(tb->target_stream), tb->node, 
-                                        txn_id, tb->pool));
+  SVN_ERR (svn_fs_fs__dag_get_edit_stream (&(tb->target_stream), tb->node, 
+                                           txn_id, tb->pool));
 
   /* Make a writable "string" stream which writes data to
      tb->target_string. */
@@ -2727,21 +2693,25 @@
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (tb->root), txn_id, 
-                       tb->path, svn_fs__dag_get_id (tb->node),
-                       svn_fs_path_change_modify, 1, 0, pool));
+                       tb->path, svn_fs_fs__dag_get_id (tb->node),
+                       svn_fs_path_change_modify, 1, 0, SVN_INVALID_REVNUM,
+                       NULL, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_apply_textdelta (svn_txdelta_window_handler_t *contents_p,
-                        void **contents_baton_p,
-                        svn_fs_root_t *root,
-                        const char *path,
-                        const char *base_checksum,
-                        const char *result_checksum,
-                        apr_pool_t *pool)
+/* Set *CONTENTS_P and *CONTENTS_BATON_P to a window handler and baton
+   that will accept text delta windows to modify the contents of PATH
+   under ROOT.  Allocations are in POOL. */
+static svn_error_t *
+fs_apply_textdelta (svn_txdelta_window_handler_t *contents_p,
+                    void **contents_baton_p,
+                    svn_fs_root_t *root,
+                    const char *path,
+                    const char *base_checksum,
+                    const char *result_checksum,
+                    apr_pool_t *pool)
 {
   txdelta_baton_t *tb = apr_pcalloc (pool, sizeof(*tb));
 
@@ -2796,7 +2766,7 @@
 };
 
 
-/* A trail-ready wrapper around svn_fs__dag_finalize_edits, but for
+/* A trail-ready wrapper around svn_fs_fs__dag_finalize_edits, but for
  * fulltext data, not text deltas.  Closes BATON->file_stream. 
  *
  * Note: If you're confused about how this function relates to another
@@ -2830,16 +2800,18 @@
   SVN_ERR (svn_stream_close (tb->file_stream));
 
   /* Need to tell fs that we're done sending text */
-  SVN_ERR (svn_fs__dag_finalize_edits (tb->node, 
-                                       tb->result_checksum,
-                                       svn_fs_txn_root_name (tb->root, 
-                                                             tb->pool),
-                                       tb->pool));
+  SVN_ERR (svn_fs_fs__dag_finalize_edits (tb->node, 
+                                          tb->result_checksum,
+                                          svn_fs_txn_root_name (tb->root, 
+                                                                tb->pool),
+                                          tb->pool));
 
   return SVN_NO_ERROR;
 }
 
 
+/* Helper function for fs_apply_text.  BATON is of type
+   text_baton_t. */
 static svn_error_t *
 apply_text (void *baton, apr_pool_t *pool)
 {
@@ -2856,8 +2828,8 @@
   tb->node = parent_path->node;
 
   /* Make a writable stream for replacing the file's text. */
-  SVN_ERR (svn_fs__dag_get_edit_stream (&(tb->file_stream), tb->node, 
-                                        txn_id, tb->pool));
+  SVN_ERR (svn_fs_fs__dag_get_edit_stream (&(tb->file_stream), tb->node, 
+                                           txn_id, tb->pool));
 
   /* Create a 'returnable' stream which writes to the file_stream. */
   tb->stream = svn_stream_create (tb, tb->pool);
@@ -2866,19 +2838,23 @@
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR (add_change (svn_fs_root_fs (tb->root), txn_id, 
-                       tb->path, svn_fs__dag_get_id (tb->node),
-                       svn_fs_path_change_modify, 1, 0, pool));
+                       tb->path, svn_fs_fs__dag_get_id (tb->node),
+                       svn_fs_path_change_modify, 1, 0, SVN_INVALID_REVNUM,
+                       NULL, pool));
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_fs_apply_text (svn_stream_t **contents_p,
-                   svn_fs_root_t *root,
-                   const char *path,
-                   const char *result_checksum,
-                   apr_pool_t *pool)
+/* Return a writable stream that will set the contents of PATH under
+   ROOT.  RESULT_CHECKSUM is the MD5 checksum of the final result.
+   Temporary allocations are in POOL. */
+static svn_error_t *
+fs_apply_text (svn_stream_t **contents_p,
+               svn_fs_root_t *root,
+               const char *path,
+               const char *result_checksum,
+               apr_pool_t *pool)
 {
   struct text_baton_t *tb = apr_pcalloc (pool, sizeof(*tb));
 
@@ -2900,15 +2876,16 @@
 /* --- End machinery for svn_fs_apply_text() ---  */
 
 
-/* Note:  it is acceptable for this function to call back into
-   public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_contents_changed (svn_boolean_t *changed_p,
-                         svn_fs_root_t *root1,
-                         const char *path1,
-                         svn_fs_root_t *root2,
-                         const char *path2,
-                         apr_pool_t *pool)
+/* Check if the contents of PATH1 under ROOT1 are different from the
+   contents of PATH2 under ROOT2.  If they are different set
+   *CHANGED_P to TRUE, otherwise set it to FALSE. */
+static svn_error_t *
+fs_contents_changed (svn_boolean_t *changed_p,
+                     svn_fs_root_t *root1,
+                     const char *path1,
+                     svn_fs_root_t *root2,
+                     const char *path2,
+                     apr_pool_t *pool)
 {
   dag_node_t *node1, *node2;
   
@@ -2935,7 +2912,7 @@
 
   SVN_ERR (get_dag (&node1, root1, path1, pool));
   SVN_ERR (get_dag (&node2, root2, path2, pool));
-  SVN_ERR (svn_fs__things_different (NULL, changed_p, node1, node2, pool));
+  SVN_ERR (svn_fs_fs__things_different (NULL, changed_p, node1, node2, pool));
   
   return SVN_NO_ERROR;
 }
@@ -2946,13 +2923,13 @@
 
 /* Note:  it is acceptable for this function to call back into
    public FS API interfaces because it does not itself use trails.  */
-svn_error_t *
-svn_fs_get_file_delta_stream (svn_txdelta_stream_t **stream_p,
-                              svn_fs_root_t *source_root,
-                              const char *source_path,
-                              svn_fs_root_t *target_root,
-                              const char *target_path,
-                              apr_pool_t *pool)
+static svn_error_t *
+fs_get_file_delta_stream (svn_txdelta_stream_t **stream_p,
+                          svn_fs_root_t *source_root,
+                          const char *source_path,
+                          svn_fs_root_t *target_root,
+                          const char *target_path,
+                          apr_pool_t *pool)
 {
   svn_stream_t *source, *target;
   svn_txdelta_stream_t *delta_stream;
@@ -2977,15 +2954,20 @@
 
 /* Finding Changes */
 
-svn_error_t *
-svn_fs_paths_changed (apr_hash_t **changed_paths_p,
-                      svn_fs_root_t *root,
-                      apr_pool_t *pool)
+/* Set *CHANGED_PATHS_P to a newly allocated hash containing
+   descriptions of the paths changed under ROOT.  The hash is keyed
+   with const char * paths an dhas svn_fs_path_change_t * values.  Use
+   POOL for all allocations. */
+static svn_error_t *
+fs_paths_changed (apr_hash_t **changed_paths_p,
+                  svn_fs_root_t *root,
+                  apr_pool_t *pool)
 {
   apr_hash_t *changed_paths;
+  fs_root_data_t *frd = root->fsap_data;
 
-  SVN_ERR (svn_fs__fs_paths_changed (&changed_paths, root->fs, root->rev,
-                                     pool));
+  SVN_ERR (svn_fs_fs__paths_changed (&changed_paths, root->fs, root->rev,
+                                     frd->copyfrom_cache, pool));
   
   *changed_paths_p = changed_paths;
   return SVN_NO_ERROR;
@@ -2994,7 +2976,7 @@
 
 
 /* Our coolio opaque history object. */
-struct svn_fs_history_t
+typedef struct
 {
   /* filesystem object */
   svn_fs_t *fs;
@@ -3009,14 +2991,8 @@
 
   /* FALSE until the first call to svn_fs_history_prev(). */
   svn_boolean_t is_interesting;
-};
-
+} fs_history_data_t;
 
-/* Return a new history object (marked as "interesting") for PATH and
-   REVISION, allocated in POOL, and with its members set to the values
-   of the parameters provided.  Note that PATH and PATH_HINT are not
-   duped into POOL -- it is the responsibility of the caller to ensure
-   that this happens. */
 static svn_fs_history_t *
 assemble_history (svn_fs_t *fs,
                   const char *path,
@@ -3024,28 +3000,22 @@
                   svn_boolean_t is_interesting,
                   const char *path_hint,
                   svn_revnum_t rev_hint,
-                  apr_pool_t *pool)
-{
-  svn_fs_history_t *history = apr_pcalloc (pool, sizeof (*history));
-  history->path = path;
-  history->revision = revision;
-  history->is_interesting = is_interesting;
-  history->path_hint = path_hint;
-  history->rev_hint = rev_hint;
-  history->fs = fs;
-  return history;
-}
+                  apr_pool_t *pool);
 
 
-svn_error_t *svn_fs_node_history (svn_fs_history_t **history_p,
-                                  svn_fs_root_t *root,
-                                  const char *path,
-                                  apr_pool_t *pool)
+/* Set *HISTORY_P to an opaque node history object which represents
+   PATH under ROOT.  ROOT must be a revision root.  Use POOL for all
+   allocations. */
+static svn_error_t *
+fs_node_history (svn_fs_history_t **history_p,
+                 svn_fs_root_t *root,
+                 const char *path,
+                 apr_pool_t *pool)
 {
   svn_node_kind_t kind;
 
   /* We require a revision root. */
-  if (root->kind != revision_root)
+  if (root->is_txn_root)
     return svn_error_create (SVN_ERR_FS_NOT_REVISION_ROOT, NULL, NULL);
 
   /* And we require that the path exist in the root. */
@@ -3054,7 +3024,7 @@
     return not_found (root, path);
 
   /* Okay, all seems well.  Build our history object and return it. */
-  *history_p = assemble_history (svn_fs_root_fs (root),
+  *history_p = assemble_history (root->fs,
                                  svn_fs__canonicalize_abspath (path, pool),
                                  root->rev, FALSE, NULL, 
                                  SVN_INVALID_REVNUM, pool);
@@ -3080,8 +3050,8 @@
                                      parent_path->parent, pool));
 
   /* Find our copyroot. */
-  SVN_ERR (svn_fs__dag_get_copyroot (&rev_mine, &path_mine, parent_path->node,
-                                     pool));
+  SVN_ERR (svn_fs_fs__dag_get_copyroot (&rev_mine, &path_mine,
+                                        parent_path->node, pool));
 
   if (rev_mine > rev_parent)
     {
@@ -3113,16 +3083,17 @@
   struct history_prev_args *args = baton;
   svn_fs_history_t **prev_history = args->prev_history_p;
   svn_fs_history_t *history = args->history;
-  const char *commit_path, *src_path, *path = history->path;
+  fs_history_data_t *fhd = history->fsap_data;
+  const char *commit_path, *src_path, *path = fhd->path;
   svn_revnum_t commit_rev, src_rev, dst_rev;
-  svn_revnum_t revision = history->revision;
+  svn_revnum_t revision = fhd->revision;
   apr_pool_t *retpool = args->pool;
-  svn_fs_t *fs = history->fs;
+  svn_fs_t *fs = fhd->fs;
   parent_path_t *parent_path;
   dag_node_t *node;
   svn_fs_root_t *root;
   const svn_fs_id_t *node_id;
-  svn_boolean_t reported = history->is_interesting;
+  svn_boolean_t reported = fhd->is_interesting;
   svn_boolean_t retry = FALSE;
   svn_revnum_t copyroot_rev;
   const char *copyroot_path;
@@ -3134,13 +3105,13 @@
      the chase, then our last report was on the destination of a
      copy.  If we are crossing copies, start from those locations,
      otherwise, we're all done here.  */
-  if (history->path_hint && SVN_IS_VALID_REVNUM (history->rev_hint))
+  if (fhd->path_hint && SVN_IS_VALID_REVNUM (fhd->rev_hint))
     {
       reported = FALSE;
       if (! args->cross_copies)
         return SVN_NO_ERROR;
-      path = history->path_hint;
-      revision = history->rev_hint;
+      path = fhd->path_hint;
+      revision = fhd->rev_hint;
     }
   
   /* Construct a ROOT for the current revision. */
@@ -3150,9 +3121,9 @@
      goodies.  */
   SVN_ERR (open_path (&parent_path, root, path, 0, NULL, pool));
   node = parent_path->node;
-  node_id = svn_fs__dag_get_id (node);
-  commit_path = svn_fs__dag_get_created_path (node);
-  SVN_ERR (svn_fs__dag_get_revision (&commit_rev, node, pool));
+  node_id = svn_fs_fs__dag_get_id (node);
+  commit_path = svn_fs_fs__dag_get_created_path (node);
+  SVN_ERR (svn_fs_fs__dag_get_revision (&commit_rev, node, pool));
 
   /* The Subversion filesystem is written in such a way that a given
      line of history may have at most one interesting history point
@@ -3180,16 +3151,16 @@
              no predecessor, in which case we're all done!). */
           const svn_fs_id_t *pred_id;
 
-          SVN_ERR (svn_fs__dag_get_predecessor_id (&pred_id, node, pool));
+          SVN_ERR (svn_fs_fs__dag_get_predecessor_id (&pred_id, node, pool));
           if (! pred_id)
             return SVN_NO_ERROR;
 
           /* Replace NODE and friends with the information from its
              predecessor. */
-          SVN_ERR (svn_fs__dag_get_node (&node, fs, pred_id, pool));
-          node_id = svn_fs__dag_get_id (node);
-          commit_path = svn_fs__dag_get_created_path (node);
-          SVN_ERR (svn_fs__dag_get_revision (&commit_rev, node, pool));
+          SVN_ERR (svn_fs_fs__dag_get_node (&node, fs, pred_id, pool));
+          node_id = svn_fs_fs__dag_get_id (node);
+          commit_path = svn_fs_fs__dag_get_created_path (node);
+          SVN_ERR (svn_fs_fs__dag_get_revision (&commit_rev, node, pool));
         }
     }
 
@@ -3211,7 +3182,7 @@
 
       SVN_ERR (svn_fs_revision_root (&copyroot_root, fs, copyroot_rev, pool));
       SVN_ERR (get_dag (&node, copyroot_root, copyroot_path, pool));
-      copy_dst = svn_fs__dag_get_created_path (node);
+      copy_dst = svn_fs_fs__dag_get_created_path (node);
 
       /* If our current path was the very destination of the copy,
          then our new current path will be the copy source.  If our
@@ -3231,8 +3202,8 @@
           /* If we get here, then our current path is the destination 
              of, or the child of the destination of, a copy.  Fill
              in the return values and get outta here.  */
-          SVN_ERR (svn_fs__dag_get_copyfrom_rev (&src_rev, node, pool));
-          SVN_ERR (svn_fs__dag_get_copyfrom_path (&copy_src, node, pool));
+          SVN_ERR (svn_fs_fs__dag_get_copyfrom_rev (&src_rev, node, pool));
+          SVN_ERR (svn_fs_fs__dag_get_copyfrom_path (&copy_src, node, pool));
           
           dst_rev = copyroot_rev;
           src_path = svn_path_join (copy_src, remainder, pool);
@@ -3267,25 +3238,31 @@
 }
 
 
-svn_error_t *svn_fs_history_prev (svn_fs_history_t **prev_history_p,
-                                  svn_fs_history_t *history,
-                                  svn_boolean_t cross_copies,
-                                  apr_pool_t *pool)
+/* Implement svn_fs_history_prev, set *PREV_HISTORY_P to a new
+   svn_fs_history_t object that represents the predecessory of
+   HISTORY.  If CROSS_COPIES is true, *PREV_HISTORY_P may be related
+   only through a copy operation.  Perform all allocations in POOL. */
+static svn_error_t *
+fs_history_prev (svn_fs_history_t **prev_history_p,
+                 svn_fs_history_t *history,
+                 svn_boolean_t cross_copies,
+                 apr_pool_t *pool)
 {
   svn_fs_history_t *prev_history = NULL;
-  svn_fs_t *fs = history->fs;
+  fs_history_data_t *fhd = history->fsap_data;
+  svn_fs_t *fs = fhd->fs;
 
   /* Special case: the root directory changes in every single
      revision, no exceptions.  And, the root can't be the target (or
      child of a target -- duh) of a copy.  So, if that's our path,
      then we need only decrement our revision by 1, and there you go. */
-  if (strcmp (history->path, "/") == 0)
+  if (strcmp (fhd->path, "/") == 0)
     {
-      if (! history->is_interesting)
-        prev_history = assemble_history (fs, "/", history->revision,
+      if (! fhd->is_interesting)
+        prev_history = assemble_history (fs, "/", fhd->revision,
                                          1, NULL, SVN_INVALID_REVNUM, pool);
-      else if (history->revision > 0)
-        prev_history = assemble_history (fs, "/", history->revision - 1,
+      else if (fhd->revision > 0)
+        prev_history = assemble_history (fs, "/", fhd->revision - 1,
                                          1, NULL, SVN_INVALID_REVNUM, pool);
     }
   else
@@ -3302,7 +3279,11 @@
           args.cross_copies = cross_copies;
           args.pool = pool;
           SVN_ERR (history_prev (&args, pool));
-          if ((! prev_history) || (prev_history->is_interesting))
+
+          if (! prev_history)
+            break;
+          fhd = prev_history->fsap_data;
+          if (fhd->is_interesting)
             break;
         }
     }
@@ -3312,12 +3293,137 @@
 }
 
 
-svn_error_t *svn_fs_history_location (const char **path,
-                                      svn_revnum_t *revision,
-                                      svn_fs_history_t *history,
-                                      apr_pool_t *pool)
+/* Set *PATH and *REVISION to the path and revision for the HISTORY
+   object.  Use POOL for all allocations. */
+static svn_error_t *
+fs_history_location (const char **path,
+                     svn_revnum_t *revision,
+                     svn_fs_history_t *history,
+                     apr_pool_t *pool)
 {
-  *path = apr_pstrdup (pool, history->path);
-  *revision = history->revision;
+  fs_history_data_t *fhd = history->fsap_data;
+
+  *path = apr_pstrdup (pool, fhd->path);
+  *revision = fhd->revision;
   return SVN_NO_ERROR;
+}
+
+static history_vtable_t history_vtable = {
+  fs_history_prev,
+  fs_history_location
+};
+
+/* Return a new history object (marked as "interesting") for PATH and
+   REVISION, allocated in POOL, and with its members set to the values
+   of the parameters provided.  Note that PATH and PATH_HINT are not
+   duped into POOL -- it is the responsibility of the caller to ensure
+   that this happens. */
+static svn_fs_history_t *
+assemble_history (svn_fs_t *fs,
+                  const char *path,
+                  svn_revnum_t revision,
+                  svn_boolean_t is_interesting,
+                  const char *path_hint,
+                  svn_revnum_t rev_hint,
+                  apr_pool_t *pool)
+{
+  svn_fs_history_t *history = apr_pcalloc (pool, sizeof (*history));
+  fs_history_data_t *fhd = apr_pcalloc (pool, sizeof (*fhd));
+  fhd->path = path;
+  fhd->revision = revision;
+  fhd->is_interesting = is_interesting;
+  fhd->path_hint = path_hint;
+  fhd->rev_hint = rev_hint;
+  fhd->fs = fs;
+  
+  history->vtable = &history_vtable;
+  history->fsap_data = fhd;
+  return history;
+}
+
+/* The vtable associated with root objects. */
+static root_vtable_t root_vtable = {
+  fs_paths_changed,
+  fs_check_path,
+  fs_node_history,
+  fs_node_id,
+  fs_node_created_rev,
+  fs_node_created_path,
+  fs_delete_node,
+  fs_copied_from,
+  fs_node_prop,
+  fs_node_proplist,
+  fs_change_node_prop,
+  fs_props_changed,
+  fs_dir_entries,
+  fs_make_dir,
+  fs_copy,
+  fs_revision_link,
+  fs_file_length,
+  fs_file_md5_checksum,
+  fs_file_contents,
+  fs_make_file,
+  fs_apply_textdelta,
+  fs_apply_text,
+  fs_contents_changed,
+  fs_get_file_delta_stream,
+  fs_merge
+};
+
+/* Construct a new root object in FS, allocated from POOL.  */
+static svn_fs_root_t *
+make_root (svn_fs_t *fs,
+           apr_pool_t *pool)
+{
+  /* We create a subpool for each root object to allow us to implement
+     svn_fs_close_root.  */
+  apr_pool_t *subpool = svn_pool_create (pool);
+  svn_fs_root_t *root = apr_pcalloc (subpool, sizeof (*root));
+  fs_root_data_t *frd = apr_pcalloc (subpool, sizeof (*frd));
+
+  root->fs = fs;
+  root->pool = subpool;
+
+  /* Init the node ID cache. */
+  frd->node_cache = apr_hash_make (subpool);
+  frd->node_cache_idx = 0;
+  frd->copyfrom_cache = apr_hash_make (subpool);
+  root->vtable = &root_vtable;
+  root->fsap_data = frd;
+
+  return root;
+}
+
+
+/* Construct a root object referring to the root of REVISION in FS,
+   whose root directory is ROOT_DIR.  Create the new root in POOL.  */
+static svn_fs_root_t *
+make_revision_root (svn_fs_t *fs,
+                    svn_revnum_t rev,
+                    dag_node_t *root_dir,
+                    apr_pool_t *pool)
+{
+  svn_fs_root_t *root = make_root (fs, pool);
+  fs_root_data_t *frd = root->fsap_data;
+  
+  root->is_txn_root = FALSE;
+  root->rev = rev;
+  frd->root_dir = root_dir;
+
+  return root;
+}
+
+
+/* Construct a root object referring to the root of the transaction
+   named TXN in FS.  Create the new root in POOL.  */
+static svn_fs_root_t *
+make_txn_root (svn_fs_t *fs,
+               const char *txn,
+               apr_pool_t *pool)
+{
+  svn_fs_root_t *root = make_root (fs, pool);
+  root->is_txn_root = TRUE;
+  root->txn = apr_pstrdup (root->pool, txn);
+
+  return root;
 }

Modified: trunk/subversion/libsvn_fs_fs/tree.h
==============================================================================
--- trunk/subversion/libsvn_fs_fs/tree.h	(original)
+++ trunk/subversion/libsvn_fs_fs/tree.h	Thu Apr 29 18:17:29 2004
@@ -24,8 +24,28 @@
 
 
 
-/* The functions you might have expected to find here are all part of
-   the libsvn_fs public interface; see ../include/svn_fs.h. */
+/* Set *ROOT_P to the root directory of revision REV in filesystem FS.
+   Allocate the structure in POOL. */
+svn_error_t *svn_fs_fs__revision_root (svn_fs_root_t **root_p, svn_fs_t *fs,
+                                       svn_revnum_t rev, apr_pool_t *pool);
+
+/* Does nothing, but included for Subversion 1.0.x compatability. */
+svn_error_t *svn_fs_fs__deltify (svn_fs_t *fs, svn_revnum_t rev,
+                                 apr_pool_t *pool);
+
+/* Commit the transaction TXN as a new revision.  Return the new
+   revision in *NEW_REV.  If the transaction conflicts with other
+   changes return SVN_ERR_FS_CONFLICT and set *CONFLICT_P to a string
+   that details the cause of the conflict.  Perform temporary
+   allocations in POOL. */
+svn_error_t *svn_fs_fs__commit_txn (const char **conflict_p,
+                                    svn_revnum_t *new_rev, svn_fs_txn_t *txn,
+                                    apr_pool_t *pool);
+
+/* Set ROOT_P to the root directory of transaction TXN.  Allocate the
+   structure in POOL. */
+svn_error_t *svn_fs_fs__txn_root (svn_fs_root_t **root_p, svn_fs_txn_t *txn,
+                                  apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: trunk/subversion/libsvn_repos/repos.c
==============================================================================
--- trunk/subversion/libsvn_repos/repos.c	(original)
+++ trunk/subversion/libsvn_repos/repos.c	Thu Apr 29 18:17:29 2004
@@ -940,11 +940,8 @@
   SVN_ERR_W (create_repos_structure (repos, path, pool),
              "Repository creation failed");
   
-  /* Initialize the filesystem object. */
-  repos->fs = svn_fs_new (fs_config, pool);
-
   /* Create a Berkeley DB environment for the filesystem. */
-  SVN_ERR (svn_fs_create_berkeley (repos->fs, repos->db_path));
+  SVN_ERR (svn_fs_create (&repos->fs, repos->db_path, fs_config, pool));
 
   *repos_p = repos;
   return SVN_NO_ERROR;
@@ -1036,10 +1033,6 @@
   /* Initialize the repository paths. */
   init_repos_dirs (repos, path, pool);
 
-  /* Initialize the filesystem object. */
-  repos->fs = svn_fs_new (NULL, pool);
-
-
   /* Locking. */
   {
     const char *lockfile_path;
@@ -1056,7 +1049,7 @@
 
   /* Open up the Berkeley filesystem only after obtaining the lock. */
   if (open_fs)
-    SVN_ERR (svn_fs_open_berkeley (repos->fs, repos->db_path));
+    SVN_ERR (svn_fs_open (&repos->fs, repos->db_path, NULL, pool));
 
   *repos_p = repos;
   return SVN_NO_ERROR;
@@ -1107,7 +1100,7 @@
   const char *db_path = svn_path_join (path, SVN_REPOS__DB_DIR, pool);
 
   /* Delete the Berkeley environment... */
-  SVN_ERR (svn_fs_delete_berkeley (db_path, pool));
+  SVN_ERR (svn_fs_delete_fs (db_path, pool));
 
   /* ...then blow away everything else.  */
   SVN_ERR (svn_io_remove_dir (path, pool));
@@ -1336,8 +1329,8 @@
                       pool));
 
 
-  SVN_ERR (svn_fs_hotcopy_berkeley (src_repos->db_path, dst_repos->db_path,
-                                    clean_logs, pool));
+  SVN_ERR (svn_fs_hotcopy (src_repos->db_path, dst_repos->db_path,
+                           clean_logs, pool));
 
   return SVN_NO_ERROR;
 }

Modified: trunk/subversion/svnadmin/main.c
==============================================================================
--- trunk/subversion/svnadmin/main.c	(original)
+++ trunk/subversion/svnadmin/main.c	Thu Apr 29 18:17:29 2004
@@ -158,6 +158,7 @@
     svnadmin__deltas,
     svnadmin__ignore_uuid,
     svnadmin__force_uuid,
+    svnadmin__fs_type,
     svnadmin__parent_dir,
     svnadmin__bdb_txn_nosync,
     svnadmin__bdb_log_keep,
@@ -205,6 +206,9 @@
     {"force-uuid", svnadmin__force_uuid, 0,
      N_("set repos UUID to that found in stream, if any")},
 
+    {"fs-type", svnadmin__fs_type, 1,
+     N_("type of repository: 'bdb' or 'fsfs'")},
+
     {"parent-dir", svnadmin__parent_dir, 1,
      N_("load at specified directory in repository")},
 
@@ -233,7 +237,7 @@
      N_("usage: svnadmin create REPOS_PATH\n\n"
      "Create a new, empty repository at REPOS_PATH.\n"),
      {svnadmin__bdb_txn_nosync, svnadmin__bdb_log_keep,
-      svnadmin__config_dir} },
+      svnadmin__config_dir, svnadmin__fs_type} },
 
     {"deltify", subcommand_deltify, {0}, N_
      ("usage: svnadmin deltify [-r LOWER[:UPPER]] REPOS_PATH\n\n"
@@ -334,6 +338,7 @@
 {
   const char *repository_path;
   const char *new_repository_path;                  /* hotcopy dest. path */
+  const char *fs_type;                              /* --fs-type */
   svn_opt_revision_t start_revision, end_revision;  /* -r X[:Y] */
   svn_boolean_t help;                               /* --help or -? */
   svn_boolean_t version;                            /* --version */
@@ -369,6 +374,11 @@
                 APR_HASH_KEY_STRING,
                 (opt_state->bdb_log_keep ? "0" : "1"));
 
+  if (opt_state->fs_type)
+    apr_hash_set (fs_config, SVN_FS_CONFIG_FS_TYPE,
+                  APR_HASH_KEY_STRING,
+                  opt_state->fs_type);
+
   SVN_ERR (svn_config_get_config (&config, opt_state->config_dir, pool));
   SVN_ERR (svn_repos_create (&repos, opt_state->repository_path,
                              NULL, NULL, 
@@ -940,6 +950,16 @@
         break;
       case svnadmin__force_uuid:
         opt_state.uuid_action = svn_repos_load_uuid_force;
+        break;
+      case svnadmin__fs_type:
+        err = svn_utf_cstring_to_utf8 (&opt_state.fs_type, opt_arg, pool);
+        if (err)
+          {
+            svn_handle_error (err, stderr, FALSE);
+            svn_error_clear (err);
+            svn_pool_destroy (pool);
+            return EXIT_FAILURE;
+          }
         break;
       case svnadmin__parent_dir:
         err = svn_utf_cstring_to_utf8 (&opt_state.parent_dir, opt_arg,

Modified: trunk/subversion/tests/clients/cmdline/svntest/main.py
==============================================================================
--- trunk/subversion/tests/clients/cmdline/svntest/main.py	(original)
+++ trunk/subversion/tests/clients/cmdline/svntest/main.py	Thu Apr 29 18:17:29 2004
@@ -27,6 +27,7 @@
 import time    # for time()
 
 from svntest import Failure
+from svntest import Skip
 from svntest import testcase
 from svntest import wc
 
@@ -108,6 +109,8 @@
 if windows == 1:
   test_area_url = string.replace(test_area_url, '\\', '/')
 
+# Global variable indicating the FS type for repository creations.
+fs_type = "bdb"
 
 # Where we want all the repositories and working copies to live.
 # Each test will have its own!
@@ -315,7 +318,15 @@
 
   if not(os.path.exists(path)):
     os.makedirs(path) # this creates all the intermediate dirs, if neccessary
-  run_svnadmin("create", path, "--bdb-txn-nosync")
+
+  stdout, stderr = run_command(svnadmin_binary, 1, 0, "create", path,
+                               "--bdb-txn-nosync", "--fs-type", fs_type)
+
+  # Skip tests if we can't create the repository (most likely, because
+  # Subversion was built without BDB and this is a default test run).
+  for line in stderr:
+    if line.find('Unknown FS type') != -1:
+      raise Skip
 
   # Allow unauthenticated users to write to the repos, for ra_svn testing.
   file_append(os.path.join(path, "conf", "svnserve.conf"),
@@ -531,6 +542,7 @@
   """
 
   global test_area_url
+  global fs_type
   global verbose_mode
   global cleanup_mode
   testnum = None
@@ -540,6 +552,7 @@
   os.environ['SVN_EDITOR'] = ''
 
   url_re = re.compile('^(?:--url|BASE_URL)=(.+)')
+  fstype_re = re.compile('^--fs-type=(.+)')
 
   for arg in sys.argv:
 
@@ -558,6 +571,10 @@
       index = sys.argv.index(arg)
       test_area_url = sys.argv[index + 1]
 
+    elif arg == "--fs-type":
+      index = sys.argv.index(arg)
+      fs_type = sys.argv[index + 1]
+
     elif arg == "-v" or arg == "--verbose":
       verbose_mode = 1
 
@@ -568,6 +585,9 @@
       match = url_re.search(arg)
       if match:
         test_area_url = match.group(1)
+      match = fstype_re.search(arg)
+      if match:
+        fs_type = match.group(1)
 
       else:
         try:

Modified: trunk/subversion/tests/fs-helpers.c
==============================================================================
--- trunk/subversion/tests/fs-helpers.c	(original)
+++ trunk/subversion/tests/fs-helpers.c	Thu Apr 29 18:17:29 2004
@@ -26,12 +26,12 @@
 #include "svn_test.h"
 #include "fs-helpers.h"
 
-#include "../libsvn_fs/fs.h"
-#include "../libsvn_fs/dag.h"
-#include "../libsvn_fs/trail.h"
+#include "../libsvn_fs_base/fs.h"
+#include "../libsvn_fs_base/dag.h"
+#include "../libsvn_fs_base/trail.h"
 
-#include "../libsvn_fs/bdb/rev-table.h"
-#include "../libsvn_fs/bdb/nodes-table.h"
+#include "../libsvn_fs_base/bdb/rev-table.h"
+#include "../libsvn_fs_base/bdb/nodes-table.h"
 
 
 /*-------------------------------------------------------------------*/

Modified: trunk/subversion/tests/libsvn_fs_base/changes-test.c
==============================================================================
--- trunk/subversion/tests/libsvn_fs_base/changes-test.c	(original)
+++ trunk/subversion/tests/libsvn_fs_base/changes-test.c	Thu Apr 29 18:17:29 2004
@@ -26,9 +26,9 @@
 #include "svn_error.h"
 #include "svn_test.h"
 #include "../fs-helpers.h"
-#include "../../libsvn_fs/util/skel.h"
-#include "../../libsvn_fs/util/fs_skels.h"
-#include "../../libsvn_fs/bdb/changes-table.h"
+#include "../../libsvn_fs_base/util/skel.h"
+#include "../../libsvn_fs_base/util/fs_skels.h"
+#include "../../libsvn_fs_base/bdb/changes-table.h"
 
 
 
@@ -79,7 +79,7 @@
 {
   svn_fs_t *fs;
   const char *key;
-  svn_fs__change_t *change;
+  change_t *change;
   apr_array_header_t *raw_changes;
   apr_hash_t *changes;
 };
@@ -89,7 +89,7 @@
 txn_body_changes_add (void *baton, trail_t *trail)
 {
   struct changes_args *b = baton;
-  return svn_fs__bdb_changes_add (b->fs, b->key, b->change, trail);
+  return svn_fs_bdb__changes_add (b->fs, b->key, b->change, trail);
 }
 
 
@@ -103,7 +103,7 @@
 
   for (i = 0; i < num_changes; i++)
     {
-      svn_fs__change_t change;
+      change_t change;
 
       /* Set up the current change item. */
       change.path = standard_changes[i][1];
@@ -120,7 +120,8 @@
       args.change = &change;
 
       /* Write new changes to the changes table. */
-      SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_changes_add, &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_changes_add, &args,
+                                       pool));
     }
 
   return SVN_NO_ERROR;
@@ -131,7 +132,7 @@
 txn_body_changes_fetch_raw (void *baton, trail_t *trail)
 {
   struct changes_args *b = baton;
-  return svn_fs__bdb_changes_fetch_raw (&(b->raw_changes), b->fs, b->key, 
+  return svn_fs_bdb__changes_fetch_raw (&(b->raw_changes), b->fs, b->key, 
                                         trail);
 }
 
@@ -140,7 +141,7 @@
 txn_body_changes_fetch (void *baton, trail_t *trail)
 {
   struct changes_args *b = baton;
-  return svn_fs__bdb_changes_fetch (&(b->changes), b->fs, b->key, trail);
+  return svn_fs_bdb__changes_fetch (&(b->changes), b->fs, b->key, trail);
 }
 
 
@@ -148,7 +149,7 @@
 txn_body_changes_delete (void *baton, trail_t *trail)
 {
   struct changes_args *b = baton;
-  return svn_fs__bdb_changes_delete (b->fs, b->key, trail);
+  return svn_fs_bdb__changes_delete (b->fs, b->key, trail);
 }
 
 
@@ -200,8 +201,8 @@
      without error. */
   args.fs = fs;
   args.key = "blahbliggityblah";
-  SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_changes_fetch_raw, 
-                              &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_changes_fetch_raw, 
+                                   &args, pool));
   if ((! args.raw_changes) || (args.raw_changes->nelts))
     return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                              "expected empty changes array");
@@ -223,8 +224,8 @@
       args.key = txn_id;
 
       /* And get those changes. */
-      SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_changes_fetch_raw, 
-                                  &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_changes_fetch_raw, 
+                                       &args, pool));
       if (! args.raw_changes)
         return svn_error_createf (SVN_ERR_TEST_FAILED, NULL,
                                   "got no changes for key '%s'", txn_id);
@@ -233,8 +234,7 @@
         {
           svn_string_t *noderev_id;
           svn_fs_path_change_kind_t kind;
-          svn_fs__change_t *change 
-            = APR_ARRAY_IDX (args.raw_changes, j, svn_fs__change_t *);
+          change_t *change = APR_ARRAY_IDX (args.raw_changes, j, change_t *);
           int mod_bit = 0;
 
           /* Verify that the TXN_ID matches. */
@@ -311,11 +311,11 @@
     {
       args.fs = fs;
       args.key = standard_txns[i];
-      SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_changes_delete, 
-                                  &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_changes_delete, 
+                                       &args, pool));
       args.changes = 0;
-      SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_changes_fetch_raw, 
-                                  &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_changes_fetch_raw, 
+                                       &args, pool));
       if ((! args.raw_changes) || (args.raw_changes->nelts))
         return svn_error_createf 
           (SVN_ERR_TEST_FAILED, NULL,
@@ -500,7 +500,7 @@
      without error. */
   args.fs = fs;
   args.key = "blahbliggityblah";
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_changes_fetch, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_changes_fetch, &args, pool));
   if ((! args.changes) || (apr_hash_count (args.changes)))
     return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                              "expected empty changes hash");
@@ -525,7 +525,8 @@
 
       /* And get those changes via in the internal interface, and
          verify that they are accurate. */
-      SVN_ERR (svn_fs__retry_txn (fs, txn_body_changes_fetch, &args, pool));
+      SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_changes_fetch, &args,
+                                       pool));
       if (! args.changes)
         return svn_error_createf 
           (SVN_ERR_TEST_FAILED, NULL,
@@ -604,7 +605,8 @@
        the deletion of 'dir1', and the addition of 'dir3'. ***/
   args.fs = fs;
   args.key = txn_name;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_changes_fetch, &args, subpool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_changes_fetch, &args,
+                                   subpool));
   if ((! args.changes) || (apr_hash_count (args.changes) != 3))
     return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                              "expected changes");
@@ -675,7 +677,8 @@
        the replacement of 'dir1', and the addition of 'dir4'. ***/
   args.fs = fs;
   args.key = txn_name;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_changes_fetch, &args, subpool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_changes_fetch, &args,
+                                   subpool));
   if ((! args.changes) || (apr_hash_count (args.changes) != 3))
     return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                              "expected changes");

Modified: trunk/subversion/tests/libsvn_fs_base/fs-test.c
==============================================================================
--- trunk/subversion/tests/libsvn_fs_base/fs-test.c	(original)
+++ trunk/subversion/tests/libsvn_fs_base/fs-test.c	Thu Apr 29 18:17:29 2004
@@ -31,15 +31,16 @@
 
 #include "../fs-helpers.h"
 
-#include "../../libsvn_fs/fs.h"
-#include "../../libsvn_fs/dag.h"
-#include "../../libsvn_fs/node-rev.h"
-#include "../../libsvn_fs/trail.h"
-#include "../../libsvn_fs/id.h"
-
-#include "../../libsvn_fs/bdb/rev-table.h"
-#include "../../libsvn_fs/bdb/txn-table.h"
-#include "../../libsvn_fs/bdb/nodes-table.h"
+#include "../../libsvn_fs/fs-loader.h"
+
+#include "../../libsvn_fs_base/fs.h"
+#include "../../libsvn_fs_base/dag.h"
+#include "../../libsvn_fs_base/node-rev.h"
+#include "../../libsvn_fs_base/trail.h"
+
+#include "../../libsvn_fs_base/bdb/rev-table.h"
+#include "../../libsvn_fs_base/bdb/txn-table.h"
+#include "../../libsvn_fs_base/bdb/nodes-table.h"
 
 #include "../../libsvn_delta/delta.h"
 
@@ -280,95 +281,6 @@
 }
 
 
-static svn_error_t *
-check_no_fs_error (svn_error_t *err)
-{
-  if (err && (err->apr_err != SVN_ERR_FS_NOT_OPEN))
-    return svn_error_create
-      (SVN_ERR_FS_GENERAL, err,
-       "checking not opened filesystem got wrong error");
-  else if (! err)
-    return svn_error_create
-      (SVN_ERR_FS_GENERAL, NULL,
-       "checking not opened filesytem failed to get error");
-  else
-    svn_error_clear (err);
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Call functions with not yet opened filesystem and see it returns
-   correct error.  */
-static svn_error_t *
-call_functions_with_unopened_fs (const char **msg,
-                                 svn_boolean_t msg_only,
-                                 apr_pool_t *pool)
-{
-  svn_fs_t *fs;
-  svn_error_t *err;
-  apr_hash_t *fs_config = apr_hash_make (pool);
-  apr_hash_set (fs_config, SVN_FS_CONFIG_BDB_TXN_NOSYNC,
-                APR_HASH_KEY_STRING, "1");
-  fs = svn_fs_new (fs_config, pool);
-
-  *msg = "call functions with unopened fs and check errors";
-
-  if (msg_only)
-    return SVN_NO_ERROR;
-
-  fs = svn_fs_new (fs_config, pool);
-  err = svn_fs_set_berkeley_errcall (fs, berkeley_error_handler);
-  SVN_ERR (check_no_fs_error (err));
-
-  {
-    svn_fs_txn_t *ignored;
-    err = svn_fs_begin_txn (&ignored, fs, 0, pool);
-    SVN_ERR (check_no_fs_error (err));
-    err = svn_fs_open_txn (&ignored, fs, "0", pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    apr_array_header_t *ignored;
-    err = svn_fs_list_transactions (&ignored, fs, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    svn_fs_root_t *ignored;
-    err = svn_fs_revision_root (&ignored, fs, 0, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    svn_revnum_t ignored;
-    err = svn_fs_youngest_rev (&ignored, fs, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    svn_string_t *ignored;
-    err = svn_fs_revision_prop (&ignored, fs, 0, NULL, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    apr_hash_t *ignored;
-    err = svn_fs_revision_proplist (&ignored, fs, 0, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  {
-    svn_string_t unused1;
-    err = svn_fs_change_rev_prop (fs, 0, NULL, &unused1, pool);
-    SVN_ERR (check_no_fs_error (err));
-  }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Make sure we get txn lists correctly. */
 static svn_error_t *
 verify_txn_list (const char **msg,
@@ -1068,10 +980,10 @@
 txn_body_check_id (void *baton, trail_t *trail)
 {
   struct check_id_args *args = baton;
-  svn_fs__node_revision_t *noderev;
+  node_revision_t *noderev;
   svn_error_t *err;
 
-  err = svn_fs__bdb_get_node_revision (&noderev, args->fs, args->id, trail);
+  err = svn_fs_bdb__get_node_revision (&noderev, args->fs, args->id, trail);
 
   if (err && (err->apr_err == SVN_ERR_FS_ID_NOT_FOUND))
     args->present = FALSE;
@@ -1100,7 +1012,7 @@
 
   args.id = id;
   args.fs = fs;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_check_id, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_check_id, &args, pool));
 
   if (args.present)
     *present = TRUE;
@@ -5198,7 +5110,7 @@
 /* Trail-ish helpers for redundant_copy(). */
 struct get_txn_args
 {
-  svn_fs__transaction_t **txn;
+  transaction_t **txn;
   const char *txn_name;
   svn_fs_t *fs;
 };
@@ -5207,7 +5119,7 @@
 txn_body_get_txn (void *baton, trail_t *trail)
 {
   struct get_txn_args *args = baton;
-  return svn_fs__bdb_get_txn (args->txn, args->fs, args->txn_name, trail);
+  return svn_fs_bdb__get_txn (args->txn, args->fs, args->txn_name, trail);
 }
 
 
@@ -5219,7 +5131,7 @@
   svn_fs_t *fs;
   svn_fs_txn_t *txn;
   const char *txn_name;
-  svn_fs__transaction_t *transaction;
+  transaction_t *transaction;
   svn_fs_root_t *txn_root, *rev_root;
   const svn_fs_id_t *old_D_id, *new_D_id;
   svn_revnum_t youngest_rev = 0;
@@ -5251,7 +5163,7 @@
   args.fs = fs;
   args.txn_name = txn_name;
   args.txn = &transaction;
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_txn, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_txn, &args, pool));
   if (transaction->copies->nelts != 1)
     return svn_error_createf (SVN_ERR_TEST_FAILED, NULL,
                               "Expected 1 copy; got %d",
@@ -5265,7 +5177,7 @@
 
   /* Now, examine the transaction.  There should still only have been
      one copy operation that "took". */
-  SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_txn, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (fs, txn_body_get_txn, &args, pool));
   if (transaction->copies->nelts != 1)
     return svn_error_createf (SVN_ERR_TEST_FAILED, NULL,
                               "Expected only 1 copy; got %d",
@@ -5298,7 +5210,6 @@
     SVN_TEST_PASS (reopen_trivial_transaction),
     SVN_TEST_PASS (create_file_transaction),
     SVN_TEST_PASS (verify_txn_list),
-    SVN_TEST_PASS (call_functions_with_unopened_fs),
     SVN_TEST_PASS (write_and_read_file),
     SVN_TEST_PASS (create_mini_tree_transaction),
     SVN_TEST_PASS (create_greek_tree_transaction),

Modified: trunk/subversion/tests/libsvn_fs_base/key-test.c
==============================================================================
--- trunk/subversion/tests/libsvn_fs_base/key-test.c	(original)
+++ trunk/subversion/tests/libsvn_fs_base/key-test.c	Thu Apr 29 18:17:29 2004
@@ -24,7 +24,7 @@
 
 #include "svn_error.h"
 #include "svn_test.h"
-#include "../../libsvn_fs/key-gen.h"
+#include "../../libsvn_fs_base/key-gen.h"
 
 
 
@@ -53,7 +53,7 @@
 
   for (i = 0; i < 9; i++)
     {
-      char gen_key[SVN_FS__MAX_KEY_SIZE];
+      char gen_key[MAX_KEY_SIZE];
       const char *orig_key = keys[i][0];
       const char *next_key = keys[i][1];
       apr_size_t len, olen;
@@ -61,7 +61,7 @@
       len = strlen (orig_key);
       olen = len;
 
-      svn_fs__next_key (orig_key, &len, gen_key);
+      svn_fs_base__next_key (orig_key, &len, gen_key);
       if (! (((len == olen) || (len == (olen + 1)))
              && (strlen (next_key) == len)
              && (strcmp (next_key, gen_key) == 0)))

Modified: trunk/subversion/tests/libsvn_fs_base/skel-test.c
==============================================================================
--- trunk/subversion/tests/libsvn_fs_base/skel-test.c	(original)
+++ trunk/subversion/tests/libsvn_fs_base/skel-test.c	Thu Apr 29 18:17:29 2004
@@ -25,8 +25,8 @@
 #include "svn_pools.h"
 #include "svn_string.h"
 #include "svn_test.h"
-#include "../../libsvn_fs/fs.h"
-#include "../../libsvn_fs/util/skel.h"
+#include "../../libsvn_fs_base/fs.h"
+#include "../../libsvn_fs_base/util/skel.h"
 
 
 /* Some utility functions.  */
@@ -60,7 +60,7 @@
 static skel_t *
 parse_str (svn_stringbuf_t *str, apr_pool_t *pool)
 {
-  return svn_fs__parse_skel (str->data, str->len, pool);
+  return svn_fs_base__parse_skel (str->data, str->len, pool);
 }
 
 
@@ -68,7 +68,7 @@
 static skel_t *
 parse_cstr (char *str, apr_pool_t *pool)
 {
-  return svn_fs__parse_skel (str, strlen (str), pool);
+  return svn_fs_base__parse_skel (str, strlen (str), pool);
 }
 
 
@@ -794,7 +794,7 @@
           char buf =  (char)byte;
           skel_t *skel = build_atom (1, &buf, pool);
 
-          str = svn_fs__unparse_skel (skel, pool);
+          str = svn_fs_base__unparse_skel (skel, pool);
 
           if (! (str
                  && str->len == 1
@@ -837,8 +837,8 @@
 
     /* Unparse that, parse it again, and see if we got the same thing
        back.  */
-    str = svn_fs__unparse_skel (list, pool);
-    reparsed = svn_fs__parse_skel (str->data, str->len, pool);
+    str = svn_fs_base__unparse_skel (list, pool);
+    reparsed = svn_fs_base__parse_skel (str->data, str->len, pool);
 
     if (! reparsed || reparsed->is_atom)
       return fail (pool, "result is syntactically misformed, or not a list");
@@ -902,8 +902,8 @@
         add (middle, top);
       }
 
-    str = svn_fs__unparse_skel (top, pool);
-    reparsed = svn_fs__parse_skel (str->data, str->len, pool);
+    str = svn_fs_base__unparse_skel (top, pool);
+    reparsed = svn_fs_base__parse_skel (str->data, str->len, pool);
 
     if (! skel_equal (top, reparsed))
       return fail (pool, "failed to reparse list of lists");

Modified: trunk/subversion/tests/libsvn_fs_base/strings-reps-test.c
==============================================================================
--- trunk/subversion/tests/libsvn_fs_base/strings-reps-test.c	(original)
+++ trunk/subversion/tests/libsvn_fs_base/strings-reps-test.c	Thu Apr 29 18:17:29 \
2004 @@ -25,10 +25,10 @@
 #include "svn_error.h"
 #include "svn_test.h"
 #include "../fs-helpers.h"
-#include "../../libsvn_fs/util/skel.h"
-#include "../../libsvn_fs/util/fs_skels.h"
-#include "../../libsvn_fs/bdb/strings-table.h"
-#include "../../libsvn_fs/bdb/reps-table.h"
+#include "../../libsvn_fs_base/util/skel.h"
+#include "../../libsvn_fs_base/util/fs_skels.h"
+#include "../../libsvn_fs_base/bdb/strings-table.h"
+#include "../../libsvn_fs_base/bdb/reps-table.h"
 
 
 
@@ -46,9 +46,10 @@
 txn_body_write_new_rep (void *baton, trail_t *trail)
 {
   struct rep_args *b = (struct rep_args *) baton;
-  svn_fs__representation_t *rep;
-  SVN_ERR (svn_fs__parse_representation_skel (&rep, b->skel, trail->pool));
-  return svn_fs__bdb_write_new_rep (&(b->key), b->fs, rep, trail);
+  representation_t *rep;
+  SVN_ERR (svn_fs_base__parse_representation_skel (&rep, b->skel,
+                                                   trail->pool));
+  return svn_fs_bdb__write_new_rep (&(b->key), b->fs, rep, trail);
 }
 
 
@@ -56,9 +57,10 @@
 txn_body_write_rep (void *baton, trail_t *trail)
 {
   struct rep_args *b = (struct rep_args *) baton;
-  svn_fs__representation_t *rep;
-  SVN_ERR (svn_fs__parse_representation_skel (&rep, b->skel, trail->pool));
-  return svn_fs__bdb_write_rep (b->fs, b->key, rep, trail);
+  representation_t *rep;
+  SVN_ERR (svn_fs_base__parse_representation_skel (&rep, b->skel,
+                                                   trail->pool));
+  return svn_fs_bdb__write_rep (b->fs, b->key, rep, trail);
 }
 
 
@@ -66,9 +68,10 @@
 txn_body_read_rep (void *baton, trail_t *trail)
 {
   struct rep_args *b = (struct rep_args *) baton;
-  svn_fs__representation_t *rep;
-  SVN_ERR (svn_fs__bdb_read_rep (&rep, b->fs, b->key, trail));
-  return svn_fs__unparse_representation_skel (&(b->skel), rep, trail->pool);
+  representation_t *rep;
+  SVN_ERR (svn_fs_bdb__read_rep (&rep, b->fs, b->key, trail));
+  return svn_fs_base__unparse_representation_skel (&(b->skel), rep,
+                                                   trail->pool);
 }
 
 
@@ -76,7 +79,7 @@
 txn_body_delete_rep (void *baton, trail_t *trail)
 {
   struct rep_args *b = (struct rep_args *) baton;
-  return svn_fs__bdb_delete_rep (b->fs, b->key, trail);
+  return svn_fs_bdb__delete_rep (b->fs, b->key, trail);
 }
 
 
@@ -103,11 +106,12 @@
 
   /* Set up transaction baton */
   args.fs = fs;
-  args.skel = svn_fs__parse_skel ((char *)rep, strlen (rep), pool);
+  args.skel = svn_fs_base__parse_skel ((char *)rep, strlen (rep), pool);
   args.key = NULL;
 
   /* Write new rep to reps table. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_write_new_rep, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_write_new_rep, &args,
+                                   pool));
 
   if (args.key == NULL)
     return svn_error_create (SVN_ERR_FS_GENERAL, NULL,
@@ -139,12 +143,13 @@
 
   /* Set up transaction baton */
   new_args.fs = fs;
-  new_args.skel = svn_fs__parse_skel ((char *)new_rep, strlen (new_rep), pool);
+  new_args.skel = svn_fs_base__parse_skel ((char *)new_rep, strlen (new_rep),
+                                           pool);
   new_args.key = NULL;
 
   /* Write new rep to reps table. */
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_write_new_rep, &new_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_write_new_rep, &new_args, pool));
 
   /* Make sure we got a valid key. */
   if (new_args.key == NULL)
@@ -153,12 +158,12 @@
 
   /* Set up transaction baton for re-writing reps. */
   args.fs = new_args.fs;
-  args.skel = svn_fs__parse_skel ((char *)rep, strlen (rep), pool);
+  args.skel = svn_fs_base__parse_skel ((char *)rep, strlen (rep), pool);
   args.key = new_args.key;
 
   /* Overwrite first rep in reps table. */
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_write_rep, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_write_rep, &args, pool));
 
   return SVN_NO_ERROR;
 }
@@ -215,13 +220,13 @@
 
   /* Set up transaction baton */
   new_args.fs = fs;
-  new_args.skel = svn_fs__parse_skel ((char *)new_rep_before,
-                                      strlen (new_rep_before), pool);
+  new_args.skel = svn_fs_base__parse_skel ((char *)new_rep_before,
+                                           strlen (new_rep_before), pool);
   new_args.key = NULL;
 
   /* Write new rep to reps table. */
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_write_new_rep, &new_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_write_new_rep, &new_args, pool));
 
   /* Make sure we got a valid key. */
   if (new_args.key == NULL)
@@ -232,41 +237,41 @@
   read_args.fs = new_args.fs;
   read_args.skel = NULL;
   read_args.key = new_args.key;
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_read_rep, &read_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_read_rep, &read_args, pool));
 
   /* Make sure the skel matches. */
   if (! read_args.skel)
     return svn_error_create (SVN_ERR_FS_GENERAL, NULL,
                              "error reading new representation");
   
-  skel_data = svn_fs__unparse_skel (read_args.skel, pool);
+  skel_data = svn_fs_base__unparse_skel (read_args.skel, pool);
   if (memcmp (skel_data->data, new_rep_after, new_rep_after_len) != 0)
     return svn_error_createf (SVN_ERR_FS_GENERAL, NULL,
                               "representation corrupted (first check)");
   
   /* Set up transaction baton for re-writing reps. */
   args.fs = new_args.fs;
-  args.skel = svn_fs__parse_skel ((char *)rep, strlen (rep), pool);
+  args.skel = svn_fs_base__parse_skel ((char *)rep, strlen (rep), pool);
   args.key = new_args.key;
 
   /* Overwrite first rep in reps table. */
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
                               txn_body_write_rep, &args, pool));
 
   /* Read the new rep back from the reps table (using the same FS and
      key as the first read...let's make sure this thing didn't get
      written to the wrong place). */
   read_args.skel = NULL;
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_read_rep, &read_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_read_rep, &read_args, pool));
 
   /* Make sure the skel matches. */
   if (! read_args.skel)
     return svn_error_create (SVN_ERR_FS_GENERAL, NULL,
                              "error reading new representation");
   
-  skel_data = svn_fs__unparse_skel (read_args.skel, pool);
+  skel_data = svn_fs_base__unparse_skel (read_args.skel, pool);
   if (memcmp (skel_data->data, rep_after, rep_after_len) != 0)
     return svn_error_createf (SVN_ERR_FS_GENERAL, NULL,
                               "representation corrupted (second check)");
@@ -298,12 +303,13 @@
 
   /* Set up transaction baton */
   new_args.fs = fs;
-  new_args.skel = svn_fs__parse_skel ((char *)new_rep, strlen (new_rep), pool);
+  new_args.skel = svn_fs_base__parse_skel ((char *)new_rep, strlen (new_rep),
+                                           pool);
   new_args.key = NULL;
 
   /* Write new rep to reps table. */
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_write_new_rep, &new_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_write_new_rep, &new_args, pool));
 
   /* Make sure we got a valid key. */
   if (new_args.key == NULL)
@@ -313,15 +319,15 @@
   /* Delete the rep we just wrote. */
   delete_args.fs = new_args.fs;
   delete_args.key = new_args.key;
-  SVN_ERR (svn_fs__retry_txn (new_args.fs, 
-                              txn_body_delete_rep, &delete_args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (new_args.fs, 
+                                   txn_body_delete_rep, &delete_args, pool));
 
   /* Try to read the new rep back from the reps table. */
   read_args.fs = new_args.fs;
   read_args.skel = NULL;
   read_args.key = new_args.key;
-  err = svn_fs__retry_txn (new_args.fs, 
-                           txn_body_read_rep, &read_args, pool);
+  err = svn_fs_base__retry_txn (new_args.fs, 
+                                txn_body_read_rep, &read_args, pool);
 
   /* We better have an error... */
   if ((! err) && (read_args.skel))
@@ -350,7 +356,7 @@
   svn_filesize_t string_size;
 
   /* Check the string size. */
-  SVN_ERR (svn_fs__bdb_string_size (&string_size, fs, key, trail));
+  SVN_ERR (svn_fs_bdb__string_size (&string_size, fs, key, trail));
   if (string_size > SVN_MAX_OBJECT_SIZE)
     return svn_error_createf (SVN_ERR_FS_GENERAL, NULL,
                               "record size is too large "
@@ -370,7 +376,7 @@
   while (1)
     {
       size = sizeof (buf);
-      SVN_ERR (svn_fs__bdb_string_read (fs, key, buf, offset, &size, trail));
+      SVN_ERR (svn_fs_bdb__string_read (fs, key, buf, offset, &size, trail));
       if (size == 0)
         break;
       svn_stringbuf_appendbytes (text, buf, size);
@@ -413,7 +419,7 @@
 txn_body_string_append (void *baton, trail_t *trail)
 {
   struct string_args *b = (struct string_args *) baton;
-  return svn_fs__bdb_string_append (b->fs, &(b->key), b->len, 
+  return svn_fs_bdb__string_append (b->fs, &(b->key), b->len, 
                                     b->text, trail);
 }
 
@@ -422,7 +428,7 @@
 txn_body_string_clear (void *baton, trail_t *trail)
 {
   struct string_args *b = (struct string_args *) baton;
-  return svn_fs__bdb_string_clear (b->fs, b->key, trail);
+  return svn_fs_bdb__string_clear (b->fs, b->key, trail);
 }
 
 
@@ -430,7 +436,7 @@
 txn_body_string_delete (void *baton, trail_t *trail)
 {
   struct string_args *b = (struct string_args *) baton;
-  return svn_fs__bdb_string_delete (b->fs, b->key, trail);
+  return svn_fs_bdb__string_delete (b->fs, b->key, trail);
 }
 
 
@@ -439,7 +445,7 @@
 {
   struct string_args *b = (struct string_args *) baton;
   svn_filesize_t string_size;
-  SVN_ERR (svn_fs__bdb_string_size (&string_size, b->fs, b->key, trail));
+  SVN_ERR (svn_fs_bdb__string_size (&string_size, b->fs, b->key, trail));
   if (string_size > SVN_MAX_OBJECT_SIZE)
     return svn_error_createf
       (SVN_ERR_FS_GENERAL, NULL,
@@ -455,7 +461,7 @@
 txn_body_string_append_fail (void *baton, trail_t *trail)
 {
   struct string_args *b = (struct string_args *) baton;
-  SVN_ERR (svn_fs__bdb_string_append (b->fs, &(b->key), b->len, 
+  SVN_ERR (svn_fs_bdb__string_append (b->fs, &(b->key), b->len, 
                                       b->text, trail));
   return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                            "la dee dah, la dee day...");
@@ -465,7 +471,7 @@
 txn_body_string_copy (void *baton, trail_t *trail)
 {
   struct string_args *b = (struct string_args *) baton;
-  return svn_fs__bdb_string_copy (b->fs, &(b->key), b->key, trail);
+  return svn_fs_bdb__string_copy (b->fs, &(b->key), b->key, trail);
 }
 
 
@@ -542,8 +548,8 @@
   args.key = NULL;
   args.text = bigstring1;
   args.len = strlen (bigstring1);
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_append, &args, pool));
 
   /* Make sure a key was returned. */
   if (! args.key)
@@ -551,52 +557,52 @@
                              "write of new string failed to return new key");
 
   /* Verify record's size and contents. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   /* Append a second string to our first one. */
   args.text = bigstring2;
   args.len = strlen (bigstring2);
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_append, &args, pool));
   
   /* Verify record's size and contents. */
   string = svn_stringbuf_create (bigstring1, pool);
   svn_stringbuf_appendcstr (string, bigstring2);
   args.text = string->data;
   args.len = string->len;
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   /* Clear the record */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_clear, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_clear, &args, pool));
 
   /* Verify record's size and contents. */
   args.text = "";
   args.len = 0;
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   /* Append a third string to our first one. */
   args.text = bigstring3;
   args.len = strlen (bigstring3);
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_append, &args, pool));
 
   /* Verify record's size and contents. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   /* Delete our record...she's served us well. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_delete, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_delete, &args, pool));
 
   /* Now, we expect a size request on this record to fail with
      SVN_ERR_FS_NO_SUCH_STRING. */
   {
-    svn_error_t *err = svn_fs__retry_txn (args.fs,
-                                          txn_body_string_size, &args, pool);
+    svn_error_t *err = svn_fs_base__retry_txn (args.fs, txn_body_string_size,
+                                               &args, pool);
 
     if (! err)
       return svn_error_create (SVN_ERR_FS_GENERAL, NULL,
@@ -632,7 +638,8 @@
   args.key = NULL;
   args.text = NULL;
   args.len = 0;
-  SVN_ERR (svn_fs__retry_txn (args.fs, txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, txn_body_string_append, &args,
+                                   pool));
 
   return SVN_NO_ERROR;
 }
@@ -667,8 +674,8 @@
   args.key = NULL;
   args.text = bigstring1;
   args.len = strlen (bigstring1);
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_append, &args, pool));
 
   /* Make sure a key was returned. */
   if (! args.key)
@@ -676,8 +683,8 @@
                              "write of new string failed to return new key");
 
   /* Verify record's size and contents. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   /* Append a second string to our first one. */
   args2.fs = fs;
@@ -688,8 +695,8 @@
     svn_error_t *err;
 
     /* This function is *supposed* to fail with SVN_ERR_TEST_FAILED */
-    err = svn_fs__retry_txn (args.fs, txn_body_string_append_fail, 
-                             &args2, pool);
+    err = svn_fs_base__retry_txn (args.fs, txn_body_string_append_fail, 
+                                  &args2, pool);
     if ((! err) || (err->apr_err != SVN_ERR_TEST_FAILED))
       return svn_error_create (SVN_ERR_TEST_FAILED, NULL,
                                "failed to intentionally abort a trail");
@@ -697,8 +704,8 @@
   }
   
   /* Verify that record's size and contents are still that of string1 */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   return SVN_NO_ERROR;
 }
@@ -726,8 +733,8 @@
   args.key = NULL;
   args.text = bigstring1;
   args.len = strlen (bigstring1);
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_append, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_append, &args, pool));
 
   /* Make sure a key was returned. */
   if (! (old_key = args.key))
@@ -735,8 +742,8 @@
                              "write of new string failed to return new key");
 
   /* Now copy that string into a new location. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_string_copy, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_string_copy, &args, pool));
 
   /* Make sure a different key was returned. */
   if ((! args.key) || (! strcmp (old_key, args.key)))
@@ -744,8 +751,8 @@
                              "copy of string failed to return new key");
 
   /* Verify record's size and contents. */
-  SVN_ERR (svn_fs__retry_txn (args.fs, 
-                              txn_body_verify_string, &args, pool));
+  SVN_ERR (svn_fs_base__retry_txn (args.fs, 
+                                   txn_body_verify_string, &args, pool));
 
   return SVN_NO_ERROR;
 }

Modified: trunk/svn_private_config.hw
==============================================================================
--- trunk/svn_private_config.hw	(original)
+++ trunk/svn_private_config.hw	Thu Apr 29 18:17:29 2004
@@ -36,6 +36,12 @@
 /* Name of system's null device */
 #define SVN_NULL_DEVICE_NAME "nul"
 
+/* Link fs base library into the fs library */
+#define SVN_LIBSVN_FS_LINKS_FS_BASE
+
+/* Link fs fs library into the fs library */
+#define SVN_LIBSVN_FS_LINKS_FS_FS
+
 /* Link local repos access library to client */
 #define SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
 

---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
For additional commands, e-mail: svn-help@subversion.tigris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic