comparison rvinterf/include/ffs.h @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
1 /*
2 * A few generic FFS API definitions which apply to both TMFFS1 and TMFFS2
3 */
4
5 enum FFS_OBJECT_TYPE {
6 OT_FILE = 1,
7 OT_DIR = 2,
8 OT_LINK = 3,
9 OT_SEGMENT = 4
10 };
11
12 enum FFS_OBJECT_FLAGS {
13 OF_READONLY = 1<<4 // object cannot be modified
14 };
15
16 enum FFS_OPEN {
17 FFS_O_EMPTY = 0x00, // Okay?
18 FFS_O_CREATE = 0x01,
19 FFS_O_APPEND = 0x02,
20 FFS_O_EXCL = 0x04,
21 FFS_O_TRUNC = 0x08,
22 FFS_O_RDONLY = 0x10,
23 FFS_O_WRONLY = 0x20,
24 FFS_O_RDWR = FFS_O_RDONLY | FFS_O_WRONLY
25 };
26
27 enum FFS_SEEK {
28 FFS_SEEK_SET = 0,
29 FFS_SEEK_CUR = 1,
30 FFS_SEEK_END = 2
31 };
32
33 enum FFS_QUERY { // data size, description
34 Q_BYTES_FREE = 1, // 4, number of free bytes in FFS
35 Q_BYTES_USED = 2, // 4, number of used bytes in FFS
36 Q_BYTES_LOST = 3, // 4, number of lost bytes in FFS
37 Q_BYTES_MAX = 4, // 4, number of max available bytes in FFS
38 Q_BYTES_FREE_RAW = 5, // 4, number of free raw bytes in FFS (used internal)
39
40 Q_FD_BUF_SIZE = 10, // 4, size of buffer used by stream functions
41
42 Q_TM_BUFADDR = 11, // 4, testmode buffer addr
43 Q_TM_BUFSIZE = 12, // 4, testmode ffs buffer size
44 Q_DEV_BASE = 13, // 4, FFS device base address
45 Q_CHUNK_SIZE_MAX = 14, // 4, max size of chunks made by non stream fkt.
46
47 // FFS versions
48 Q_FFS_API_VERSION = 16, // 2, FFS API Version
49 Q_FFS_DRV_VERSION = 17, // 2, FFS Driver Version
50 Q_FFS_REVISION = 18, // 2, FFS Revision (from PRCS)
51 Q_FFS_FORMAT_READ = 19, // 2, FFS version as read from ffs
52 Q_FFS_LASTERROR = 20, // 2, FFS last error (from init)
53 Q_FFS_FORMAT_WRITE = 21, // 2, FFS version as written to ffs on format
54 Q_FFS_TM_VERSION = 22, // 2, FFS Testmode version
55
56 // File system queries
57 Q_FILENAME_MAX = 24, // 2, max filename length
58 Q_PATH_DEPTH_MAX = 25, // 2, max path/directory nesting depth
59 Q_FD_MAX = 26, // 2, max numbers of simultaneous open files
60
61 Q_OBJECTS_FREE = 32, // 2, number of objects that can be created
62 Q_INODES_USED = 33, // 2, number of inodes used
63 Q_INODES_LOST = 34, // 2, number of inodes lost
64 Q_OBJECTS_USED = 33, // 2, DEPRECATED: old name for Q_INODES_USED
65 Q_OBJECTS_LOST = 34, // 2, DEPRECATED: old name for Q_INODES_LOST
66 Q_OBJECTS_MAX = 35, // 2, max number of valid objects allowed
67 Q_INODES_MAX = 36, // 2, physical total max number of inodes
68 Q_INODES_HIGH = 37, // 2, watermark for when inodes will be reclaimed
69 Q_LOST_HIGH = 38, // 2, watermark for when data block will be reclaimed
70
71 // Device queries
72 Q_DEV_MANUFACTURER = 48, // 2, flash manufacturer ID
73 Q_DEV_DEVICE = 49, // 2, flash device ID
74 Q_DEV_BLOCKS = 50, // 2, number of FFS blocks in device
75 Q_DEV_ATOMSIZE = 51, // 2, atomsize used by FFS for this device
76 Q_DEV_DRIVER = 52, // 2, flash device driver
77
78 // All queries below here are for debug purpose only, are unsupported
79 // and can change at any time without notice!
80
81 // Miscellaneous/Internal
82 Q_BLOCKS_FREE_MIN = 64, // 2, Number of spare blocks (0 or 1)
83
84 Q_BLOCKS_FREE = 70, // 2, number of free blocks
85
86 // Debug queries
87 Q_FS_FLAGS = 80,
88 Q_FS_INODES = 81,
89 Q_FS_ROOT = 82,
90
91 Q_OBJECTS_TOTAL = 90, // 2, Accumulated number of valid objects
92 Q_TOTAL_OBJECTS = 90, // 2, DEPRECATED: old name for Q_OBJECTS_TOTAL
93
94 Q_STATS_FIRST = 100,
95 Q_STATS_DRECLAIMS = 100,
96 Q_STATS_IRECLAIMS = 101,
97 Q_STATS_BRECLAIMS = 102,
98 Q_STATS_DATA_RECLAIMED = 103,
99 Q_STATS_INODES_RECLAIMED = 104,
100 Q_STATS_DATA_ALLOCATED = 105,
101
102 Q_REQUEST_ID_LAST = 110,
103
104 Q_DEBUG_FIRST = 120,
105 Q_DEBUG_0 = 120,
106 Q_DEBUG_1 = 121,
107 Q_DEBUG_2 = 122,
108 Q_DEBUG_3 = 123,
109 Q_DEBUG_LAST = 127,
110
111 // individual lines of the bstat array can be returned by the following
112 // id plus the bstat index of the line wanted.
113 Q_BSTAT = -128
114 };