ck: Merged FSCK+CK -> CK flag namespace

Unintentionally arriving at the infamous "fsck" name is a bit funny.

But it's probably something we don't want to conflict with if we can
help it, on the off chance we want a sort of lfs3_fsck function in the
future. (This is all hypothetical, but lfs3_fsck may expect an unmounted
filesystem, and have a much larger scope than lfs3_fs_ck. Though typing
this out now I'm realizing how confusing that might be...)

Since lfs3_file_ck and lfs3_fs_ck share a subset of flags, it's not
_entirely_ unreasonable for lfs3_file_ck and lfs3_fs_ck to share the
same namespace.

There's a risk of confusing users around what flags lfs3_file_ck
accepts, but we have asserts, and said flags (LFS3_CK_MKCONSISTENT,
LFS3_CK_LOOKAHEAD, etc) just don't really make sense in lfs3_file_ck:

  fs file
  y     LFS3_CK_MKCONSISTENT 0x00000800  Make the filesystem consistent
  y     LFS3_CK_LOOKAHEAD    0x00001000  Repopulate lookahead buffer
  y     LFS3_CK_LOOKGBMAP    0x00002000  Repopulate the gbmap
  y     LFS3_CK_PREERASE*    0x00004000  Pre-erase unused blocks
  y     LFS3_CK_COMPACTMETA  0x00008000  Compact metadata logs
  y  y  LFS3_CK_CKMETA       0x00010000  Check metadata checksums
  y  y  LFS3_CK_CKDATA       0x00020000  Check metadata + data checksums
  y  y  LFS3_CK_REPAIRMETA*  0x00040000  Repair data blocks
  y  y  LFS3_CK_REPAIRDATA*  0x00080000  Repair metadata + data blocks

  * Planned

Another option would be to document that lfs3_fs_ck accepts both
LFS3_CK_* _and_ LFS3_GC_* flags, but I worry that would be more
confusing. It would also lock us into supporting all LFs3_GC_* flags in
lfs3_fs_ck, which may not always be the case.

Though this is an argument for doing away with the whole
LFS3_M/F/CK/GC/I_* duplication... (tbh another reason for this is to
reduce the number of namespaces by at least one).

No code changes.
This commit is contained in:
Christopher Haster
2025-11-16 00:39:24 -06:00
parent 5c0cebb00b
commit c16c4a00d3
5 changed files with 53 additions and 74 deletions
+5 -12
View File
@@ -15,7 +15,6 @@ PREFIX_A = ['--a', '--attr'] # Filter by LFS3_A_* flags
PREFIX_F = ['--f', '--format'] # Filter by LFS3_F_* flags
PREFIX_M = ['--m', '--mount'] # Filter by LFS3_M_* flags
PREFIX_CK = ['--ck'] # Filter by LFS3_CK_* flags
PREFIX_FSCK = ['--fsck'] # Filter by LFS3_FSCK_* flags
PREFIX_GC = ['--gc'] # Filter by LFS3_GC_* flags
PREFIX_I = ['--i', '--info'] # Filter by LFS3_I_* flags
PREFIX_T = ['--t', '--trv'] # Filter by LFS3_T_* flags
@@ -109,20 +108,14 @@ M_COMPACTMETA = 0x00008000 # y- Compact metadata logs
M_CKMETA = 0x00010000 # y- Check metadata checksums
M_CKDATA = 0x00020000 # y- Check metadata + data checksums
# File check flags
# File/filesystem check flags
CK_MKCONSISTENT = 0x00000800 # -- Make the filesystem consistent
CK_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer
CK_LOOKGBMAP = 0x00002000 # -- Repopulate the gbmap
CK_COMPACTMETA = 0x00008000 # -- Compact metadata logs
CK_CKMETA = 0x00010000 # -- Check metadata checksums
CK_CKDATA = 0x00020000 # -- Check metadata + data checksums
# Filesystem check flags
FSCK_MKCONSISTENT \
= 0x00000800 # -- Make the filesystem consistent
FSCK_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer
FSCK_LOOKGBMAP = 0x00002000 # -- Repopulate the gbmap
FSCK_COMPACTMETA \
= 0x00008000 # -- Compact metadata logs
FSCK_CKMETA = 0x00010000 # -- Check metadata checksums
FSCK_CKDATA = 0x00020000 # -- Check metadata + data checksums
# GC flags
GC_MKCONSISTENT = 0x00000800 # -- Make the filesystem consistent
GC_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer