Exemple #1
0
yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
{
	yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
	yaffs_tnode_t *tn = NULL;

	if(!allocator){
		YBUG();
		return NULL;
	}

	/* If there are none left make more */
	if (!allocator->freeTnodes)
		yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES);

	if (allocator->freeTnodes) {
		tn = allocator->freeTnodes;
		allocator->freeTnodes = allocator->freeTnodes->internal[0];
		allocator->nFreeTnodes--;
	}

	return tn;
}
struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
{
	struct yaffs_allocator *allocator =
	    (struct yaffs_allocator *)dev->allocator;
	struct yaffs_tnode *tn = NULL;

	if (!allocator) {
		BUG();
		return NULL;
	}

	/* If there are none left make more */
	if (!allocator->free_tnodes)
		yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES);

	if (allocator->free_tnodes) {
		tn = allocator->free_tnodes;
		allocator->free_tnodes = allocator->free_tnodes->internal[0];
		allocator->n_free_tnodes--;
	}

	return tn;
}