FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
/* Obtain a write lock on the file BATON->LOCK_PATH and call BATON->BODY
   with BATON->BATON.  If this is the outermost lock call, release all file
   locks after the body returned.  If BATON->IS_GLOBAL_LOCK is set, set the
   HAS_WRITE_LOCK flag while we keep the write lock. */
Obtain a write lock on the file BATON->LOCK_PATH and call BATON->BODY
with BATON->BATON.  If this is the outermost lock call, release all file
locks after the body returned.  If BATON->IS_GLOBAL_LOCK is set, set the
HAS_WRITE_LOCK flag while we keep the write lock.
Obtain a write lock on the file BATON - > LOCK_PATH and call BATON - > BODY with BATON - > BATON . If this is the outermost lock call release all file locks after the body returned . If BATON - > IS_GLOBAL_LOCK is set set the HAS_WRITE_LOCK flag while we keep the write lock .
static svn_error_t *
with_some_lock_file(with_lock_baton_t *baton)
{
  apr_pool_t *pool = baton->lock_pool;
  svn_error_t *err = get_lock_on_filesystem(baton->lock_path, pool);
  if (!err)
    {
      svn_fs_t *fs = baton->fs;
      fs_fs_data_t *ffd = fs->fsap_data;
      if (baton->is_global_lock)
        {
          apr_pool_cleanup_register(pool,
                                    ffd,
                                    reset_lock_flag,
                                    apr_pool_cleanup_null);
          ffd->has_write_lock = TRUE;
        }
      if (baton->is_inner_most_lock)
        {
          if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
            err = svn_fs_fs__update_min_unpacked_rev(fs, pool);
          if (!err)
            err = get_youngest(&ffd->youngest_rev_cache, fs, pool);
        }
      if (!err)
        err = baton->body(baton->baton, pool);
    }
  if (baton->is_outer_most_lock)
    svn_pool_destroy(pool);
  return svn_error_trace(err);
}
static svn_error_t * with_some_lock_file ( with_lock_baton_t * baton ) { apr_pool_t * pool = baton -> lock_pool ; svn_error_t * err = get_lock_on_filesystem ( baton -> lock_path , pool ) ; if ( ! err ) { svn_fs_t * fs = baton -> fs ; fs_fs_data_t * ffd = fs -> fsap_data ; if ( baton -> is_global_lock ) { apr_pool_cleanup_register ( pool , ffd , reset_lock_flag , apr_pool_cleanup_null ) ; ffd -> has_write_lock = TRUE ; } if ( baton -> is_inner_most_lock ) { if ( ffd -> format >= SVN_FS_FS__MIN_PACKED_FORMAT ) err = svn_fs_fs__update_min_unpacked_rev ( fs , pool ) ; if ( ! err ) err = get_youngest ( & ffd -> youngest_rev_cache , fs , pool ) ; } if ( ! err ) err = baton -> body ( baton -> baton , pool ) ; } if ( baton -> is_outer_most_lock ) svn_pool_destroy ( pool ) ; return svn_error_trace ( err ) ; }
Obtain a write lock on the file BATON->LOCK_PATH and call BATON->BODY
with BATON->BATON.
Obtain a write lock on the file BATON - > LOCK_PATH and call BATON - > BODY with BATON - > BATON .
/* set the "got the lock" flag and register reset function */ /* nobody else will modify the repo state
         => read HEAD & pack info once */