porting.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. struct jffs2_dirent
  27. {
  28. #ifdef CYGPKG_FILEIO_DIRENT_DTYPE
  29. unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
  30. // and JFFS2.
  31. // d_type is not part of POSIX so
  32. // should be used with caution.
  33. #endif
  34. char d_name[JFFS2_NAME_MAX+1];
  35. };
  36. extern cyg_fileops jffs2_fileops;
  37. extern cyg_fileops jffs2_dirops;
  38. extern struct cyg_fstab_entry jffs2_fste;
  39. time_t jffs2_get_timestamp(void);
  40. void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info);
  41. int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
  42. void * stat_buf);
  43. #endif