projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
For at91sam7 family.
[bertos.git]
/
fs
/
battfs.h
diff --git
a/fs/battfs.h
b/fs/battfs.h
index 455b21ce0c20c1a6e4bd521a5281936e6a714048..14728a8d2b199f82c36054fa9237bbdb1bc5904a 100644
(file)
--- a/
fs/battfs.h
+++ b/
fs/battfs.h
@@
-75,15
+75,21
@@
typedef struct BattFsPageHeader
*/
fcs_t fcs;
} BattFsPageHeader;
*/
fcs_t fcs;
} BattFsPageHeader;
+/* Ensure structure has no padding added */
+STATIC_ASSERT(sizeof(BattFsPageHeader) == 12);
+
+
+/**
+ * Mark for valid pages.
+ * Simply set to 1 all field bits.
+ */
+#define MARK_PAGE_VALID ((1 << (CPU_BITS_PER_CHAR * sizeof(mark_t))) - 1)
/**
* Max number of files.
*/
#define BATTFS_MAX_FILES (1 << (CPU_BITS_PER_CHAR * sizeof(inode_t)))
/**
* Max number of files.
*/
#define BATTFS_MAX_FILES (1 << (CPU_BITS_PER_CHAR * sizeof(inode_t)))
-/* Ensure structure has no padding added */
-STATIC_ASSERT(sizeof(BattFsPageHeader) == 12);
-
/* Fwd decl */
struct BattFsSuper;
/* Fwd decl */
struct BattFsSuper;
@@
-92,6
+98,11
@@
struct BattFsSuper;
*/
typedef uint16_t pgcnt_t;
*/
typedef uint16_t pgcnt_t;
+/**
+ * Sentinel used to keep trace of unset pages in disk->pag_array.
+ */
+#define PAGE_UNSET_SENTINEL ((1 << (CPU_BITS_PER_CHAR * sizeof(pgcnt_t))) - 1)
+
/**
* Type interface for disk init function.
* \return true if all is ok, false otherwise.
/**
* Type interface for disk init function.
* \return true if all is ok, false otherwise.
@@
-153,7
+164,10
@@
typedef struct BattFsSuper
* Is used by the filesystem to represent
* the entire disk in memory.
*/
* Is used by the filesystem to represent
* the entire disk in memory.
*/
- pgcnt_t *page_array;
+ pgcnt_t *page_array;
+
+ mark_t min_free; ///< Lowest sequence number of free page
+ mark_t max_free; ///< Highest sequence number of free page
disk_size_t disk_size; ///< Size of the disk, in bytes (page_count * page_size).
disk_size_t free_bytes; ///< Free space on the disk.
disk_size_t disk_size; ///< Size of the disk, in bytes (page_count * page_size).
disk_size_t free_bytes; ///< Free space on the disk.