12 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 in the supplied reference archives:
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 imported mars-nwe namespace model now lives directly under src/nwfs/ and include/nwfs/. The duplicate src/nwfs/nss/namespace/ staging tree was removed after adding nwfs.namespace.model; future concrete function imports should come from the supplied NSS archives and land directly in normal libnwfs paths.
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
_ADMINvirtual 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.
Bottom-up namespace dependency order
The namespace import is now intentionally ordered from the lowest reusable NSS
state upward. Do not make dosNSpace.c compile by adding local shim functions
or reduced replacement headers. If an imported file needs another NSS symbol,
find the source/header that owns that symbol, check whether the corresponding
primitive already exists in include/core, and import the missing layer first.
Current dependency walk from the imported DOS namespace source:
dosNSpace.c
-> DOSNS_Startup()
-> COMN_RegisterNameSpace()
-> public_core/comn/namespace/nameSpace.c
-> comnBeastClass.h / comnBeasts.h / adminVolume.h / pssStartup.h
-> latch.h + xCache.h + NSS MPK/OS abstraction headers
comnBeasts.h is the first blocker, not the DOS namespace code itself. It
includes latch.h and xCache.h; xCache.h then pulls the scheduler/FSM/cache
header family (alarm.h, control.h, fsm.h, asyncio.h), and latch.h pulls
pssmpk.h, pssDebug.h, fsm.h and parse.h. These are NSS runtime
abstractions, so the next import must start below beast/namespace with the
smallest real buildable support layer rather than with nameSpace.c.
Core-owned headers must not be duplicated under include/nwfs. The following
are already supplied by the existing core layer and should be found through the
mars_nwe::core dependency or the explicit core include path:
include/core/bit.h
include/core/guid.h
include/core/omni.h
include/core/que.h
include/core/utc.h
include/core/xError.h
include/core/xUnicode.h
include/core/zOmni.h
Headers that are genuinely NSS/NWFS-specific are imported flat as
include/nwfs/<header>.h; do not keep them under include/nwfs/nss/..., and do
not add private copies under src/nwfs/.
The planned code order is therefore:
nwcore-nss-spinlock: Linux-userspace spinlock primitive backed by POSIXpthread_spinlock_t. This is core-owned because the NSS latch/MPK/runtime layer is shared infrastructure, not a filesystem object. mars-nwe is Linux userspace only for this path; do not add BSD portability scaffolding here.nwcore-nss-runtime-base: the smallest real subset of NSS MPK/scheduler/FSM headers and sources needed bylatch.h/xCache.h, with Linux-kernel-only or NDPS/DDS-only includes removed or guarded only when the filesystem path does not use them.nwfs-latch-cache-base: direct imports forlatch/cache types required by beast structures once the generic runtime primitives are in core.nwfs-beast-base: beast class and root-beast structure support.nwfs-admin-volume: build the_ADMINvirtual volume model, but do not expose it through NCP until the runtime path is ready.nwfs-namespace-registry:nameSpace.cand registration state.- DOS namespace activation: build
dosNSpace.conly after the registry and its real dependencies are present.
The _ADMIN volume ID policy for that later import is fixed even while the
volume is hidden from NCP:
SYS => volume ID 0
_ADMIN => volume ID 1
other volumes start at ID 2
_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:
- Data stream / namespace / volume metadata basis.
- Lowlevel NetWare/NSS compression algorithm.
- Compression metadata/accounting and active compression/decompression state.
- 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:
- Continue replacing namespace-model stubs with the smallest buildable NSS
namespace primitives directly under
src/nwfs/. - Import/adapt DOS and LONG namespace scan/compare/convert functions.
- Import/adapt MAC and UNIX namespace functions, with metadata hooks tied to NSS-shaped metadata rather than private parallel state.
- Import/adapt Data Stream and Extended Attribute namespace helpers.
- Add regression tests against current MARS DOS/OS2 behavior.
- Switch
namspace.ccallsites from old MARSnamedos/nameos2logic to the imported NSS namespace code. - Remove old
namedos/nameos2after behavior is covered. - Add
libnwfsfollow-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.