trv: Renamed trv.htrv -> trv.h
Just moving away from the *trv when unnecessary. This matches the h variable used for local iteration.
This commit is contained in:
@@ -7486,7 +7486,7 @@ static void lfs3_handle_clobber(lfs3_t *lfs3, const lfs3_handle_t *h,
|
|||||||
if (lfs3_o_type(h_->flags) == LFS3_type_TRV) {
|
if (lfs3_o_type(h_->flags) == LFS3_type_TRV) {
|
||||||
h_->flags |= flags;
|
h_->flags |= flags;
|
||||||
|
|
||||||
if (h && ((lfs3_trv_t*)h_)->htrv == h) {
|
if (h && ((lfs3_trv_t*)h_)->h == h) {
|
||||||
lfs3_trv_clobber(lfs3, (lfs3_trv_t*)h_);
|
lfs3_trv_clobber(lfs3, (lfs3_trv_t*)h_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9792,7 +9792,7 @@ static void lfs3_trv_init(lfs3_trv_t *trv, uint32_t flags) {
|
|||||||
trv->b.h.mdir.r.blocks[0] = -1;
|
trv->b.h.mdir.r.blocks[0] = -1;
|
||||||
trv->b.h.mdir.r.blocks[1] = -1;
|
trv->b.h.mdir.r.blocks[1] = -1;
|
||||||
lfs3_bshrub_init(&trv->b);
|
lfs3_bshrub_init(&trv->b);
|
||||||
trv->htrv = NULL;
|
trv->h = NULL;
|
||||||
trv->u.mtortoise.blocks[0] = -1;
|
trv->u.mtortoise.blocks[0] = -1;
|
||||||
trv->u.mtortoise.blocks[1] = -1;
|
trv->u.mtortoise.blocks[1] = -1;
|
||||||
trv->u.mtortoise.step = 0;
|
trv->u.mtortoise.step = 0;
|
||||||
@@ -9951,7 +9951,7 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
|
|||||||
|
|
||||||
// no? next we need to check any opened files
|
// no? next we need to check any opened files
|
||||||
} else {
|
} else {
|
||||||
trv->htrv = lfs3->handles;
|
trv->h = lfs3->handles;
|
||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9965,8 +9965,8 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
|
|||||||
//
|
//
|
||||||
// note we can skip checking opened files if mounted rdonly,
|
// note we can skip checking opened files if mounted rdonly,
|
||||||
// this saves a bit of code when compiled rdonly
|
// this saves a bit of code when compiled rdonly
|
||||||
if (lfs3_m_isrdonly(lfs3->flags) || !trv->htrv) {
|
if (lfs3_m_isrdonly(lfs3->flags) || !trv->h) {
|
||||||
trv->htrv = NULL;
|
trv->h = NULL;
|
||||||
trv->b.h.mdir.mid += 1;
|
trv->b.h.mdir.mid += 1;
|
||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIR);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIR);
|
||||||
continue;
|
continue;
|
||||||
@@ -9980,15 +9980,15 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
|
|||||||
// literally every file open, but other things grow O(n^2) with
|
// literally every file open, but other things grow O(n^2) with
|
||||||
// this list anyways
|
// this list anyways
|
||||||
//
|
//
|
||||||
if (trv->htrv->mdir.mid != trv->b.h.mdir.mid
|
if (trv->h->mdir.mid != trv->b.h.mdir.mid
|
||||||
|| lfs3_o_type(trv->htrv->flags) != LFS3_TYPE_REG
|
|| lfs3_o_type(trv->h->flags) != LFS3_TYPE_REG
|
||||||
|| !lfs3_o_isunsync(trv->htrv->flags)) {
|
|| !lfs3_o_isunsync(trv->h->flags)) {
|
||||||
trv->htrv = trv->htrv->next;
|
trv->h = trv->h->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// transition to traversing the file
|
// transition to traversing the file
|
||||||
const lfs3_file_t *file = (const lfs3_file_t*)trv->htrv;
|
const lfs3_file_t *file = (const lfs3_file_t*)trv->h;
|
||||||
trv->b.shrub = file->b.shrub;
|
trv->b.shrub = file->b.shrub;
|
||||||
trv->u.bid = -2;
|
trv->u.bid = -2;
|
||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HBTREE);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HBTREE);
|
||||||
@@ -10017,14 +10017,14 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
|
|||||||
// end of mdir btree? start iterating over opened files
|
// end of mdir btree? start iterating over opened files
|
||||||
} else if (lfs3_t_tstate(trv->b.h.flags)
|
} else if (lfs3_t_tstate(trv->b.h.flags)
|
||||||
== LFS3_TSTATE_BTREE) {
|
== LFS3_TSTATE_BTREE) {
|
||||||
trv->htrv = lfs3->handles;
|
trv->h = lfs3->handles;
|
||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
||||||
continue;
|
continue;
|
||||||
// end of opened btree? go to next opened file
|
// end of opened btree? go to next opened file
|
||||||
} else if (lfs3_m_isrdonly(lfs3->flags)
|
} else if (lfs3_m_isrdonly(lfs3->flags)
|
||||||
|| lfs3_t_tstate(trv->b.h.flags)
|
|| lfs3_t_tstate(trv->b.h.flags)
|
||||||
== LFS3_TSTATE_HBTREE) {
|
== LFS3_TSTATE_HBTREE) {
|
||||||
trv->htrv = trv->htrv->next;
|
trv->h = trv->h->next;
|
||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_HANDLES);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@@ -16086,7 +16086,7 @@ static void lfs3_trv_clobber(lfs3_t *lfs3, lfs3_trv_t *trv) {
|
|||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIRS);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIRS);
|
||||||
trv->b.h.mdir.mid = 0;
|
trv->b.h.mdir.mid = 0;
|
||||||
lfs3_bshrub_init(&trv->b);
|
lfs3_bshrub_init(&trv->b);
|
||||||
trv->htrv = NULL;
|
trv->h = NULL;
|
||||||
#endif
|
#endif
|
||||||
// in-mtree mdir? increment the mid (to make progress) and reset to
|
// in-mtree mdir? increment the mid (to make progress) and reset to
|
||||||
// mdir iteration
|
// mdir iteration
|
||||||
@@ -16097,7 +16097,7 @@ static void lfs3_trv_clobber(lfs3_t *lfs3, lfs3_trv_t *trv) {
|
|||||||
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIR);
|
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_MDIR);
|
||||||
trv->b.h.mdir.mid += 1;
|
trv->b.h.mdir.mid += 1;
|
||||||
lfs3_bshrub_init(&trv->b);
|
lfs3_bshrub_init(&trv->b);
|
||||||
trv->htrv = NULL;
|
trv->h = NULL;
|
||||||
#endif
|
#endif
|
||||||
// opened mdir? skip to next omdir
|
// opened mdir? skip to next omdir
|
||||||
} else if (lfs3_t_tstate(trv->b.h.flags) < LFS3_TSTATE_DONE) {
|
} else if (lfs3_t_tstate(trv->b.h.flags) < LFS3_TSTATE_DONE) {
|
||||||
@@ -16105,7 +16105,7 @@ static void lfs3_trv_clobber(lfs3_t *lfs3, lfs3_trv_t *trv) {
|
|||||||
LFS3_TSTATE_DONE,
|
LFS3_TSTATE_DONE,
|
||||||
LFS3_TSTATE_HANDLES));
|
LFS3_TSTATE_HANDLES));
|
||||||
lfs3_bshrub_init(&trv->b);
|
lfs3_bshrub_init(&trv->b);
|
||||||
trv->htrv = (trv->htrv) ? trv->htrv->next : NULL;
|
trv->h = (trv->h) ? trv->h->next : NULL;
|
||||||
// done traversals should never need clobbering
|
// done traversals should never need clobbering
|
||||||
} else {
|
} else {
|
||||||
LFS3_UNREACHABLE();
|
LFS3_UNREACHABLE();
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ typedef struct lfs3_trv {
|
|||||||
// state machine
|
// state machine
|
||||||
lfs3_bshrub_t b;
|
lfs3_bshrub_t b;
|
||||||
// opened file state
|
// opened file state
|
||||||
lfs3_handle_t *htrv;
|
lfs3_handle_t *h;
|
||||||
union {
|
union {
|
||||||
// cycle detection state, only valid when traversing the mroot chain
|
// cycle detection state, only valid when traversing the mroot chain
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user