projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some changes to get VxWorks wrapper working
[yaffs2.git]
/
yaffs_yaffs2.c
diff --git
a/yaffs_yaffs2.c
b/yaffs_yaffs2.c
index 34c0bde985cb5d972624d31b9e905b5aa489511d..9fb7c944caca02acbf511e55dbe71d9cf88f573f 100644
(file)
--- a/
yaffs_yaffs2.c
+++ b/
yaffs_yaffs2.c
@@
-836,7
+836,7
@@
int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
* of hole marker.
*/
loff_t old_file_size;
* of hole marker.
*/
loff_t old_file_size;
-
in
t increase;
+
loff_
t increase;
int small_hole;
int result = YAFFS_OK;
struct yaffs_dev *dev = NULL;
int small_hole;
int result = YAFFS_OK;
struct yaffs_dev *dev = NULL;
@@
-873,7
+873,7
@@
int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
if (local_buffer) {
/* fill hole with zero bytes */
if (local_buffer) {
/* fill hole with zero bytes */
-
in
t pos = old_file_size;
+
loff_
t pos = old_file_size;
int this_write;
int written;
memset(local_buffer, 0, dev->data_bytes_per_chunk);
int this_write;
int written;
memset(local_buffer, 0, dev->data_bytes_per_chunk);
@@
-942,7
+942,7
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
struct yaffs_obj *in;
struct yaffs_obj *parent;
int equiv_id;
struct yaffs_obj *in;
struct yaffs_obj *parent;
int equiv_id;
-
in
t file_size;
+
loff_
t file_size;
int is_shrink;
int is_unlinked;
struct yaffs_ext_tags tags;
int is_shrink;
int is_unlinked;
struct yaffs_ext_tags tags;
@@
-957,9
+957,13
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
result = yaffs_summary_fetch(dev, &tags, chunk_in_block);
tags.seq_number = bi->seq_number;
}
result = yaffs_summary_fetch(dev, &tags, chunk_in_block);
tags.seq_number = bi->seq_number;
}
-
- if (!summary_available || tags.obj_id == 0)
+
+ if (!summary_available || tags.obj_id == 0)
{
result = yaffs_rd_chunk_tags_nand(dev, chunk, NULL, &tags);
result = yaffs_rd_chunk_tags_nand(dev, chunk, NULL, &tags);
+ dev->tags_used++;
+ } else {
+ dev->summary_used++;
+ }
/* Let's have a good look at this chunk... */
/* Let's have a good look at this chunk... */
@@
-1019,6
+1023,7
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
dev->n_free_chunks++;
} else if (tags.obj_id > YAFFS_MAX_OBJECT_ID ||
tags.chunk_id > YAFFS_MAX_CHUNK_ID ||
dev->n_free_chunks++;
} else if (tags.obj_id > YAFFS_MAX_OBJECT_ID ||
tags.chunk_id > YAFFS_MAX_CHUNK_ID ||
+ tags.obj_id == YAFFS_OBJECTID_SUMMARY ||
(tags.chunk_id > 0 &&
tags.n_bytes > dev->data_bytes_per_chunk) ||
tags.seq_number != bi->seq_number) {
(tags.chunk_id > 0 &&
tags.n_bytes > dev->data_bytes_per_chunk) ||
tags.seq_number != bi->seq_number) {
@@
-1029,8
+1034,8
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
dev->n_free_chunks++;
} else if (tags.chunk_id > 0) {
/* chunk_id > 0 so it is a data chunk... */
dev->n_free_chunks++;
} else if (tags.chunk_id > 0) {
/* chunk_id > 0 so it is a data chunk... */
-
unsigned in
t endpos;
-
u32
chunk_base = (tags.chunk_id - 1) *
+
loff_
t endpos;
+
loff_t
chunk_base = (tags.chunk_id - 1) *
dev->data_bytes_per_chunk;
*found_chunks = 1;
dev->data_bytes_per_chunk;
*found_chunks = 1;
@@
-1152,9
+1157,9
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
(tags.extra_available &&
tags.extra_obj_type == YAFFS_OBJECT_TYPE_FILE)
)) {
(tags.extra_available &&
tags.extra_obj_type == YAFFS_OBJECT_TYPE_FILE)
)) {
-
u32
this_size = (oh) ?
-
oh->file_size
:
- tags.extra_
length
;
+
loff_t
this_size = (oh) ?
+
yaffs_oh_to_size(oh)
:
+ tags.extra_
file_size
;
u32 parent_obj_id = (oh) ?
oh->parent_obj_id :
tags.extra_parent_id;
u32 parent_obj_id = (oh) ?
oh->parent_obj_id :
tags.extra_parent_id;
@@
-1188,12
+1193,14
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
}
if (!in->valid && in->variant_type !=
}
if (!in->valid && in->variant_type !=
- (oh ? oh->type : tags.extra_obj_type))
+ (oh ? oh->type : tags.extra_obj_type))
{
yaffs_trace(YAFFS_TRACE_ERROR,
yaffs_trace(YAFFS_TRACE_ERROR,
- "yaffs tragedy: Bad
object
type, %d != %d, for object %d at chunk %d during scan",
+ "yaffs tragedy: Bad type, %d != %d, for object %d at chunk %d during scan",
oh ? oh->type : tags.extra_obj_type,
in->variant_type, tags.obj_id,
chunk);
oh ? oh->type : tags.extra_obj_type,
in->variant_type, tags.obj_id,
chunk);
+ in = yaffs_retype_obj(in, oh ? oh->type : tags.extra_obj_type);
+ }
if (!in->valid &&
(tags.obj_id == YAFFS_OBJECTID_ROOT ||
if (!in->valid &&
(tags.obj_id == YAFFS_OBJECTID_ROOT ||
@@
-1228,7
+1235,7
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
parent = yaffs_find_or_create_by_number(dev,
oh->parent_obj_id,
YAFFS_OBJECT_TYPE_DIRECTORY);
parent = yaffs_find_or_create_by_number(dev,
oh->parent_obj_id,
YAFFS_OBJECT_TYPE_DIRECTORY);
- file_size =
oh->file_size
;
+ file_size =
yaffs_oh_to_size(oh)
;
is_shrink = oh->is_shrink;
equiv_id = oh->equiv_id;
} else {
is_shrink = oh->is_shrink;
equiv_id = oh->equiv_id;
} else {
@@
-1236,7
+1243,7
@@
static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
parent = yaffs_find_or_create_by_number(dev,
tags.extra_parent_id,
YAFFS_OBJECT_TYPE_DIRECTORY);
parent = yaffs_find_or_create_by_number(dev,
tags.extra_parent_id,
YAFFS_OBJECT_TYPE_DIRECTORY);
- file_size = tags.extra_
length
;
+ file_size = tags.extra_
file_size
;
is_shrink = tags.extra_is_shrink;
equiv_id = tags.extra_equiv_id;
in->lazy_loaded = 1;
is_shrink = tags.extra_is_shrink;
equiv_id = tags.extra_equiv_id;
in->lazy_loaded = 1;
@@
-1344,7
+1351,6
@@
int yaffs2_scan_backwards(struct yaffs_dev *dev)
int n_to_scan = 0;
enum yaffs_block_state state;
int c;
int n_to_scan = 0;
enum yaffs_block_state state;
int c;
- int deleted;
LIST_HEAD(hard_list);
struct yaffs_block_info *bi;
u32 seq_number;
LIST_HEAD(hard_list);
struct yaffs_block_info *bi;
u32 seq_number;
@@
-1434,7
+1440,7
@@
int yaffs2_scan_backwards(struct yaffs_dev *dev)
bi++;
}
bi++;
}
- yaffs_trace(YAFFS_TRACE_
SCAN
, "%d blocks to be sorted...", n_to_scan);
+ yaffs_trace(YAFFS_TRACE_
ALWAYS
, "%d blocks to be sorted...", n_to_scan);
cond_resched();
cond_resched();
@@
-1462,13
+1468,12
@@
int yaffs2_scan_backwards(struct yaffs_dev *dev)
/* get the block to scan in the correct order */
blk = block_index[block_iter].block;
bi = yaffs_get_block_info(dev, blk);
/* get the block to scan in the correct order */
blk = block_index[block_iter].block;
bi = yaffs_get_block_info(dev, blk);
- deleted = 0;
- summary_available = yaffs_summary_read(dev, blk);
+ summary_available = yaffs_summary_read(dev,
dev->sum_tags,
blk);
/* For each chunk in each block that needs scanning.... */
found_chunks = 0;
/* For each chunk in each block that needs scanning.... */
found_chunks = 0;
- if(summary_available)
+ if
(summary_available)
c = dev->chunks_per_summary - 1;
else
c = dev->param.chunks_per_block - 1;
c = dev->chunks_per_summary - 1;
else
c = dev->param.chunks_per_block - 1;