Compilation clean up
[yaffs2.git] / yaffs_yaffs2.c
index 6d4681726a60b3ae63adc3456661a8652790194a..47fa8eba2d5c049c86700a930a6b50323b034416 100644 (file)
@@ -42,7 +42,7 @@
  */
 void yaffs_calc_oldest_dirty_seq(struct yaffs_dev *dev)
 {
-       int i;
+       u32 i;
        unsigned seq;
        unsigned block_no = 0;
        struct yaffs_block_info *b;
@@ -55,7 +55,7 @@ void yaffs_calc_oldest_dirty_seq(struct yaffs_dev *dev)
        b = dev->block_info;
        for (i = dev->internal_start_block; i <= dev->internal_end_block; i++) {
                if (b->block_state == YAFFS_BLOCK_STATE_FULL &&
-                   (b->pages_in_use - b->soft_del_pages) <
+                   (u32)(b->pages_in_use - b->soft_del_pages) <
                    dev->param.chunks_per_block &&
                    b->seq_number < seq) {
                        seq = b->seq_number;
@@ -345,7 +345,7 @@ static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev)
        u32 n_bytes;
        u32 n_blocks = dev->internal_end_block - dev->internal_start_block + 1;
        int ok;
-       int i;
+       u32 i;
        union yaffs_block_info_union bu;
 
        /* Write device runtime values */
@@ -359,7 +359,8 @@ static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev)
        /* Write block info. */
        if (!dev->swap_endian) {
                n_bytes = n_blocks * sizeof(struct yaffs_block_info);
-               ok = (yaffs2_checkpt_wr(dev, dev->block_info, n_bytes) == n_bytes);
+               ok = (yaffs2_checkpt_wr(dev, dev->block_info, n_bytes) ==
+                       (int)n_bytes);
        } else {
                /*
                 * Need to swap the endianisms. We can't do this in place
@@ -382,7 +383,8 @@ static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev)
         * no endian conversion is needed.
         */
        n_bytes = n_blocks * dev->chunk_bit_stride;
-       ok = (yaffs2_checkpt_wr(dev, dev->chunk_bits, n_bytes) == n_bytes);
+       ok = (yaffs2_checkpt_wr(dev, dev->chunk_bits, n_bytes) ==
+               (int)n_bytes);
 
        return ok ? 1 : 0;
 }
@@ -407,7 +409,8 @@ static int yaffs2_rd_checkpt_dev(struct yaffs_dev *dev)
 
        n_bytes = n_blocks * sizeof(struct yaffs_block_info);
 
-       ok = (yaffs2_checkpt_rd(dev, dev->block_info, n_bytes) == n_bytes);
+       ok = (yaffs2_checkpt_rd(dev, dev->block_info, n_bytes) ==
+               (int)n_bytes);
 
        if (!ok)
                return 0;
@@ -424,7 +427,8 @@ static int yaffs2_rd_checkpt_dev(struct yaffs_dev *dev)
 
        n_bytes = n_blocks * dev->chunk_bit_stride;
 
-       ok = (yaffs2_checkpt_rd(dev, dev->chunk_bits, n_bytes) == n_bytes);
+       ok = (yaffs2_checkpt_rd(dev, dev->chunk_bits, n_bytes) ==
+               (int)n_bytes);
 
 
        return ok ? 1 : 0;
@@ -604,7 +608,7 @@ static int yaffs2_checkpt_tnode_worker(struct yaffs_obj *in,
                 */
                tn = yaffs2_do_endian_tnode_copy(dev, tn);
                ok = (yaffs2_checkpt_wr(dev, tn, dev->tnode_size) ==
-                       dev->tnode_size);
+                       (int)dev->tnode_size);
        }
        return ok;
 }
@@ -649,7 +653,7 @@ static int yaffs2_rd_checkpt_tnodes(struct yaffs_obj *obj)
                tn = yaffs_get_tnode(dev);
                if (tn) {
                        ok = (yaffs2_checkpt_rd(dev, tn, dev->tnode_size) ==
-                               dev->tnode_size);
+                               (int)dev->tnode_size);
                        yaffs2_do_endian_tnode(dev, tn);
                }
                else
@@ -768,7 +772,7 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                        cp.obj_id, cp.parent_id, cp_variant_type,
                        cp.hdr_chunk);
 
-               if (ok && cp.obj_id == ~0) {
+               if (ok && cp.obj_id == (u32)(~0)) {
                        done = 1;
                } else if (ok) {
                        obj =
@@ -1050,7 +1054,7 @@ int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
 
                while (increase > 0 && small_increase_ok) {
                        this_write = increase;
-                       if (this_write > dev->data_bytes_per_chunk)
+                       if (this_write > (int)dev->data_bytes_per_chunk)
                                this_write = dev->data_bytes_per_chunk;
                        written =
                            yaffs_do_file_wr(obj, local_buffer, pos, this_write,
@@ -1136,6 +1140,9 @@ static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
                dev->summary_used++;
        }
 
+       if (result == YAFFS_FAIL)
+               yaffs_trace(YAFFS_TRACE_SCAN,
+                               "Could not get tags for chunk %d\n", chunk);
        /* Let's have a good look at this chunk... */
 
        if (!tags.chunk_used) {
@@ -1334,7 +1341,7 @@ static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
                                        yaffs_oh_to_size(dev, oh, 0) :
                                        tags.extra_file_size;
                                u32 parent_obj_id = (oh) ?
-                                       oh->parent_obj_id :
+                                       (u32)oh->parent_obj_id :
                                        tags.extra_parent_id;
 
                                is_shrink = (oh) ?
@@ -1517,7 +1524,7 @@ static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
 
 int yaffs2_scan_backwards(struct yaffs_dev *dev)
 {
-       int blk;
+       u32 blk;
        int block_iter;
        int start_iter;
        int end_iter;