void yaffs_FreeRawObject(yaffs_Device *dev, yaffs_Object *obj)
{
- dev = dev;
+ dev = dev;
YFREE(obj);
}
typedef struct yaffs_ObjectList_struct yaffs_ObjectList;
-
+
struct yaffs_AllocatorStruct {
int nTnodesCreated;
yaffs_Tnode *freeTnodes;
int nObjectsCreated;
yaffs_Object *freeObjects;
int nFreeObjects;
-
+
yaffs_ObjectList *allocatedObjectList;
};
yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
yaffs_TnodeList *tmp;
-
+
if(!allocator){
YBUG();
return;
yaffs_Tnode *curr;
yaffs_Tnode *next;
yaffs_TnodeList *tnl;
-
+
if(!allocator){
YBUG();
return YAFFS_FAIL;
return YAFFS_FAIL;
}
- /* Hook them into the free list */
-#if 0
- for (i = 0; i < nTnodes - 1; i++) {
- newTnodes[i].internal[0] = &newTnodes[i + 1];
-#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- newTnodes[i].internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
-#endif
- }
-
- newTnodes[nTnodes - 1].internal[0] = allocator->freeTnodes;
-#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- newTnodes[nTnodes - 1].internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
-#endif
- allocator->freeTnodes = newTnodes;
-#else
/* New hookup for wide tnodes */
for (i = 0; i < nTnodes - 1; i++) {
curr = (yaffs_Tnode *) &mem[i * dev->tnodeSize];
curr->internal[0] = allocator->freeTnodes;
allocator->freeTnodes = (yaffs_Tnode *)mem;
-#endif
-
-
allocator->nFreeTnodes += nTnodes;
allocator->nTnodesCreated += nTnodes;
{
yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
yaffs_Tnode *tn = NULL;
-
+
if(!allocator){
YBUG();
return NULL;
if (allocator->freeTnodes) {
tn = allocator->freeTnodes;
-#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- if (tn->internal[YAFFS_NTNODES_INTERNAL] != (void *)1) {
- /* Hoosterman, this thing looks like it isn't in the list */
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs: Tnode list bug 1" TENDSTR)));
- }
-#endif
allocator->freeTnodes = allocator->freeTnodes->internal[0];
allocator->nFreeTnodes--;
}
}
if (tn) {
-#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- if (tn->internal[YAFFS_NTNODES_INTERNAL] != 0) {
- /* Hoosterman, this thing looks like it is already in the list */
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs: Tnode list bug 2" TENDSTR)));
- }
- tn->internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
-#endif
tn->internal[0] = allocator->freeTnodes;
allocator->freeTnodes = tn;
allocator->nFreeTnodes++;
if(!allocator)
YBUG();
- else {
+ else {
/* Link into the free list. */
obj->siblings.next = (struct ylist_head *)(allocator->freeObjects);
allocator->freeObjects = obj;
if(dev->allocator){
yaffs_DeinitialiseRawTnodes(dev);
yaffs_DeinitialiseRawObjects(dev);
-
+
YFREE(dev->allocator);
dev->allocator=NULL;
} else
void yaffs_InitialiseRawTnodesAndObjects(yaffs_Device *dev)
{
yaffs_Allocator *allocator;
-
+
if(!dev->allocator){
allocator = YMALLOC(sizeof(yaffs_Allocator));
if(allocator){