yaffs: Replace YBUG() with BUG()
authorCharles Manning <cdhmanning@gmail.com>
Wed, 26 Jan 2011 00:51:16 +0000 (13:51 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 26 Jan 2011 00:51:16 +0000 (13:51 +1300)
Also clean a few other things in yportenv_xxxx.h

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
13 files changed:
direct/basic-test/yaffs_norif1.c
direct/ydirectenv.h
direct/yportenv.h
patches/yaffs_linux_allocator.c
patches/yaffs_mtdif2.c
yaffs_allocator.c
yaffs_bitmap.c
yaffs_getblockinfo.h
yaffs_guts.c
yaffs_nand.c
yaffs_verify.c
yportenv_multi.h
yportenv_single.h

index 5394f0e..6a9c2c4 100644 (file)
@@ -161,12 +161,12 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data
          */
          
         if(sizeof(struct yaffs_spare) != 16)
-                YBUG();
+                BUG();
         
         if(data && spare)
         {
                 if(spare->page_status != 0xff)
-                        YBUG();
+                        BUG();
                 /* Write a pre-marker */
                 memset(&tmpSpare,0xff,sizeof(tmpSpare));
                 tmpSpare.page_status = YNOR_PREMARKER;
@@ -196,7 +196,7 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data
                 ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,16/ 4);
         }
         else {
-                YBUG();
+                BUG();
         }
         
 
index ad4efab..f026e40 100644 (file)
@@ -29,8 +29,8 @@
 #include "yaffs_hweight.h"
 
 #include "assert.h"
-#define YBUG() assert(0)
-//#define YBUG() do { *((int *)0) =1;} while(0)
+#define BUG() assert(0)
+//#define BUG() do { *((int *)0) =1;} while(0)
 
 
 #define YCHAR char
index 4208e80..9127f84 100644 (file)
@@ -278,8 +278,8 @@ struct iattr {
 #define Y_DUMP_STACK() do { } while (0)
 #endif
 
-#ifndef YBUG
-#define YBUG() do {\
+#ifndef BUG
+#define BUG() do {\
        yaffs_trace(YAFFS_TRACE_BUG,\
                "==>> yaffs bug: " __FILE__ " %d",\
                __LINE__);\
index 395f4ea..636fee1 100644 (file)
@@ -55,7 +55,7 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
                } else {
                        T(YAFFS_TRACE_ALWAYS,
                                (TSTR("NULL tnode cache\n")));
-                       YBUG();
+                       BUG();
                }
 
                if(allocator->object_cache){
@@ -64,7 +64,7 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
                } else {
                        T(YAFFS_TRACE_ALWAYS,
                                (TSTR("NULL object cache\n")));
-                       YBUG();
+                       BUG();
                }
 
                kfree(allocator);
@@ -72,7 +72,7 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
        } else {
                T(YAFFS_TRACE_ALWAYS,
                        (TSTR("Deinitialising NULL allocator\n")));
-               YBUG();
+               BUG();
        }
        dev->allocator = NULL;
 }
@@ -110,7 +110,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
        T(YAFFS_TRACE_ALLOCATE,(TSTR("Initialising yaffs allocator\n")));
 
        if(dev->allocator)
-               YBUG();
+               BUG();
        else if(mount_id >= 10){
                T(YAFFS_TRACE_ALWAYS,(TSTR("Bad mount_id %u\n"),mount_id));
        } else {
@@ -121,7 +121,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                if(!dev->allocator){
                        T(YAFFS_TRACE_ALWAYS,
                                (TSTR("yaffs allocator creation failed\n")));
-                       YBUG();
+                       BUG();
                        return;
 
                }
@@ -141,7 +141,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                else {
                        T(YAFFS_TRACE_ALWAYS,
                                (TSTR("yaffs cache creation failed\n")));
-                       YBUG();
+                       BUG();
                }
 
 
@@ -159,7 +159,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                else {
                        T(YAFFS_TRACE_ALWAYS,
                                (TSTR("yaffs cache creation failed\n")));
-                       YBUG();
+                       BUG();
                }
        } 
 }
@@ -169,7 +169,7 @@ struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
        if(!allocator || !allocator->tnode_cache){
-               YBUG();
+               BUG();
                return NULL;
        }
        return kmem_cache_alloc(allocator->tnode_cache, GFP_NOFS);
