If unsure, say N.
-
-config YAFFS_DISABLE_WIDE_TNODES
- bool "Turn off wide tnodes"
- depends on YAFFS_FS
- default n
- help
- Wide tnodes are only used for NAND arrays >=32MB for 512-byte
- page devices and >=128MB for 2k page devices. They use slightly
- more RAM but are faster since they eliminate chunk group
- searching.
-
- Setting this to 'y' will force tnode width to 16 bits and save
- memory but make large arrays slower.
-
- If unsure, say N.
-
config YAFFS_ALWAYS_CHECK_CHUNK_ERASED
bool "Force chunk erase check"
depends on YAFFS_FS
If unsure, say Y.
-config YAFFS_SHORT_NAMES_IN_RAM
- bool "Cache short names in RAM"
- depends on YAFFS_FS
- default y
- help
- If this config is set, then short names are stored with the
- yaffs_Object. This costs an extra 16 bytes of RAM per object,
- but makes look-ups faster.
-
- If unsure, say Y.
-
config YAFFS_EMPTY_LOST_AND_FOUND
bool "Empty lost and found on boot"
depends on YAFFS_FS
If this is set, then background processing is disabled.
Background processing makes many foreground activities faster.
- If unsure, say N.
+ If unsure, say N.
config YAFFS_XATTR
bool "Enable yaffs2 xattr support"
help
If this is set then yaffs2 will provide xattr support.
If unsure, say Y.
-
-
#EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
-CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2
+CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_YAFFS2
CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE
CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Werror=strict-aliasing
#CFLAGS += -fno-strict-aliasing
#EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
-CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2
+CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_YAFFS2
CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE
CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing
#CFLAGS += -fno-strict-aliasing
#EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
-CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2
+CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_YAFFS2
CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES
CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing
#CFLAGS += -fno-strict-aliasing
/* empty directory. This can also be achieved with a mount option. */
#define CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
-/* Default: Selected */
-/* Meaning: Cache short names, taking more RAM, but faster look-ups */
-#define CONFIG_YAFFS_SHORT_NAMES_IN_RAM
-
/* Default: Unselected */
/* Meaning: Select to disable block refreshing. */
/* Block Refreshing periodically rewrites the oldest block. */
allocator->free_tnodes = NULL;
allocator->n_free_tnodes = 0;
allocator->n_tnodes_created = 0;
- } else
+ } else {
YBUG();
+ }
}
static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes)
allocator->allocated_obj_list = NULL;
allocator->free_objs = NULL;
allocator->n_free_objects = 0;
- } else
+ } else {
YBUG();
+ }
}
static void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
YFREE(dev->allocator);
dev->allocator = NULL;
- } else
+ } else {
YBUG();
+ }
}
void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
yaffs_init_raw_tnodes(dev);
yaffs_init_raw_objs(dev);
}
- } else
+ } else {
YBUG();
+ }
}
#endif
YFREE(dev->checkpt_buffer);
dev->checkpt_buffer = NULL;
return 1;
- } else
+ } else {
return 0;
+ }
}
int yaffs2_checkpt_invalidate_stream(struct yaffs_dev *dev)
void yaffs_set_obj_name(struct yaffs_obj *obj, const YCHAR * name)
{
-#ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
- memset(obj->short_name, 0,
- sizeof(YCHAR) * (YAFFS_SHORT_NAME_LENGTH + 1));
- if (name
- && yaffs_strnlen(name,
- YAFFS_SHORT_NAME_LENGTH + 1) <=
+#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
+ memset(obj->short_name, 0, sizeof(obj->short_name));
+ if (name &&
+ yaffs_strnlen(name, YAFFS_SHORT_NAME_LENGTH + 1) <=
YAFFS_SHORT_NAME_LENGTH)
yaffs_strcpy(obj->short_name, name);
else
dev->block_info =
YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_info));
dev->block_info_alt = 1;
- } else
+ } else {
dev->block_info_alt = 0;
+ }
if (dev->block_info) {
/* Set up dynamic blockinfo stuff. */
dev->chunk_bits =
YMALLOC_ALT(dev->chunk_bit_stride * n_blocks);
dev->chunk_bits_alt = 1;
- } else
+ } else {
dev->chunk_bits_alt = 0;
+ }
}
if (dev->block_info && dev->chunk_bits) {
oh,
&tags,
1);
- } else
+ } else {
new_chunk =
yaffs_write_new_chunk(dev,
buffer,
&tags,
1);
+ }
if (new_chunk < 0) {
ret_val = YAFFS_FAIL;
bi = yaffs_get_block_info(dev, selected);
dev->gc_pages_in_use =
bi->pages_in_use - bi->soft_del_pages;
- } else
+ } else {
dev->gc_not_done = 0;
+ }
}
if (selected) {
memcpy(old_name, oh->name, sizeof(oh->name));
memset(buffer, 0xFF, sizeof(struct yaffs_obj_hdr));
- } else
+ } else {
memset(buffer, 0xFF, dev->data_bytes_per_chunk);
+ }
oh->type = in->variant_type;
oh->yst_mode = in->yst_mode;
if (name && *name) {
memset(oh->name, 0, sizeof(oh->name));
yaffs_load_oh_from_name(dev, oh->name, name);
- } else if (prev_chunk_id > 0)
+ } else if (prev_chunk_id > 0) {
memcpy(oh->name, old_name, sizeof(oh->name));
- else
+ } else {
memset(oh->name, 0, sizeof(oh->name));
+ }
oh->is_shrink = is_shrink;
}
return cache;
- } else
+ } else {
return NULL;
-
+ }
}
/* Find a cached chunk */
default:
return YAFFS_FAIL;
}
- } else if (yaffs_is_non_empty_dir(obj))
+ } else if (yaffs_is_non_empty_dir(obj)) {
return YAFFS_FAIL;
- else
+ } else {
return yaffs_change_obj_name(obj, obj->my_dev->unlinked_dir,
_Y("unlinked"), 0, 0);
+ }
}
static int yaffs_unlink_obj(struct yaffs_obj *obj)
hanging = 0;
} else if (!parent
|| parent->variant_type !=
- YAFFS_OBJECT_TYPE_DIRECTORY)
+ YAFFS_OBJECT_TYPE_DIRECTORY) {
hanging = 1;
- else if (yaffs_has_null_parent(dev, parent))
+ } else if (yaffs_has_null_parent(dev, parent)) {
hanging = 0;
- else {
+ } else {
/*
* Need to follow the parent chain to see if it is hanging.
*/
obj->obj_id));
}
- } else
+ } else {
yaffs_update_oh(obj, NULL, 0, 0, 0, NULL);
+ }
}
void yaffs_update_dirty_dirs(struct yaffs_dev *dev)
/* Special case for lost-n-found */
if (l->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
- if (yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME) ==
- 0)
+ if (!yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME))
return l;
} else if (yaffs_sum_cmp(l->sum, sum)
|| l->hdr_chunk <= 0) {
ascii_oh_name++;
n--;
}
- } else
+ } else {
yaffs_strncpy(name, oh_name + 1, buff_size - 1);
- } else
+ }
+ } else {
+#else
+ {
#endif
yaffs_strncpy(name, oh_name, buff_size - 1);
+ }
}
static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR * oh_name,
yaffs_strncpy(oh_name + 1, name,
YAFFS_MAX_NAME_LENGTH - 2);
}
- } else
+ } else {
+#else
+ {
#endif
yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+ }
}
if (obj->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
yaffs_strncpy(name, YAFFS_LOSTNFOUND_NAME, buffer_size - 1);
}
-#ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
+#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
else if (obj->short_name[0]) {
yaffs_strcpy(name, obj->short_name);
}
dev->tnode_width = 16;
else
dev->tnode_width = bits;
- } else
+ } else {
dev->tnode_width = 16;
+ }
dev->tnode_mask = (1 << dev->tnode_width) - 1;
if (!init_failed && !yaffs2_scan_backwards(dev))
init_failed = 1;
}
- } else if (!yaffs1_scan(dev))
+ } else if (!yaffs1_scan(dev)) {
init_failed = 1;
+ }
yaffs_strip_deleted_objs(dev);
yaffs_fix_hanging_objs(dev);
u32 yst_mode;
-#ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
+#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
YCHAR short_name[YAFFS_SHORT_NAME_LENGTH + 1];
#endif
dev->
data_bytes_per_chunk);
yaffs_pack_tags2_tags_only(pt2tp, tags);
- } else
+ } else {
yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
+ }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
ops.mode = MTD_OOB_AUTO;
dev->
data_bytes_per_chunk);
yaffs_pack_tags2_tags_only(pt2tp, tags);
- } else
+ } else {
yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
+ }
ops.mode = MTD_OOB_AUTO;
ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
memcpy(xb + pos, xb + pos + size, xb_size - (pos + size));
memset(xb + (xb_size - size), 0, size);
return 0;
- } else
+ } else {
return -ENODATA;
+ }
}
int nval_set(char *xb, int xb_size, const YCHAR * name, const char *buf,
buf++;
}
ncopied += (name_len + 1);
- } else
+ } else {
filled = 1;
+ }
pos += size;
if (pos < xb_size - sizeof(int))
memcpy(&size, xb + pos, sizeof(int));
next_gc = now + HZ / 10 + 1;
else
next_gc = now + HZ * 2;
- } else /*
+ } else {
+ /*
* gc not running so set to next_dir_update
* to cut down on wake ups
*/
next_gc = next_dir_update;
+ }
}
yaffs_gross_unlock(dev);
#if 1
options_str++;
}
- if (!strcmp(cur_opt, "inband-tags"))
+ if (!strcmp(cur_opt, "inband-tags")) {
options->inband_tags = 1;
- else if (!strcmp(cur_opt, "tags-ecc-off")) {
+ } else if (!strcmp(cur_opt, "tags-ecc-off")) {
options->tags_ecc_on = 0;
options->tags_ecc_overridden = 1;
} else if (!strcmp(cur_opt, "tags-ecc-on")) {
} else if (!strcmp(cur_opt, "empty-lost-and-found-on")) {
options->empty_lost_and_found = 1;
options->empty_lost_and_found_overridden = 1;
- } else if (!strcmp(cur_opt, "no-cache"))
+ } else if (!strcmp(cur_opt, "no-cache")) {
options->no_cache = 1;
- else if (!strcmp(cur_opt, "no-checkpoint-read"))
+ } else if (!strcmp(cur_opt, "no-checkpoint-read")) {
options->skip_checkpoint_read = 1;
- else if (!strcmp(cur_opt, "no-checkpoint-write"))
+ } else if (!strcmp(cur_opt, "no-checkpoint-write")) {
options->skip_checkpoint_write = 1;
- else if (!strcmp(cur_opt, "no-checkpoint")) {
+ } else if (!strcmp(cur_opt, "no-checkpoint")) {
options->skip_checkpoint_read = 1;
options->skip_checkpoint_write = 1;
} else {
sprintf(buf, "\nDevice %d \"%s\"\n", n,
dev->param.name);
buf = yaffs_dump_dev_part0(buf, dev);
- } else
+ } else {
buf = yaffs_dump_dev_part1(buf, dev);
+ }
break;
}
my_proc_entry->write_proc = yaffs_proc_write;
my_proc_entry->read_proc = yaffs_proc_read;
my_proc_entry->data = NULL;
- } else
+ } else {
return -ENOMEM;
+ }
debug_proc_entry = create_proc_entry("yaffs_stats",
S_IRUGO | S_IFREG, YPROC_ROOT);
debug_proc_entry->write_proc = NULL;
debug_proc_entry->read_proc = yaffs_stats_proc_read;
debug_proc_entry->data = NULL;
- } else
+ } else {
return -ENOMEM;
+ }
/* Now add the file system entries */
next_gc = now + HZ / 10 + 1;
else
next_gc = now + HZ * 2;
- } else /*
+ } else {
+ /*
* gc not running so set to next_dir_update
* to cut down on wake ups
*/
next_gc = next_dir_update;
+ }
}
yaffs_gross_unlock(dev);
expires = next_dir_update;
options_str++;
}
- if (!strcmp(cur_opt, "inband-tags"))
+ if (!strcmp(cur_opt, "inband-tags")) {
options->inband_tags = 1;
- else if (!strcmp(cur_opt, "tags-ecc-off")) {
+ } else if (!strcmp(cur_opt, "tags-ecc-off")) {
options->tags_ecc_on = 0;
options->tags_ecc_overridden = 1;
} else if (!strcmp(cur_opt, "tags-ecc-on")) {
} else if (!strcmp(cur_opt, "empty-lost-and-found-on")) {
options->empty_lost_and_found = 1;
options->empty_lost_and_found_overridden = 1;
- } else if (!strcmp(cur_opt, "no-cache"))
+ } else if (!strcmp(cur_opt, "no-cache")) {
options->no_cache = 1;
- else if (!strcmp(cur_opt, "no-checkpoint-read"))
+ } else if (!strcmp(cur_opt, "no-checkpoint-read")) {
options->skip_checkpoint_read = 1;
- else if (!strcmp(cur_opt, "no-checkpoint-write"))
+ } else if (!strcmp(cur_opt, "no-checkpoint-write")) {
options->skip_checkpoint_write = 1;
- else if (!strcmp(cur_opt, "no-checkpoint")) {
+ } else if (!strcmp(cur_opt, "no-checkpoint")) {
options->skip_checkpoint_read = 1;
options->skip_checkpoint_write = 1;
} else {
param->use_nand_ecc = 1;
#endif
-#ifdef CONFIG_YAFFS_DISABLE_WIDE_TNODES
- param->wide_tnodes_disabled = 1;
-#endif
-
param->skip_checkpt_rd = options.skip_checkpoint_read;
param->skip_checkpt_wr = options.skip_checkpoint_write;
sprintf(buf, "\nDevice %d \"%s\"\n", n,
dev->param.name);
buf = yaffs_dump_dev_part0(buf, dev);
- } else
+ } else {
buf = yaffs_dump_dev_part1(buf, dev);
+ }
break;
}
my_proc_entry->write_proc = yaffs_proc_write;
my_proc_entry->read_proc = yaffs_proc_read;
my_proc_entry->data = NULL;
- } else
+ } else {
return -ENOMEM;
+ }
debug_proc_entry = create_proc_entry("yaffs_stats",
S_IRUGO | S_IFREG, YPROC_ROOT);
debug_proc_entry->write_proc = NULL;
debug_proc_entry->read_proc = yaffs_stats_proc_read;
debug_proc_entry->data = NULL;
- } else
+ } else {
return -ENOMEM;
+ }
/* Now add the file system entries */
variant.dir_variant.children);
} else if (!parent
|| parent->variant_type !=
- YAFFS_OBJECT_TYPE_DIRECTORY)
- {
+ YAFFS_OBJECT_TYPE_DIRECTORY) {
/* Hoosterman, another problem....
* We're trying to use a non-directory as a directory
*/
if (tn) {
ok = (yaffs2_checkpt_rd(dev, tn, dev->tnode_size) ==
dev->tnode_size);
- } else
+ } else {
ok = 0;
+ }
if (tn && ok)
ok = yaffs_add_find_tnode_0(dev,
TENDSTR), cp.obj_id, cp.parent_id, cp.variant_type,
cp.hdr_chunk));
- if (ok && cp.obj_id == ~0)
+ if (ok && cp.obj_id == ~0) {
done = 1;
- else if (ok) {
+ } else if (ok) {
obj =
yaffs_find_or_create_by_number(dev, cp.obj_id,
cp.variant_type);
(struct list_head *)hard_list;
hard_list = obj;
}
- } else
+ } else {
ok = 0;
+ }
}
}
if (written == this_write) {
pos += this_write;
increase -= this_write;
- } else
+ } else {
small_increase_ok = 0;
+ }
}
yaffs_release_temp_buffer(dev, local_buffer, __LINE__);
in->yst_mode = oh->yst_mode;
yaffs_load_attribs(in, oh);
in->lazy_loaded = 0;
- } else
+ } else {
in->lazy_loaded = 1;
-
+ }
in->hdr_chunk = chunk;
} else if (!in->valid) {
variant.dir_variant.children);
} else if (!parent
|| parent->variant_type !=
- YAFFS_OBJECT_TYPE_DIRECTORY)
- {
+ YAFFS_OBJECT_TYPE_DIRECTORY) {
/* Hoosterman, another problem....
* We're trying to use a non-directory as a directory
*/