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

Re: svn commit: r981204 - in /subversion/branches/performance/subversion: include/private/svn_file_cache.h include/private/svn_file_handle_cache.h libsvn_subr/svn_file_cache.c libsvn_subr/svn_file_handle_cache.c

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Mon, 2 Aug 2010 09:00:47 -0500

Sorry to be pedantic about variable naming, but stuff in
include/private/svn_*.h is usually prefixed with 'svn__' instead of
'svn_'. Since these private symbols are included in the same library
as the public API, we prefer the naming differentiation so that folks
know these APIs are not for public export or consumption.

-Hyrum

On Sun, Aug 1, 2010 at 6:13 AM, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Sun Aug  1 11:13:46 2010
> New Revision: 981204
>
> URL: http://svn.apache.org/viewvc?rev=981204&view=rev
> Log:
> Rename all svn_file_cache_* to svn_file_handle_cache_*, including the
> file names as requested in http://svn.haxx.se/dev/archive-2010-08/0005.shtml
>
> * rename subversion/include/private/svn_file_cache.h to
>  subversion/include/private/svn_file_handle_cache.h
> * rename subversion/libsvn_subr/svn_file_cache.c to
>  subversion/libsvn_subr/svn_file_handle_cache.c
>
> * subversion/include/private/svn_file_handle_cache.h
>  (svn_file_cache_*): rename to svn_file_handle_cache_*
>
> * subversion/libsvn_subr/svn_file_handle_cache.c
>  (svn_file_cache_*): rename to svn_file_handle_cache_*
>  (lock_cache, unlock_cache, find_first, internal_file_open, internal_close_file,
>   open_entry, close_oldest_idle, auto_close_oldest): adapt signatures
>  (close_handle_before_cleanup): adapt implementation
>
> Added:
>    subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h   (contents, props changed)
>      - copied, changed from r981091, subversion/branches/performance/subversion/include/private/svn_file_cache.h
>    subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c   (contents, props changed)
>      - copied, changed from r981091, subversion/branches/performance/subversion/libsvn_subr/svn_file_cache.c
> Removed:
>    subversion/branches/performance/subversion/include/private/svn_file_cache.h
>    subversion/branches/performance/subversion/libsvn_subr/svn_file_cache.c
>
> Copied: subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h (from r981091, subversion/branches/performance/subversion/include/private/svn_file_cache.h)
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h?p2=subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h&p1=subversion/branches/performance/subversion/include/private/svn_file_cache.h&r1=981091&r2=981204&rev=981204&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/include/private/svn_file_cache.h (original)
> +++ subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h Sun Aug  1 11:13:46 2010
> @@ -20,7 +20,7 @@
>  * ====================================================================
>  * @endcopyright
>  *
> - * @file svn_file_cache.h
> + * @file svn_file_handle_cache.h
>  * @brief File handle cache API
>  */
>
> @@ -30,13 +30,14 @@
>  /**
>  * An opaque structure representing a cache for open file handles.
>  */
> -typedef struct svn_file_cache_t svn_file_cache_t;
> +typedef struct svn_file_handle_cache_t svn_file_handle_cache_t;
>
>  /**
>  * An opaque structure representing a cached file handle being used
>  * by the calling application.
>  */
> -typedef struct svn_file_cache__handle_t svn_file_cache__handle_t;
> +typedef
> +struct svn_file_handle_cache__handle_t svn_file_handle_cache__handle_t;
>
>  /**
>  * Get an open file handle in @a f, for the file named @a fname with the
> @@ -50,14 +51,14 @@ typedef struct svn_file_cache__handle_t
>  * returned is undefined.
>  */
>  svn_error_t *
> -svn_file_cache__open(svn_file_cache__handle_t **f,
> -                     svn_file_cache_t *cache,
> -                     const char *fname,
> -                     apr_int32_t flag,
> -                     apr_fileperms_t perm,
> -                     apr_off_t offset,
> -                     int cookie,
> -                     apr_pool_t *pool);
> +svn_file_handle_cache__open(svn_file_handle_cache__handle_t **f,
> +                            svn_file_handle_cache_t *cache,
> +                            const char *fname,
> +                            apr_int32_t flag,
> +                            apr_fileperms_t perm,
> +                            apr_off_t offset,
> +                            int cookie,
> +                            apr_pool_t *pool);
>
>  /**
>  * Efficiently check whether the file handle cache @a cache holds an open
> @@ -66,8 +67,8 @@ svn_file_cache__open(svn_file_cache__han
>  * that the respective file does not exist.
>  */
>  svn_boolean_t
> -svn_file_cache__has_file(svn_file_cache_t *cache,
> -                         const char *fname);
> +svn_file_handle_cache__has_file(svn_file_handle_cache_t *cache,
> +                                const char *fname);
>
>  /**
>  * Return the APR level file handle underlying the cache file handle @a f.
> @@ -75,7 +76,7 @@ svn_file_cache__has_file(svn_file_cache_
>  * invalidated.
>  */
>  apr_file_t *
> -svn_file_cache__get_apr_handle(svn_file_cache__handle_t *f);
> +svn_file_handle_cache__get_apr_handle(svn_file_handle_cache__handle_t *f);
>
>  /**
>  * Return the name of the file that the cached handle @a f refers to.
> @@ -83,7 +84,7 @@ svn_file_cache__get_apr_handle(svn_file_
>  * invalidated.
>  */
>  const char *
> -svn_file_cache__get_name(svn_file_cache__handle_t *f);
> +svn_file_handle_cache__get_name(svn_file_handle_cache__handle_t *f);
>
>  /**
>  * Return the cached file handle @a f to the cache. Depending on the number
> @@ -91,13 +92,13 @@ svn_file_cache__get_name(svn_file_cache_
>  * is NULL, already closed or an invalidated handle, this is a no-op.
>  */
>  svn_error_t *
> -svn_file_cache__close(svn_file_cache__handle_t *f);
> +svn_file_handle_cache__close(svn_file_handle_cache__handle_t *f);
>
>  /**
>  * Close all file handles currently not held by the application.
>  */
>  svn_error_t *
> -svn_file_cache__flush(svn_file_cache_t *cache);
> +svn_file_handle_cache__flush(svn_file_handle_cache_t *cache);
>
>  /**
>  * Creates a new file handle cache in @a cache. Up to @a max_handles
> @@ -108,7 +109,7 @@ svn_file_cache__flush(svn_file_cache_t *
>  * cache, @a thread_safe may be @c FALSE. Otherwise, it must be @c TRUE.
>  */
>  svn_error_t *
> -svn_file_cache__create_cache(svn_file_cache_t **cache,
> -                             size_t max_handles,
> -                             svn_boolean_t thread_safe,
> -                             apr_pool_t *pool);
> +svn_file_handle_cache__create_cache(svn_file_handle_cache_t **cache,
> +                                    size_t max_handles,
> +                                    svn_boolean_t thread_safe,
> +                                    apr_pool_t *pool);
>
> Propchange: subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h
> ------------------------------------------------------------------------------
>    svn:mergeinfo =
>
> Copied: subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c (from r981091, subversion/branches/performance/subversion/libsvn_subr/svn_file_cache.c)
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c?p2=subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c&p1=subversion/branches/performance/subversion/libsvn_subr/svn_file_cache.c&r1=981091&r2=981204&rev=981204&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/svn_file_cache.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c Sun Aug  1 11:13:46 2010
> @@ -1,5 +1,5 @@
>  /*
> - * svn_file_cache.c: open file handle caching for Subversion
> + * svn_file_handle_cache.c: open file handle caching for Subversion
>  *
>  * ====================================================================
>  *    Licensed to the Apache Software Foundation (ASF) under one
> @@ -25,7 +25,7 @@
>
>  #include <apr_thread_mutex.h>
>
> -#include "private/svn_file_cache.h"
> +#include "private/svn_file_handle_cache.h"
>  #include "svn_private_config.h"
>  #include "svn_pools.h"
>  #include "svn_io.h"
> @@ -67,8 +67,8 @@
>  * between read-after-write, write-after-read or others.
>  *
>  * For similar reasons, an application may want to close all idle handles
> - * explicitly, i.e. without opening new ones. svn_file_cache__flush is
> - * the function to call in that case.
> + * explicitly, i.e. without opening new ones. svn_file_handle_cache__flush
> + * is the function to call in that case.
>  */
>
>  /* forward-declarations */
> @@ -129,7 +129,7 @@ struct cache_entry_t
>
>   /* The cached file handle object handed out to the application.
>    * If this is NULL, the entry is either idle or unused. */
> -  svn_file_cache__handle_t *open_handle;
> +  svn_file_handle_cache__handle_t *open_handle;
>
>   /* the file name. NULL for unused entries */
>   const char *name;
> @@ -161,7 +161,7 @@ struct cache_entry_t
>
>  /* The file handle cache structure.
>  */
> -struct svn_file_cache_t
> +struct svn_file_handle_cache_t
>  {
>   /* all cache sub-structures are allocated from this pool */
>   apr_pool_t *pool;
> @@ -199,12 +199,12 @@ struct svn_file_cache_t
>  * either the handle has already been returned to the cache or the cache
>  * itself has been destroyed already.
>  */
> -struct svn_file_cache__handle_t
> +struct svn_file_handle_cache__handle_t
>  {
>   /* the issuing cache. Having that element here simplifies function
>    * signatures dealing with cached file handles. It also makes them
>    * harder to use incorrectly. */
> -  svn_file_cache_t *cache;
> +  svn_file_handle_cache_t *cache;
>
>   /* the handle-specific information */
>   cache_entry_t *entry;
> @@ -213,7 +213,7 @@ struct svn_file_cache__handle_t
>  /* If applicable, locks CACHE's mutex.
>  */
>  static svn_error_t *
> -lock_cache(svn_file_cache_t *cache)
> +lock_cache(svn_file_handle_cache_t *cache)
>  {
>  #if APR_HAS_THREADS
>   apr_status_t status;
> @@ -231,7 +231,7 @@ lock_cache(svn_file_cache_t *cache)
>  /* If applicable, unlocks CACHE's mutex, then returns ERR.
>  */
>  static svn_error_t *
> -unlock_cache(svn_file_cache_t *cache, svn_error_t *err)
> +unlock_cache(svn_file_handle_cache_t *cache, svn_error_t *err)
>  {
>  #if APR_HAS_THREADS
>   apr_status_t status;
> @@ -354,7 +354,7 @@ remove_from_list(entry_list_t *list, ent
>  * If no such entry exists, the result is NULL.
>  */
>  static cache_entry_t *
> -find_first(svn_file_cache_t *cache, const char *name)
> +find_first(svn_file_handle_cache_t *cache, const char *name)
>  {
>   cache_entry_t *result =
>     (cache_entry_t *)apr_hash_get(cache->first_by_name,
> @@ -394,7 +394,7 @@ auto_close_cached_handle(void *entry_voi
>  */
>  static svn_error_t *
>  internal_file_open(cache_entry_t **result,
> -                   svn_file_cache_t *cache,
> +                   svn_file_handle_cache_t *cache,
>                    const char *name,
>                    apr_int32_t flag,
>                    apr_fileperms_t perm,
> @@ -471,7 +471,7 @@ internal_file_open(cache_entry_t **resul
>  * The entry will be in "unused" state afterwards.
>  */
>  static svn_error_t *
> -internal_close_file(svn_file_cache_t *cache, cache_entry_t *entry)
> +internal_close_file(svn_file_handle_cache_t *cache, cache_entry_t *entry)
>  {
>   /* any cached file handle held by the application must have either
>    * been returned or invalidated before, i.e. this entry must be "idle" */
> @@ -524,14 +524,14 @@ internal_close_file(svn_file_cache_t *ca
>  static apr_status_t
>  close_handle_before_cleanup(void *handle_void)
>  {
> -  svn_file_cache__handle_t *f = handle_void;
> +  svn_file_handle_cache__handle_t *f = handle_void;
>   svn_error_t *err = SVN_NO_ERROR;
>
>   /* if this hasn't been done before:
>    * "close" the handle, i.e. return it to the cache
>    */
>   if (f->entry)
> -    err = svn_file_cache__close(f);
> +    err = svn_file_handle_cache__close(f);
>
>   /* fully reset all members to prevent zombies doing damage */
>   f->entry = NULL;
> @@ -546,8 +546,8 @@ close_handle_before_cleanup(void *handle
>  * is cleared or destroyed.
>  */
>  static svn_error_t *
> -open_entry(svn_file_cache__handle_t **f,
> -           svn_file_cache_t *cache,
> +open_entry(svn_file_handle_cache__handle_t **f,
> +           svn_file_handle_cache_t *cache,
>            cache_entry_t *entry,
>            apr_pool_t *pool)
>  {
> @@ -558,7 +558,7 @@ open_entry(svn_file_cache__handle_t **f,
>   remove_from_list(&cache->idle_entries, &entry->idle_link);
>
>   /* create and initialize the cached file handle structure */
> -  *f = apr_palloc(pool, sizeof(svn_file_cache__handle_t));
> +  *f = apr_palloc(pool, sizeof(svn_file_handle_cache__handle_t));
>   (*f)->cache = cache;
>   (*f)->entry = entry;
>   entry->open_handle = *f;
> @@ -576,7 +576,7 @@ open_entry(svn_file_cache__handle_t **f,
>  * underlying APR file handle rendering the entry "unused".
>  */
>  static svn_error_t *
> -close_oldest_idle(svn_file_cache_t *cache)
> +close_oldest_idle(svn_file_handle_cache_t *cache)
>  {
>   return cache->idle_entries.first
>     ? internal_close_file(cache, cache->idle_entries.first->item)
> @@ -587,7 +587,7 @@ close_oldest_idle(svn_file_cache_t *cach
>  * if there is such an entry.
>  */
>  static svn_error_t *
> -auto_close_oldest(svn_file_cache_t *cache)
> +auto_close_oldest(svn_file_handle_cache_t *cache)
>  {
>   return cache->used_entries.count > cache->max_used_count
>     ? close_oldest_idle(cache)
> @@ -639,14 +639,14 @@ pointer_is_closer(const cache_entry_t *e
>  * is undefined.
>  */
>  svn_error_t *
> -svn_file_cache__open(svn_file_cache__handle_t **f,
> -                     svn_file_cache_t *cache,
> -                     const char *fname,
> -                     apr_int32_t flag,
> -                     apr_fileperms_t perm,
> -                     apr_off_t offset,
> -                     int cookie,
> -                     apr_pool_t *pool)
> +svn_file_handle_cache__open(svn_file_handle_cache__handle_t **f,
> +                            svn_file_handle_cache_t *cache,
> +                            const char *fname,
> +                            apr_int32_t flag,
> +                            apr_fileperms_t perm,
> +                            apr_off_t offset,
> +                            int cookie,
> +                            apr_pool_t *pool)
>  {
>   svn_error_t *err = SVN_NO_ERROR;
>   cache_entry_t *entry;
> @@ -728,7 +728,8 @@ svn_file_cache__open(svn_file_cache__han
>  * the respective file does not exist.
>  */
>  svn_boolean_t
> -svn_file_cache__has_file(svn_file_cache_t *cache, const char *fname)
> +svn_file_handle_cache__has_file(svn_file_handle_cache_t *cache,
> +                                const char *fname)
>  {
>   svn_boolean_t result = FALSE;
>
> @@ -763,7 +764,7 @@ svn_file_cache__has_file(svn_file_cache_
>  * invalidated.
>  */
>  apr_file_t *
> -svn_file_cache__get_apr_handle(svn_file_cache__handle_t *f)
> +svn_file_handle_cache__get_apr_handle(svn_file_handle_cache__handle_t *f)
>  {
>   return (f && f->entry) ? f->entry->file : NULL;
>  }
> @@ -773,7 +774,7 @@ svn_file_cache__get_apr_handle(svn_file_
>  * invalidated.
>  */
>  const char *
> -svn_file_cache__get_name(svn_file_cache__handle_t *f)
> +svn_file_handle_cache__get_name(svn_file_handle_cache__handle_t *f)
>  {
>   return (f && f->entry) ? f->entry->name : NULL;
>  }
> @@ -782,10 +783,10 @@ svn_file_cache__get_name(svn_file_cache_
>  * of open handles, the underlying handle may actually get closed.
>  */
>  svn_error_t *
> -svn_file_cache__close(svn_file_cache__handle_t *f)
> +svn_file_handle_cache__close(svn_file_handle_cache__handle_t *f)
>  {
>   svn_error_t *err = SVN_NO_ERROR;
> -  svn_file_cache_t *cache = f ? f->cache : NULL;
> +  svn_file_handle_cache_t *cache = f ? f->cache : NULL;
>   cache_entry_t *entry = f ? f->entry : NULL;
>
>   /* no-op for closed or invalidated cached file handles */
> @@ -827,7 +828,7 @@ svn_file_cache__close(svn_file_cache__ha
>  /* Close all file handles currently not held by the application.
>  */
>  svn_error_t *
> -svn_file_cache__flush(svn_file_cache_t *cache)
> +svn_file_handle_cache__flush(svn_file_handle_cache_t *cache)
>  {
>   svn_error_t *err = SVN_NO_ERROR;
>
> @@ -866,14 +867,14 @@ svn_file_cache__flush(svn_file_cache_t *
>  * THREAD_SAFE may be FALSE. Otherwise, it must be TRUE.
>  */
>  svn_error_t *
> -svn_file_cache__create_cache(svn_file_cache_t **cache,
> -                             size_t max_handles,
> -                             svn_boolean_t thread_safe,
> -                             apr_pool_t *pool)
> +svn_file_handle_cache__create_cache(svn_file_handle_cache_t **cache,
> +                                    size_t max_handles,
> +                                    svn_boolean_t thread_safe,
> +                                    apr_pool_t *pool)
>  {
>   /* allocate cache header */
> -  svn_file_cache_t *new_cache =
> -      (svn_file_cache_t *)apr_palloc(pool, sizeof(*new_cache));
> +  svn_file_handle_cache_t *new_cache =
> +      (svn_file_handle_cache_t *)apr_palloc(pool, sizeof(*new_cache));
>
>   /* create sub-pool for all cache sub-structures */
>   new_cache->pool = svn_pool_create(pool);
>
> Propchange: subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: subversion/branches/performance/subversion/libsvn_subr/svn_file_handle_cache.c
> ------------------------------------------------------------------------------
>    svn:mergeinfo =
>
>
>
Received on 2010-08-02 16:01:30 CEST

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