From 1dd2d1919e78641592098968e221b661a7451a58 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Thu, 13 Jun 2013 11:09:45 +1200 Subject: [PATCH] Split out low level init code for making low level tests Signed-off-by: Charles Manning --- yaffs_guts.c | 35 +++++++++++++++++++++++++---------- yaffs_guts.h | 2 ++ yportenv_multi.h | 3 +++ yportenv_single.h | 3 +++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/yaffs_guts.c b/yaffs_guts.c index 9f6b409..ed5a005 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -4593,11 +4593,14 @@ static int yaffs_create_initial_dir(struct yaffs_dev *dev) return YAFFS_FAIL; } -int yaffs_guts_initialise(struct yaffs_dev *dev) +/* Low level init. + * Typically only used by yaffs_guts_initialise, but also used by the + * Low level yaffs driver tests. + */ + +int yaffs_guts_ll_init(struct yaffs_dev *dev) { - int init_failed = 0; - unsigned x; - int bits; + yaffs_trace(YAFFS_TRACE_TRACING, "yaffs: yaffs_guts_initialise()"); @@ -4653,11 +4656,6 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) return YAFFS_FAIL; } - if (yaffs_init_nand(dev) != YAFFS_OK) { - yaffs_trace(YAFFS_TRACE_ALWAYS, "InitialiseNAND failed"); - return YAFFS_FAIL; - } - /* Sort out space for inband tags, if required */ if (dev->param.inband_tags) dev->data_bytes_per_chunk = @@ -4675,7 +4673,24 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) return YAFFS_FAIL; } - /* Finished with most checks. Further checks happen later on too. */ + return YAFFS_OK; +} + + +int yaffs_guts_initialise(struct yaffs_dev *dev) +{ + int init_failed = 0; + unsigned x; + int bits; + + if(yaffs_guts_ll_init(dev) != YAFFS_OK) + return YAFFS_FAIL; + + + if (yaffs_init_nand(dev) != YAFFS_OK) { + yaffs_trace(YAFFS_TRACE_ALWAYS, "InitialiseNAND failed"); + return YAFFS_FAIL; + } dev->is_mounted = 1; diff --git a/yaffs_guts.h b/yaffs_guts.h index 64929ed..79cec33 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -923,6 +923,8 @@ int yaffs_bg_gc(struct yaffs_dev *dev, unsigned urgency); int yaffs_dump_obj(struct yaffs_obj *obj); void yaffs_guts_test(struct yaffs_dev *dev); +int yaffs_guts_ll_init(struct yaffs_dev *dev); + /* A few useful functions to be used within the core files*/ void yaffs_chunk_del(struct yaffs_dev *dev, int chunk_id, int mark_flash, diff --git a/yportenv_multi.h b/yportenv_multi.h index 666d909..8975af3 100644 --- a/yportenv_multi.h +++ b/yportenv_multi.h @@ -73,6 +73,9 @@ ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; }) +#define yaffs_printf(msk, fmt, ...) \ + printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__) + #define yaffs_trace(msk, fmt, ...) do { \ if (yaffs_trace_mask & (msk)) \ printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \ diff --git a/yportenv_single.h b/yportenv_single.h index d819475..76a7914 100644 --- a/yportenv_single.h +++ b/yportenv_single.h @@ -49,6 +49,9 @@ #define compile_time_assertion(assertion) \ ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; }) +#define yaffs_printf(msk, fmt, ...) \ + printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__) + #ifdef CONFIG_YAFFS_DEBUG #define yaffs_trace(msk, fmt, ...) do { \ if (yaffs_trace_mask & (msk)) \ -- 2.30.2