Files
mars-nwe/include/nwatalk.h
OpenAI 4637f3ee57
All checks were successful
Source release / source-package (push) Successful in 48s
nwatalk: cache AFP fallback entry ids in xattrs
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
2026-05-30 11:56:43 +02:00

18 lines
578 B
C

#ifndef _NWATALK_H_
#define _NWATALK_H_
#include "net.h"
#define NWATALK_FINDER_INFO_LEN 32
int nwatalk_backend_available(void);
int nwatalk_get_finder_info(const char *path, uint8 *finder_info,
int finder_info_len);
int nwatalk_set_finder_info(const char *path, const uint8 *finder_info,
int finder_info_len);
int nwatalk_get_resource_fork_size(const char *path, uint32 *resource_size);
int nwatalk_get_entry_id(const char *path, uint32 *entry_id);
int nwatalk_set_entry_id(const char *path, uint32 entry_id);
#endif