FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
/* Write the format number, maximum number of files per directory and
   the addressing scheme to a new format file in PATH, possibly expecting
   to overwrite a previously existing file.

   Use POOL for temporary allocation. */
Write the format number, maximum number of files per directory and
the addressing scheme to a new format file in PATH, possibly expecting
to overwrite a previously existing file.

Use POOL for temporary allocation.
Write the format number maximum number of files per directory and the addressing scheme to a new format file in PATH possibly expecting to overwrite a previously existing file . Use POOL for temporary allocation .
svn_error_t *
svn_fs_fs__write_format(svn_fs_t *fs,
                        svn_boolean_t overwrite,
                        apr_pool_t *pool)
{
  svn_stringbuf_t *sb;
  fs_fs_data_t *ffd = fs->fsap_data;
  const char *path = path_format(fs, pool);
  SVN_ERR_ASSERT(1 <= ffd->format
                 && ffd->format <= SVN_FS_FS__FORMAT_NUMBER);
  sb = svn_stringbuf_createf(pool, "%d\n", ffd->format);
  if (ffd->format >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT)
    {
      if (ffd->max_files_per_dir)
        svn_stringbuf_appendcstr(sb, apr_psprintf(pool, "layout sharded %d\n",
                                                  ffd->max_files_per_dir));
      else
        svn_stringbuf_appendcstr(sb, "layout linear\n");
    }
  if (ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
    {
      if (ffd->use_log_addressing)
        svn_stringbuf_appendcstr(sb, "addressing logical\n");
      else
        svn_stringbuf_appendcstr(sb, "addressing physical\n");
    }
  if (! overwrite)
    {
      SVN_ERR(svn_io_file_create(path, sb->data, pool));
    }
  else
    {
      SVN_ERR(svn_io_write_atomic(path, sb->data, sb->len,
                                  NULL , pool));
    }
  return svn_io_set_file_read_only(path, FALSE, pool);
}
svn_error_t * svn_fs_fs__write_format ( svn_fs_t * fs , svn_boolean_t overwrite , apr_pool_t * pool ) { svn_stringbuf_t * sb ; fs_fs_data_t * ffd = fs -> fsap_data ; const char * path = path_format ( fs , pool ) ; SVN_ERR_ASSERT ( 1 <= ffd -> format && ffd -> format <= SVN_FS_FS__FORMAT_NUMBER ) ; sb = svn_stringbuf_createf ( pool , " \n " , ffd -> format ) ; if ( ffd -> format >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT ) { if ( ffd -> max_files_per_dir ) svn_stringbuf_appendcstr ( sb , apr_psprintf ( pool , " \n " , ffd -> max_files_per_dir ) ) ; else svn_stringbuf_appendcstr ( sb , " \n " ) ; } if ( ffd -> format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT ) { if ( ffd -> use_log_addressing ) svn_stringbuf_appendcstr ( sb , " \n " ) ; else svn_stringbuf_appendcstr ( sb , " \n " ) ; } if ( ! overwrite ) { SVN_ERR ( svn_io_file_create ( path , sb -> data , pool ) ) ; } else { SVN_ERR ( svn_io_write_atomic ( path , sb -> data , sb -> len , NULL , pool ) ) ; } return svn_io_set_file_read_only ( path , FALSE , pool ) ; }
Write the format number, maximum number of files per directory and
the addressing scheme to a new format file in PATH, possibly expecting
to overwrite a previously existing file.
Write the format number maximum number of files per directory and the addressing scheme to a new format file in PATH possibly expecting to overwrite a previously existing file .
/* svn_io_write_version_file() does a load of magic to allow it to
     replace version files that already exist.  We only need to do
     that when we're allowed to overwrite an existing file. */ /* Create the file */ /* copy_perms_path */ /* And set the perms to make it read only */