projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clear creation counters when deinitialising.
[yaffs2.git]
/
yaffs_guts.c
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index 0bab9cf00f5ea6f8c67146835ff82b048912ffac..5ea11500ffd506fa3f3a083dea48a62ca27c574f 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-12,7
+12,7
@@
*/
const char *yaffs_guts_c_version =
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.10
0 2009-12-22 04:09:06
charles Exp $";
+ "$Id: yaffs_guts.c,v 1.10
3 2010-01-01 23:54:03
charles Exp $";
#include "yportenv.h"
#include "yportenv.h"
@@
-1351,6
+1351,7
@@
static void yaffs_DeinitialiseTnodes(yaffs_Device *dev)
dev->freeTnodes = NULL;
dev->nFreeTnodes = 0;
dev->freeTnodes = NULL;
dev->nFreeTnodes = 0;
+ dev->nTnodesCreated = 0;
}
static void yaffs_InitialiseTnodes(yaffs_Device *dev)
}
static void yaffs_InitialiseTnodes(yaffs_Device *dev)
@@
-1807,6
+1808,10
@@
static void yaffs_SoftDeleteFile(yaffs_Object *obj)
* level 0 tnode entries must be zeroed out.
* Could also use this for file deletion, but that's probably better handled
* by a special case.
* level 0 tnode entries must be zeroed out.
* Could also use this for file deletion, but that's probably better handled
* by a special case.
+ *
+ * This function is recursive. For levels > 0 the function is called again on
+ * any sub-tree. For level == 0 we just check if the sub-tree has data.
+ * If there is no data in a subtree then it is pruned.
*/
static yaffs_Tnode *yaffs_PruneWorker(yaffs_Device *dev, yaffs_Tnode *tn,
*/
static yaffs_Tnode *yaffs_PruneWorker(yaffs_Device *dev, yaffs_Tnode *tn,
@@
-1818,17
+1823,32
@@
static yaffs_Tnode *yaffs_PruneWorker(yaffs_Device *dev, yaffs_Tnode *tn,
if (tn) {
hasData = 0;
if (tn) {
hasData = 0;
- for (i = 0; i < YAFFS_NTNODES_INTERNAL; i++) {
- if (tn->internal[i] && level > 0) {
- tn->internal[i] =
- yaffs_PruneWorker(dev, tn->internal[i],
- level - 1,
- (i == 0) ? del0 : 1);
+ if(level > 0){
+ for (i = 0; i < YAFFS_NTNODES_INTERNAL; i++) {
+ if (tn->internal[i]) {
+ tn->internal[i] =
+ yaffs_PruneWorker(dev, tn->internal[i],
+ level - 1,
+ (i == 0) ? del0 : 1);
+ }
+
+ if (tn->internal[i])
+ hasData++;
}
}
+ } else {
+ int tnodeSize;
+ __u32 *map = (__u32 *)tn;
+ tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8;
- if (tn->internal[i])
- hasData++;
- }
+ if (tnodeSize < sizeof(yaffs_Tnode))
+ tnodeSize = sizeof(yaffs_Tnode);
+ tnodeSize /= sizeof(__u32);
+
+ for(i = 0; !hasData && i < tnodeSize; i++){
+ if(map[i])
+ hasData++;
+ }
+ }
if (hasData == 0 && del0) {
/* Free and return NULL */
if (hasData == 0 && del0) {
/* Free and return NULL */
@@
-2090,6
+2110,7
@@
static void yaffs_DeinitialiseObjects(yaffs_Device *dev)
dev->freeObjects = NULL;
dev->nFreeObjects = 0;
dev->freeObjects = NULL;
dev->nFreeObjects = 0;
+ dev->nObjectsCreated = 0;
}
static void yaffs_InitialiseObjects(yaffs_Device *dev)
}
static void yaffs_InitialiseObjects(yaffs_Device *dev)