changeset 357:9f250509e64c

Tweaks to allow GPL YAFFS to work with eCosPro
author Ross Younger <wry@ecoscentric.com>
date Tue, 01 Dec 2009 17:34:28 +0000
parents 531f5810eaf7
children 3de713ddbde9
files packages/fs/yaffs/current/ChangeLog packages/fs/yaffs/current/cdl/yaffs.cdl packages/fs/yaffs/current/src/ecos-yaffs.c
diffstat 3 files changed, 45 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/yaffs/current/ChangeLog
+++ b/packages/fs/yaffs/current/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-01  Ross Younger  <wry@ecoscentric.com>
+
+	* ecos-yaffs.c: Interface tweaks to allow this this package
+	to be easily used with eCosPro.
+	* yaffs.cdl: Create CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO switch
+	for the above, default off (i.e. for anoncvs).
+
 2009-11-19  Ross Younger  <wry@ecoscentric.com>
 
 	* ecos-yaffs.c, ecos-yaffs-nand.c: Update to NAND interface v2.
--- a/packages/fs/yaffs/current/cdl/yaffs.cdl
+++ b/packages/fs/yaffs/current/cdl/yaffs.cdl
@@ -225,6 +225,14 @@ cdl_package CYGPKG_FS_YAFFS {
             this function."
     }
 
+    cdl_option CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO {
+        display         "eCosPro compatibility mode"
+        flavor          bool
+        default_value   0
+        description     "This package is targetted at eCos but may be
+            built under eCosPro by setting this switch."
+    }
+
 	cdl_option CYGPKG_FS_YAFFS_TESTS {
 		display "YAFFS filesystem tests"
 		flavor data
--- a/packages/fs/yaffs/current/src/ecos-yaffs.c
+++ b/packages/fs/yaffs/current/src/ecos-yaffs.c
@@ -527,9 +527,8 @@ static int eyaffs_mount    ( cyg_fstab_e
     int o_nReserved = CYGNUM_FS_YAFFS_RESERVED_BLOCKS;
     int o_nShortOpCaches = CYGNUM_FS_YAFFS_SHORTOP_CACHES;
     int o_skipCheckpointRead = 0;
-    // (eCosPro can change these at mount time.)
 
-#if 0 // Applicable only to eCosPro
+#if defined(CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO) && (CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO == 1)
     if (mte->options) {
         int t;
         char buf[10];
@@ -566,8 +565,7 @@ static int eyaffs_mount    ( cyg_fstab_e
     if ( mi.fordblks < want) {
         TOUT(("eyaffs_mount: warning: arena reports %u bytes free; %u recommended for this device\n", mi.fordblks, want));
     }
-
-#endif
+#endif // CYGSEM_FS_YAFFS_COMPATIBILITY
 
     yaffs_Device *y = YMALLOC(sizeof(yaffs_Device)); // ^^^^^^^^^^^^^^^^
     if (!y) EG(ENOMEM);
@@ -653,7 +651,11 @@ err_exit:
     return _err;
 }
 
+#if defined(CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO) && (CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO == 1)
+static int eyaffs_umount   ( cyg_mtab_entry *mte, cyg_bool force )
+#else
 static int eyaffs_umount   ( cyg_mtab_entry *mte )
+#endif
 {
     yaffs_Device *y = (yaffs_Device*) mte->data;
     
@@ -976,7 +978,11 @@ static int eyaffs_getinfo( cyg_mtab_entr
 
         case FS_INFO_GETCWD:
             // yaffs doesn't provide anything special, we'd only end up duplicating the fallback ".." method.
-        default: // others not supported
+        case FS_INFO_ATTRIB: // not supported
+#ifdef FS_INFO_CALLBACK
+        case FS_INFO_CALLBACK: // not supported
+#endif
+        default:
             return ENOSYS;
     }
 
@@ -989,6 +995,9 @@ static int eyaffs_getinfo( cyg_mtab_entr
             if (len < sizeof (struct cyg_pathconf_info)) return EINVAL;
             return eyaffs_pathconf(ds.node, (struct cyg_pathconf_info *) buf);
 
+#ifdef FS_INFO_MBCS_TRANSLATE
+        case FS_INFO_MBCS_TRANSLATE:
+#endif
         default:
             return ENOSYS;
     }
@@ -1010,11 +1019,27 @@ static int eyaffs_setinfo( cyg_mtab_entr
     switch (key) {
         case FS_INFO_SYNC:
             return eyaffs_do_sync_fs( (yaffs_Device*) mte->data );
+        case FS_INFO_ATTRIB: // not supported
+#ifdef FS_INFO_CALLBACK
+        case FS_INFO_CALLBACK: // not supported
+#endif
+#ifdef FS_INFO_SECURE_ERASE
+        case FS_INFO_SECURE_ERASE:
+#endif
+#ifdef FS_INFO_MBCS_TRANSLATE
+        case FS_INFO_MBCS_TRANSLATE:
+#endif
+            return ENOSYS;
     }
     return EINVAL;
 }
 
 FSTAB_ENTRY(eyaffs_fste, "yaffs", 0, CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, 
+        /* N.B. If you get a build failure here (initialization
+           from incompatible pointer type), it might be because you're
+           using this GPL-licensed package on eCosPro and need to set
+           CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO.
+         */
         eyaffs_mount,
         eyaffs_umount,
         eyaffs_open,