FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/lock.c
/* A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
   all locks in and under PATH in FS.
   HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
   has the FS write lock. */
A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
all locks in and under PATH in FS.
HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
has the FS write lock.
A function that calls GET_LOCKS_FUNC / GET_LOCKS_BATON for all locks in and under PATH in FS . HAVE_WRITE_LOCK should be true if the caller ( directly or indirectly ) has the FS write lock .
static svn_error_t *
walk_locks(svn_fs_t *fs,
           const char *digest_path,
           svn_fs_get_locks_callback_t get_locks_func,
           void *get_locks_baton,
           svn_boolean_t have_write_lock,
           apr_pool_t *pool)
{
  apr_hash_index_t *hi;
  apr_hash_t *children;
  apr_pool_t *subpool;
  svn_lock_t *lock;
  SVN_ERR(read_digest_file(&children, &lock, fs->path, digest_path, pool));
  if (lock && lock_expired(lock))
    {
      if (have_write_lock)
        SVN_ERR(unlock_single(fs, lock, pool));
    }
  else if (lock)
    {
      SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
    }
  if (! apr_hash_count(children))
    return SVN_NO_ERROR;
  subpool = svn_pool_create(pool);
  for (hi = apr_hash_first(pool, children); hi; hi = apr_hash_next(hi))
    {
      const char *digest = apr_hash_this_key(hi);
      svn_pool_clear(subpool);
      SVN_ERR(read_digest_file
              (NULL, &lock, fs->path,
               digest_path_from_digest(fs->path, digest, subpool), subpool));
      if (lock && lock_expired(lock))
        {
          if (have_write_lock)
            SVN_ERR(unlock_single(fs, lock, pool));
        }
      else if (lock)
        {
          SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
        }
    }
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
static svn_error_t * walk_locks ( svn_fs_t * fs , const char * digest_path , svn_fs_get_locks_callback_t get_locks_func , void * get_locks_baton , svn_boolean_t have_write_lock , apr_pool_t * pool ) { apr_hash_index_t * hi ; apr_hash_t * children ; apr_pool_t * subpool ; svn_lock_t * lock ; SVN_ERR ( read_digest_file ( & children , & lock , fs -> path , digest_path , pool ) ) ; if ( lock && lock_expired ( lock ) ) { if ( have_write_lock ) SVN_ERR ( unlock_single ( fs , lock , pool ) ) ; } else if ( lock ) { SVN_ERR ( get_locks_func ( get_locks_baton , lock , pool ) ) ; } if ( ! apr_hash_count ( children ) ) return SVN_NO_ERROR ; subpool = svn_pool_create ( pool ) ; for ( hi = apr_hash_first ( pool , children ) ; hi ; hi = apr_hash_next ( hi ) ) { const char * digest = apr_hash_this_key ( hi ) ; svn_pool_clear ( subpool ) ; SVN_ERR ( read_digest_file ( NULL , & lock , fs -> path , digest_path_from_digest ( fs -> path , digest , subpool ) , subpool ) ) ; if ( lock && lock_expired ( lock ) ) { if ( have_write_lock ) SVN_ERR ( unlock_single ( fs , lock , pool ) ) ; } else if ( lock ) { SVN_ERR ( get_locks_func ( get_locks_baton , lock , pool ) ) ; } } svn_pool_destroy ( subpool ) ; return SVN_NO_ERROR ; }
A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
all locks in and under PATH in FS.
A function that calls GET_LOCKS_FUNC / GET_LOCKS_BATON for all locks in and under PATH in FS .
/* First, send up any locks in the current digest file. */ /* Only remove the lock if we have the write lock.
         Read operations shouldn't change the filesystem. */ /* Now, report all the child entries (if any; bail otherwise). */ /* Only remove the lock if we have the write lock.
             Read operations shouldn't change the filesystem. */