diff --git a/AI.md b/AI.md index 9e86e3f..e259384 100644 --- a/AI.md +++ b/AI.md @@ -11,18 +11,18 @@ When the user says this is a new chat or asks to continue mars-nwe work, first read this file before proposing patches or making assumptions. Then ask for, or use, the current project status that the user pasted into the chat. -## Current handoff status after patch 0207 +## Current handoff status after patch 0208 The current accepted patch line in this chat is expected to include: - endpoint-audit/documentation patches through `0176-docs-audit-direct-lifecycle-buffer-endpoints.patch`; - redesign documentation patches `0177` through `0198`; -- endpoint-audit/documentation patches `0199` through `0207`; -- latest expected patch name: `0207-docs-audit-existing-source-stub-coverage.patch`. +- endpoint-audit/documentation patches `0199` through `0208`; +- latest expected patch name: `0208-docs-audit-extended-attribute-endpoints.patch`. When continuing in a new chat, first ask the user which patch was actually last -applied. If they confirm `0207`, build the next patch as `0208-...` against a -tree that already contains `0207`. If any patch failed or was skipped, rebuild +applied. If they confirm `0208`, build the next patch as `0209-...` against a +tree that already contains `0208`. If any patch failed or was skipped, rebuild against the last confirmed applied patch instead of assuming the file in `/mnt/data` was accepted. @@ -195,6 +195,19 @@ Schema/import direction: not blindly copy code into mars-nwe. Use as a reference and implement a mars-nwe-native importer/OID module. + +Latest endpoint audit note: + +- Patch `0208` audits `NCP 0x2222/86` / wire `0x56` Extended Attributes. + `nwconn.c` forwards requestdata starting at the EA `SubFunction` byte to + `handle_func_0x56()` in `src/namspace.c`. SDK subfunctions `86/01` through + `86/05` are all present in source, so no new disabled source stubs were + needed. The current handlers are compatibility shims: close/write mostly + return success without storage, read returns an EA-not-found body, enumerate + returns a fixed zero body, and duplicate remains unknown request. Next patch + should be `0209`; a likely next block is `0x2222/87` Name Space unless the + user chooses another family. + ## Patch workflow - Produce patches that apply with exactly: diff --git a/TODO.md b/TODO.md index 8048899..9535ef9 100644 --- a/TODO.md +++ b/TODO.md @@ -188,12 +188,14 @@ Present in the code but not yet fully endpoint-audited: compatibility block. Follow-up fixes, if any, should be driven by client traces, especially around the old six-byte file-handle layout and the 65 Open File (old) access-rights compatibility note. -- SDK `0x2222/86` / wire `0x56` Extended Attribute, SDK `0x2222/87` / wire - `0x57` Name Space, SDK `0x2222/97` / wire `0x61` Packet Burst, SDK - `0x2222/101` / wire `0x65` Packet Burst Connection Request, and SDK - `0x2222/104` / wire `0x68` NDS/NCP fragger paths all have top-level code - entries and need their own generation-bucketed audits before any new TODO - stubs are added. +- SDK `0x2222/86` / wire `0x56` Extended Attribute is endpoint-audited as + a compatibility shim block in `src/nwconn.c` and `src/namspace.c`; see the + Extended Attribute section below for the exact per-subfunction status. +- SDK `0x2222/87` / wire `0x57` Name Space, SDK `0x2222/97` / wire `0x61` + Packet Burst, SDK `0x2222/101` / wire `0x65` Packet Burst Connection + Request, and SDK `0x2222/104` / wire `0x68` NDS/NCP fragger paths all have + top-level code entries and need their own generation-bucketed audits before + any new TODO stubs are added. SDK-listed blocks that do not currently show a top-level handler in `src/nwconn.c`: @@ -1000,6 +1002,41 @@ Follow-up: table expansion. +### Extended Attribute group 0x2222/86 + +Current status: + +- `NCP 0x2222/86` / wire `0x56` is endpoint-audited as the old Extended + Attribute group. `src/nwconn.c` forwards requestdata starting at the EA + `SubFunction` byte to `handle_func_0x56()` in `src/namspace.c`, and maps the + handler's non-negative return value to `data_len` or its negative return value + to the NCP Completion code. +- The NDK/Core-Protocols EA table lists through-3.x subfunctions `86/01` + through `86/05`; all five source slots are present in `src/namspace.c`, so no + additional disabled source stubs are needed for this block. +- `86/01 Close Extended Attribute Handle` is a success shim: it ignores the + handle and returns no reply payload. +- `86/02 Write Extended Attribute` is a success shim: it does not persist EA + data and currently returns no reply payload, although the NDK reply format + includes `ErrorCode`, `BytesWritten`, and `NewEAHandle`. +- `86/03 Read Extended Attribute` returns a fixed body with `ErrorCode` + `0xc9` / `ERR_EA_NOT_FOUND` and zero lengths/handle fields, rather than + reading real EA storage. +- `86/04 Enumerate Extended Attribute` returns a fixed all-zero body and no + enumerated EA structures. +- `86/05 Duplicate Extended Attributes` has a source case but is intentionally + unimplemented and returns unknown request via `0xfb`. + +Follow-up: + +- Keep this block as a compatibility shim unless a concrete client needs real + Extended Attribute storage. +- If real EA support is added, decide whether to use the existing Unix xattr + layer, the future `libdirectory` store, or a filesystem-backed sidecar, and + add packet tests for the Lo-Hi EA handle structs, flag information levels, + and multi-action EA return values. + + ### Retrospective source-stub coverage for already audited blocks Current status: diff --git a/src/namspace.c b/src/namspace.c index ac1d0d1..ebd9c5f 100644 --- a/src/namspace.c +++ b/src/namspace.c @@ -3732,7 +3732,13 @@ int handle_func_0x56(uint8 *p, uint8 *responsedata, int task) switch (ufunc) { #if 1 - case 0x01 : /* close extended attribute handle */ + case 0x01 : /* SDK 86/01 Close Extended Attribute Handle. + * Coverage: present as a compatibility shim. + * Request: reserved word (Lo-Hi), EAHandle long (Lo-Hi). + * Reply: no payload, normal Completion response. + * Difference: current code does not maintain an EA handle + * table; it ignores the handle and returns success. + */ { /* uint32 ea_handle=GET_BE32(p+2); @@ -3741,13 +3747,32 @@ int handle_func_0x56(uint8 *p, uint8 *responsedata, int task) } break; - case 0x02 : /* write extended attribute handle */ + case 0x02 : /* SDK 86/02 Write Extended Attribute. + * Coverage: present as a compatibility shim. + * Request: Flags word (Lo-Hi), EAHandleStruct, total write + * size, write position, access flag, value/key lengths, + * key bytes, then value bytes. + * Reply per NDK: ErrorCode, BytesWritten, NewEAHandle. + * Difference: current code accepts the call with no reply + * payload and does not persist EA data. + */ { result=0; /* dummy */ } break; - case 0x03 : /* read extended attribute */ + case 0x03 : /* SDK 86/03 Read Extended Attribute. + * Coverage: present as a compatibility shim. + * Request: Flags word (Lo-Hi), EAHandleStruct, ReadPosition, + * InspectSize, KeyLength, Key. Flags select whether the + * handle struct identifies a volume/base handle or an EA + * handle plus base handle. + * Reply: ErrorCode, total value length, NewEAHandle, access, + * ValueLength, Value. + * Compatibility: current code returns ErrorCode 0xc9 + * (ERR_EA_NOT_FOUND) in the reply body, with zero lengths, + * rather than implementing EA storage. + */ { #if 0 int flags = GET_16(p); /* LOW-HIGH */ @@ -3775,7 +3800,16 @@ int handle_func_0x56(uint8 *p, uint8 *responsedata, int task) } break; - case 0x04 : /* enumerate extended attributes */ + case 0x04 : /* SDK 86/04 Enumerate Extended Attribute. + * Coverage: present as a compatibility shim. + * Request: Flags word (Lo-Hi), EAHandleStruct, InspectSize, + * EnumerateSequence, KeyLength, Key. The information + * level is encoded in Flags bits 6..4. + * Reply: level-dependent body beginning with ErrorCode, + * total EA counts/sizes and NewEAHandle. + * Difference: current code returns an all-zero fixed-size + * body and no enumerated EA structures. + */ { struct OUTPUT { uint8 dontknow1[16]; /* all zero */ @@ -3787,7 +3821,15 @@ int handle_func_0x56(uint8 *p, uint8 *responsedata, int task) } break; - case 0x05 : /* duplicate extended attributes */ + case 0x05 : /* SDK 86/05 Duplicate Extended Attributes. + * Coverage: source case is present, but unimplemented. + * Request: SrcFlags, DstFlags, SrcEAHandleStruct, + * DstEAHandleStruct. + * Reply per NDK: DuplicateCount, DataSizeDuplicated, + * KeySizeDuplicated. + * Current behavior: falls through with result still -0xfb, + * so nwconn returns unknown request. + */ { } break; diff --git a/src/nwconn.c b/src/nwconn.c index 4a6dbbc..997c136 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -6659,7 +6659,18 @@ static int handle_ncp_serv(void) break; #if WITH_NAME_SPACE_CALLS - case 0x56 : /* some extended atrribute calls */ + case 0x56 : /* SDK 86 Extended Attribute group / wire 0x56. + * Coverage: forwarded to handle_func_0x56() in namspace.c. + * Request handoff: nwconn strips the NCP header and passes + * requestdata starting at SubFunction byte; the EA handler + * then dispatches SDK 86/01 through 86/05. + * Reply handoff: handler returns a non-negative payload + * length for responsedata, or a negative completion code. + * Source outcome: no missing through-3.x EA subfunctions + * found in the NDK/Core-Protocols EA table; SDK 86/01..05 + * are all present below, though most are compatibility + * shims rather than full EA storage. + */ { int result = handle_func_0x56(requestdata, responsedata, ncprequest->task); if (result > -1) data_len = result;