Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.h
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2017-03-13 03:41:08 +0300
committerChristopher Haster <chaster@utexas.edu>2017-03-20 06:25:36 +0300
commit53674cb3bc2ce2ec55f92c61b54a46f369d3726e (patch)
treebd915d59471dfa21ed15bbcaa139878b9bb3ac53 /lfs.h
parent106b06a45778a227bfd934f0065c5f440582738f (diff)
Added limited support for directories
This comes with a lot of scafolding put into place around the core of the filesystem. Added operations: - append an entry to a directory - find an entry in a directory - iterate over entries in a directory Some to do: - Chaining multiple directory blocks - Recursion on directory operations
Diffstat (limited to 'lfs.h')
-rw-r--r--lfs.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/lfs.h b/lfs.h
index 9e8edf0..c7cb555 100644
--- a/lfs.h
+++ b/lfs.h
@@ -13,8 +13,17 @@
// Data structures
enum lfs_error {
- LFS_ERROR_OK = 0,
- LFS_ERROR_CORRUPT = -3,
+ LFS_ERROR_OK = 0,
+ LFS_ERROR_CORRUPT = -3,
+ LFS_ERROR_NO_ENTRY = -4,
+ LFS_ERROR_EXISTS = -5,
+ LFS_ERROR_NOT_DIR = -6,
+ LFS_ERROR_INVALID = -7,
+};
+
+enum lfs_type {
+ LFS_TYPE_REG = 1,
+ LFS_TYPE_DIR = 2,
};
typedef struct lfs_free {
@@ -28,11 +37,12 @@ typedef struct lfs_free {
typedef struct lfs_dir {
lfs_ino_t pair[2];
+ lfs_off_t i;
+
lfs_disk_struct lfs_disk_dir {
lfs_word_t rev;
lfs_size_t size;
lfs_ino_t tail[2];
- lfs_ino_t parent[2];
struct lfs_disk_free free;
} d;
@@ -49,20 +59,9 @@ typedef struct lfs_entry {
lfs_disk_struct {
lfs_ino_t head;
lfs_size_t size;
- char name[LFS_NAME_MAX];
} file;
- lfs_disk_struct {
- lfs_ino_t dir[2];
- char name[LFS_NAME_MAX];
- } dir;
- lfs_disk_struct {
- char magic[4];
- uint32_t read_size;
- uint32_t write_size;
- uint32_t erase_size;
- uint32_t erase_count;
- } superblock;
- } value;
+ lfs_ino_t dir[2];
+ } u;
} d;
} lfs_entry_t;
@@ -83,6 +82,7 @@ typedef struct lfs {
lfs_bd_t *bd;
const struct lfs_bd_ops *ops;
+ lfs_ino_t cwd[2];
lfs_free_t free;
struct lfs_bd_info info;
} lfs_t;
@@ -92,4 +92,7 @@ lfs_error_t lfs_create(lfs_t *lfs, lfs_bd_t *bd, const struct lfs_bd_ops *bd_ops
lfs_error_t lfs_format(lfs_t *lfs);
lfs_error_t lfs_mount(lfs_t *lfs);
+lfs_error_t lfs_mkdir(lfs_t *lfs, const char *path);
+
+
#endif