Remove dead code and simplify code introduced during sidecar migration

Merged
HE
3mo ago
+359-272

Follow up improvement effort to improve code introduce in https://github.com/sysprog21/elfuse/pull/256


Summary by cubic

Removes sidecar-era paths and cuts per-lookup work in casefold and sysroot resolution. Old: each component copied prefixes, re-derived realpath() and object types, and rebuilt resolver outputs; new: probe components in place, reuse ATTR_CMN_OBJTYPE, skip redundant realpath() and concatenations, and treat fully typed walks as containment proofs.

  • Probe components in place: append candidates to out and restore its terminator. out doubles as probe scratch; do not overlap out with guest_path or base_host_prefix.

  • Reuse object types from the probe: record leaf_type_known, leaf_is_link, and all_types_known. Run fstatat/faccessat only when types are unknown. host_component_spelling exposes link-ness to the NO_XDEV walker.

  • Skip the sysroot containment recheck for a fully typed walk; keep it for listing-answered components, dot components, and byte-exact paths.

  • Canonicalize the sysroot once and read _Atomic fold/canonical flags. Avoid per-call realpath() and skip sysroot snapshots for relative paths.

  • Remove unread resolver outputs and duplicate sysroot+lookup concatenations; rely on the seed buffer.

  • Make the walk report optional in casefold_resolve_at; pass NULL when only the verdict or out is needed.

  • Move the UTF-8/UTF-16 budget oracles into tests; drop casefold_utf16_units from casefold.h.

  • Fixes

    • Withdraw type info on readdir fallback so callers do not skip required fstatat checks.
    • Bounds-check getattrlistat stored-name replies; prevent an overlong append from leaving a trailing /.
    • Make the escape fallback strict: on broken preconditions, return an error rather than guess a spelling.