Files
mars-nwe/doc/NSS_IMPORT_NOTES.md

39 KiB

NSS import notes

This file consolidates NSS import guidance: the userspace adaptation boundary, the public_core classification audit, and the namespace/storage import audit.


Userspace adaptation boundary

The NSS import is a source and behaviour reference for Mars NWE. The goal is not to recreate the Novell NSS filesystem or its Linux kernel modules in userspace. The goal is to reuse the useful NSS semantics as libraries that Mars NWE can call.

Target semantics

The useful exported behaviour is primarily:

  • namespace handling for DOS, LONG/OS2 and later MAC/UNIX/DataStream/EA;
  • trustee and rights-management semantics;
  • effective-rights calculation;
  • extended-attribute and metadata semantics;
  • the _ADMIN/AdminVolume view as a Mars-provided in-memory/config-backed userspace volume;
  • salvage/compression/repair-related helpers where they expose useful NetWare semantics.

These pieces should become library code owned by Mars NWE integration points, not a standalone NSS volume implementation.

Storage and persistence boundary

NSS code may contain logic for writing metadata, names, trustees or xattrs into an NSS volume. In Mars NWE, that storage backend is different:

  • metadata and xattrs should be mapped to the underlying host filesystem, using the existing or future Mars/NWFS xattr layer;
  • AdminVolume data should be generated from Mars configuration/runtime state, not stored in a fake NSS disk format;
  • namespace and rights functions should operate on Mars volume/file abstractions once the dependency chain is available;
  • no Linux kernel module, NSS disk format or hidden NSS volume should become a runtime requirement.

During initial imports, keep NSS files as close to original as practical so the real dependencies are visible. Later integration patches may replace NSS storage hooks with Mars userspace hooks, but those replacements should be explicit and well documented.

Makefile and module-list audit

The NSS Makefile, *Modules.mk and buildtool files are useful as dependency maps. They should be used to identify which sources belong to features such as AdminVolume, namespace, common Beast objects, LSA, cache/runtime support and rights handling.

They are not a build target for Mars NWE. Mars should import only the source files and headers required to expose the desired library behaviour, then wire those pieces into the CMake library targets.

Import strategy

  1. Import bottom-up runtime dependencies with original filenames and directory shape where practical.
  2. Prefer real NSS implementation files over invented wrappers.
  3. Keep imported NSS headers under include/nwnss/ subdirectories; keep Mars core headers under include/nwcore/ and NWFS headers under include/nwfs/.
  4. Add small CTests for each imported runtime group.
  5. When NSS code reaches filesystem persistence, replace that boundary with Mars userspace adapters instead of carrying NSS kernel/disk assumptions forward.
  6. Audit already-imported or rewritten Mars files, especially nwfs/lsa, before building higher-level namespace/AdminVolume features on top of them.

AdminVolume direction

_ADMIN should be represented as a Mars NWE userspace/admin service view, not as an NSS disk volume. The NSS sources provide the semantics, object layout and dependency map. Mars provides the backing data and the NCP-facing integration.

The intended runtime shape is:

  • nwadminvol owns the generated _ADMIN tree and its Mars/NSS-adapted AdminVolume logic;
  • nwconn talks to nwadminvol over IPC when NCP clients access _ADMIN;
  • normal Mars/NWFS volumes continue to use the host filesystem plus Mars metadata/xattr adapters;
  • _ADMIN is generated from Mars configuration and runtime state, with any required persistence stored in Mars-owned state files, not in an NSS volume image.

The initial integration should keep _ADMIN internal and not expose it over NCP until namespace, metadata, rights and generated-file behaviour are reliable.

Volume numbering is a fixed Novell compatibility rule, not a configuration choice:

  • SYS = 0
  • _ADMIN = 1
  • further configured volumes start at 2

Volume ID 1 is therefore reserved even if _ADMIN is generated in memory by nwadminvol.

Current confirmed NSS import baseline

The local integration baseline after the AFP/Mac import and Unicode userspace boundary repair is:

ctest --output-on-failure
73 tests total
73 passed
0 failed

This includes the nwnss.* unit tests, the AFP and salvage ncpfs smokes, and the live nwfs.ncpfs.* metadata, quota and salvage-related smokes.

Provider and backend capability model

