17 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-mpk-lock: direct NSSpssmpk.hpluspublic_core/library/os/pssmpk.cimport for the globalMPKNSS_LOCKAPI, ported to the core Linux-userspace spinlock backend. The companion NSS histogram base fromshared/sdk/include/histogram.handpublic_core/library/misc/histogram.cis also present so the MPKMeasureSpinLockinstrumentation path keeps its original shape. This is now present inlibnwcoreand covered bynwcore.pssmpk.nwcore-nss-runtime-base: the next smallest real subset of NSS 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.
0488 core: import NSS mailbox runtime
Imported the real NSS mailbox runtime before FSM/latch:
shared/sdk/include/mailbox.h->include/core/mailbox.hpublic_core/library/os/mailbox.c->src/core/mailbox.c
This is a bottom-up dependency for public_core/library/fsm/fsmnw.c and the latch runtime. No scheduler wrapper is introduced in this step.
0489 core: import NSS production debug header base
Imported the real NSS production-debug interface before FSM/latch:
shared/sdk/include/pssDebug.h->include/core/pssDebug.hshared/sdk/include/schedule.h->include/core/schedule.hshared/sdk/library/xStdio.h->include/core/xStdio.hshared/sdk/library/inlines.h->include/core/inlines.hpublic_core/library/debug/pssDebug.c->src/core/pssDebug.c
This is intentionally the production/no-debug path: NSS_DEBUG is disabled by
include/core/omni.h, so DEBUG_PRINTF, ENTER, RTN_*, and related macros
compile to the same inert form as the original header's #else /* NSS_DEBUG */
branch. The Linux userspace port keeps the original header/source shape but
moves the scheduler/xStdio/inlines includes behind NSS_DEBUG IS_ENABLED, so the
inactive debug branch does not pull the full scheduler/console stack before FSM
and alarm are imported.
The next runtime import can now use <pssDebug.h> without local stubs. FSM still
comes later from public_core/library/fsm/fsmnw.c; do not reintroduce a scheduler
wrapper.
0490 core: import NSS stdio formatter runtime
Imported the NSS bounded formatter as another bottom-up core dependency before parse/FSM/latch code:
public_core/library/stdio/snprintf.c->src/core/snprintf.cpublic_core/library/stdio/snprintf.h->include/core/snprintf.h
This is not an .imp reconstruction and not a libc replacement. The port keeps
the formatter implementation and makes only Linux-userspace compile changes:
remove the kernel module include, use existing core Unicode declarations, and
keep the two formatter-local Stack_s allocations on automatic storage until the
real NSS private stack/MPK allocator layer is imported.
Existing core UTC remains authoritative; no NSS UTC duplicate was imported.
0491 stdio formatter prerequisite
Imported public_core/library/stdio/sprintf.c and public_core/library/stdio/vsprintf.c into src/core/ with only Linux userspace include adjustment from <stdio.h>/<linux/limits.h> to the existing Core NSS stdio header and standard <limits.h>. This keeps parse/wio work bottom-up without inventing wrappers.
0492 core: import NSS Linux WIO output base
The parse dependency chain now has the real NSS WIO output base instead of a local wrapper:
shared/sdk/include/wio.his imported asinclude/core/wio.h.public_core/library/wio/wio.cis imported assrc/core/wio.c; its LinuxLB__wioOutput()path is used.public_core/library/wio/nssUI.cis imported assrc/core/nssUI.c; the kernel/proctransport is ported to Linux userspace stdout while retaining the NSSNSS_UI_vprintf()formatter/colour path.- The small WIO stdio forwarding files are imported from NSS rather than
recreated:
printf.c,vprintf.c,aprintf.c,vaprintf.c,wprintf.c,wvprintf.c, andwaprintf.c.
This still does not import full interactive window/input handling. Parser help
paths that require cursor movement and wrapping will need the next real WIO
functions (wGetPos, wSetPos, wWrapString) or the parser must be imported
only after those NSS sources are available and ported.
0493 Core production-debug/WIO cleanup
After importing the Linux WIO output path, the production pssDebug.h path no
longer needs to hide the NSS stdio declarations behind NSS_DEBUG. Keep the
heavy scheduler include gated until the real scheduler/FSM runtime is imported,
but expose the real xStdio.h and inlines.h includes unconditionally so
PRINT() resolves through the imported WIO/stdio stack instead of relying on
implicit declarations or placeholder output assumptions.
This audit also rechecked the earlier runtime patches for placeholders. The
remaining known non-final item is procdefs.h, which is still a small Core port
header rather than the full Linux-kernel NSS lnxmbINC/procdefs.h; keep it
tracked until the real scheduler/OS layer decides which declarations are needed.
Do not expand it by copying .imp files or inventing missing APIs.