Renamed omdir -> handle

- lfs3_omdir_t -> lfs3_handle_t
- lfs3.omdirs -> lfs3.handles
- o -> h
- lfs3_omdir_* -> lfs3_handle_*
- lfs3_omdir_ismidopen -> lfs3_mid_isopen

From conversations with users, the term "handle" or "file handle" seems
to be the most common/easily understood term for the lfs3_file_t struct
itself. It makes sense to adopt this in our codebase.

I usually dislike inventing new names for things when prefixes can imply
a relationship (size -> ssize, cache -> rcache, shrub -> bshrub, etc),
but lfs3_omdirs_t was probably a bit much.
This commit is contained in:
Christopher Haster
2025-07-18 15:22:22 -05:00
parent ee3be04a93
commit 4cea5af96f
8 changed files with 650 additions and 644 deletions
+10 -7
View File
@@ -691,11 +691,14 @@ typedef struct lfs3_mdir {
uint32_t gcksumdelta;
} lfs3_mdir_t;
typedef struct lfs3_omdir {
struct lfs3_omdir *next;
// a handle to an opened mdir for tracking purposes
typedef struct lfs3_handle {
// an invasive linked-list is used to keep things in-sync
struct lfs3_handle *next;
// flags includes the type and type-specific flags
uint32_t flags;
lfs3_mdir_t mdir;
} lfs3_omdir_t;
} lfs3_handle_t;
// a shrub is a secondary trunk in an mdir
typedef lfs3_rbyd_t lfs3_shrub_t;
@@ -703,7 +706,7 @@ typedef lfs3_rbyd_t lfs3_shrub_t;
// a bshrub is like a btree but with a shrub as a root
typedef struct lfs3_bshrub {
// bshrubs need to be tracked for commits to work
lfs3_omdir_t o;
lfs3_handle_t h;
// files contain both an active bshrub and staging bshrub, to allow
// staging during mdir compacts
// trunk=0 => no bshrub/btree
@@ -749,7 +752,7 @@ typedef struct lfs3_file {
// littlefs directory type
typedef struct lfs3_dir {
lfs3_omdir_t o;
lfs3_handle_t h;
lfs3_did_t did;
lfs3_off_t pos;
} lfs3_dir_t;
@@ -767,7 +770,7 @@ typedef struct lfs3_traversal {
// state machine
lfs3_bshrub_t b;
// opened file state
lfs3_omdir_t *ot;
lfs3_handle_t *ht;
union {
// cycle detection state, only valid when traversing the mroot chain
struct {
@@ -817,7 +820,7 @@ typedef struct lfs3 {
#endif
// linked-list of opened mdirs
lfs3_omdir_t *omdirs;
lfs3_handle_t *handles;
lfs3_mdir_t mroot;
#ifndef LFS3_2BONLY