Files
mars-nwe/doc/NSS_NAMESPACE_AUDIT.md

8.4 KiB

NSS namespace and storage import audit

This note records the namespace follow-up after the Unicode/codepage/GUID import series. The goal is to replace the old MARS namedos/nameos2 logic with the more complete NSS namespace implementation. Do not add a permanent wrapper around the old MARS namespace code; import/adapt NSS namespace sources directly and then retire the duplicate MARS implementation in controlled steps.

Source tree

Primary NSS namespace source locations:

public_core/comn/namespace/nameSpace.c
public_core/comn/namespace/dosNSpace.c
public_core/comn/namespace/dosNSWild.c
public_core/comn/namespace/longNSpace.c
public_core/comn/namespace/macNSpace.c
public_core/comn/namespace/unixNSpace.c
public_core/comn/namespace/dataStreamNSpace.c
public_core/comn/namespace/extAttrNSpace.c
public_core/comn/namespace/*NSpace.h
public_core/comn/namespace/nspaceStartup.h
shared/sdk/include/nameSpace.h
shared/sdk/internal/macNSpace.h
shared/sdk/internal/unixNSpace.h

The NSS namespace set covers the target replacement area:

  • DOS namespace
  • LONG namespace
  • MAC namespace
  • UNIX namespace
  • Data Stream namespace
  • Extended Attribute namespace

Why this is not a small helper import

The namespace implementation is not just string parsing. The real NSS files use common-layer/file-system state:

comnPublics.h
comnParams.h
comnBeasts.h
comnVariableData.h
adminVolume.h
comnBeastClass.h
pssStartup.h
name.h
msgName.h
msgGen.h
zParams.h
sysimp.h

Important runtime hooks include:

  • namespace registration through COMN_RegisterNameSpace()
  • AdminVolume namespace beasts
  • root variable-data registration for MAC/UNIX metadata
  • name-beast/cache structures
  • unique-name generation against directories
  • message/error plumbing

So the namespace block should not be treated like the earlier pure helper libs (crc, unicode, utc, guid, xString). It is closer to an NSS common-layer subsystem and belongs on the path toward libnwfs.

Import direction

libnwcore

libnwcore should receive only stable reusable primitives needed by several other imports:

  • public NSS namespace IDs/flags/types
  • component scan/compare/convert helpers once their common-layer dependencies are adapted
  • wildcard helpers
  • DOS/LONG/MAC/UNIX legal-character logic
  • Data Stream / Extended Attribute namespace constants and parser helpers

libnwfs

libnwfs is the target for direct NSS namespace runtime integration:

  • namespace registration
  • DOS/LONG/MAC/UNIX namespace objects
  • Data Stream namespace objects
  • Extended Attribute namespace objects
  • volume/pool namespace exposure
  • metadata/salvage/stream integration
  • future _ADMIN virtual management volume

The old MARS files are replacement targets, not extension points:

include/namedos.h
include/nameos2.h
src/namedos.c
src/nameos2.c
src/namspace.c

namedos/nameos2 should be retired after NSS DOS/LONG/MAC/UNIX namespace code is imported and tests show identical or better NetWare 3.x DOS behavior.

libnwnds

NDS/eDirectory helpers stay out of libnwcore:

public_core/library/eDir/getDSGuid.c
public_core/library/eDir/parseDSObjectName.c

getDSGuid.c depends on DDC/DS read APIs and belongs in a future libnwnds. A simple DS object-name parser can be imported there later if 4.x guarded endpoints need it.

libnwbind

Bindery/auth/object-ID bridging remains separate:

public_core/comn/authsys/*

That code references bindery/auth/common-layer internals and should become a future libnwbind or libnwauth block, not a core namespace import.

_ADMIN virtual volume

NSS also carries the _ADMIN management volume model. It is storage/filesystem management state, not a primitive core helper and not an eDirectory library by itself.

Known NSS/OES shape to preserve later:

SYS     => reserved volume ID 0
_ADMIN  => reserved volume ID 1

_ADMIN is a virtual system/management NCP volume. It should not be treated as a normal exported data volume and should not be enabled by default for NetWare 3.x behavior. Later libnwfs work can model it as hidden/admin-only and expose NSS management trees such as:

_ADMIN:/Pools
_ADMIN:/Volumes
_ADMIN:/NameSpaces
_ADMIN:/BeastClasses
_ADMIN:/AuthModels
_ADMIN:/Manage_NSS/...

Use libnwnds only for the eDirectory backend portions behind this virtual filesystem when those are imported. The virtual volume/runtime belongs to libnwfs.

Compression follow-up

NSS compression is another libnwfs candidate, not libnwcore.

Lowlevel algorithm sources found under public_core/comn/compression/:

cdcomp.c
cdcompa.c
cduncomp.c
cduncompa.c
copyAlgo.c
nwAlgo.c
nwAlgo.h
cdcommon.h
cdcomp.h
cduncomp.h

Larger compression manager/runtime sources also exist there:

cmActivity.c
cmAlgoMan.c
cmBgCompress.c
cmCompDecomp.c
cmCompFile.c
cmControl.c
cmRuntime.c
comnCompress.c

Import order should be:

  1. Data stream / namespace / volume metadata basis.
  2. Lowlevel NetWare/NSS compression algorithm.
  3. Compression metadata/accounting and active compression/decompression state.
  4. NCP providers.

Relevant NCP endpoints already audited in decimal and wire/code notation:

decimal 90/12  == wire/code 0x5a/0x0c  Set Compressed File Size
decimal 123/70 == wire/code 0x7b/0x46  Get Current Compressing File
decimal 123/71 == wire/code 0x7b/0x47  Get Current DeCompressing File Info List
decimal 123/72 == wire/code 0x7b/0x48  Get Compression and Decompression Time and Counts
decimal 22/51  == wire/code 0x16/0x33  Extended Volume Info compression counters

Do not synthesize fake compression state. Those endpoints should remain stubbed/guarded until libnwfs has real stream/volume compression state.

Host-created files and namespace reconciliation

The namespace replacement must cover files that appear without a MARS/NCP create path. Samba, rsync, backup restore, local mv/cp, and administrator edits can all create visible directory entries under a volume root before MARS-NWE has a DOS/LONG/MAC/UNIX namespace record for them.

The future libnwfs namespace layer should therefore pair the NSS namespace engine with a host-side reconcile path:

watcher path:
  inotify/fanotify for CREATE, MOVED_TO, DELETE, RENAME and ATTRIB
  update or create netware.metadata where the event is unambiguous
  invalidate namespace lookup/search/namecache state

startup/full scan path:
  walk the visible Linux tree after volume mount/startup
  allocate missing stable file IDs in netware.metadata
  create DOS/LONG/MAC/UNIX namespace records for normal files
  report orphaned .nwfs_streams and invalid .recycle metadata

For an ordinary host-created file, use conservative initial names: UNIX/backend name is the current Linux name, LONG/OS2 name is the current Linux name, DOS name is generated by the DOS namespace engine, and MAC name is derived only through the future MAC namespace rules. Do not create a private side database for this state; netware.metadata remains authoritative.

MAC namespace state is not transport state. Classic Mac clients may later arrive through TCP/IP NCP, but the namespace engine sees namespace IDs and file requests, not TCP-specific session data. Resource forks and Finder info belong to libnwfs streams/metadata.

Patch plan

Recommended next patches:

  1. Import namespace headers/constants and the smallest buildable NSS namespace primitives directly.
  2. Import/adapt DOS and LONG namespace scan/compare/convert functions.
  3. Import/adapt MAC and UNIX namespace functions, with metadata hooks tied to NSS-shaped metadata rather than private parallel state.
  4. Import/adapt Data Stream and Extended Attribute namespace helpers.
  5. Add regression tests against current MARS DOS/OS2 behavior.
  6. Switch namspace.c callsites from old MARS namedos/nameos2 logic to the imported NSS namespace code.
  7. Remove old namedos/nameos2 after behavior is covered.
  8. Add libnwfs follow-ups for _ADMIN, namespace registration visibility, and compression after the namespace/storage basis is present.

Endpoint relevance

The namespace replacement primarily supports NCP namespace/file endpoints, especially decimal 87 == wire/code 0x57. Data stream and extended attribute namespace support also feeds NSS-shaped metadata and future 4.x guarded work.

This does not change the NetWare 3.x priority: DOS behavior must remain correct, and 4.x/MAC/UNIX/DataStream/EA pieces can stay guarded until callsites are ready.