Split out low level init code for making low level tests
authorCharles Manning <cdhmanning@gmail.com>
Wed, 12 Jun 2013 23:09:45 +0000 (11:09 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 12 Jun 2013 23:09:45 +0000 (11:09 +1200)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c
yaffs_guts.h
yportenv_multi.h
yportenv_single.h

index 9f6b40964b5e85d154294fef73af38b544634cd8..ed5a005ebc1873e5a30d7691db730386e9c0bd1a 100644 (file)
@@ -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;
 
index 64929ed37c29b6e4debf22e83b1a38a288d33fa5..79cec3333ec000fe241e656b23350345276c762d 100644 (file)
@@ -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,
index 666d909bf6018299da92aa522f51f6b1824c6831..8975af331ea12230ab0b8db9dcf2a2092e9c2e31 100644 (file)
@@ -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__); \
index d8194754a8f3c49dd20e28b982b681095b73191a..76a7914940fcfa6f437b535a2771f6605a896630 100644 (file)
@@ -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)) \