porting.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _PORTING_H
  2. #define _PORTING_H
  3. #include "jffs2_config.h"
  4. /* the following should be same with os_sys_stat.h */
  5. #define JFFS2_S_IFMT 0x000003FF
  6. #define JFFS2_S_IFDIR (1<<0)
  7. #define JFFS2_S_IFREG (1<<3)
  8. struct jffs2_fs_info
  9. {
  10. unsigned sector_size; /* a erasing block size*/
  11. unsigned nr_blocks; /* number of blocks in flash */
  12. unsigned free_size;
  13. };
  14. struct jffs2_stat {
  15. unsigned long st_mode; /* File mode */
  16. unsigned int st_ino; /* File serial number */
  17. unsigned int st_dev; /* ID of device containing file */
  18. unsigned short st_nlink; /* Number of hard links */
  19. unsigned short st_uid; /* User ID of the file owner */
  20. unsigned short st_gid; /* Group ID of the file's group */
  21. long st_size; /* File size (regular files only) */
  22. long st_atime; /* Last access time */
  23. long st_mtime; /* Last data modification time */
  24. long st_ctime; /* Last file status change time */
  25. };
  26. #ifndef NAME_MAX
  27. #define NAME_MAX 14
  28. #endif
  29. struct jffs2_dirent
  30. {
  31. #ifdef CYGPKG_FILEIO_DIRENT_DTYPE
  32. unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
  33. // and JFFS2.
  34. // d_type is not part of POSIX so
  35. // should be used with caution.
  36. #endif
  37. char d_name[NAME_MAX+1];
  38. };
  39. extern cyg_fileops jffs2_fileops;
  40. extern cyg_fileops jffs2_dirops;
  41. extern struct cyg_fstab_entry jffs2_fste;
  42. time_t jffs2_get_timestamp(void);
  43. void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info);
  44. int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
  45. void * stat_buf);
  46. #endif