+static void yaffs_VerifyObjectInDirectory(yaffs_Object *obj)
+{
+ struct ylist_head *lh;
+ yaffs_Object *listObj;
+
+ int count = 0;
+
+ if(!obj)
+ YBUG();
+
+ if(yaffs_SkipVerification(obj->myDev))
+ return;
+
+ if(!obj->parent)
+ YBUG();
+
+ if(obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+ YBUG();
+
+ /* Iterate through the objects in each hash entry */
+
+ ylist_for_each(lh, &obj->parent->variant.directoryVariant.children) {
+ if (lh) {
+ listObj = ylist_entry(lh, yaffs_Object, siblings);
+ yaffs_VerifyObject(listObj);
+ if(obj == listObj)
+ count ++;
+ }
+ }
+
+ if(count != 1)
+ YBUG();
+
+
+}
+
+static void yaffs_VerifyDirectory(yaffs_Object *directory)
+{
+
+ struct ylist_head *lh;
+ yaffs_Object *listObj;
+
+ if(!directory)
+ YBUG();
+
+ if(yaffs_SkipVerification(directory->myDev))
+ return;
+
+
+ if(directory->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+ YBUG();
+
+ /* Iterate through the objects in each hash entry */
+
+ ylist_for_each(lh, &directory->variant.directoryVariant.children) {
+ if (lh) {
+ listObj = ylist_entry(lh, yaffs_Object, siblings);
+ if(listObj->parent != directory)
+ YBUG();
+ yaffs_VerifyObjectInDirectory(listObj);
+ }
+ }
+
+}
+
+