1 /* 2 * Copyright (c) 2006-2018, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 */ 9 #ifndef __DFS_JFFS2_H__ 10 #define __DFS_JFFS2_H__ 11 12 #include "mtd_partition.h" 13 #include "os-ecos.h" 14 #include "fileio.h" 15 16 #ifdef __cplusplus 17 #if __cplusplus 18 extern "C" { 19 #endif /* __cplusplus */ 20 #endif /* __cplusplus */ 21 22 #ifndef NOR_FLASH_BOOT_SIZE 23 #define NOR_FLASH_BOOT_SIZE 0x100000 24 #endif 25 26 #define JFFS_WAITING_FOREVER -1 /* Block forever until get resource. */ 27 28 29 struct los_jffs2_operations { 30 int (*mount) (cyg_mtab_entry *mte, int partition_num); 31 int (*stat) (cyg_mtab_entry *mte, const char *name, struct jffs2_stat *buf); 32 int (*open) (cyg_mtab_entry *mte, const char *name, int flags, 33 int mode, cyg_file *fte); 34 int (*close) (struct CYG_FILE_TAG *fp); 35 int (*read) (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); 36 int (*write) (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); 37 int (*lseek) (struct CYG_FILE_TAG *fp, off_t *apos, int whence); 38 int (*opendir) (cyg_mtab_entry *mte, const char *name, cyg_file *fte); 39 int (*mkdir) (cyg_mtab_entry *mte, const char *name, int mode); 40 int (*rmdir) (cyg_mtab_entry *mte, const char *name); 41 int (*unlink) (cyg_mtab_entry *mte, const char *name); 42 int (*rename) (cyg_mtab_entry *mte, const char *name1, const char *name2); 43 int (*readdir) (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); 44 int (*lseekdir) (struct CYG_FILE_TAG *fp, off_t *pos, int whence); 45 int (*umount) (cyg_mtab_entry *mte); 46 int (*chattr) (cyg_mtab_entry *mte, const char *name, iattr *attr); 47 }; 48 49 extern struct los_jffs2_operations jffs2_fs_type; 50 extern struct los_jffs2_operations jffs2_file_operations; 51 extern struct los_jffs2_operations jffs2_dir_operations; 52 extern struct los_jffs2_operations jffs2_dir_inode_operations; 53 54 int JffsMutexCreate(void); 55 void JffsMutexDelete(void); 56 57 #ifdef __cplusplus 58 #if __cplusplus 59 } 60 #endif /* __cplusplus */ 61 #endif /* __cplusplus */ 62 63 #endif 64