@@ -185,11 +185,11 @@ struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
        if(!allocator){
-               YBUG();
+               BUG();
                return NULL;
        }
        if(!allocator->object_cache){
-               YBUG();
+               BUG();
                return NULL;
        }
        return kmem_cache_alloc(allocator->object_cache, GFP_NOFS);
index 19677ad..1bfdfa1 100644 (file)
@@ -48,7 +48,7 @@ void nandmtd2_pt2buf(struct yaffs_dev *dev, yaffs_PackedTags2 *pt, int is_raw)
 
                if (n == 0) {
                        T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR)));
-                       YBUG();
+                       BUG();
                }
 
                for (i = 0; i < sizeof(yaffs_PackedTags2); i++) {
@@ -58,7 +58,7 @@ void nandmtd2_pt2buf(struct yaffs_dev *dev, yaffs_PackedTags2 *pt, int is_raw)
                                n = mtd->oobinfo.oobfree[j][1];
                                if (n == 0) {
                                        T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR)));
-                                       YBUG();
+                                       BUG();
                                }
                        }
                        dev->spareBuffer[k] = ptab[i];
@@ -86,7 +86,7 @@ void nandmtd2_buf2pt(struct yaffs_dev *dev, yaffs_PackedTags2 *pt, int is_raw)
 
                if (n == 0) {
                        T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR)));
-                       YBUG();
+                       BUG();
                }
 
                for (i = 0; i < sizeof(yaffs_PackedTags2); i++) {
@@ -96,7 +96,7 @@ void nandmtd2_buf2pt(struct yaffs_dev *dev, yaffs_PackedTags2 *pt, int is_raw)
                                n = mtd->oobinfo.oobfree[j][1];
                                if (n == 0) {
                                        T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR)));
-                                       YBUG();
+                                       BUG();
                                }
                        }
                        ptab[i] = dev->spareBuffer[k];
@@ -140,7 +140,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(struct yaffs_dev * dev, int nand_chunk,
                T(YAFFS_TRACE_ALWAYS,
                  (TSTR
                  ("Write chunk with null tags or data!" TENDSTR)));
-               YBUG();
+               BUG();
        }
 
        if (retval == 0)
index af61ec0..1dd0c27 100644 (file)
@@ -47,7 +47,7 @@ static void yaffs_deinit_raw_tnodes(struct yaffs_dev *dev)
        struct yaffs_tnode_list *tmp;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -74,7 +74,7 @@ static void yaffs_init_raw_tnodes(struct yaffs_dev *dev)
                allocator->n_free_tnodes = 0;
                allocator->n_tnodes_created = 0;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -90,7 +90,7 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes)
        struct yaffs_tnode_list *tnl;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
@@ -148,7 +148,7 @@ struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
        struct yaffs_tnode *tn = NULL;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return NULL;
        }
 
@@ -171,7 +171,7 @@ void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -192,7 +192,7 @@ static void yaffs_init_raw_objs(struct yaffs_dev *dev)
                allocator->free_objs = NULL;
                allocator->n_free_objects = 0;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -202,7 +202,7 @@ static void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
        struct yaffs_obj_list *tmp;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -227,7 +227,7 @@ static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj)
        struct yaffs_obj_list *list;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
@@ -274,7 +274,7 @@ struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return obj;
        }
 
@@ -298,7 +298,7 @@ void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator)
-               YBUG();
+               BUG();
        else {
                /* Link into the free list. */
                obj->siblings.next = (struct list_head *)(allocator->free_objs);
@@ -316,7 +316,7 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
                kfree(dev->allocator);
                dev->allocator = NULL;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -332,7 +332,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                        yaffs_init_raw_objs(dev);
                }
        } else {
-               YBUG();
+               BUG();
        }
 }
 
index dc673e8..55c7213 100644 (file)
@@ -23,7 +23,7 @@ static inline u8 *yaffs_block_bits(struct yaffs_dev *dev, int blk)
                yaffs_trace(YAFFS_TRACE_ERROR,
                        "BlockBits block %d is not valid",
                        blk);
-               YBUG();
+               BUG();
        }
        return dev->chunk_bits +
            (dev->chunk_bit_stride * (blk - dev->internal_start_block));
