/*
* YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
*
- * Copyright (C) 2002-2011 Aleph One Ltd.
- * for Toby Churchill Ltd and Brightstar Engineering
+ * Copyright (C) 2002-2018 Aleph One Ltd.
*
* Created by Charles Manning <charles@aleph1.co.uk>
*
*/
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;
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;
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 */
/* 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
* 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;
}
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;
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;
*/
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;
}
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
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 =
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,
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) {
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) ?
int yaffs2_scan_backwards(struct yaffs_dev *dev)
{
- int blk;
+ u32 blk;
int block_iter;
int start_iter;
int end_iter;