The userspace provider split is now a first-class NSS import boundary. The first decision is only whether a path is backed by a real NSS volume or by an OtherFS/HostFS tree. Feature-specific code still needs its own probes after that first decision.

NSS_VOLUME
  real NSS pool/volume/media semantics
  future Linux VFS exposure through nwnssmount/FUSE
  future block-I/O path through io_uring
  NSS metadata/RVD/data-stream/quota/salvage/repair code paths

OTHERFS_XATTR
  normal host filesystem tree
  Linux host xattrs and sidecars where required
  Netatalk-compatible AFP EAs for AFP/Mac state
  Linux quota or NWQUOTA metadata fallback for quota
  host recycle/salvage mapping for salvage

FUSE and io_uring are not alternative providers. They are both part of the future NSS_VOLUME implementation: FUSE is the Linux mount/frontend surface and io_uring is the asynchronous block-I/O backend below libnwnss.

Do not use provider names such as FUSE or IO_URING as feature selectors. Use NSS_VOLUME versus OTHERFS_XATTR, then let the feature-specific provider select the right backend.

The generic NSS capability names should stay NSS-shaped even for OtherFS. A host filesystem may later map comparable features such as Btrfs/ZFS snapshots onto NSS snapshot semantics, but only when the behaviour is close enough. For current XFS/ext4/HostFS work, the useful OtherFS capabilities are limited to namespace, host xattrs, trustees, effective rights, quota, salvage/purge, RVD-metadata mirroring where explicitly defined, and named streams where a backend such as Netatalk EA provides one.

Recommended provider capability vocabulary:

NSS_CAP_POOL
NSS_CAP_VOLUME
NSS_CAP_PARTITION
NSS_CAP_RAID
NSS_CAP_SNAPSHOT
NSS_CAP_ADMINFS
NSS_CAP_MANAGE_API
NSS_CAP_NAMESPACE
NSS_CAP_DATA_STREAMS
NSS_CAP_RVD_METADATA
NSS_CAP_EXTATTR
NSS_CAP_TRUSTEES
NSS_CAP_EFFECTIVE_RIGHTS
NSS_CAP_QUOTA
NSS_CAP_SALVAGE
NSS_CAP_PURGE
NSS_CAP_REPAIR_VERIFY
NSS_CAP_COMPRESSION
NSS_CAP_ENCRYPTION

For NSS_VOLUME, the eventual target is the full NSS stack: pools, volumes, partitions, RAID, snapshots, AdminFS/manage APIs, namespaces, data streams, RVD/extended metadata, trustees/effective rights, quota, salvage/purge, repair/verify/RAV, compression and encryption flags. For OTHERFS_XATTR, set only the subset that the concrete host backend can really emulate.

The first NSS-volume path probe can use the original NSS LSA superblock magic when a real Linux NSS filesystem is mounted:

statfs(path).f_type == LSA_MAGIC_SB -> NSS_VOLUME
otherwise                          -> OTHERFS_XATTR

This is only the coarse provider-kind probe. Quota still needs Linux quotactl() capability probes, AFP still needs Netatalk-EA versus NSS RVD/stream dispatch, salvage still needs NSS salvage versus host recycle storage, and xattr still needs NSS extended metadata versus Linux host-xattr storage.

AFP/Mac metadata provider boundary

Original NSS does not store AFP/Mac state in a Linux host xattr and it does not extend the LSA netware.metadata xattr for AFP. In NSS the Finder/Mac metadata belongs to root variable data:

RVD_MAC_META_DATA
  zMacInfo_s
  PackedMacInfo_s
  MACNS_PackRootVariableData()
  MACNS_UnpackRootVariableData()

The resource fork is a named data stream with the NSS stream name:

MAC_RF

For a real NSS_VOLUME, AFP must therefore use NSS RVD metadata and the MAC_RF stream. It must not read or write Netatalk EAs.

For OTHERFS_XATTR, there is no NSS-on-disk-compatible host representation for RVD metadata. The chosen compatibility backend is Netatalk adouble:ea, stored on the same host object that owns the AFP state:

org.netatalk.Metadata
org.netatalk.ResourceFork

