FreeBSD/contrib/subversion/subversion/libsvn_fs_x/tree.c
/* Create a new directory named PATH in ROOT.  The new directory has
   no entries, and no properties.  ROOT must be the root of a
   transaction, not a revision.  Do any necessary temporary allocation
   in SCRATCH_POOL.  */
Create a new directory named PATH in ROOT.  The new directory has
no entries, and no properties.  ROOT must be the root of a
transaction, not a revision.  Do any necessary temporary allocation
in SCRATCH_POOL.
Create a new directory named PATH in ROOT . The new directory has no entries and no properties . ROOT must be the root of a transaction not a revision . Do any necessary temporary allocation in SCRATCH_POOL .
static svn_error_t *
x_make_dir(svn_fs_root_t *root,
           const char *path,
           apr_pool_t *scratch_pool)
{
  parent_path_t *parent_path;
  dag_node_t *sub_dir;
  svn_fs_x__txn_id_t txn_id = root_txn_id(root);
  apr_pool_t *subpool = svn_pool_create(scratch_pool);
  path = svn_fs__canonicalize_abspath(path, subpool);
  SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
                    TRUE, subpool));
  if (root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)
    SVN_ERR(svn_fs_x__allow_locked_operation(path, root->fs, TRUE, FALSE,
                                             subpool));
  if (parent_path->node)
    return SVN_FS__ALREADY_EXISTS(root, path);
  SVN_ERR(make_path_mutable(root, parent_path->parent, path, subpool,
                            subpool));
  SVN_ERR(svn_fs_x__dag_make_dir(&sub_dir,
                                 parent_path->parent->node,
                                 parent_path_path(parent_path->parent,
                                                  subpool),
                                 parent_path->entry,
                                 txn_id,
                                 subpool, subpool));
  SVN_ERR(dag_node_cache_set(root, parent_path_path(parent_path, subpool),
                             sub_dir, subpool));
  SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(sub_dir),
                     svn_fs_path_change_add, FALSE, FALSE, FALSE,
                     svn_node_dir, SVN_INVALID_REVNUM, NULL, subpool));
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
static svn_error_t * x_make_dir ( svn_fs_root_t * root , const char * path , apr_pool_t * scratch_pool ) { parent_path_t * parent_path ; dag_node_t * sub_dir ; svn_fs_x__txn_id_t txn_id = root_txn_id ( root ) ; apr_pool_t * subpool = svn_pool_create ( scratch_pool ) ; path = svn_fs__canonicalize_abspath ( path , subpool ) ; SVN_ERR ( open_path ( & parent_path , root , path , open_path_last_optional , TRUE , subpool ) ) ; if ( root -> txn_flags & SVN_FS_TXN_CHECK_LOCKS ) SVN_ERR ( svn_fs_x__allow_locked_operation ( path , root -> fs , TRUE , FALSE , subpool ) ) ; if ( parent_path -> node ) return SVN_FS__ALREADY_EXISTS ( root , path ) ; SVN_ERR ( make_path_mutable ( root , parent_path -> parent , path , subpool , subpool ) ) ; SVN_ERR ( svn_fs_x__dag_make_dir ( & sub_dir , parent_path -> parent -> node , parent_path_path ( parent_path -> parent , subpool ) , parent_path -> entry , txn_id , subpool , subpool ) ) ; SVN_ERR ( dag_node_cache_set ( root , parent_path_path ( parent_path , subpool ) , sub_dir , subpool ) ) ; SVN_ERR ( add_change ( root -> fs , txn_id , path , svn_fs_x__dag_get_id ( sub_dir ) , svn_fs_path_change_add , FALSE , FALSE , FALSE , svn_node_dir , SVN_INVALID_REVNUM , NULL , subpool ) ) ; svn_pool_destroy ( subpool ) ; return SVN_NO_ERROR ; }
Create a new directory named PATH in ROOT.
Create a new directory named PATH in ROOT .
/* Check (recursively) to see if some lock is 'reserving' a path at
     that location, or even some child-path; if so, check that we can
     use it. */ /* If there's already a sub-directory by that name, complain.  This
     also catches the case of trying to make a subdirectory named `/'.  */ /* Create the subdirectory.  */ /* Add this directory to the path cache. */ /* Make a record of this modification in the changes table. */