[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r16162 - in trunk/subversion: include libsvn_fs libsvn_fs_fs

From: <kfogel_at_collab.net>
Date: 2005-09-20 23:01:26 CEST

Daniel Rall <dlr@finemaltcoding.com> writes:
> How would this work with a third-party FS backend which is not yet part of
> the SVN core (not that they're falling from the sky or anything)? It
> doesn't seem particularly pluggable -- that might be okay given the
> complexity of implementing a FS backend, however.

Hmm. That's a good point. The API could return a constant string
instead, so that each back end would be free to return whatever value
it wants.

There wouldn't be any central registry guaranteeing that the namespace
remains free of conflict, if we did it that way. But maybe that's
okay. People implementing new repository back ends should be at least
enough in touch with each other to avoid choosing the same names!

Would you be +1 on getting rid of the enum type and just returning a
constant string (i.e., allocated in static data segment, not pool)
from svn_fs_type()? I'm happy to make the change...

-Karl

-- 
www.collab.net  <>  CollabNet  |  Distributed Development On Demand
> On Tue, 20 Sep 2005, kfogel@tigris.org wrote:
> 
> > Author: kfogel
> > Date: Tue Sep 20 02:07:00 2005
> > New Revision: 16162
> > 
> > Modified:
> >    trunk/subversion/include/svn_fs.h
> >    trunk/subversion/libsvn_fs/fs-loader.c
> >    trunk/subversion/libsvn_fs/fs-loader.h
> >    trunk/subversion/libsvn_fs_base/fs.c
> >    trunk/subversion/libsvn_fs_fs/fs.c
> > 
> > Log:
> > Implement svn_fs_type() API, for issue #2389.
> > 
> > Suggested by: maxb
> > 
> > * subversion/libsvn_fs/fs-loader.h
> >   (struct svn_fs_t): Add new 'type' field.
> > 
> > * subversion/include/svn_fs.h
> >   (SVN_FS_CONFIG_FS_TYPE): Add a comment referring to the new stuff below.
> >   (svn_fs_fs_type_t): New enum group.
> >   (svn_fs_type): New prototype.
> > 
> > * subversion/libsvn_fs/fs-loader.c
> >   (svn_fs_type): New function.
> >   (svn_fs_new): Initialize fs->type field to svn_fs_type_unknown.
> > 
> > * subversion/libsvn_fs_fs/fs.c
> >   (fs_create, fs_open): Initialize fs->type field to svn_fs_type_fsfs.
> > 
> > * subversion/libsvn_fs_base/fs.c
> >   (base_create, base_open): Initialize fs->type field to svn_fs_type_bdb.
> > 
> > 
> > Modified: trunk/subversion/include/svn_fs.h
> > Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/include/svn_fs.h?rev=16162&p1=trunk/subversion/include/svn_fs.h&p2=trunk/subversion/include/svn_fs.h&r1=16161&r2=16162
> > ==============================================================================
> > --- trunk/subversion/include/svn_fs.h	(original)
> > +++ trunk/subversion/include/svn_fs.h	Tue Sep 20 02:07:00 2005
> > @@ -59,6 +59,7 @@
> >  #define SVN_FS_CONFIG_BDB_TXN_NOSYNC            "bdb-txn-nosync"
> >  #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE        "bdb-log-autoremove"
> >  
> > +/* See also svn_fs_fs_type_t and svn_fs_type(). */
> >  /** @since New in 1.1. */
> >  #define SVN_FS_CONFIG_FS_TYPE                   "fs-type"
> >  /** @since New in 1.1. */
> > @@ -167,6 +168,28 @@
> >   */
> >  svn_error_t *svn_fs_open (svn_fs_t **fs_p, const char *path,
> >                            apr_hash_t *config, apr_pool_t *pool);
> > +
> > +/** The back-end type of filesystem.  
> > + *
> > + * In general, this should make no difference in the filesystem's
> > + * behavior, but there are a few situations (such as backups) where
> > + * it can matter.  See also the @c SVN_FS_TYPE_* defined constants.
> > + *
> > + * @since New in 1.3.
> > + */
> > +typedef enum
> > +{
> > +  svn_fs_type_unknown = 0,   /* Back-end type not (yet) known. */
> > +  svn_fs_type_fsfs,          /* OS filesystem back end. */
> > +  svn_fs_type_bdb            /* Berkeley DB back end. */
> > +} svn_fs_fs_type_t;
> > +
> > +/**
> > + * Return the type of @a fs.
> > + *
> > + * @since New in 1.3.
> > + */
> > +svn_fs_fs_type_t svn_fs_type (svn_fs_t *fs);
> >  
> >  /**
> >   * Return the path to @a fs's repository, allocated in @a pool.
> > 
> > Modified: trunk/subversion/libsvn_fs/fs-loader.c
> > Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs/fs-loader.c?rev=16162&p1=trunk/subversion/libsvn_fs/fs-loader.c&p2=trunk/subversion/libsvn_fs/fs-loader.c&r1=16161&r2=16162
> > ==============================================================================
> > --- trunk/subversion/libsvn_fs/fs-loader.c	(original)
> > +++ trunk/subversion/libsvn_fs/fs-loader.c	Tue Sep 20 02:07:00 2005
> > @@ -312,6 +312,7 @@
> >    fs->access_ctx = NULL;
> >    fs->vtable = NULL;
> >    fs->fsap_data = NULL;
> > +  fs->type = svn_fs_type_unknown;
> >    return fs;
> >  }
> >  
> > @@ -357,6 +358,12 @@
> >    *fs_p = svn_fs_new (fs_config, pool);
> >    SVN_ERR (vtable->open (*fs_p, path, pool));
> >    return serialized_init (*fs_p, pool);
> > +}
> > +
> > +svn_fs_fs_type_t
> > +svn_fs_type (svn_fs_t *fs)
> > +{
> > +  return fs->type;
> >  }
> >  
> >  const char *
> > 
> > Modified: trunk/subversion/libsvn_fs/fs-loader.h
> > Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs/fs-loader.h?rev=16162&p1=trunk/subversion/libsvn_fs/fs-loader.h&p2=trunk/subversion/libsvn_fs/fs-loader.h&r1=16161&r2=16162
> > ==============================================================================
> > --- trunk/subversion/libsvn_fs/fs-loader.h	(original)
> > +++ trunk/subversion/libsvn_fs/fs-loader.h	Tue Sep 20 02:07:00 2005
> > @@ -339,6 +339,9 @@
> >    /* FSAP-specific vtable and private data */
> >    fs_vtable_t *vtable;
> >    void *fsap_data;
> > +
> > +  /* What type of filesystem is this (e.g., FSFS, BDB, ...?) */
> > +  svn_fs_fs_type_t type;
> >  };
> >  
> >  
> > 
> > Modified: trunk/subversion/libsvn_fs_base/fs.c
> > Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs_base/fs.c?rev=16162&p1=trunk/subversion/libsvn_fs_base/fs.c&p2=trunk/subversion/libsvn_fs_base/fs.c&r1=16161&r2=16162
> > ==============================================================================
> > --- trunk/subversion/libsvn_fs_base/fs.c	(original)
> > +++ trunk/subversion/libsvn_fs_base/fs.c	Tue Sep 20 02:07:00 2005
> > @@ -576,6 +576,7 @@
> >    bfd = apr_pcalloc (fs->pool, sizeof (*bfd));
> >    fs->vtable = &fs_vtable;
> >    fs->fsap_data = bfd;
> > +  fs->type = svn_fs_type_bdb;
> >  
> >    /* Initialize the fs's path. */
> >    fs->path = apr_pstrdup (fs->pool, path);
> > @@ -697,6 +698,7 @@
> >    bfd = apr_pcalloc (fs->pool, sizeof (*bfd));
> >    fs->vtable = &fs_vtable;
> >    fs->fsap_data = bfd;
> > +  fs->type = svn_fs_type_bdb;
> >  
> >    /* Initialize paths. */
> >    fs->path = apr_pstrdup (fs->pool, path);
> > 
> > Modified: trunk/subversion/libsvn_fs_fs/fs.c
> > Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_fs_fs/fs.c?rev=16162&p1=trunk/subversion/libsvn_fs_fs/fs.c&p2=trunk/subversion/libsvn_fs_fs/fs.c&r1=16161&r2=16162
> > ==============================================================================
> > --- trunk/subversion/libsvn_fs_fs/fs.c	(original)
> > +++ trunk/subversion/libsvn_fs_fs/fs.c	Tue Sep 20 02:07:00 2005
> > @@ -154,6 +154,7 @@
> >    ffd = apr_pcalloc (fs->pool, sizeof (*ffd));
> >    fs->vtable = &fs_vtable;
> >    fs->fsap_data = ffd;
> > +  fs->type = svn_fs_type_fsfs;
> >  
> >    SVN_ERR (svn_fs_fs__create (fs, path, pool));
> >  
> > @@ -176,6 +177,7 @@
> >    ffd = apr_pcalloc (fs->pool, sizeof (*ffd));
> >    fs->vtable = &fs_vtable;
> >    fs->fsap_data = ffd;
> > +  fs->type = svn_fs_type_fsfs;
> >  
> >    SVN_ERR (svn_fs_fs__open (fs, path, pool));
> >  
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> > For additional commands, e-mail: svn-help@subversion.tigris.org
> 
-- 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 21 00:08:01 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.