t: Replaced LFS_T_EXCL with LFS_I_DIRTY flag in lfsr_tinfo

This just forwards the internal LFS_I_DIRTY flag to the user via the
lfsr_tinfo flags field.

Benefits of this approach:

- Gives the user more flexibility on what to do if the filesystem is
  modified, maybe you want to keep traversing depending on some other
  logic.

- Can eventually add other flags to tinfo.flags, such as
  LFS_I_COMPACTED, LFS_I_REPAIRED, LFS_I_INCONSISTENT, etc.

- Avoids confusion around the very different behaviors of LFS_O_EXCL and
  LFS_T_EXCL.

  I tried to come up with a better name (maybe LFS_T_WATCH?) but it was
  a bit of a struggle... Switching to a flags approach sidesteps the
  issue.

- Can drop the LFS_ERR_BUSY error code for now.

Code changes were fairly insignificant:

           code          stack
  before: 35244           2680
  after:  35224 (-0.1%)   2680 (+0.0%)

The only concern is that the tests highlighted it's possible for our
flag scheme to miss mutation if it happens after/during the last set of
blocks... Not sure how to handle this yet...
This commit is contained in:
Christopher Haster
2024-07-06 00:01:38 -05:00
parent 950124146c
commit 23c82bd7e5
4 changed files with 393 additions and 347 deletions
-1
View File
@@ -6,7 +6,6 @@ ERRS = [
('UNKNOWN', -1, "Unknown error" ),
('INVAL', -22, "Invalid parameter" ),
('NOTSUP', -95, "Operation not supported" ),
('BUSY', -16, "Device or resource busy" ),
('IO', -5, "Error during device operation" ),
('CORRUPT', -84, "Corrupted" ),
('NOENT', -2, "No directory entry" ),