porting.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef _PORTING_H
  2. #define _PORTING_H
  3. /* the following should be same with os_sys_stat.h */
  4. #define JFFS2_S_IFMT 0x000003FF
  5. #define JFFS2_S_IFDIR (1<<0)
  6. #define JFFS2_S_IFREG (1<<3)
  7. struct jffs2_fs_info
  8. {
  9. unsigned sector_size; /* a erasing block size*/
  10. unsigned nr_blocks; /* number of blocks in flash */
  11. unsigned free_size;
  12. };
  13. struct jffs2_stat {
  14. unsigned long st_mode; /* File mode */
  15. unsigned int st_ino; /* File serial number */
  16. unsigned int st_dev; /* ID of device containing file */
  17. unsigned short st_nlink; /* Number of hard links */
  18. unsigned short st_uid; /* User ID of the file owner */
  19. unsigned short st_gid; /* Group ID of the file's group */
  20. long st_size; /* File size (regular files only) */
  21. long st_atime; /* Last access time */
  22. long st_mtime; /* Last data modification time */
  23. long st_ctime; /* Last file status change time */
  24. };
  25. #ifndef NAME_MAX
  26. #define NAME_MAX 14
  27. #endif
  28. struct jffs2_dirent
  29. {
  30. unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
  31. // and JFFS2.
  32. // d_type is not part of POSIX so
  33. // should be used with caution.
  34. char d_name[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