FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
/* Read the configuration information of the file system at FS_PATH
 * and set the respective values in FFD.  Use pools as usual.
 */
Read the configuration information of the file system at FS_PATH
and set the respective values in FFD.  Use pools as usual.
Read the configuration information of the file system at FS_PATH and set the respective values in FFD . Use pools as usual .
static svn_error_t *
read_config(fs_fs_data_t *ffd,
            const char *fs_path,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool)
{
  svn_config_t *config;
  SVN_ERR(svn_config_read3(&config,
                           svn_dirent_join(fs_path, PATH_CONFIG, scratch_pool),
                           FALSE, FALSE, FALSE, scratch_pool));
  if (ffd->format >= SVN_FS_FS__MIN_REP_SHARING_FORMAT)
    SVN_ERR(svn_config_get_bool(config, &ffd->rep_sharing_allowed,
                                CONFIG_SECTION_REP_SHARING,
                                CONFIG_OPTION_ENABLE_REP_SHARING, TRUE));
  else
    ffd->rep_sharing_allowed = FALSE;
  if (ffd->format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT)
    {
      apr_int64_t compression_level;
      SVN_ERR(svn_config_get_bool(config, &ffd->deltify_directories,
                                  CONFIG_SECTION_DELTIFICATION,
                                  CONFIG_OPTION_ENABLE_DIR_DELTIFICATION,
                                  TRUE));
      SVN_ERR(svn_config_get_bool(config, &ffd->deltify_properties,
                                  CONFIG_SECTION_DELTIFICATION,
                                  CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION,
                                  TRUE));
      SVN_ERR(svn_config_get_int64(config, &ffd->max_deltification_walk,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_MAX_DELTIFICATION_WALK,
                                   SVN_FS_FS_MAX_DELTIFICATION_WALK));
      SVN_ERR(svn_config_get_int64(config, &ffd->max_linear_deltification,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_MAX_LINEAR_DELTIFICATION,
                                   SVN_FS_FS_MAX_LINEAR_DELTIFICATION));
      SVN_ERR(svn_config_get_int64(config, &compression_level,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_COMPRESSION_LEVEL,
                                   SVN_DELTA_COMPRESSION_LEVEL_DEFAULT));
      ffd->delta_compression_level
        = (int)MIN(MAX(SVN_DELTA_COMPRESSION_LEVEL_NONE, compression_level),
                   SVN_DELTA_COMPRESSION_LEVEL_MAX);
    }
  else
    {
      ffd->deltify_directories = FALSE;
      ffd->deltify_properties = FALSE;
      ffd->max_deltification_walk = SVN_FS_FS_MAX_DELTIFICATION_WALK;
      ffd->max_linear_deltification = SVN_FS_FS_MAX_LINEAR_DELTIFICATION;
      ffd->delta_compression_level = SVN_DELTA_COMPRESSION_LEVEL_DEFAULT;
    }
  if (ffd->format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
    {
      SVN_ERR(svn_config_get_bool(config, &ffd->compress_packed_revprops,
                                  CONFIG_SECTION_PACKED_REVPROPS,
                                  CONFIG_OPTION_COMPRESS_PACKED_REVPROPS,
                                  FALSE));
      SVN_ERR(svn_config_get_int64(config, &ffd->revprop_pack_size,
                                   CONFIG_SECTION_PACKED_REVPROPS,
                                   CONFIG_OPTION_REVPROP_PACK_SIZE,
                                   ffd->compress_packed_revprops
                                       ? 0x10
                                       : 0x4));
      ffd->revprop_pack_size *= 1024;
    }
  else
    {
      ffd->revprop_pack_size = 0x10000;
      ffd->compress_packed_revprops = FALSE;
    }
  if (ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
    {
      SVN_ERR(svn_config_get_int64(config, &ffd->block_size,
                                   CONFIG_SECTION_IO,
                                   CONFIG_OPTION_BLOCK_SIZE,
                                   64));
      SVN_ERR(svn_config_get_int64(config, &ffd->l2p_page_size,
                                   CONFIG_SECTION_IO,
                                   CONFIG_OPTION_L2P_PAGE_SIZE,
                                   0x2000));
      SVN_ERR(svn_config_get_int64(config, &ffd->p2l_page_size,
                                   CONFIG_SECTION_IO,
                                   CONFIG_OPTION_P2L_PAGE_SIZE,
                                   0x400));
      SVN_ERR(verify_block_size(ffd->block_size, 0x400,
                                CONFIG_OPTION_BLOCK_SIZE, scratch_pool));
      SVN_ERR(verify_block_size(ffd->p2l_page_size, 0x400,
                                CONFIG_OPTION_P2L_PAGE_SIZE, scratch_pool));
      SVN_ERR(verify_block_size(ffd->l2p_page_size, sizeof(apr_off_t),
                                CONFIG_OPTION_L2P_PAGE_SIZE, scratch_pool));
      ffd->block_size *= 0x400;
      ffd->p2l_page_size *= 0x400;
    }
  else
    {
      ffd->block_size = 0x1000; 
      ffd->l2p_page_size = 0x2000;    
      ffd->p2l_page_size = 0x100000;  
    }
  if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
    {
      SVN_ERR(svn_config_get_bool(config, &ffd->pack_after_commit,
                                  CONFIG_SECTION_DEBUG,
                                  CONFIG_OPTION_PACK_AFTER_COMMIT,
                                  FALSE));
    }
  else
    {
      ffd->pack_after_commit = FALSE;
    }
  SVN_ERR(svn_cache__make_memcache_from_config(&ffd->memcache, config,
                                               result_pool, scratch_pool));
  SVN_ERR(svn_config_get_bool(config, &ffd->fail_stop,
                              CONFIG_SECTION_CACHES, CONFIG_OPTION_FAIL_STOP,
                              FALSE));
  return SVN_NO_ERROR;
}
static svn_error_t * read_config ( fs_fs_data_t * ffd , const char * fs_path , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_config_t * config ; SVN_ERR ( svn_config_read3 ( & config , svn_dirent_join ( fs_path , PATH_CONFIG , scratch_pool ) , FALSE , FALSE , FALSE , scratch_pool ) ) ; if ( ffd -> format >= SVN_FS_FS__MIN_REP_SHARING_FORMAT ) SVN_ERR ( svn_config_get_bool ( config , & ffd -> rep_sharing_allowed , CONFIG_SECTION_REP_SHARING , CONFIG_OPTION_ENABLE_REP_SHARING , TRUE ) ) ; else ffd -> rep_sharing_allowed = FALSE ; if ( ffd -> format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT ) { apr_int64_t compression_level ; SVN_ERR ( svn_config_get_bool ( config , & ffd -> deltify_directories , CONFIG_SECTION_DELTIFICATION , CONFIG_OPTION_ENABLE_DIR_DELTIFICATION , TRUE ) ) ; SVN_ERR ( svn_config_get_bool ( config , & ffd -> deltify_properties , CONFIG_SECTION_DELTIFICATION , CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION , TRUE ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & ffd -> max_deltification_walk , CONFIG_SECTION_DELTIFICATION , CONFIG_OPTION_MAX_DELTIFICATION_WALK , SVN_FS_FS_MAX_DELTIFICATION_WALK ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & ffd -> max_linear_deltification , CONFIG_SECTION_DELTIFICATION , CONFIG_OPTION_MAX_LINEAR_DELTIFICATION , SVN_FS_FS_MAX_LINEAR_DELTIFICATION ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & compression_level , CONFIG_SECTION_DELTIFICATION , CONFIG_OPTION_COMPRESSION_LEVEL , SVN_DELTA_COMPRESSION_LEVEL_DEFAULT ) ) ; ffd -> delta_compression_level = ( int ) MIN ( MAX ( SVN_DELTA_COMPRESSION_LEVEL_NONE , compression_level ) , SVN_DELTA_COMPRESSION_LEVEL_MAX ) ; } else { ffd -> deltify_directories = FALSE ; ffd -> deltify_properties = FALSE ; ffd -> max_deltification_walk = SVN_FS_FS_MAX_DELTIFICATION_WALK ; ffd -> max_linear_deltification = SVN_FS_FS_MAX_LINEAR_DELTIFICATION ; ffd -> delta_compression_level = SVN_DELTA_COMPRESSION_LEVEL_DEFAULT ; } if ( ffd -> format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT ) { SVN_ERR ( svn_config_get_bool ( config , & ffd -> compress_packed_revprops , CONFIG_SECTION_PACKED_REVPROPS , CONFIG_OPTION_COMPRESS_PACKED_REVPROPS , FALSE ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & ffd -> revprop_pack_size , CONFIG_SECTION_PACKED_REVPROPS , CONFIG_OPTION_REVPROP_PACK_SIZE , ffd -> compress_packed_revprops ? 0x10 : 0x4 ) ) ; ffd -> revprop_pack_size *= 1024 ; } else { ffd -> revprop_pack_size = 0x10000 ; ffd -> compress_packed_revprops = FALSE ; } if ( ffd -> format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT ) { SVN_ERR ( svn_config_get_int64 ( config , & ffd -> block_size , CONFIG_SECTION_IO , CONFIG_OPTION_BLOCK_SIZE , 64 ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & ffd -> l2p_page_size , CONFIG_SECTION_IO , CONFIG_OPTION_L2P_PAGE_SIZE , 0x2000 ) ) ; SVN_ERR ( svn_config_get_int64 ( config , & ffd -> p2l_page_size , CONFIG_SECTION_IO , CONFIG_OPTION_P2L_PAGE_SIZE , 0x400 ) ) ; SVN_ERR ( verify_block_size ( ffd -> block_size , 0x400 , CONFIG_OPTION_BLOCK_SIZE , scratch_pool ) ) ; SVN_ERR ( verify_block_size ( ffd -> p2l_page_size , 0x400 , CONFIG_OPTION_P2L_PAGE_SIZE , scratch_pool ) ) ; SVN_ERR ( verify_block_size ( ffd -> l2p_page_size , sizeof ( apr_off_t ) , CONFIG_OPTION_L2P_PAGE_SIZE , scratch_pool ) ) ; ffd -> block_size *= 0x400 ; ffd -> p2l_page_size *= 0x400 ; } else { ffd -> block_size = 0x1000 ; ffd -> l2p_page_size = 0x2000 ; ffd -> p2l_page_size = 0x100000 ; } if ( ffd -> format >= SVN_FS_FS__MIN_PACKED_FORMAT ) { SVN_ERR ( svn_config_get_bool ( config , & ffd -> pack_after_commit , CONFIG_SECTION_DEBUG , CONFIG_OPTION_PACK_AFTER_COMMIT , FALSE ) ) ; } else { ffd -> pack_after_commit = FALSE ; } SVN_ERR ( svn_cache__make_memcache_from_config ( & ffd -> memcache , config , result_pool , scratch_pool ) ) ; SVN_ERR ( svn_config_get_bool ( config , & ffd -> fail_stop , CONFIG_SECTION_CACHES , CONFIG_OPTION_FAIL_STOP , FALSE ) ) ; return SVN_NO_ERROR ; }
Read the configuration information of the file system at FS_PATH
 and set the respective values in FFD.
Read the configuration information of the file system at FS_PATH and set the respective values in FFD .
/* Initialize ffd->rep_sharing_allowed. */ /* Initialize deltification settings in ffd. */ /* Initialize revprop packing settings in ffd. */ /* Don't accept unreasonable or illegal values.
       * Block size and P2L page size are in kbytes;
       * L2P blocks are arrays of apr_off_t. */ /* convert kBytes to bytes */ /* L2P pages are in entries - not in (k)Bytes */ /* should be irrelevant but we initialize them anyway */ /* Matches default APR file buffer size. */ /* Matches above default. */ /* Matches above default in bytes. */ /* memcached configuration */