xref: /nrf52832-nimble/rt-thread/components/dfs/filesystems/uffs/src/inc/uffs/uffs.h (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2   This file is part of UFFS, the Ultra-low-cost Flash File System.
3 
4   Copyright (C) 2005-2009 Ricky Zheng <[email protected]>
5 
6   UFFS is free software; you can redistribute it and/or modify it under
7   the GNU Library General Public License as published by the Free Software
8   Foundation; either version 2 of the License, or (at your option) any
9   later version.
10 
11   UFFS is distributed in the hope that it will be useful, but WITHOUT
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   or GNU Library General Public License, as applicable, for more details.
15 
16   You should have received a copy of the GNU General Public License
17   and GNU Library General Public License along with UFFS; if not, write
18   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19   Boston, MA  02110-1301, USA.
20 
21   As a special exception, if other files instantiate templates or use
22   macros or inline functions from this file, or you compile this file
23   and link it with other works to produce a work based on this file,
24   this file does not by itself cause the resulting work to be covered
25   by the GNU General Public License. However the source code for this
26   file must still be made available in accordance with section (3) of
27   the GNU General Public License v2.
28 
29   This exception does not invalidate any other reasons why a work based
30   on this file might be covered by the GNU General Public License.
31 */
32 /**
33  * \file uffs.h
34  * \brief uffs basic defines
35  * \author Ricky Zheng
36  */
37 
38 #ifndef _UFFS_H_
39 #define _UFFS_H_
40 
41 #ifdef __cplusplus
42 extern "C"{
43 #endif
44 
45 #define UO_RDONLY		0x0000		/** read only */
46 #define UO_WRONLY		0x0001		/** write only */
47 #define UO_RDWR			0x0002		/** read and write */
48 #define UO_APPEND		0x0008		/** append */
49 
50 #define UO_BINARY		0x0000		/** no used in uffs */
51 
52 #define UO_CREATE		0x0100
53 #define UO_TRUNC		0x0200
54 #define UO_EXCL			0x0400
55 
56 #define UO_NOECC		0x0800		/** skip ECC when reading file data from media */
57 
58 
59 #define UO_DIR			0x1000		/** open a directory */
60 
61 
62 
63 #define UENOERR 0		/** no error */
64 #define UEACCES	1		/** Tried to open read-only file
65 						 for writing, or files sharing mode
66 						 does not allow specified operations,
67 						 or given path is directory */
68 
69 #define UEEXIST	2		/** _O_CREAT and _O_EXCL flags specified,
70 							but filename already exists */
71 #define UEINVAL	3		/** Invalid oflag or pmode argument */
72 #define UEMFILE	4		/** No more file handles available
73 						  (too many open files)  */
74 #define UENOENT	5		/** file or path not found */
75 #define UETIME	6		/** can't set file time */
76 #define UEBADF	9		/** invalid file handle */
77 #define UENOMEM	10		/** no enough memory */
78 #define UEIOERR	11		/** I/O error from lower level flash operation */
79 #define UENOTDIR 12		/** Not a directory */
80 #define UEISDIR 13		/** Is a directory */
81 
82 #define UEUNKNOWN_ERR	100	/** unknown error */
83 
84 
85 
86 #define _SEEK_CUR		0		/** seek from current position */
87 #define _SEEK_SET		1		/** seek from beginning of file */
88 #define _SEEK_END		2		/** seek from end of file */
89 
90 #define USEEK_CUR		_SEEK_CUR
91 #define USEEK_SET		_SEEK_SET
92 #define USEEK_END		_SEEK_END
93 
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 
100 #endif
101 
102