static int yaffs2_checkpt_space_ok(yaffs_dev_t *dev)
{
- int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
+ int blocks_avail = dev->n_erased_blocks - dev->param.n_reserved_blocks;
T(YAFFS_TRACE_CHECKPOINT,
(TSTR("checkpt blocks available = %d" TENDSTR),
- blocksAvailable));
+ blocks_avail));
- return (blocksAvailable <= 0) ? 0 : 1;
+ return (blocks_avail <= 0) ? 0 : 1;
}
static void yaffs2_checkpt_find_erased_block(yaffs_dev_t *dev)
{
int i;
- int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
+ int blocks_avail = dev->n_erased_blocks - dev->param.n_reserved_blocks;
T(YAFFS_TRACE_CHECKPOINT,
(TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR),
- dev->n_erased_blocks, dev->param.n_reserved_blocks, blocksAvailable, dev->checkpt_next_block));
+ dev->n_erased_blocks, dev->param.n_reserved_blocks, blocks_avail, dev->checkpt_next_block));
if (dev->checkpt_next_block >= 0 &&
dev->checkpt_next_block <= dev->internal_end_block &&
- blocksAvailable > 0) {
+ blocks_avail > 0) {
for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) {
yaffs_block_info_t *bi = yaffs_get_block_info(dev, i);
if (dev->blocks_in_checkpt < dev->checkpt_max_blocks)
for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) {
int chunk = i * dev->param.chunks_per_block;
- int realignedChunk = chunk - dev->chunk_offset;
+ int realigned_chunk = chunk - dev->chunk_offset;
- dev->param.read_chunk_tags_fn(dev, realignedChunk,
+ dev->param.read_chunk_tags_fn(dev, realigned_chunk,
NULL, &tags);
T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
i, tags.obj_id, tags.seq_number, tags.ecc_result));
}
-int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
+int yaffs2_checkpt_open(yaffs_dev_t *dev, int writing)
{
- dev->checkpt_open_write = forWriting;
+ dev->checkpt_open_write = writing;
/* Got the functions we need? */
if (!dev->param.write_chunk_tags_fn ||
!dev->param.bad_block_fn)
return 0;
- if (forWriting && !yaffs2_checkpt_space_ok(dev))
+ if (writing && !yaffs2_checkpt_space_ok(dev))
return 0;
if (!dev->checkpt_buffer)
dev->checkpt_next_block = dev->internal_start_block;
/* Erase all the blocks in the checkpoint area */
- if (forWriting) {
+ if (writing) {
memset(dev->checkpt_buffer, 0, dev->data_bytes_per_chunk);
dev->checkpt_byte_offs = 0;
return yaffs_checkpt_erase(dev);
int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum)
{
- __u32 compositeSum;
- compositeSum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
- *sum = compositeSum;
+ __u32 composite_sum;
+ composite_sum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
+ *sum = composite_sum;
return 1;
}
static int yaffs2_checkpt_flush_buffer(yaffs_dev_t *dev)
{
int chunk;
- int realignedChunk;
+ int realigned_chunk;
yaffs_ext_tags tags;
T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR),
chunk, dev->checkpt_cur_block, dev->checkpt_cur_chunk, tags.obj_id, tags.chunk_id));
- realignedChunk = chunk - dev->chunk_offset;
+ realigned_chunk = chunk - dev->chunk_offset;
dev->n_page_writes++;
- dev->param.write_chunk_tags_fn(dev, realignedChunk,
+ dev->param.write_chunk_tags_fn(dev, realigned_chunk,
dev->checkpt_buffer, &tags);
dev->checkpt_byte_offs = 0;
dev->checkpt_page_seq++;
int ok = 1;
- __u8 * dataBytes = (__u8 *)data;
+ __u8 * data_bytes = (__u8 *)data;
return -1;
while (i < n_bytes && ok) {
- dev->checkpt_buffer[dev->checkpt_byte_offs] = *dataBytes;
- dev->checkpt_sum += *dataBytes;
- dev->checkpt_xor ^= *dataBytes;
+ dev->checkpt_buffer[dev->checkpt_byte_offs] = *data_bytes;
+ dev->checkpt_sum += *data_bytes;
+ dev->checkpt_xor ^= *data_bytes;
dev->checkpt_byte_offs++;
i++;
- dataBytes++;
+ data_bytes++;
dev->checkpt_byte_count++;
int chunk;
- int realignedChunk;
+ int realigned_chunk;
- __u8 *dataBytes = (__u8 *)data;
+ __u8 *data_bytes = (__u8 *)data;
if (!dev->checkpt_buffer)
return 0;
dev->param.chunks_per_block +
dev->checkpt_cur_chunk;
- realignedChunk = chunk - dev->chunk_offset;
+ realigned_chunk = chunk - dev->chunk_offset;
dev->n_page_reads++;
/* read in the next chunk */
- /* printf("read checkpoint page %d\n",dev->checkpointPage); */
dev->param.read_chunk_tags_fn(dev,
- realignedChunk,
+ realigned_chunk,
dev->checkpt_buffer,
&tags);
}
if (ok) {
- *dataBytes = dev->checkpt_buffer[dev->checkpt_byte_offs];
- dev->checkpt_sum += *dataBytes;
- dev->checkpt_xor ^= *dataBytes;
+ *data_bytes = dev->checkpt_buffer[dev->checkpt_byte_offs];
+ dev->checkpt_sum += *data_bytes;
+ dev->checkpt_xor ^= *data_bytes;
dev->checkpt_byte_offs++;
i++;
- dataBytes++;
+ data_bytes++;
dev->checkpt_byte_count++;
}
}