Files
mars-nwe/doc/NSS_IMPORT_NOTES.md
Mario Fetka 8b4892157b docs: fix remaining stale references after doc consolidation
- TODO.md: TUI_TOOLBOX_PLAN.md and NWCORE_INI_PLAN.md → TOOLBOX_PLAN.md
- REDESIGN.md line 2971-2973: same three old names → TOOLBOX_PLAN.md and
  DIRECTORY_AND_ADMIN_PLAN.md
- NSS_IMPORT_NOTES.md: correct four stale libnwcore claims left over from
  the old NSS_PUBLIC_CORE_AUDIT.md text:
  - import policy: "Put primitive helpers in libnwcore" → libnwnss
  - namespace import-direction section header/body: libnwcore → libnwnss
  - pssmpk placement: libnwcore/nwcore.pssmpk → libnwnss/nwnss.pssmpk
  - eDir helpers: clarify they stay out of libnwcore AND libnwnss (→ libnwnds)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 18:21:52 +02:00

941 lines
32 KiB
Markdown

# 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`.
### 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:
```text
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:
```text
nss/lib/bitmap.c
nss/lib/crc.c
nss/lib/hash.c
```
Potential later helpers:
```text
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:
```text
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:
```text
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:
```text
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:
```text
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:
```text
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:
```text
cdcomp.c
cdcompa.c
cduncomp.c
cduncompa.c
nwAlgo.c
copyAlgo.c
```
Larger manager/runtime:
```text
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:
```text
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:
```text
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:
```text
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.
### Recommended order after Unicode/GUID/string imports
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:
```text
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:
```text
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:
```text
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`:
```text
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:
```text
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:
```text
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:
```text
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:
```text
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:
```text
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:
```text
_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/`:
```text
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:
```text
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:
```text
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:
```text
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.