X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_allocator.c;h=024ee2af0185e391ac09e5bab8950180eca42376;hp=c0513d54ec5d13cbcde6260e32893d07732cebf6;hb=f330fefa27f2c87f7dff414fe6227261327663b7;hpb=f43976eda35065890e7cf0a008e9518158eb71d6 diff --git a/yaffs_allocator.c b/yaffs_allocator.c index c0513d5..024ee2a 100644 --- a/yaffs_allocator.c +++ b/yaffs_allocator.c @@ -1,5 +1,5 @@ /* - * YAFFS: Yet another Flash File System . A NAND-flash specific file system. + * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. * * Copyright (C) 2002-2010 Aleph One Ltd. * for Toby Churchill Ltd and Brightstar Engineering @@ -7,13 +7,12 @@ * Created by Charles Manning * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 as + * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. - * - * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ + #include "yaffs_allocator.h" #include "yaffs_guts.h" #include "yaffs_trace.h" @@ -75,12 +74,12 @@ struct yaffs_tnode_list { typedef struct yaffs_tnode_list yaffs_tnodelist_t; -struct yaffs_obj_tList_struct { +struct yaffs_obj_list_struct { yaffs_obj_t *objects; - struct yaffs_obj_tList_struct *next; + struct yaffs_obj_list_struct *next; }; -typedef struct yaffs_obj_tList_struct yaffs_obj_tList; +typedef struct yaffs_obj_list_struct yaffs_obj_list; struct yaffs_AllocatorStruct { @@ -93,7 +92,7 @@ struct yaffs_AllocatorStruct { yaffs_obj_t *freeObjects; int nFreeObjects; - yaffs_obj_tList *allocatedObjectList; + yaffs_obj_list *allocated_list; }; typedef struct yaffs_AllocatorStruct yaffs_Allocator; @@ -253,7 +252,7 @@ static void yaffs_init_raw_objs(yaffs_dev_t *dev) yaffs_Allocator *allocator = dev->allocator; if(allocator) { - allocator->allocatedObjectList = NULL; + allocator->allocated_list = NULL; allocator->freeObjects = NULL; allocator->nFreeObjects = 0; } else @@ -263,19 +262,19 @@ static void yaffs_init_raw_objs(yaffs_dev_t *dev) static void yaffs_deinit_raw_objs(yaffs_dev_t *dev) { yaffs_Allocator *allocator = dev->allocator; - yaffs_obj_tList *tmp; + yaffs_obj_list *tmp; if(!allocator){ YBUG(); return; } - while (allocator->allocatedObjectList) { - tmp = allocator->allocatedObjectList->next; - YFREE(allocator->allocatedObjectList->objects); - YFREE(allocator->allocatedObjectList); + while (allocator->allocated_list) { + tmp = allocator->allocated_list->next; + YFREE(allocator->allocated_list->objects); + YFREE(allocator->allocated_list); - allocator->allocatedObjectList = tmp; + allocator->allocated_list = tmp; } allocator->freeObjects = NULL; @@ -290,7 +289,7 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj) int i; yaffs_obj_t *newObjects; - yaffs_obj_tList *list; + yaffs_obj_list *list; if(!allocator){ YBUG(); @@ -302,7 +301,7 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj) /* make these things */ newObjects = YMALLOC(n_obj * sizeof(yaffs_obj_t)); - list = YMALLOC(sizeof(yaffs_obj_tList)); + list = YMALLOC(sizeof(yaffs_obj_list)); if (!newObjects || !list) { if (newObjects){ @@ -332,8 +331,8 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj) /* Now add this bunch of Objects to a list for freeing up. */ list->objects = newObjects; - list->next = allocator->allocatedObjectList; - allocator->allocatedObjectList = list; + list->next = allocator->allocated_list; + allocator->allocated_list = list; return YAFFS_OK; }