Mercurial > yaffs-ecoscentric
comparison packages/fs/yaffs/current/src/ecos-yaffs.c @ 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 |
comparison
equal
deleted
inserted
replaced
| 356:531f5810eaf7 | 357:9f250509e64c |
|---|---|
| 525 | 525 |
| 526 // Option handling. Defaults come from CDL. | 526 // Option handling. Defaults come from CDL. |
| 527 int o_nReserved = CYGNUM_FS_YAFFS_RESERVED_BLOCKS; | 527 int o_nReserved = CYGNUM_FS_YAFFS_RESERVED_BLOCKS; |
| 528 int o_nShortOpCaches = CYGNUM_FS_YAFFS_SHORTOP_CACHES; | 528 int o_nShortOpCaches = CYGNUM_FS_YAFFS_SHORTOP_CACHES; |
| 529 int o_skipCheckpointRead = 0; | 529 int o_skipCheckpointRead = 0; |
| 530 // (eCosPro can change these at mount time.) | 530 |
| 531 | 531 #if defined(CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO) && (CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO == 1) |
| 532 #if 0 // Applicable only to eCosPro | |
| 533 if (mte->options) { | 532 if (mte->options) { |
| 534 int t; | 533 int t; |
| 535 char buf[10]; | 534 char buf[10]; |
| 536 // reserved=<int>: Number of blocks to reserve (minimum 2) | 535 // reserved=<int>: Number of blocks to reserve (minimum 2) |
| 537 if (0==cyg_fs_get_option(mte->options, "reserved", buf, sizeof buf)) { | 536 if (0==cyg_fs_get_option(mte->options, "reserved", buf, sizeof buf)) { |
| 564 struct mallinfo mi = mallinfo(); | 563 struct mallinfo mi = mallinfo(); |
| 565 unsigned want = ( 1 << (nand->block_page_bits + 1) ) * (1 + part->last - part->first); | 564 unsigned want = ( 1 << (nand->block_page_bits + 1) ) * (1 + part->last - part->first); |
| 566 if ( mi.fordblks < want) { | 565 if ( mi.fordblks < want) { |
| 567 TOUT(("eyaffs_mount: warning: arena reports %u bytes free; %u recommended for this device\n", mi.fordblks, want)); | 566 TOUT(("eyaffs_mount: warning: arena reports %u bytes free; %u recommended for this device\n", mi.fordblks, want)); |
| 568 } | 567 } |
| 569 | 568 #endif // CYGSEM_FS_YAFFS_COMPATIBILITY |
| 570 #endif | |
| 571 | 569 |
| 572 yaffs_Device *y = YMALLOC(sizeof(yaffs_Device)); // ^^^^^^^^^^^^^^^^ | 570 yaffs_Device *y = YMALLOC(sizeof(yaffs_Device)); // ^^^^^^^^^^^^^^^^ |
| 573 if (!y) EG(ENOMEM); | 571 if (!y) EG(ENOMEM); |
| 574 memset(y, 0, sizeof(yaffs_Device)); | 572 memset(y, 0, sizeof(yaffs_Device)); |
| 575 y->name = mte->devname; | 573 y->name = mte->devname; |
| 651 err_exit: | 649 err_exit: |
| 652 if (y) YFREE(y); | 650 if (y) YFREE(y); |
| 653 return _err; | 651 return _err; |
| 654 } | 652 } |
| 655 | 653 |
| 654 #if defined(CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO) && (CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO == 1) | |
| 655 static int eyaffs_umount ( cyg_mtab_entry *mte, cyg_bool force ) | |
| 656 #else | |
| 656 static int eyaffs_umount ( cyg_mtab_entry *mte ) | 657 static int eyaffs_umount ( cyg_mtab_entry *mte ) |
| 658 #endif | |
| 657 { | 659 { |
| 658 yaffs_Device *y = (yaffs_Device*) mte->data; | 660 yaffs_Device *y = (yaffs_Device*) mte->data; |
| 659 | 661 |
| 660 yaffs_FlushEntireDeviceCache(y); | 662 yaffs_FlushEntireDeviceCache(y); |
| 661 yaffs_CheckpointSave(y); | 663 yaffs_CheckpointSave(y); |
| 974 (void)y; | 976 (void)y; |
| 975 #endif | 977 #endif |
| 976 | 978 |
| 977 case FS_INFO_GETCWD: | 979 case FS_INFO_GETCWD: |
| 978 // yaffs doesn't provide anything special, we'd only end up duplicating the fallback ".." method. | 980 // yaffs doesn't provide anything special, we'd only end up duplicating the fallback ".." method. |
| 979 default: // others not supported | 981 case FS_INFO_ATTRIB: // not supported |
| 982 #ifdef FS_INFO_CALLBACK | |
| 983 case FS_INFO_CALLBACK: // not supported | |
| 984 #endif | |
| 985 default: | |
| 980 return ENOSYS; | 986 return ENOSYS; |
| 981 } | 987 } |
| 982 | 988 |
| 983 init_dirsearch(&ds, (yaffs_Object*) dir, name); | 989 init_dirsearch(&ds, (yaffs_Object*) dir, name); |
| 984 _err = eyaffs_find(&ds); | 990 _err = eyaffs_find(&ds); |
| 987 switch(key) { | 993 switch(key) { |
| 988 case FS_INFO_CONF: | 994 case FS_INFO_CONF: |
| 989 if (len < sizeof (struct cyg_pathconf_info)) return EINVAL; | 995 if (len < sizeof (struct cyg_pathconf_info)) return EINVAL; |
| 990 return eyaffs_pathconf(ds.node, (struct cyg_pathconf_info *) buf); | 996 return eyaffs_pathconf(ds.node, (struct cyg_pathconf_info *) buf); |
| 991 | 997 |
| 998 #ifdef FS_INFO_MBCS_TRANSLATE | |
| 999 case FS_INFO_MBCS_TRANSLATE: | |
| 1000 #endif | |
| 992 default: | 1001 default: |
| 993 return ENOSYS; | 1002 return ENOSYS; |
| 994 } | 1003 } |
| 995 } | 1004 } |
| 996 | 1005 |
| 1008 int key, void *buf, int len ) | 1017 int key, void *buf, int len ) |
| 1009 { | 1018 { |
| 1010 switch (key) { | 1019 switch (key) { |
| 1011 case FS_INFO_SYNC: | 1020 case FS_INFO_SYNC: |
| 1012 return eyaffs_do_sync_fs( (yaffs_Device*) mte->data ); | 1021 return eyaffs_do_sync_fs( (yaffs_Device*) mte->data ); |
| 1022 case FS_INFO_ATTRIB: // not supported | |
| 1023 #ifdef FS_INFO_CALLBACK | |
| 1024 case FS_INFO_CALLBACK: // not supported | |
| 1025 #endif | |
| 1026 #ifdef FS_INFO_SECURE_ERASE | |
| 1027 case FS_INFO_SECURE_ERASE: | |
| 1028 #endif | |
| 1029 #ifdef FS_INFO_MBCS_TRANSLATE | |
| 1030 case FS_INFO_MBCS_TRANSLATE: | |
| 1031 #endif | |
| 1032 return ENOSYS; | |
| 1013 } | 1033 } |
| 1014 return EINVAL; | 1034 return EINVAL; |
| 1015 } | 1035 } |
| 1016 | 1036 |
| 1017 FSTAB_ENTRY(eyaffs_fste, "yaffs", 0, CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, | 1037 FSTAB_ENTRY(eyaffs_fste, "yaffs", 0, CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, |
| 1038 /* N.B. If you get a build failure here (initialization | |
| 1039 from incompatible pointer type), it might be because you're | |
| 1040 using this GPL-licensed package on eCosPro and need to set | |
| 1041 CYGSEM_FS_YAFFS_COMPATIBILITY_ECOSPRO. | |
| 1042 */ | |
| 1018 eyaffs_mount, | 1043 eyaffs_mount, |
| 1019 eyaffs_umount, | 1044 eyaffs_umount, |
| 1020 eyaffs_open, | 1045 eyaffs_open, |
| 1021 eyaffs_unlink, | 1046 eyaffs_unlink, |
| 1022 eyaffs_mkdir, | 1047 eyaffs_mkdir, |