@@ -36,7 +36,7 @@ void yaffs_verify_chunk_bit_id(struct yaffs_dev *dev, int blk, int chunk)
                yaffs_trace(YAFFS_TRACE_ERROR,
                        "Chunk Id (%d:%d) invalid",
                        blk, chunk);
-               YBUG();
+               BUG();
        }
 }
 
index d87acbd..5f6e063 100644 (file)
@@ -27,7 +27,7 @@ static inline struct yaffs_block_info *yaffs_get_block_info(struct yaffs_dev
                yaffs_trace(YAFFS_TRACE_ERROR,
                        "**>> yaffs: get_block_info block %d is not valid",
                        blk);
-               YBUG();
+               BUG();
        }
        return &dev->block_info[blk - dev->internal_start_block];
 }
index 496cf5f..c31ca30 100644 (file)
@@ -1089,7 +1089,7 @@ int yaffs_put_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
                        yaffs_trace(YAFFS_TRACE_ERROR,
                                "yaffs tragedy:attempt to put data chunk into a non-file"
                                );
-                       YBUG();
+                       BUG();
                }
 
                yaffs_chunk_del(dev, nand_chunk, 1, __LINE__);
@@ -1290,19 +1290,19 @@ void yaffs_add_obj_to_dir(struct yaffs_obj *directory, struct yaffs_obj *obj)
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "tragedy: Trying to add an object to a null pointer directory"
                        );
-               YBUG();
+               BUG();
                return;
        }
        if (directory->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "tragedy: Trying to add an object to a non-directory"
                        );
-               YBUG();
+               BUG();
        }
 
        if (obj->siblings.prev == NULL) {
                /* Not initialised */
-               YBUG();
+               BUG();
        }
 
        yaffs_verify_dir(directory);
@@ -1339,7 +1339,7 @@ static int yaffs_change_obj_name(struct yaffs_obj *obj,
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "tragedy: yaffs_change_obj_name: new_dir is not a directory"
                        );
-               YBUG();
+               BUG();
        }
 
        /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
@@ -1643,16 +1643,16 @@ static void yaffs_free_obj(struct yaffs_obj *obj)
        struct yaffs_dev *dev;
 
        if (!obj) {
-               YBUG();
+               BUG();
                return;
        }
        dev = obj->my_dev;
        yaffs_trace(YAFFS_TRACE_OS, "FreeObject %p inode %p",
                obj, obj->my_inode);
        if (obj->parent)
-               YBUG();
+               BUG();
        if (!list_empty(&obj->siblings))
-               YBUG();
+               BUG();
 
        if (obj->my_inode) {
                /* We're still hooked up to a cached inode.
@@ -3041,7 +3041,7 @@ static int yaffs_wr_data_obj(struct yaffs_obj *in, int inode_chunk,
                yaffs_trace(YAFFS_TRACE_ERROR,
                  "Writing %d bytes to chunk!!!!!!!!!",
                   n_bytes);
-               YBUG();
+               BUG();
        }
 
        new_chunk_id =
@@ -3591,7 +3591,7 @@ int yaffs_do_file_wr(struct yaffs_obj *in, const u8 *buffer, loff_t offset,
 
                        if (n_writeback < 0 ||
                            n_writeback > dev->data_bytes_per_chunk)
-                               YBUG();
+                               BUG();
 
                } else {
                        n_copy = dev->data_bytes_per_chunk - start;
@@ -4083,11 +4083,11 @@ int yaffs_rename_obj(struct yaffs_obj *old_dir, const YCHAR *old_name,
        struct yaffs_dev *dev;
 
        if (!old_dir || old_dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
        if (!new_dir || new_dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
@@ -4330,7 +4330,7 @@ static void yaffs_del_dir_contents(struct yaffs_obj *dir)
        struct list_head *n;
 
        if (dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
-               YBUG();
+               BUG();
 
        list_for_each_safe(lh, n, &dir->variant.dir_variant.children) {
                obj = list_entry(lh, struct yaffs_obj, siblings);
@@ -4364,14 +4364,14 @@ struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *directory,
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "tragedy: yaffs_find_by_name: null pointer directory"
                        );
-               YBUG();
+               BUG();
                return NULL;
        }
        if (directory->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "tragedy: yaffs_find_by_name: non-directory"
                        );
-               YBUG();
+               BUG();
        }
 
        sum = yaffs_calc_name_sum(name);
@@ -4380,7 +4380,7 @@ struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *directory,
                l = list_entry(i, struct yaffs_obj, siblings);
 
                if (l->parent != directory)
-                       YBUG();
+                       BUG();
 
                yaffs_check_obj_details_loaded(l);
 
index ee061a8..ff9daad 100644 (file)
@@ -61,14 +61,14 @@ int yaffs_wr_chunk_tags_nand(struct yaffs_dev *dev,
                if (!yaffs_validate_tags(tags)) {
                        yaffs_trace(YAFFS_TRACE_ERROR,
                                "Writing uninitialised tags");
-                       YBUG();
+                       BUG();
                }
                yaffs_trace(YAFFS_TRACE_WRITE,
                        "Writing chunk %d tags %d %d",
                        nand_chunk, tags->obj_id, tags->chunk_id);
        } else {
                yaffs_trace(YAFFS_TRACE_ERROR, "Writing with no tags");
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
index 1a5ed9a..87e39c8 100644 (file)
@@ -425,7 +425,7 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj)
 
        if (!obj) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "No object to verify");
-               YBUG();
+               BUG();
                return;
        }
 
@@ -434,13 +434,13 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj)
 
        if (!obj->parent) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "Object does not have parent");
-               YBUG();
+               BUG();
                return;
        }
 
        if (obj->parent->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "Parent is not directory");
-               YBUG();
+               BUG();
        }
 
        /* Iterate through the objects in each hash entry */
@@ -456,7 +456,7 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj)
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "Object in directory %d times",
                        count);
