summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Manning <cdhmanning@gmail.com>2011-03-31 15:13:03 +1300
committerCharles Manning <cdhmanning@gmail.com>2011-03-31 15:13:03 +1300
commit2c98f380f6e28ef71d4d7a8a174cc22b0481f102 (patch)
tree1f229b0431eb421e54799498932d03e6cc82e1ca
parentbf4900527f7eab3a629498f2aedbaebf259a6f7a (diff)
yaffs: More mainlining cleanup
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
-rw-r--r--Kconfig_multi (renamed from Kconfig)0
-rw-r--r--Kconfig_single30
-rw-r--r--moduleconfig.h60
-rwxr-xr-xpatch-ker.sh4
-rw-r--r--yaffs_ecc.c15
-rw-r--r--yaffs_guts.c13
-rw-r--r--yaffs_guts.h16
-rw-r--r--yaffs_mtdif1_multi.c66
-rw-r--r--yaffs_mtdif1_single.c43
-rw-r--r--yaffs_vfs_multi.c54
-rw-r--r--yaffs_vfs_single.c196
-rw-r--r--yportenv_single.h7
12 files changed, 107 insertions, 397 deletions
diff --git a/Kconfig b/Kconfig_multi
index 658feea..658feea 100644
--- a/Kconfig
+++ b/Kconfig_multi
diff --git a/Kconfig_single b/Kconfig_single
new file mode 100644
index 0000000..bd6e8df
--- /dev/null
+++ b/Kconfig_single
@@ -0,0 +1,30 @@
+#
+# yaffs file system configurations
+#
+
+config YAFFS_FS
+ tristate "yaffs2 file system support"
+ default n
+ depends on MTD_BLOCK
+ select YAFFS_YAFFS1
+ select YAFFS_YAFFS2
+ help
+ yaffs2, or Yet Another Flash File System, is a file system
+ optimised for NAND Flash chips.
+
+ To compile the yaffs2 file system support as a module, choose M
+ here: the module will be called yaffs2.
+
+ If unsure, say N.
+
+ Further information on yaffs2 is available at
+ <http://www.aleph1.co.uk/yaffs/>.
+
+config YAFFS_DEBUG
+ bool "Enable yaffs debugging"
+ depends on YAFFS_FS
+ default n
+ help
+ Enable the yaffs debugging tracing.
+
+ If unsure, say N.
diff --git a/moduleconfig.h b/moduleconfig.h
index b8b0e89..c5b6cf1 100644
--- a/moduleconfig.h
+++ b/moduleconfig.h
@@ -18,64 +18,10 @@
#ifdef YAFFS_OUT_OF_TREE
-/* DO NOT UNSET THESE THREE. YAFFS2 will not compile if you do. */
#define CONFIG_YAFFS_FS
-#define CONFIG_YAFFS_YAFFS1
-#define CONFIG_YAFFS_YAFFS2
+#define CONFIG_YAFFS_DEBUG
-/* These options are independent of each other. Select those that matter. */
+#endif
-/* Default: Not selected */
-/* Meaning: Yaffs does its own ECC, rather than using MTD ECC */
-/* #define CONFIG_YAFFS_DOES_ECC */
+#endif
-/* Default: Selected */
-/* Meaning: Yaffs does ECC on tags for packed tags rather than use mtd */
-#define CONFIG_YAFFS_DOES_TAGS_ECC
-
-/* Default: Not selected */
-/* Meaning: ECC byte order is 'wrong'. Only meaningful if */
-/* CONFIG_YAFFS_DOES_ECC is set */
-/* #define CONFIG_YAFFS_ECC_WRONG_ORDER */
-
-/* Default: Not selected */
-/* Meaning: Always test whether chunks are erased before writing to them.
- Use during mtd debugging and init. */
-/* #define CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED */
-
-/* Default: Not Selected */
-/* Meaning: At mount automatically empty all files from lost and found. */
-/* This is done to fix an old problem where rmdir was not checking for an */
-/* empty directory. This can also be achieved with a mount option. */
-#define CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
-
-/* Default: Unselected */
-/* Meaning: Select to disable block refreshing. */
-/* Block Refreshing periodically rewrites the oldest block. */
-/* #define CONFIG_DISABLE_BLOCK_REFRESHING */
-
-/* Default: Unselected */
-/* Meaning: Select to disable background processing */
-/* #define CONFIG_DISABLE_BACKGROUND */
-
-/* Default: Selected */
-/* Meaning: Enable XATTR support */
-#define CONFIG_YAFFS_XATTR
-
-/*
-Older-style on-NAND data format has a "page_status" byte to record
-chunk/page state. This byte is zeroed when the page is discarded.
-Choose this option if you have existing on-NAND data in this format
-that you need to continue to support. New data written also uses the
-older-style format.
-Note: Use of this option generally requires that MTD's oob layout be
-adjusted to use the older-style format. See notes on tags formats and
-MTD versions in yaffs_mtdif1.c.
-*/
-/* Default: Not selected */
-/* Meaning: Use older-style on-NAND data format with page_status byte */
-/* #define CONFIG_YAFFS_9BYTE_TAGS */
-
-#endif /* YAFFS_OUT_OF_TREE */
-
-#endif /* __YAFFS_CONFIG_H__ */
diff --git a/patch-ker.sh b/patch-ker.sh
index ba6b6e4..41c5089 100755
--- a/patch-ker.sh
+++ b/patch-ker.sh
@@ -57,11 +57,13 @@ if [ $MULTIORSINGLE = m ]; then
MTD1_CODE="yaffs_mtdif1_multi.c"
MTD2_CODE="yaffs_mtdif2_multi.c"
YPORTENV="yportenv_multi.h"
+ KCONFIG="Kconfig_multi"
elif [ $MULTIORSINGLE = s ]; then
VFS_CODE="yaffs_vfs_single.c"
MTD1_CODE="yaffs_mtdif1_single.c"
MTD2_CODE="yaffs_mtdif2_single.c"
YPORTENV="yportenv_single.h"
+ KCONFIG="Kconfig_single"
echo ""
echo "*** Warning ***"
@@ -145,7 +147,7 @@ else
rm yaffs*.mod.c
mkdir $LINUXDIR/fs/yaffs2
$CPY $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile
- $CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2
+ $CPY $PWD/$KCONFIG $LINUXDIR/fs/yaffs2/Kconfig
$CPY $PWD/*.c $PWD/*.h $LINUXDIR/fs/yaffs2
rm $LINUXDIR/fs/yaffs2/yaffs_vfs*.c $LINUXDIR/fs/yaffs2/yaffs_mtdif[12]*.c
rm $LINUXDIR/fs/yaffs2/yportenv*.h
diff --git a/yaffs_ecc.c b/yaffs_ecc.c
index 0f41ec7..0f38807 100644
--- a/yaffs_ecc.c
+++ b/yaffs_ecc.c
@@ -128,12 +128,6 @@ void yaffs_ecc_cacl(const unsigned char *data, unsigned char *ecc)
t |= 0x01;
ecc[0] = ~t;
-#ifdef CONFIG_YAFFS_ECC_WRONG_ORDER
- /* Swap the bytes into the wrong order */
- t = ecc[0];
- ecc[0] = ecc[1];
- ecc[1] = t;
-#endif
}
/* Correct the ECC on a 256 byte block of data */
@@ -158,15 +152,6 @@ int yaffs_ecc_correct(unsigned char *data, unsigned char *read_ecc,
unsigned byte;
unsigned bit;
-#ifdef CONFIG_YAFFS_ECC_WRONG_ORDER
- /* swap the bytes to correct for the wrong order */
- unsigned char t;
-
- t = d0;
- d0 = d1;
- d1 = t;
-#endif
-
bit = byte = 0;
if (d1 & 0x80)
diff --git a/yaffs_guts.c b/yaffs_guts.c
index 109a0b7..cd70c54 100644
--- a/yaffs_guts.c
+++ b/yaffs_guts.c
@@ -671,7 +671,6 @@ static u16 yaffs_calc_name_sum(const YCHAR *name)
void yaffs_set_obj_name(struct yaffs_obj *obj, const YCHAR * name)
{
-#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
memset(obj->short_name, 0, sizeof(obj->short_name));
if (name &&
strnlen(name, YAFFS_SHORT_NAME_LENGTH + 1) <=
@@ -679,7 +678,6 @@ void yaffs_set_obj_name(struct yaffs_obj *obj, const YCHAR * name)
strcpy(obj->short_name, name);
else
obj->short_name[0] = _Y('\0');
-#endif
obj->sum = yaffs_calc_name_sum(name);
}
@@ -4413,13 +4411,11 @@ int yaffs_get_obj_name(struct yaffs_obj *obj, YCHAR *name, int buffer_size)
{
memset(name, 0, buffer_size * sizeof(YCHAR));
yaffs_check_obj_details_loaded(obj);
- if (obj->obj_id == YAFFS_OBJECTID_LOSTNFOUND)
+ if (obj->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
strncpy(name, YAFFS_LOSTNFOUND_NAME, buffer_size - 1);
-#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
- else if (obj->short_name[0])
+ } else if (obj->short_name[0]) {
strcpy(name, obj->short_name);
-#endif
- else if (obj->hdr_chunk > 0) {
+ } else if (obj->hdr_chunk > 0) {
int result;
u8 *buffer = yaffs_get_temp_buffer(obj->my_dev);
@@ -4533,8 +4529,6 @@ static int yaffs_check_dev_fns(const struct yaffs_dev *dev)
if (!dev->param.erase_fn || !dev->param.initialise_flash_fn)
return 0;
-#ifdef CONFIG_YAFFS_YAFFS2
-
/* Can use the "with tags" style interface for yaffs1 or yaffs2 */
if (dev->param.write_chunk_tags_fn &&
dev->param.read_chunk_tags_fn &&
@@ -4542,7 +4536,6 @@ static int yaffs_check_dev_fns(const struct yaffs_dev *dev)
!dev->param.read_chunk_fn &&
dev->param.bad_block_fn && dev->param.query_block_fn)
return 1;
-#endif
/* Can use the "spare" style interface for yaffs1 */
if (!dev->param.is_yaffs2 &&
diff --git a/yaffs_guts.h b/yaffs_guts.h
index 551fb7a..77c05d3 100644
--- a/yaffs_guts.h
+++ b/yaffs_guts.h
@@ -38,13 +38,13 @@
#define YAFFS_TNODES_INTERNAL_MASK 0x7
#define YAFFS_TNODES_MAX_LEVEL 6
-#ifndef CONFIG_YAFFS_NO_YAFFS1
+
+/* Constants for YAFFS1 mode */
#define YAFFS_BYTES_PER_SPARE 16
#define YAFFS_BYTES_PER_CHUNK 512
#define YAFFS_CHUNK_SIZE_SHIFT 9
#define YAFFS_CHUNKS_PER_BLOCK 32
#define YAFFS_BYTES_PER_BLOCK (YAFFS_CHUNKS_PER_BLOCK*YAFFS_BYTES_PER_CHUNK)
-#endif
#define YAFFS_MIN_YAFFS2_CHUNK_SIZE 1024
#define YAFFS_MIN_YAFFS2_SPARE_SIZE 32
@@ -117,12 +117,11 @@ struct yaffs_cache {
u8 *data;
};
-/* Tags structures in RAM
+/* yaffs1 tags structures in RAM
* NB This uses bitfield. Bitfields should not straddle a u32 boundary
* otherwise the structure size will get blown out.
*/
-#ifndef CONFIG_YAFFS_NO_YAFFS1
struct yaffs_tags {
unsigned chunk_id:20;
unsigned serial_number:2;
@@ -137,7 +136,6 @@ union yaffs_tags_union {
u8 as_bytes[8];
};
-#endif
/* Stuff used for extended tags in YAFFS2 */
@@ -281,10 +279,8 @@ struct yaffs_block_info {
u32 chunk_error_strikes:3; /* How many times we've had ecc etc
failures on this block and tried to reuse it */
-#ifdef CONFIG_YAFFS_YAFFS2
u32 has_shrink_hdr:1; /* This block has at least one shrink header */
u32 seq_number; /* block sequence number for yaffs2 */
-#endif
};
@@ -433,9 +429,7 @@ struct yaffs_obj {
u32 yst_mode;
-#ifndef CONFIG_YAFFS_NO_SHORT_NAMES
YCHAR short_name[YAFFS_SHORT_NAME_LENGTH + 1];
-#endif
#ifdef CONFIG_YAFFS_WINCE
u32 win_ctime[2];
@@ -521,6 +515,7 @@ struct yaffs_param {
*/
int use_nand_ecc; /* Flag to decide whether or not to use
* NAND driver ECC on data (yaffs1) */
+ int tags_9bytes; /* Use 9 byte tags */
int no_tags_ecc; /* Flag to decide whether or not to do ECC
* on packed tags (yaffs2) */
@@ -548,7 +543,7 @@ struct yaffs_param {
int (*initialise_flash_fn) (struct yaffs_dev *dev);
int (*deinitialise_flash_fn) (struct yaffs_dev *dev);
-#ifdef CONFIG_YAFFS_YAFFS2
+ /* yaffs2 mode functions */
int (*write_chunk_tags_fn) (struct yaffs_dev *dev,
int nand_chunk, const u8 *data,
const struct yaffs_ext_tags *tags);
@@ -559,7 +554,6 @@ struct yaffs_param {
int (*query_block_fn) (struct yaffs_dev *dev, int block_no,
enum yaffs_block_state *state,
u32 *seq_number);
-#endif
/* The remove_obj_fn function must be supplied by OS flavours that
* need it.
diff --git a/yaffs_mtdif1_multi.c b/yaffs_mtdif1_multi.c
index cbaa326..3673891 100644
--- a/yaffs_mtdif1_multi.c
+++ b/yaffs_mtdif1_multi.c
@@ -39,15 +39,10 @@
/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
-# define YTAG1_SIZE 8
-#else
-# define YTAG1_SIZE 9
-#endif
#if 0
/* Use the following nand_ecclayout with MTD when using
- * CONFIG_YAFFS_9BYTE_TAGS and the older on-NAND tags layout.
+ * 9 byte tags and the older on-NAND tags layout.
* If you have existing Yaffs images and the byte order differs from this,
* adjust 'oobfree' to match your existing Yaffs data.
*
@@ -113,25 +108,25 @@ int nandmtd1_write_chunk_tags(struct yaffs_dev *dev,
* that only zeroed-bits stick and set tag bytes to all-ones and
* zero just the (not) deleted bit.
*/
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
- if (etags->is_deleted) {
- memset(&pt1, 0xff, 8);
- /* clear delete status bit to indicate deleted */
- pt1.deleted = 0;
- }
-#else
- ((u8 *) &pt1)[8] = 0xff;
- if (etags->is_deleted) {
- memset(&pt1, 0xff, 8);
- /* zero page_status byte to indicate deleted */
- ((u8 *) &pt1)[8] = 0;
+ if(dev->param.tags_9bytes) {
+ ((u8 *) &pt1)[8] = 0xff;
+ if (etags->is_deleted) {
+ memset(&pt1, 0xff, 8);
+ /* zero page_status byte to indicate deleted */
+ ((u8 *) &pt1)[8] = 0;
+ }
+ } else {
+ if (etags->is_deleted) {
+ memset(&pt1, 0xff, 8);
+ /* clear delete status bit to indicate deleted */
+ pt1.deleted = 0;
+ }
}
-#endif
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunk_bytes : 0;
- ops.ooblen = YTAG1_SIZE;
+ ops.ooblen = dev->param.tags_9bytes ? 9 : 8;
ops.datbuf = (u8 *) data;
ops.oobbuf = (u8 *) &pt1;
@@ -184,7 +179,7 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev,
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunk_bytes : 0;
- ops.ooblen = YTAG1_SIZE;
+ ops.ooblen = dev->param.tags_9bytes ? 9 : 8;
ops.datbuf = data;
ops.oobbuf = (u8 *) &pt1;
@@ -230,16 +225,17 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev,
/* when blank, upper layers want ecc_result to be <= NO_ERROR */
return rettags(etags, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_OK);
}
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
- /* Read deleted status (bit) then return it to it's non-deleted
- * state before performing tags mini-ECC check. pt1.deleted is
- * inverted.
- */
- deleted = !pt1.deleted;
- pt1.deleted = 1;
-#else
- deleted = (hweight8(((u8 *) &pt1)[8]) < 7);
-#endif
+
+ if(dev->param.tags_9bytes) {
+ deleted = (hweight8(((u8 *) &pt1)[8]) < 7);
+ } else {
+ /* Read deleted status (bit) then return it to it's non-deleted
+ * state before performing tags mini-ECC check. pt1.deleted is
+ * inverted.
+ */
+ deleted = !pt1.deleted;
+ pt1.deleted = 1;
+ }
/* Check the packed tags mini-ECC and correct if necessary/possible.
*/
@@ -295,16 +291,16 @@ int nandmtd1_mark_block_bad(struct yaffs_dev *dev, int block_no)
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-static int nandmtd1_test_prerequists(struct mtd_info *mtd)
+static int nandmtd1_test_prerequists(struct yaffs_dev *dev, struct mtd_info *mtd)
{
/* 2.6.18 has mtd->ecclayout->oobavail */
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
int oobavail = mtd->ecclayout->oobavail;
- if (oobavail < YTAG1_SIZE) {
+ if (oobavail < (dev->param.tags_9bytes ? 9 : 8)) {
yaffs_trace(YAFFS_TRACE_ERROR,
"mtd device has only %d bytes for tags, need %d",
- oobavail, YTAG1_SIZE);
+ oobavail, dev->param.tags_9bytes ? 9 : 8);
return YAFFS_FAIL;
}
return YAFFS_OK;
@@ -333,7 +329,7 @@ int nandmtd1_query_block(struct yaffs_dev *dev, int block_no,
/* We don't yet have a good place to test for MTD config prerequists.
* Do it here as we are called during the initial scan.
*/
- if (nandmtd1_test_prerequists(mtd) != YAFFS_OK)
+ if (nandmtd1_test_prerequists(dev, mtd) != YAFFS_OK)
return YAFFS_FAIL;
retval = nandmtd1_read_chunk_tags(dev, chunk_num, NULL, &etags);
diff --git a/yaffs_mtdif1_single.c b/yaffs_mtdif1_single.c
index 03af8a8..467a031 100644
--- a/yaffs_mtdif1_single.c
+++ b/yaffs_mtdif1_single.c
@@ -35,12 +35,6 @@
#include "linux/types.h"
#include "linux/mtd/mtd.h"
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
-# define YTAG1_SIZE 8
-#else
-# define YTAG1_SIZE 9
-#endif
-
/* Write a chunk (page) of data to NAND.
*
* Caller always provides ExtendedTags data which are converted to a more
@@ -86,25 +80,26 @@ int nandmtd1_write_chunk_tags(struct yaffs_dev *dev,
* that only zeroed-bits stick and set tag bytes to all-ones and
* zero just the (not) deleted bit.
*/
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
- if (etags->is_deleted) {
- memset(&pt1, 0xff, 8);
- /* clear delete status bit to indicate deleted */
- pt1.deleted = 0;
- }
-#else
- ((u8 *) &pt1)[8] = 0xff;
- if (etags->is_deleted) {
- memset(&pt1, 0xff, 8);
- /* zero page_status byte to indicate deleted */
- ((u8 *) &pt1)[8] = 0;
- }
-#endif
+
+ if(dev->param.tags_9bytes) {
+ ((u8 *) &pt1)[8] = 0xff;
+ if (etags->is_deleted) {
+ memset(&pt1, 0xff, 8);
+ /* zero page_status byte to indicate deleted */
+ ((u8 *) &pt1)[8] = 0;
+ }
+ } else {
+ if (etags->is_deleted) {
+ memset(&pt1, 0xff, 8);
+ /* clear delete status bit to indicate deleted */
+ pt1.deleted = 0;
+ }
+ }
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunk_bytes : 0;
- ops.ooblen = YTAG1_SIZE;
+ ops.ooblen = dev->param.tags_9bytes ? 9 : 8;
ops.datbuf = (u8 *) data;
ops.oobbuf = (u8 *) &pt1;
@@ -157,7 +152,7 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev,
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunk_bytes : 0;
- ops.ooblen = YTAG1_SIZE;
+ ops.ooblen = dev->param.tags_9bytes ? 9 : 8;
ops.datbuf = data;
ops.oobbuf = (u8 *) &pt1;
@@ -270,10 +265,10 @@ static int nandmtd1_test_prerequists(struct mtd_info *mtd)
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
int oobavail = mtd->ecclayout->oobavail;
- if (oobavail < YTAG1_SIZE) {
+ if (oobavail < (dev->param.tags_9bytes ? 9 : 8)) {
yaffs_trace(YAFFS_TRACE_ERROR,
"mtd device has only %d bytes for tags, need %d",
- oobavail, YTAG1_SIZE);
+ oobavail, (dev->param.tags_9bytes ? 9 : 8);
return YAFFS_FAIL;
}
return YAFFS_OK;
diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c
index acf4348..7e28c40 100644
--- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c
@@ -176,7 +176,7 @@ unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS;
unsigned int yaffs_auto_checkpoint = 1;
unsigned int yaffs_gc_control = 1;
unsigned int yaffs_bg_enable = 1;
-
+unsigned int yaffs_auto_select = 1;
/* Module Parameters */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
module_param(yaffs_trace_mask, uint, 0644);
@@ -307,14 +307,12 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc);
static int yaffs_writepage(struct page *page);
#endif
-#ifdef CONFIG_YAFFS_XATTR
static int yaffs_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
static ssize_t yaffs_getxattr(struct dentry *dentry, const char *name,
void *buff, size_t size);
static int yaffs_removexattr(struct dentry *dentry, const char *name);
static ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size);
-#endif
#if (YAFFS_USE_WRITE_BEGIN_END != 0)
static int yaffs_write_begin(struct file *filp, struct address_space *mapping,
@@ -409,12 +407,10 @@ static void zero_user_segment(struct page *page, unsigned start, unsigned end)
static const struct inode_operations yaffs_file_inode_operations = {
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
static const struct inode_operations yaffs_symlink_inode_operations = {
@@ -424,12 +420,10 @@ static const struct inode_operations yaffs_symlink_inode_operations = {
.put_link = yaffs_put_link,
#endif
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
static const struct inode_operations yaffs_dir_inode_operations = {
@@ -443,12 +437,10 @@ static const struct inode_operations yaffs_dir_inode_operations = {
.mknod = yaffs_mknod,
.rename = yaffs_rename,
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
static const struct file_operations yaffs_dir_operations = {
@@ -1962,7 +1954,6 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
return error;
}
-#ifdef CONFIG_YAFFS_XATTR
static int yaffs_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
@@ -2065,7 +2056,6 @@ static ssize_t yaffs_listxattr(struct dentry * dentry, char *buff, size_t size)
return error;
}
-#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -2709,9 +2699,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
yaffs_trace(YAFFS_TRACE_OS, " size %lld", mtd->size);
#endif
-#ifdef CONFIG_YAFFS_AUTO_YAFFS2
-
- if (yaffs_version == 1 && WRITE_SIZE(mtd) >= 2048) {
+ if (yaffs_auto_select && yaffs_version == 1 && WRITE_SIZE(mtd) >= 2048) {
yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs2");
yaffs_version = 2;
}
@@ -2722,7 +2710,6 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs1");
yaffs_version = 1;
}
-#endif
if (yaffs_version == 2) {
/* Check for version 2 style functions */
@@ -2839,40 +2826,17 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
param->n_caches = (options.no_cache) ? 0 : 10;
param->inband_tags = options.inband_tags;
-#ifdef CONFIG_YAFFS_DISABLE_LAZY_LOAD
- param->disable_lazy_load = 1;
-#endif
-#ifdef CONFIG_YAFFS_XATTR
param->enable_xattr = 1;
-#endif
if (options.lazy_loading_overridden)
param->disable_lazy_load = !options.lazy_loading_enabled;
-#ifdef CONFIG_YAFFS_DISABLE_TAGS_ECC
- param->no_tags_ecc = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_BACKGROUND
-#else
param->defered_dir_update = 1;
-#endif
if (options.tags_ecc_overridden)
param->no_tags_ecc = !options.tags_ecc_on;
-#ifdef CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
param->empty_lost_n_found = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING
- param->refresh_period = 0;
-#else
param->refresh_period = 500;
-#endif
-
-#ifdef CONFIG_YAFFS__ALWAYS_CHECK_CHUNK_ERASED
- param->always_check_erased = 1;
-#endif
if (options.empty_lost_and_found_overridden)
param->empty_lost_n_found = options.empty_lost_and_found;
@@ -2921,13 +2885,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
yaffs_dev_to_lc(dev)->super = sb;
-#ifndef CONFIG_YAFFS_DOES_ECC
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;
@@ -3049,7 +3007,6 @@ static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
FS_REQUIRES_DEV);
#endif
-#ifdef CONFIG_YAFFS_YAFFS2
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
@@ -3095,7 +3052,6 @@ static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super,
FS_REQUIRES_DEV);
#endif
-#endif /* CONFIG_YAFFS_YAFFS2 */
static struct proc_dir_entry *my_proc_entry;
@@ -3394,12 +3350,6 @@ static int __init init_yaffs_fs(void)
yaffs_trace(YAFFS_TRACE_ALWAYS,
"yaffs built " __DATE__ " " __TIME__ " Installing.");
-#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
- yaffs_trace(YAFFS_TRACE_ALWAYS,
- " \n\n\n\nYAFFS-WARNING CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED selected.\n\n\n\n"
- );
-#endif
-
mutex_init(&yaffs_context_lock);
/* Install the proc_fs entries */
diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c
index 724bd3f..64e590c 100644
--- a/yaffs_vfs_single.c
+++ b/yaffs_vfs_single.c
@@ -72,6 +72,7 @@ unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS;
unsigned int yaffs_auto_checkpoint = 1;
unsigned int yaffs_gc_control = 1;
unsigned int yaffs_bg_enable = 1;
+unsigned int yaffs_auto_select = 1;
/* Module Parameters */
module_param(yaffs_trace_mask, uint, 0644);
@@ -79,6 +80,7 @@ module_param(yaffs_wr_attempts, uint, 0644);
module_param(yaffs_auto_checkpoint, uint, 0644);
module_param(yaffs_gc_control, uint, 0644);
module_param(yaffs_bg_enable, uint, 0644);
+module_param(yaffs_auto_select, uint, 0644);
#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
@@ -542,7 +544,6 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
return error;
}
-#ifdef CONFIG_YAFFS_XATTR
static int yaffs_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
@@ -627,8 +628,6 @@ static ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size)
return error;
}
-#endif
-
static const struct inode_operations yaffs_dir_inode_operations = {
.create = yaffs_create,
.lookup = yaffs_lookup,
@@ -640,12 +639,10 @@ static const struct inode_operations yaffs_dir_inode_operations = {
.mknod = yaffs_mknod,
.rename = yaffs_rename,
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
/*-----------------------------------------------------------------*/
/* Directory search context allows us to unlock access to yaffs during
@@ -1801,12 +1798,10 @@ static const struct address_space_operations yaffs_file_address_operations = {
static const struct inode_operations yaffs_file_inode_operations = {
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
static const struct inode_operations yaffs_symlink_inode_operations = {
@@ -1814,12 +1809,10 @@ static const struct inode_operations yaffs_symlink_inode_operations = {
.follow_link = yaffs_follow_link,
.put_link = yaffs_put_link,
.setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
.setxattr = yaffs_setxattr,
.getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
.removexattr = yaffs_removexattr,
-#endif
};
static void yaffs_fill_inode_from_obj(struct inode *inode,
@@ -2060,20 +2053,16 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
yaffs_trace(YAFFS_TRACE_OS, " erasesize %d", mtd->erasesize);
yaffs_trace(YAFFS_TRACE_OS, " size %lld", mtd->size);
-#ifdef CONFIG_YAFFS_AUTO_YAFFS2
-
- if (yaffs_version == 1 && mtd->writesize >= 2048) {
+ if (yaffs_auto_select && yaffs_version == 1 && mtd->writesize >= 2048) {
yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs2");
yaffs_version = 2;
}
- /* Added NCB 26/5/2006 for completeness */
- if (yaffs_version == 2 && !options.inband_tags &&
+ if (yaffs_auto_select && yaffs_version == 2 && !options.inband_tags &&
mtd->writesize == 512) {
yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs1");
yaffs_version = 1;
}
-#endif
if (yaffs_version == 2) {
/* Check for version 2 style functions */
@@ -2170,40 +2159,19 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
param->n_caches = (options.no_cache) ? 0 : 10;
param->inband_tags = options.inband_tags;
-#ifdef CONFIG_YAFFS_DISABLE_LAZY_LOAD
param->disable_lazy_load = 1;
-#endif
-#ifdef CONFIG_YAFFS_XATTR
param->enable_xattr = 1;
-#endif
if (options.lazy_loading_overridden)
param->disable_lazy_load = !options.lazy_loading_enabled;
-#ifdef CONFIG_YAFFS_DISABLE_TAGS_ECC
- param->no_tags_ecc = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_BACKGROUND
-#else
param->defered_dir_update = 1;
-#endif
if (options.tags_ecc_overridden)
param->no_tags_ecc = !options.tags_ecc_on;
-#ifdef CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
param->empty_lost_n_found = 1;
-#endif
-#ifdef CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING
- param->refresh_period = 0;
-#else
param->refresh_period = 500;
-#endif
-
-#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
- param->always_check_erased = 1;
-#endif
if (options.empty_lost_and_found_overridden)
param->empty_lost_n_found = options.empty_lost_and_found;
@@ -2242,9 +2210,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
yaffs_dev_to_lc(dev)->super = sb;
-#ifndef CONFIG_YAFFS_DOES_ECC
param->use_nand_ecc = 1;
-#endif
param->skip_checkpt_rd = options.skip_checkpoint_read;
param->skip_checkpt_wr = options.skip_checkpoint_write;
@@ -2343,8 +2309,6 @@ static struct file_system_type yaffs_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};
-#ifdef CONFIG_YAFFS_YAFFS2
-
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
int silent)
{
@@ -2366,7 +2330,7 @@ static struct file_system_type yaffs2_fs_type = {
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
-#endif /* CONFIG_YAFFS_YAFFS2 */
+
static struct proc_dir_entry *my_proc_entry;
@@ -2505,149 +2469,6 @@ static int yaffs_proc_read(char *page,
}
-/**
- * Set the verbosity of the warnings and error messages.
- *
- * Note that the names can only be a..z or _ with the current code.
- */
-
-static struct {
- char *mask_name;
- unsigned mask_bitfield;
-} mask_flags[] = {
- {"allocate", YAFFS_TRACE_ALLOCATE},
- {"always", YAFFS_TRACE_ALWAYS},
- {"background", YAFFS_TRACE_BACKGROUND},
- {"bad_blocks", YAFFS_TRACE_BAD_BLOCKS},
- {"buffers", YAFFS_TRACE_BUFFERS},
- {"bug", YAFFS_TRACE_BUG},
- {"checkpt", YAFFS_TRACE_CHECKPOINT},
- {"deletion", YAFFS_TRACE_DELETION},
- {"erase", YAFFS_TRACE_ERASE},
- {"error", YAFFS_TRACE_ERROR},
- {"gc_detail", YAFFS_TRACE_GC_DETAIL},
- {"gc", YAFFS_TRACE_GC},
- {"lock", YAFFS_TRACE_LOCK},
- {"mtd", YAFFS_TRACE_MTD},
- {"nandaccess", YAFFS_TRACE_NANDACCESS},
- {"os", YAFFS_TRACE_OS},
- {"scan_debug", YAFFS_TRACE_SCAN_DEBUG},
- {"scan", YAFFS_TRACE_SCAN},
- {"mount", YAFFS_TRACE_MOUNT},
- {"tracing", YAFFS_TRACE_TRACING},
- {"sync", YAFFS_TRACE_SYNC},
- {"write", YAFFS_TRACE_WRITE},
- {"verify", YAFFS_TRACE_VERIFY},
- {"verify_nand", YAFFS_TRACE_VERIFY_NAND},
- {"verify_full", YAFFS_TRACE_VERIFY_FULL},
- {"verify_all", YAFFS_TRACE_VERIFY_ALL},
- {"all", 0xffffffff},
- {"none", 0},
- {NULL, 0},
-};
-
-#define MAX_MASK_NAME_LENGTH 40
-static int yaffs_proc_write_trace_options(struct file *file, const char *buf,
- unsigned long count, void *data)
-{
- unsigned rg = 0, mask_bitfield;
- char *end;
- char *mask_name;
- const char *x;
- char substring[MAX_MASK_NAME_LENGTH + 1];
- int i;
- int done = 0;
- int add, len = 0;
- int pos = 0;
-
- rg = yaffs_trace_mask;
-
- while (!done && (pos < count)) {
- done = 1;
- while ((pos < count) && isspace(buf[pos]))
- pos++;
-
- switch (buf[pos]) {
- case '+':
- case '-':
- case '=':
- add = buf[pos];
- pos++;
- break;
-
- default:
- add = ' ';
- break;
- }
- mask_name = NULL;
-
- mask_bitfield = simple_strtoul(buf + pos, &end, 0);
-
- if (end > buf + pos) {
- mask_name = "numeral";
- len = end - (buf + pos);
- pos += len;
- done = 0;
- } else {
- for (x = buf + pos, i = 0;
- (*x == '_' || (*x >= 'a' && *x <= 'z')) &&
- i < MAX_MASK_NAME_LENGTH; x++, i++, pos++)
- substring[i] = *x;
- substring[i] = '\0';
-
- for (i = 0; mask_flags[i].mask_name != NULL; i++) {
- if (strcmp(substring, mask_flags[i].mask_name)
- == 0) {
- mask_name = mask_flags[i].mask_name;
- mask_bitfield =
- mask_flags[i].mask_bitfield;
- done = 0;
- break;
- }
- }
- }
-
- if (mask_name != NULL) {
- done = 0;
- switch (add) {
- case '-':
- rg &= ~mask_bitfield;
- break;
- case '+':
- rg |= mask_bitfield;
- break;
- case '=':
- rg = mask_bitfield;
- break;
- default:
- rg |= mask_bitfield;
- break;
- }
- }
- }
-
- yaffs_trace_mask = rg | YAFFS_TRACE_ALWAYS;
-
- printk(KERN_DEBUG "new trace = 0x%08X\n", yaffs_trace_mask);
-
- if (rg & YAFFS_TRACE_ALWAYS) {
- for (i = 0; mask_flags[i].mask_name != NULL; i++) {
- char flag;
- flag = ((rg & mask_flags[i].mask_bitfield) ==
- mask_flags[i].mask_bitfield) ? '+' : '-';
- printk(KERN_DEBUG "%c%s\n", flag,
- mask_flags[i].mask_name);
- }
- }
-
- return count;
-}
-
-static int yaffs_proc_write(struct file *file, const char *buf,
- unsigned long count, void *data)
-{
- return yaffs_proc_write_trace_options(file, buf, count, data);
-}
/* Stuff to handle installation of file systems */
struct file_system_to_install {
@@ -2669,11 +2490,6 @@ static int __init init_yaffs_fs(void)
yaffs_trace(YAFFS_TRACE_ALWAYS,
"yaffs built " __DATE__ " " __TIME__ " Installing.");
-#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
- yaffs_trace(YAFFS_TRACE_ALWAYS,
- "\n\nYAFFS-WARNING CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED selected.\n\n\n");
-#endif
-
mutex_init(&yaffs_context_lock);
/* Install the proc_fs entries */
@@ -2681,7 +2497,7 @@ static int __init init_yaffs_fs(void)
S_IRUGO | S_IFREG, NULL);
if (my_proc_entry) {
- my_proc_entry->write_proc = yaffs_proc_write;
+ my_proc_entry->write_proc = NULL;
my_proc_entry->read_proc = yaffs_proc_read;
my_proc_entry->data = NULL;
} else {
diff --git a/yportenv_single.h b/yportenv_single.h
index aa7c22b..d819475 100644
--- a/yportenv_single.h
+++ b/yportenv_single.h
@@ -49,11 +49,14 @@
#define compile_time_assertion(assertion) \
({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
-
+#ifdef CONFIG_YAFFS_DEBUG
#define yaffs_trace(msk, fmt, ...) do { \
if (yaffs_trace_mask & (msk)) \
printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
} while (0)
-
+#else
+#define yaffs_trace(msk, fmt, ...) do { \
+} while (0)
+#endif
#endif