2012-01-31 09:29:22 +08:00
|
|
|
#ifndef _PORTING_H
|
|
|
|
#define _PORTING_H
|
|
|
|
|
2012-03-06 22:50:19 +08:00
|
|
|
#include "jffs2_config.h"
|
2012-01-31 09:29:22 +08:00
|
|
|
/* the following should be same with os_sys_stat.h */
|
|
|
|
#define JFFS2_S_IFMT 0x000003FF
|
|
|
|
#define JFFS2_S_IFDIR (1<<0)
|
|
|
|
#define JFFS2_S_IFREG (1<<3)
|
|
|
|
|
|
|
|
struct jffs2_fs_info
|
|
|
|
{
|
|
|
|
unsigned sector_size; /* a erasing block size*/
|
|
|
|
unsigned nr_blocks; /* number of blocks in flash */
|
|
|
|
unsigned free_size;
|
|
|
|
};
|
|
|
|
|
2012-01-14 02:45:44 +08:00
|
|
|
struct jffs2_stat {
|
|
|
|
unsigned long st_mode; /* File mode */
|
|
|
|
unsigned int st_ino; /* File serial number */
|
|
|
|
unsigned int st_dev; /* ID of device containing file */
|
|
|
|
unsigned short st_nlink; /* Number of hard links */
|
|
|
|
unsigned short st_uid; /* User ID of the file owner */
|
|
|
|
unsigned short st_gid; /* Group ID of the file's group */
|
|
|
|
long st_size; /* File size (regular files only) */
|
|
|
|
long st_atime; /* Last access time */
|
|
|
|
long st_mtime; /* Last data modification time */
|
|
|
|
long st_ctime; /* Last file status change time */
|
2012-01-31 09:29:22 +08:00
|
|
|
};
|
|
|
|
#ifndef NAME_MAX
|
|
|
|
#define NAME_MAX 14
|
|
|
|
#endif
|
|
|
|
|
2012-01-14 02:45:44 +08:00
|
|
|
struct jffs2_dirent
|
|
|
|
{
|
2012-03-06 22:50:19 +08:00
|
|
|
#ifdef CYGPKG_FILEIO_DIRENT_DTYPE
|
|
|
|
|
2012-01-14 02:45:44 +08:00
|
|
|
unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
|
|
|
|
// and JFFS2.
|
|
|
|
// d_type is not part of POSIX so
|
|
|
|
// should be used with caution.
|
2012-03-06 22:50:19 +08:00
|
|
|
#endif
|
2012-01-14 02:45:44 +08:00
|
|
|
char d_name[NAME_MAX+1];
|
2012-01-31 09:29:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern cyg_fileops jffs2_fileops;
|
|
|
|
extern cyg_fileops jffs2_dirops;
|
|
|
|
extern struct cyg_fstab_entry jffs2_fste;
|
|
|
|
|
2012-02-07 11:53:11 +08:00
|
|
|
time_t jffs2_get_timestamp(void);
|
|
|
|
void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info);
|
|
|
|
int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
|
2012-01-31 09:29:22 +08:00
|
|
|
void * stat_buf);
|
|
|
|
|
|
|
|
#endif
|