blob: 2ed7e136b4313d1ab7be502d7dad992f5782b7d2 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/**************************************************************************
2*
3* Copyright (c) 2012 ZTE Corporation.
4*
5***************************************************************************
6* Ä£ ¿é Ãû : P98C_OSS
7* ÎÄ ¼þ Ãû : oss_fs.h
8* Ïà¹ØÎļþ :
9* ʵÏÖ¹¦ÄÜ : Îļþϵͳ
10* ×÷ Õß : chenxingfang
11* °æ ±¾ : V1.0
12* Íê³ÉÈÕÆÚ : 2012-08-10
13* ÆäËü˵Ã÷ :
14**************************************************************************/
15
16/**************************************************************************
17* Ð޸ļǼ
18**************************************************************************/
19#ifndef _OSS_FS_H
20#define _OSS_FS_H
21
22/**************************************************************************
23* #includeÇø
24**************************************************************************/
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
30/**************************************************************************
31* ³£Á¿¶¨ÒåÇø
32**************************************************************************/
33/* ¶ÁдλÖà */
34#define ZOSS_SEEK_SET 0x0 /* set to offset */
35#define ZOSS_SEEK_CUR 0x1 /* set to current position plus offset */
36#define ZOSS_SEEK_END 0x2 /* set to the size of the file plus offset */
37
38/* ÅäÖòÎÊý */
39#define ZOSS_MAX_FILENAME_LEN 255 /* Îļþ¡¢Ä¿Â¼Ãû×î´ó³¤¶È, °üº¬Â·¾¶ */
40
41/* Îļþ¡¢Ä¿Â¼ÊôÐÔ£¬°Ë½øÖƱíʾ */
42#define ZOSS_ATTR_IFDIR 040000 /* Ŀ¼λ */
43
44#define ZOSS_ATTR_RD_USR 0400 /* user¶Á */
45#define ZOSS_ATTR_WR_USR 0200 /* userд */
46#define ZOSS_ATTR_EX_USR 0100 /* userÖ´ÐÐ */
47
48#define ZOSS_ATTR_RD_GRP 0040 /* group¶Á */
49#define ZOSS_ATTR_WR_GRP 0020 /* groupд */
50#define ZOSS_ATTR_EX_GRP 0010 /* groupÖ´ÐÐ */
51
52#define ZOSS_ATTR_RD_OTH 0004 /* other¶Á */
53#define ZOSS_ATTR_WR_OTH 0002 /* otherд */
54#define ZOSS_ATTR_EX_OTH 0001 /* otherÖ´ÐÐ */
55
56#define ZOSS_ATTR_RWX_USR 0700 /* userµÄ¶ÁдִÐÐ */
57#define ZOSS_ATTR_RWX_GRP 0070 /* groupµÄ¶ÁдִÐÐ */
58#define ZOSS_ATTR_RWX_OTH 0007 /* otherµÄ¶ÁдִÐÐ */
59
60#define ZOSS_ATTR_RD_ALL 0444 /* user,group,otherµÄ¶Á */
61#define ZOSS_ATTR_WR_ALL 0222 /* user,group,otherµÄд */
62#define ZOSS_ATTR_EX_ALL 0111 /* user£¬group,otherµÄÖ´ÐÐ */
63
64#define ZOSS_ATTR_RWX_ALL 0777 /* user£¬group,otherµÄ¶ÁдִÐÐ */
65
66#ifdef _OS_LINUX
67# define FILE int
68#endif
69
70/**************************************************************************
71* Êý¾Ý½á¹¹¶¨ÒåÇø
72**************************************************************************/
73typedef struct
74{
75#if defined(_OS_TOS) && defined(CYGPKG_FILEIO_DIRENT_DTYPE)
76 mode_t d_type;
77#endif
78
79 CHAR d_name[ZOSS_MAX_FILENAME_LEN + 1];
80}ZOSS_S_DIRENT;
81
82typedef struct
83{
84 UINT32 st_dev; /* Device ID number */
85 UINT32 st_ino; /* File serial number */
86 mode_t st_mode; /* Mode of file */
87 UINT16 st_nlink; /* Number of hard links to file */
88 UINT32 st_uid; /* User ID of file */
89 UINT32 st_gid; /* Group ID of file */
90 UINT32 st_rdev; /* Device ID if special file */
91 UINT32 st_size; /* File size in bytes */
92 time_t st_atime; /* Time of last access */
93 time_t st_mtime; /* Time of last modification */
94 time_t st_ctime; /* Time of last status change */
95}ZOSS_S_STAT;
96
97/**************************************************************************
98* º¯ÊýÉùÃ÷Çø
99**************************************************************************/
100UINT32 zOss_FCreate(const CHAR *filename);
101FILE *zOss_FOpen(const CHAR *filename, const CHAR *mode);
102UINT32 zOss_FSeek(FILE *stream, SINT32 offset, SINT32 whence);
103SSIZE_T zOss_FRead(VOID *data, SSIZE_T size, SSIZE_T count, FILE *stream);
104SSIZE_T zOss_FWrite(const VOID *data, SSIZE_T size, SSIZE_T count, FILE *stream);
105UINT32 zOss_FEof(FILE *stream);
106UINT32 zOss_FError(FILE *stream);
107UINT32 zOss_FTruncate(FILE *stream, UINT32 size);
108UINT32 zOss_FFlush(FILE *stream);
109UINT32 zOss_FTell(FILE *stream);
110UINT32 zOss_FClose(FILE *stream);
111UINT32 zOss_FRename(const CHAR *old_filename, const CHAR *new_filename);
112UINT32 zOss_FDelete(const CHAR *filename);
113UINT32 zOss_FLength(FILE *stream);
114BOOL zOss_FExist(const CHAR *filename);
115UINT32 zOss_Mkdir(const CHAR *dirname);
116UINT32 zOss_Rmdir(const CHAR *dirname);
117UINT32 zOss_Rndir(const CHAR *old_dirname, const CHAR *new_dirname);
118UINT32 zOss_GetPwd(CHAR *dirname, UINT32 dirnamelen);
119UINT32 zOss_ChDir(CHAR *dirname);
120BOOL zOss_IsDir(const CHAR *dirname);
121UINT32 zOss_OpenDir(const CHAR *dirname, VOID **dir_entry_ptr);
122UINT32 zOss_CloseDir(VOID **dir_entry_ptr);
123UINT32 zOss_ReadDir(VOID **dir_entry_ptr, ZOSS_S_DIRENT *dir_item_ptr);
124VOID zOss_Rewinddir(VOID *dir_entry_ptr);
125UINT32 zOss_ChMod(const CHAR *pathname, mode_t attrs);
126UINT32 zOss_Stat(const CHAR *pathname, ZOSS_S_STAT *buf);
127UINT32 zOss_MountDisk(CHAR diskname);
128UINT32 zOss_UnMountDisk(CHAR diskname);
129UINT32 zOss_UnMountAllDisk(VOID);
130UINT32 zOss_GetDiskFreeSpace(CHAR diskname, UINT64 *space);
131UINT32 zOss_GetDiskCapacity(CHAR diskname, UINT64 *space);
132UINT32 zOss_GetAllDynamicDisk(CHAR *disk, UINT32 size);
133UINT32 zOss_SyncFS(VOID);
134UINT32 zOss_MountDynamicDisk(CHAR *pWinDir, CHAR *pLinuxDir, CHAR *pDevName, char *pFsName);
135UINT32 zOss_UnMountDynamicDisk(CHAR *pWinDir);
136UINT32 zOss_FsMount(VOID);
137
138/**************************************************************************
139* È«¾Ö±äÁ¿ÉùÃ÷Çø
140**************************************************************************/
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* _OSS_FS_H */
147