-               YBUG();
+               BUG();
        }
 }
 
@@ -466,7 +466,7 @@ void yaffs_verify_dir(struct yaffs_obj *directory)
        struct yaffs_obj *list_obj;
 
        if (!directory) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -477,7 +477,7 @@ void yaffs_verify_dir(struct yaffs_obj *directory)
                yaffs_trace(YAFFS_TRACE_ALWAYS,
                        "Directory has wrong type: %d",
                        directory->variant_type);
-               YBUG();
+               BUG();
        }
 
        /* Iterate through the objects in each hash entry */
@@ -488,7 +488,7 @@ void yaffs_verify_dir(struct yaffs_obj *directory)
                        yaffs_trace(YAFFS_TRACE_ALWAYS,
                                "Object in directory list has wrong parent %p",
                                list_obj->parent);
-                       YBUG();
+                       BUG();
                }
                yaffs_verify_obj_in_dir(list_obj);
        }
index 309b146..a74d398 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/sort.h>
 #include <linux/bitops.h>
 
+/*  These type wrappings are used to support Unicode names in WinCE. */
 #define YCHAR char
 #define YUCHAR unsigned char
 #define _Y(x)     x
        ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
 
 
-#ifndef Y_DUMP_STACK
-#define Y_DUMP_STACK() dump_stack()
-#endif
-
 #define yaffs_trace(msk, fmt, ...) do { \
        if (yaffs_trace_mask & (msk)) \
                printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
 } while (0)
 
-#ifndef YBUG
-#define YBUG() do {\
-       yaffs_trace(YAFFS_TRACE_BUG,\
-               "bug " __FILE__ " %d",\
-               __LINE__);\
-       Y_DUMP_STACK();\
-} while (0)
-#endif
 
 #endif
index 6cea9fe..ebf56ca 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/sort.h>
 #include <linux/bitops.h>
 
+/*  These type wrappings are used to support Unicode names in WinCE. */
 #define YCHAR char
 #define YUCHAR unsigned char
 #define _Y(x)     x
        ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
 
 
-#ifndef Y_DUMP_STACK
-#define Y_DUMP_STACK() dump_stack()
-#endif
-
 #define yaffs_trace(msk, fmt, ...) do { \
        if (yaffs_trace_mask & (msk)) \
                printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
 } while (0)
 
-#ifndef YBUG
-#define YBUG() do {\
-       yaffs_trace(YAFFS_TRACE_BUG,\
-               "bug " __FILE__ " %d",\
-               __LINE__);\
-       Y_DUMP_STACK();\
-} while (0)
-#endif
 
 #endif