Do not invent user.netware.afp.* xattrs and do not pack AFP into the existing netware.metadata mirror. The Netatalk EAs are an OtherFS provider representation only. The library API should expose NSS semantics (zMacInfo_s, RVD_MAC_META_DATA, MAC_RF) and dispatch through the provider.

NSS management and volume creation scope

NSS_VOLUME also covers the management side of NSS, not only mounted file I/O. The NSS sources include pool, volume and management paths that should guide future nwnssmu, nwnssmount, and AdminFS work.

Relevant source groups:

public_core/manage/
  managePool.c
  manageVolume.c
  managePartition.c
  manageFile.c
  manageAFP.c
  manageLinux.c
  manageServer.c
  manageUserSpaceRestr.c

public_core/zlss/
  zlssLogicalVolume.c
  zfsPool.c
  zfsVol.c
  zfsSuperBlk.c
  zlssDev.c
  repair*.c
  zlssIOPerformance.c

public_core/lsa/
  lsaSuper.c
  lsaSuperPool.c
  lsaSuperVol.c
  lsaXattr.c
  lsaNSSKR.c

public_core/nwraid/
  RAID 0/1/5 and device-manager integration references

public_core/admindrv/
  Admin-driver/AdminFS reference plumbing

Pool creation exists in the Linux management layer, historically through EVMS/NSSFS plugin paths such as LNXPOOL_CreatePool(). That path is a useful semantic/dependency reference but should not become a runtime EVMS requirement. Volume creation is closer to the real NSS/ZLSS core through management and logical-volume functions such as CreateVolumeInPool() and the ZLSSVOL_LV_Create*() family. Future nwnssmu pool create and nwnssmu volume create should build on those NSS semantics while replacing the old Linux/EVMS/block-device boundary with the planned io_uring storage boundary.

Planned tool split:

nwnssmount
  FUSE mount frontend for real NSS volumes.
  Provides Linux VFS access to NSS namespace, files, xattrs, RVD metadata,
  data streams including MAC_RF, trustees/effective rights, quota and salvage.

nwnssmu
  NSSMU-like management TUI/CLI for devices, partitions, pools, volumes,
  RAID, snapshots, repair/verify and volume attributes.

nwnssrights
  RIGHTS-like trustee, inherited-rights and effective-rights tool.

nwnssattrib
  ATTRIB-like NSS file/directory attribute tool.

nwnssquota
  nssquota-like user, directory and volume quota management frontend.

nwnssrav
  RAVSUI/RAVVIEW-like repair/analyze/verify frontend.

nwnsscon / AdminFS
  NSSCON/setcmd/AdminFS-style runtime and management views.

OtherFS providers must report unavailable for native NSS pool/volume/RAID/AdminFS management unless a future host filesystem backend deliberately maps a comparable feature onto the NSS capability model.

Xattr and metadata adaptation

NSS xattr and metadata functions are useful because they encode NetWare/NSS semantics. Their storage backend must be replaced at the Mars boundary.

For normal volumes:

  • NSS namespace, rights, effective-rights and metadata code should operate on Mars/NWFS objects;
  • xattrs and metadata should be persisted through the host filesystem xattr layer where possible;
  • data that does not map cleanly to host xattrs should go through an explicit Mars sidecar/state adapter;
  • no hidden NSS volume, NSS disk layout or kernel object should be required.

For _ADMIN:

  • files and directories are virtual/generated AdminVolume objects;
  • reads should be served from Mars configuration/runtime state;
  • writes, if supported, should update Mars configuration/state through explicit handlers;
  • the AdminVolume implementation should be usable as a library/service by nwadminvol, not as a mounted filesystem.

public_core import audit

This section classifies the top-level NSS public_core directories for the MARS-NWE import path. It is intentionally conservative: directly import useful open NSS code where it is a real subsystem, adapt only at platform/closed-source boundaries, and do not build wrappers around old MARS half-implementations when an NSS replacement exists.

Current import policy

  • Prefer direct NSS source import/adaptation over reimplementing behavior.
  • Keep original NSS file/API names where practical.
  • Put primitive reusable helpers in libnwnss.
  • Put filesystem/storage/runtime subsystems in a future libnwfs.
  • Put eDirectory/NDS code in a future libnwnds.
  • Put Bindery/auth/object-ID bridging in a future libnwbind.
  • Do not import Novell closed/kernel-only backend code. Adapt those boundaries to libc, libowfat, MatrixSSL, libsodium, or existing MARS-NWE state.

