nwatalk: cache AFP fallback entry ids in xattrs
All checks were successful
Source release / source-package (push) Successful in 48s
All checks were successful
Source release / source-package (push) Successful in 48s
The AFP smoke endpoints can now read mars_nwe-owned entry ids from the versioned org.mars-nwe.afp.entry-id xattr, but a newly discovered file still had to fall back to the temporary stat-derived id on every request until a real CNID allocator exists. Preserve the existing WebSDK/NWAFP response semantics while making that fallback sticky: when Get Entry ID, Get File Information, or Scan File Information has no mars_nwe xattr and no Netatalk/libatalk AppleDouble/CNID id, derive the existing compatibility id and cache it through nwatalk_set_entry_id(). The first request still logs fallback so diagnostics remain honest about the id origin; subsequent requests should read the xattr directly and avoid re-entering the stat fallback path. Keep the write narrowly scoped to mars_nwe's private AFP metadata namespace. The payload is versioned, big-endian, and stored through the nwxattr helper, so Linux persists it as user.org.mars-nwe.afp.entry-id while source-level code continues to use the Netatalk-style org.mars-nwe.afp.entry-id name. This does not implement CNID allocation, parent-id lookup, entry-id-only resolution, FinderInfo mutation beyond the existing smoke path, or resource-fork semantics. Tests: - git diff --check - cmake --build build-xattr-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF - cmake --build build-xattr-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON against Netatalk 4.4.3 headers plus local link stubs
This commit is contained in:
@@ -7,11 +7,13 @@ The tests use the ncpfs/libncp client library. They are not built by default
|
||||
because they require the host ncpfs development headers/library and a running
|
||||
NetWare-compatible server.
|
||||
|
||||
The AFP endpoints are intentionally conservative. When persistent AFP entry
|
||||
ids become available, mars_nwe-owned ids are read from the versioned
|
||||
`org.mars-nwe.afp.entry-id` xattr before falling back to Netatalk/libatalk
|
||||
AppleDouble/CNID metadata and then the temporary stat-derived fallback. The
|
||||
first AFP write smoke path is deliberately limited to the FinderInfo bitmap of
|
||||
The AFP endpoints are intentionally conservative. mars_nwe-owned ids are read
|
||||
from the versioned `org.mars-nwe.afp.entry-id` xattr before falling back to
|
||||
Netatalk/libatalk AppleDouble/CNID metadata. When neither source has an id yet,
|
||||
the existing stat-derived compatibility id is cached in that xattr so subsequent
|
||||
AFP probes can reuse the same mars_nwe-owned id instead of re-entering the
|
||||
temporary fallback path. The first AFP write smoke path is deliberately limited
|
||||
to the FinderInfo bitmap of
|
||||
AFP 2.0 Set File Information; CNID allocation, DOS attribute mapping, resource
|
||||
fork writes, and data-fork writes remain separate write-safety work. mars_nwe
|
||||
source uses Netatalk-style `org.mars-nwe.<domain>.*` xattr names; AFP
|
||||
@@ -401,13 +403,29 @@ AFP 2.0 Set File Information: vol=0 request_vol=0 entry=0x00000000 mask=0x0020 p
|
||||
AFP 2.0 Get File Information: vol=0 entry=0x00000000 mask=0xffff path='SYS:PUBLIC/pmdflts.ini' reply_entry=0x23c8787d fallback
|
||||
```
|
||||
|
||||
The `fallback` marker on the verification Get File Information diagnostic still
|
||||
refers to the entry-id source: the returned entry id is derived from the current
|
||||
stat-backed fallback path because no persistent CNID or `org.mars-nwe.afp.entry-id`
|
||||
metadata was present. It does not mean the FinderInfo write was ignored; the
|
||||
The `fallback` marker on the first verification Get File Information diagnostic
|
||||
still refers to the entry-id source: the returned entry id was derived from the
|
||||
stat-backed compatibility path because no CNID or mars_nwe entry-id xattr existed
|
||||
yet. The server now caches that derived id in `org.mars-nwe.afp.entry-id`, so a
|
||||
second probe of the same file should reuse the xattr-backed id and normally omit
|
||||
the `fallback` marker. It does not mean the FinderInfo write was ignored; the
|
||||
helper verifies the written FinderInfo through the follow-up Get File Information
|
||||
reply.
|
||||
|
||||
Linux xattr checks for the FinderInfo and cached Entry ID look like this:
|
||||
|
||||
```sh
|
||||
getfattr -n user.org.mars-nwe.afp.finder-info -e hex /var/mars_nwe/SYS/public/pmdflts.ini
|
||||
getfattr -n user.org.mars-nwe.afp.entry-id -e hex /var/mars_nwe/SYS/public/pmdflts.ini
|
||||
```
|
||||
|
||||
For the verified FinderInfo smoke run, the FinderInfo xattr starts with
|
||||
`TEXTMARS`:
|
||||
|
||||
```text
|
||||
user.org.mars-nwe.afp.finder-info=0x544558544d415253000000000000000000000000000000000000000000000000
|
||||
```
|
||||
|
||||
All other Set File Information bitmap bits are intentionally rejected for now.
|
||||
That keeps attribute, timestamp, DOS/NetWare mode-bit mapping, resource-fork,
|
||||
and Entry-ID-only write semantics out of this first metadata-only write smoke
|
||||
|
||||
Reference in New Issue
Block a user