projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs: Clean up as per Ryan's comments
[yaffs2.git]
/
yaffs_yaffs1.c
diff --git
a/yaffs_yaffs1.c
b/yaffs_yaffs1.c
index 6ee91a139e1ae508acec7fc26a091d740fdeefb0..a70c1422e1cbc844dbf8b9338060e4ed2f10412e 100644
(file)
--- a/
yaffs_yaffs1.c
+++ b/
yaffs_yaffs1.c
@@
-28,7
+28,7
@@
int yaffs1_scan(struct yaffs_dev *dev)
int c;
int deleted;
enum yaffs_block_state state;
int c;
int deleted;
enum yaffs_block_state state;
-
struct yaffs_obj *hard_list = NULL
;
+
LIST_HEAD(hard_list)
;
struct yaffs_block_info *bi;
u32 seq_number;
struct yaffs_obj_hdr *oh;
struct yaffs_block_info *bi;
u32 seq_number;
struct yaffs_obj_hdr *oh;
@@
-89,8
+89,9
@@
int yaffs1_scan(struct yaffs_dev *dev)
deleted = 0;
/* For each chunk in each block that needs scanning.... */
deleted = 0;
/* For each chunk in each block that needs scanning.... */
- for (c = 0; !alloc_failed && c < dev->param.chunks_per_block &&
- state == YAFFS_BLOCK_STATE_NEEDS_SCANNING; c++) {
+ for (c = 0;
+ !alloc_failed && c < dev->param.chunks_per_block &&
+ state == YAFFS_BLOCK_STATE_NEEDS_SCAN; c++) {
/* Read the tags and decide what to do */
chunk = blk * dev->param.chunks_per_block + c;
/* Read the tags and decide what to do */
chunk = blk * dev->param.chunks_per_block + c;
@@
-99,8
+100,8
@@
int yaffs1_scan(struct yaffs_dev *dev)
/* Let's have a good look at this chunk... */
/* Let's have a good look at this chunk... */
- if (tags.ecc_result == YAFFS_ECC_RESULT_UNFIXED
-
||
tags.is_deleted) {
+ if (tags.ecc_result == YAFFS_ECC_RESULT_UNFIXED
||
+ tags.is_deleted) {
/* YAFFS1 only...
* A deleted chunk
*/
/* YAFFS1 only...
* A deleted chunk
*/
@@
-160,9
+161,9
@@
int yaffs1_scan(struct yaffs_dev *dev)
tags.n_bytes;
if (in &&
in->variant_type ==
tags.n_bytes;
if (in &&
in->variant_type ==
- YAFFS_OBJECT_TYPE_FILE &&
+
YAFFS_OBJECT_TYPE_FILE &&
in->variant.file_variant.scanned_size <
in->variant.file_variant.scanned_size <
- endpos) {
+
endpos) {
in->variant.file_variant.scanned_size =
endpos;
if (!dev->param.use_header_file_size) {
in->variant.file_variant.scanned_size =
endpos;
if (!dev->param.use_header_file_size) {
@@
-332,10
+333,8
@@
int yaffs1_scan(struct yaffs_dev *dev)
in->variant.
hardlink_variant.equiv_id =
oh->equiv_id;
in->variant.
hardlink_variant.equiv_id =
oh->equiv_id;
- in->hard_links.next =
- (struct list_head *)
- hard_list;
- hard_list = in;
+ list_add(&in->hard_links,
+ &hard_list);
break;
case YAFFS_OBJECT_TYPE_DIRECTORY:
/* Do nothing */
break;
case YAFFS_OBJECT_TYPE_DIRECTORY:
/* Do nothing */
@@
-356,7
+355,7
@@
int yaffs1_scan(struct yaffs_dev *dev)
}
}
}
}
- if (state == YAFFS_BLOCK_STATE_NEEDS_SCAN
NING
) {
+ if (state == YAFFS_BLOCK_STATE_NEEDS_SCAN) {
/* If we got this far while scanning,
* then the block is fully allocated. */
state = YAFFS_BLOCK_STATE_FULL;
/* If we got this far while scanning,
* then the block is fully allocated. */
state = YAFFS_BLOCK_STATE_FULL;
@@
-374,9
+373,8
@@
int yaffs1_scan(struct yaffs_dev *dev)
/* Now let's see if it was dirty */
if (bi->pages_in_use == 0 &&
!bi->has_shrink_hdr &&
/* Now let's see if it was dirty */
if (bi->pages_in_use == 0 &&
!bi->has_shrink_hdr &&
- bi->block_state == YAFFS_BLOCK_STATE_FULL)
{
+ bi->block_state == YAFFS_BLOCK_STATE_FULL)
yaffs_block_became_dirty(dev, blk);
yaffs_block_became_dirty(dev, blk);
- }
}
/* Ok, we've done all the scanning.
}
/* Ok, we've done all the scanning.
@@
-385,9
+383,12
@@
int yaffs1_scan(struct yaffs_dev *dev)
* these hardlinks.
*/
* these hardlinks.
*/
- yaffs_link_fixup(dev, hard_list);
+ yaffs_link_fixup(dev,
&
hard_list);
- /* Fix up any shadowed objects */
+ /*
+ * Fix up any shadowed objects.
+ * There should not be more than one of these.
+ */
{
struct yaffs_shadow_fixer *fixer;
struct yaffs_obj *obj;
{
struct yaffs_shadow_fixer *fixer;
struct yaffs_obj *obj;