Top-level public_core directories

library/

Status: already partly imported; continue selectively into libnwnss.

Useful lowlevel helpers already imported or identified:

library/utc/*        => imported UTC/DOS/MS-time helpers
library/guid/guid.c  => imported GUID helper
library/id/id.c      => imported ID helper
library/eDir/*       => future libnwnds, not core
library/misc/*       => selective utility/error/table helpers only
library/os/*         => OS/NLM/platform glue; import only when needed
library/wio/*        => tool/UI logging; not server runtime first

library/eDir/getDSGuid.c depends on DDC/DS access and belongs in libnwnds. library/eDir/parseDSObjectName.c can also stay there unless a guarded 4.x endpoint needs it earlier.

nss/

Status: selective libnwnss plus later runtime work.

Already useful:

nss/lib/bitmap.c
nss/lib/crc.c
nss/lib/hash.c

Potential later helpers:

nss/lib/setErrno.c
nss/msg/*
nss/cache/*

nss/msg and nss/cache are not first-tier imports; they tie into NSS runtime message/cache infrastructure and should be pulled only when a concrete consumer requires them.

sharedsrc/

Status: source-fragment support for direct imports.

This directory contains .c.h implementation fragments used by multiple NSS library files. Continue importing these locally into src/nwnss/ or the future src/nwfs/ when the corresponding real source file needs them. Do not install .c.h files as public headers.

Examples already used:

sharedsrc/guid.c.h
sharedsrc/uni2utf.c.h
sharedsrc/utf2uni.c.h
sharedsrc/unicpy.c.h
sharedsrc/unilen.c.h

comn/namespace/

Status: future direct NSS namespace replacement path, not wrapper.

Sources:

comn/namespace/nameSpace.c
comn/namespace/dosNSpace.c
comn/namespace/dosNSWild.c
comn/namespace/longNSpace.c
comn/namespace/macNSpace.c
comn/namespace/unixNSpace.c
comn/namespace/dataStreamNSpace.c
comn/namespace/extAttrNSpace.c

Targets:

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

The goal is to replace old MARS namedos/nameos2 behavior, not wrap it. The runtime parts belong to libnwfs; reusable legal-name/wildcard helpers can be introduced first if they compile cleanly.

comn/common/

Status: important libnwfs runtime source, but too broad for blind import.

This is where much of the NSS common/filesystem object model lives:

adminVolume.c
adminVolFile.c
beastClass.c
beastHash.c
beastIO.c
beastStartup.c
comnDataStream.c
comnFile.c
comnIO.c
comnLookup.c
comnMacintosh.c
comnPool.c
comnUnicode.c
comnVariableData.c
comnVol.c
extAttrBeast.c
fileBeast.c
fileHandle.c
name.c
nameCache.c
nameLookup.c
objectIDStore.c
rootBeast.c
volBeast.c
zPool.c
zPublics.c

Useful later in libnwfs:

  • Beast object model
  • volume/pool object model
  • name/name-cache lookup
  • data-stream/extended-attribute runtime
  • _ADMIN virtual management volume
  • object ID store

Do not import this as one block. Pull it in along the namespace/data-stream/ volume axis after the boundary is clear.

comn/authsys/

Status: future direct authsys import/adaptation, split across libnwbind, libnwfs, and libnwnds as needed.

Files:

authorize.c
unixAuthModel.c
unixAuthSpace.c
unixDecision.c
zasAuthCache.c
zasAuthModel.c
zasAuthSpace.c
zasDecision.c

Policy:

  • Do not build a wrapper over old MARS auth behavior as the long-term target.
  • Import/adapt NSS authsys logic directly where it is open and useful.
  • Adapt only at closed/platform/backend boundaries.

Backend boundary mapping:

AES/crypto/RNG     => MatrixSSL/libsodium/libc as appropriate
Bindery identity   => future libnwbind
NDS/eDir identity  => future libnwnds
filesystem hooks   => future libnwfs

The AES code under comn/aes/ should not become a new crypto stack. Use the existing MatrixSSL/libsodium integration for real crypto operations.

comn/compression/

Status: future libnwfs storage feature.

Lowlevel algorithm sources are useful later:

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

Larger manager/runtime:

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

Import after namespace/data-stream/volume metadata exists. Relevant NCPs must report real state, not synthetic state:

decimal 90/12  == wire/code 0x5a/0x0c
decimal 123/70 == wire/code 0x7b/0x46
decimal 123/71 == wire/code 0x7b/0x47
decimal 123/72 == wire/code 0x7b/0x48
decimal 22/51  == wire/code 0x16/0x33

comn/main/ and comn/sbs/

Status: runtime/startup/support code, not first-tier library import.

comn/main includes NSS startup, symbol-export, command-line, and NLM/Linux module plumbing. Import only narrow pieces when a real libnwfs subsystem needs those APIs.

comn/sbs appears to be support/mgmt plumbing. Keep reference-only until a concrete endpoint or management path needs it.

lsa/

Status: possible future libnwfs storage adapter reference.

The LSA layer looks like logical storage adapter / super-volume / pool support:

lsa.c
lsaXattr.c
lsaSuperVol.c
lsaSuperPool.c
lsaUser.c
lsaNSSKR.c

Useful later for volume/pool/storage modeling and Linux xattr integration, but not needed before namespace/data-stream basics.

zlss/

Status: large ZLSS storage engine reference, future libnwfs only.

Contains B-tree, name-tree, file-map, pool/volume, repair, and storage I/O code:

nameTree.c
beastTree.c
myBTree.c
zfs.c
zfsFileMap.c
zfsPool.c
zfsVol.c
zlssLogicalVolume.c
repair*.c

This is valuable for NSS-shaped storage semantics, but too large for early imports. Use as reference while building libnwfs; import only if the complete required dependency slice is understood.

manage/

Status: future management tooling / _ADMIN / libnwadmin or libnwfs-mgmt.

Contains management commands for pools, volumes, NDS, partitions, server, Linux, and user-space restrictions. Not needed for NetWare 3.x data-path behavior. Potential later user: _ADMIN:/Manage_NSS/....

ndpmod/

Status: future NDP/NDS identity broker, likely libnwnds plus references for identity mapping.

Files such as ndp_idbroker.c and ndp_guids.c are not core imports. Revisit when guarded 4.x/NDS endpoints or DS identity mapping need them.

admindrv/, nebdrv/, nsslnxlib/

Status: platform/driver glue.

  • admindrv: Linux kernel/admin driver module wrapper.
  • nebdrv: driver/service plumbing.
  • nsslnxlib: Linux NSS compatibility wrappers (procdefslnx.c, nwlocale.c, microSecondTimer.c, kernel file helpers).

Import only specific userland-compatible functions when needed. Do not create a new kernel-driver dependency.

nwraid/

Status: future storage reference, not NCP namespace priority.

Contains RAID 0/1/5 logic and DM I/O helpers. Keep out of current libnwfs work until volume/pool/storage layering exists.

Transport and host-change boundaries

The transport split is outside NSS public_core, but it constrains the import boundaries. Future TCP/IP support belongs under the existing server process as a code/library split (nwtransport, nwipx, later nwtcp), not as a new daemon and not as an NSS namespace dependency. NCP providers and imported namespace code must remain transport-neutral.

The audited bundled libowfat API names for the later TCP listener are socket_tcp4(), socket_tcp6(), socket_bind4_reuse(), socket_bind6_reuse(), socket_listen(), socket_accept4_*(), socket_accept6_*(), and the io_* readiness helpers. Do not write future TCP code against shorthand socket4/socket6 names.

External host changes are a libnwfs/metadata concern, not a transport concern. When Samba, rsync, backup restore or local admin tools create files, the watcher/startup scanner should create or reconcile netware.metadata and DOS/LONG/MAC/UNIX namespace records. Keep that state in NSS-shaped metadata, not in a private database.

  1. Keep documentation current: direct namespace import, authsys direct/adapted import, and platform-boundary adapters only.
  2. Start namespace with the smallest direct NSS DOS namespace slice that can replace old namedos behavior under tests.
  3. Add LONG namespace and retire nameos2 logic under tests.
  4. Add MAC/UNIX/DataStream/EA namespace slices.
  5. Build libnwfs Beast/name-cache/data-stream/EA runtime as required by those namespace imports.
  6. Then revisit compression, _ADMIN, objectID/authsys, and NDS/bindery splits.

Namespace and storage import audit

This section 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

libnwnss

libnwnss receives stable reusable NSS primitives needed by 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 and libnwnss; they belong in the future libnwnds:

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/nwnss, 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.

NSS runtime headers must not be duplicated under include/nwfs. The following are already supplied by libnwnss and should be found through the mars_nwe::nwnss dependency or the explicit nwnss include path:

include/nwnss/library/bit.h
include/nwnss/include/guid.h
include/nwnss/library/omni.h
include/nwnss/library/que.h
include/nwnss/include/utc.h
include/nwnss/include/xError.h
include/nwnss/library/xUnicode.h
include/nwnss/public/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:

  1. nwcore-nss-spinlock: Linux-userspace spinlock primitive backed by POSIX pthread_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.
  2. nwcore-nss-mpk-lock: direct NSS pssmpk.h plus public_core/library/os/pssmpk.c import for the global MPKNSS_LOCK API, ported to the core Linux-userspace spinlock backend. The companion NSS histogram base from shared/sdk/include/histogram.h and public_core/library/misc/histogram.c is also present so the MPK MeasureSpinLock instrumentation path keeps its original shape. This is now present in libnwnss and covered by nwnss.pssmpk.
  3. nwcore-nss-runtime-base: the next smallest real subset of NSS scheduler/FSM headers and sources needed by latch.h/xCache.h, with Linux-kernel-only or NDPS/DDS-only includes removed or guarded only when the filesystem path does not use them.
  4. nwfs-latch-cache-base: direct imports for latch/cache types required by beast structures once the generic runtime primitives are in core.
  5. nwfs-beast-base: beast class and root-beast structure support.
  6. nwfs-admin-volume: build the _ADMIN virtual volume model, but do not expose it through NCP until the runtime path is ready.
  7. nwfs-namespace-registry: nameSpace.c and registration state.
  8. DOS namespace activation: build dosNSpace.c only 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:

  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. Continue replacing namespace-model stubs with the smallest buildable NSS namespace primitives directly under src/nwfs/.
  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.

Patch records

0488 core: import NSS mailbox runtime

Imported the real NSS mailbox runtime before FSM/latch:

  • shared/sdk/include/mailbox.h -> include/nwnss/include/mailbox.h
  • public_core/library/os/mailbox.c -> src/nwnss/library/os/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/nwnss/include/pssDebug.h
  • shared/sdk/include/schedule.h -> include/nwnss/include/schedule.h
  • shared/sdk/library/xStdio.h -> include/nwnss/library/xStdio.h
  • shared/sdk/library/inlines.h -> include/nwnss/library/inlines.h
  • public_core/library/debug/pssDebug.c -> src/nwnss/library/debug/pssDebug.c

This is intentionally the production/no-debug path: NSS_DEBUG is disabled by include/nwnss/library/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/nwnss/library/stdio/snprintf.c
  • public_core/library/stdio/snprintf.h -> include/nwnss/library/stdio/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/nwnss/library/stdio/ with only Linux userspace include adjustment from <stdio.h>/<linux/limits.h> to the existing 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.h is imported as include/nwnss/include/wio.h.
  • public_core/library/wio/wio.c is imported as src/nwnss/library/wio/wio.c; its Linux LB__wioOutput() path is used.
  • public_core/library/wio/nssUI.c is imported as src/nwnss/library/wio/nssUI.c; the kernel /proc transport is ported to Linux userspace stdout while retaining the NSS NSS_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, and waprintf.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.

Legacy nwfs namespace staging removed

The old src/nwfs/comn/namespace/ and matching reduced include/nwfs/ NSS namespace staging files were only an early Mars/NWFS import scaffold. They are not built and conflict conceptually with the real libnwnss COMN and namespace import. nwfs now keeps only the legacy xattr/quota/authorization helpers that are still used by current Mars/NCP compatibility tests. New NSS namespace, AFP, RVD metadata, data-stream, quota and salvage semantics belong in libnwnss; Mars/NWFS must adapt to those APIs rather than carrying parallel NSS-shaped source copies.