# Data model

---

# Data model

_Peios Kernel / Internals / LCS / Data model_

> Find the Peios kernel articles about data model.

Use these articles to understand data model in the Peios kernel.

- [Hives and Routing](</kernel/internals/lcs/data-model/hives-and-routing.md>)
- [Private Hives](</kernel/internals/lcs/data-model/private-hives.md>)
- [Keys](</kernel/internals/lcs/data-model/keys.md>)
- [Symlinks](</kernel/internals/lcs/data-model/symlinks.md>)
- [Path Entries](</kernel/internals/lcs/data-model/path-entries.md>)
- [Values](</kernel/internals/lcs/data-model/values.md>)
- [Tombstones](</kernel/internals/lcs/data-model/tombstones.md>)
- [Names and Case](</kernel/internals/lcs/data-model/names-and-case.md>)
- [Deletion and Orphans](</kernel/internals/lcs/data-model/deletion-and-orphans.md>)

---

# Hives and Routing

_Peios Kernel / Internals / LCS / Data model_

> A hive is the first component of every path — the routing table that maps hive names to sources, and the two names the kernel knows itself.

<a id="trm-5-2-1"></a>

A hive is a top-level namespace — the first component of every registry
path. LCS keeps a routing table mapping hive names to registered
sources, and that table is built entirely from what registers. There is
no static configuration. <a id="cite-hive.routing-table.built-from-registrations"></a>

| Field | Description |
|---|---|
| Name | The hive name, e.g. `Machine`, `Users`. Case-preserving, compared case-insensitively. <a id="cite-hive.field.name-case-insensitive"></a> |
| Root GUID | The GUID of the hive's root key, supplied by the source at registration. <a id="cite-hive.field.root-guid-supplied-by-source"></a> |
| Source | The source slot backing this hive. |
| Status | Active or Unavailable, tracking source connectivity. <a id="cite-hive.field.status-active-or-unavailable"></a> |

Status is a property of the source slot rather than of the individual
hive, which amounts to the same thing: a slot's hives are exactly one
source's, and they go Down together. <a id="cite-hive.status-is-per-source-slot"></a>

<a id="trm-5-2-1-1"></a>

## Route identity

A hive route is identified by the pair **(case-folded name, scope)**,
where the scope is either the global namespace or one private scope
GUID. <a id="cite-hive.route-identity.name-and-scope"></a>

That pair must be unique across every registered source; a source
claiming one another source already holds is rejected. <a id="cite-hive.route-identity.must-be-unique"></a>

The same name may appear in different scopes, which is precisely how a
private hive shadows a global one without colliding with it. <a id="cite-hive.route-identity.same-name-in-different-scopes"></a>

A hive is backed by exactly one source. A source may back many. <a id="cite-hive.one-source-per-hive"></a>

<a id="trm-5-2-1-2"></a>

## Routing a path

LCS takes the first component of a path — everything before the first
separator — and looks it up. <a id="cite-hive.routing.uses-first-component"></a>

- Registered and active routes to the backing source. <a id="cite-hive.routing.active-routes-to-source"></a>
- Not registered is `ENOENT`. <a id="cite-hive.routing.unregistered-is-enoent"></a>
- Registered but Down is `EIO`. <a id="cite-hive.routing.down-is-eio"></a>

Before any source registers, the table is empty and every path yields
`ENOENT` ([The Bootstrap Problem](</kernel/internals/lcs/bootstrap/dependencies-and-boot-sequence.md#trm-5-10-1>)).

<a id="trm-5-2-1-3"></a>

## `CurrentUser` is not a hive

`CurrentUser\` is a kernel-level alias. When a caller-supplied absolute
path starts with it, LCS reads the user SID from the calling thread's
effective token and rewrites the path to `Users\<SID>\...` before
routing. <a id="cite-hive.currentuser.rewrites-to-users-sid"></a>

The rewritten path is re-checked against the total-length limit, since
a textual SID is longer than the alias it replaced. <a id="cite-hive.currentuser.rewritten-path-rechecked-for-length"></a>

Three constraints keep this safe.

It applies **only to the first component** of a path, and only to a
caller-supplied absolute one. <a id="cite-hive.currentuser.first-component-of-caller-path-only"></a>

It does **not** apply to symlink targets: a target beginning with
`CurrentUser\` is followed literally, routes as a hive of that name,
and finds nothing. <a id="cite-hive.currentuser.not-applied-to-symlink-targets"></a> Without that rule, a symlink
containing `CurrentUser\` would redirect a privileged service into the
service's own user hive — a confused deputy.

And `CurrentUser` cannot be registered as a hive name. LCS rejects the
registration with `EINVAL`, so the alias can never collide with a real
hive. <a id="cite-hive.currentuser.cannot-be-registered-einval"></a>

Symlink targets *are* subject to ordinary hive routing, private hives
included. <a id="cite-hive.symlink-targets-use-ordinary-routing"></a> A sandboxed process resolving a symlink sees the same
registry through it that it sees directly, which is the point of
sandboxing it.

<a id="trm-5-2-1-4"></a>

## Two names the kernel knows

LCS is source-agnostic about routing but not entirely ignorant of
names. `Users` is compiled in as the target of `CurrentUser\`
rewriting. `Machine` is matched, case-insensitively and only for a
global hive, to decide when to run the bootstrap refresh that reads
LCS's own configuration ([The Boot Sequence](</kernel/internals/lcs/bootstrap/dependencies-and-boot-sequence.md#trm-5-10-2>)).

Neither is a routing decision — an unregistered `Machine` routes
nowhere like any other name — but the two names do exist in the kernel. <a id="cite-hive.known-names.get-no-routing-privilege"></a>

In practice loregd registers `Machine` and `Users` at boot. Other
sources may register other hives at any time.

<a id="trm-5-2-1-5"></a>

## Names

Hive names follow the same rules as key name components: no backslash,
no forward slash, no null byte, valid UTF-8, non-empty, and no longer
than `MaxPathComponentLength`. <a id="cite-hive.name.follows-key-component-rules"></a> They are case-preserving and compared
case-insensitively ([Names and Case](</kernel/internals/lcs/data-model/names-and-case.md#trm-5-2-8>)).

---

# Private Hives

_Peios Kernel / Internals / LCS / Data model_

> Hives invisible in the global namespace, reachable only through a scope GUID on the calling token — routing, lifecycle and registration rules.

<a id="trm-5-2-2"></a>

A private hive is registered with the `RSI_HIVE_PRIVATE` flag and a
scope GUID. <a id="cite-private-hive.registered-with-flag-and-scope-guid"></a>

It is invisible in the global namespace and reachable only by a thread
whose token carries that scope GUID. <a id="cite-private-hive.invisible-globally-and-scope-gated"></a>

<a id="trm-5-2-2-1"></a>

## Routing

Private hives are checked **before** global ones. <a id="cite-private-hive.routing.checked-before-global"></a>

For each scope GUID on the calling thread's token, in the order the
token carries them, LCS looks for a private hive with the path's name
and that scope. The first match wins. Only if none matches is the
global table consulted. <a id="cite-private-hive.routing.token-order-first-match-wins"></a>

A private hive can therefore shadow a global one, and no name is exempt
— a thread with a private `Machine\` sees the private one. <a id="cite-private-hive.routing.shadows-any-global-name"></a> That is what
makes complete registry isolation possible for a container or a
sandbox without giving it a differently-named hive to notice.

`MaxScopeGUIDsPerToken`, default 8, bounds the per-syscall iteration
cost; a token above the cap fails every registry operation with `E2BIG`
([Private Layers](</kernel/internals/lcs/layers/private-layers.md#trm-5-3-5>)). <a id="cite-private-hive.scope.max-guids-per-token"></a> Duplicate scope GUIDs on a token are rejected.

<a id="trm-5-2-2-2"></a>

## Scope GUIDs on a token

Scope GUIDs reach a thread through the KACS token's LCS credential
extension: a versioned block in the token specification carrying the
thread's scope GUIDs and its private layer names ([Private Layers](</kernel/internals/lcs/layers/private-layers.md#trm-5-3-5>)). It parses at
a fixed offset, and:

- rejects a nil scope GUID; <a id="cite-private-hive.credential.rejects-nil-guid"></a>
- rejects duplicate scope GUIDs; <a id="cite-private-hive.credential.rejects-duplicate-guids"></a>
- caps the count at 256 — a hard KACS limit, above the configurable
  LCS one. <a id="cite-private-hive.credential.caps-count-at-256"></a>

The credentials propagate across fork, duplication and impersonation
like the rest of the token. <a id="cite-private-hive.credential.propagates-across-fork-and-impersonation"></a>

Attaching them is gated by `SeCreateTokenPrivilege`, because scope
GUIDs can only enter a token when the token is created. <a id="cite-private-hive.scope.attaching-gated-by-secreatetokenprivilege"></a> That is a
blanket privilege rather than a per-scope authorisation: a caller that
can create tokens at all can create one claiming any scope. Isolation
between private hives therefore rests on who may create tokens, not on
who owns a scope.

<a id="trm-5-2-2-3"></a>

## Scope lifecycle

A scope GUID is an opaque 128-bit value with no lifecycle. LCS neither
creates nor tracks one; it only compares. <a id="cite-private-hive.scope.opaque-and-untracked-by-lcs"></a> A scope exists as long as
some private hive or some token references it, and when the last
reference goes it is simply a number nobody uses.

Nothing in the kernel generates scope GUIDs. <a id="cite-private-hive.scope.not-generated-by-kernel"></a> Key GUIDs and token GUIDs
come from the kernel's UUIDv4 generator; scope GUIDs are supplied by
userspace, and choosing them unpredictably is userspace's
responsibility.

<a id="trm-5-2-2-4"></a>

## Registration rules

Registration enforces more than the route-identity uniqueness of
[Hives and Routing](</kernel/internals/lcs/data-model/hives-and-routing.md#trm-5-2-1>) — the full list is [Registration and Slots](</kernel/internals/lcs/sources/registration-and-slots.md#trm-5-8-2>), and the rules that exist for private
hives are these:

- A hive's root GUID may not be nil.
- The root GUIDs within one registration request must be
  distinct.
- A hive without the `RSI_HIVE_PRIVATE` flag may not carry a non-nil
  scope GUID.
- A hive **with** the flag may not carry a nil one. <a id="cite-private-hive.registration.private-hive-requires-scope-guid"></a> No token
  can carry a nil scope GUID, so such a hive would be registrable and
  then permanently unroutable — holding its name against other sources
  in that scope while every lookup returned `ENOENT`.
- Unknown flag bits are rejected.
- Opening `/dev/pkm_registry` at all requires an **enabled**
  `SeTcbPrivilege`, checked in the device's `open()` handler
  ([Registration and Slots](</kernel/internals/lcs/sources/registration-and-slots.md#trm-5-8-2>)).

---

# Keys

_Peios Kernel / Internals / LCS / Data model_

> A key is a container of subkeys and values — its identity, its properties, volatile keys, and the rules for naming one.

<a id="trm-5-2-3"></a>

A key is a node in the hierarchy: a container holding subkeys and
values. The filesystem analogy is an inode. A key carries identity and
properties; naming lives in path entries ([Path Entries](</kernel/internals/lcs/data-model/path-entries.md#trm-5-2-5>)).

| Field | Mutable | Layered | Description |
|---|---|---|---|
| GUID | No | No | Identity, assigned by LCS at creation, persisted by the source. |
| Name | No | No | The key's own name component. Informational; the path entry resolves the identity. `QUERY_KEY_INFO` preserves this spelling only when it folds to that resolved leaf, and audits and refuses a mismatch with `EIO`. <a id="cite-key.field.name-is-informational"></a> |
| Parent GUID | No | No | The parent key. Nil for a hive root. <a id="cite-key.field.parent-guid-nil-for-hive-root"></a> |
| Security Descriptor | Yes | No | Computed from the parent at creation; changed at runtime with `WRITE_DAC` / `WRITE_OWNER`. <a id="cite-key.field.security-descriptor-computed-from-parent"></a> |
| Last write time | Yes | No | Updated when a value is written or deleted or the descriptor changes. <a id="cite-key.field.last-write-time-updates"></a> |
| Volatile | No | No | The source stores this key in non-persistent storage only. |
| Symlink | No | No | This key is a symbolic link ([Symlinks](</kernel/internals/lcs/data-model/symlinks.md#trm-5-2-4>)). |

**No key property is layer-qualified.** Properties belong to the object. <a id="cite-key.no-property-is-layer-qualified"></a>
Changing a key's structural type through a layer is not a matter of
setting a flag; the layer hides the original key and creates a new one
at the same path, which is the ordinary overlay pattern.

<a id="trm-5-2-3-1"></a>

## Identity

A key's identity is its GUID, not its path. Two keys occupying the same
path at different times are different objects with different GUIDs. <a id="cite-key.identity.is-guid-not-path"></a> A
path is a name that maps to an identity; the identity outlives the
name.

GUIDs are assigned by LCS — never by a source — and pushed to the
source at creation, where they become the primary key of its
storage. <a id="cite-key.identity.guid-assigned-by-lcs-not-source"></a>

Once a path has been resolved to a GUID at open time, every subsequent
RSI operation uses the GUID directly. <a id="cite-key.identity.rsi-uses-guid-after-open"></a>

The generator is the kernel's version-4 GUID generator: random bytes
from the kernel CSPRNG with the version and variant bits set in the
PCDS layout — the version nibble in the high nibble of byte 7, because
`Data3` is little-endian in bytes 6–7, and the variant bits in byte 8. <a id="cite-key.identity.guid-generator-is-uuidv4"></a>

Freshness is the collision resistance of UUIDv4 plus a check against
the keys LCS currently tracks, with a bounded retry. <a id="cite-key.identity.freshness-checked-against-tracked-keys"></a>

There is **no persistent retired-GUID catalogue**, and no code anywhere
that would maintain one. A GUID dropped by orphan cleanup is not
remembered. <a id="cite-key.identity.no-retired-guid-catalogue"></a>

If a source answers `RSI_CREATE_KEY` for a freshly generated GUID with
`RSI_ALREADY_EXISTS`, that is not a race to retry — the kernel believes
the GUID is unused and the source disagrees. LCS treats it as source
inconsistency and fails closed with `EIO`. <a id="cite-key.identity.create-key-already-exists-is-eio"></a>

It is never retried as an open and `EEXIST` never reaches userspace
from `reg_create_key`. <a id="cite-key.identity.no-eexist-from-reg-create-key"></a>

A GUID appears at exactly one canonical location. LCS validates that
and rejects a source that reports otherwise.

<a id="trm-5-2-3-2"></a>

## Volatile keys

Volatile is a flag LCS carries and forwards. Storing a volatile key in
non-persistent storage is the source's obligation; nothing in the
kernel enforces it. <a id="cite-key.volatile.storage-is-the-source-obligation"></a>

What the kernel does enforce is the containment rule: **a non-volatile
key may not be created under a volatile parent** (`EINVAL`). <a id="cite-key.volatile.non-volatile-under-volatile-parent-is-einval"></a>

The converse is allowed — a volatile key under a persistent parent is
ordinary. <a id="cite-key.volatile.volatile-under-persistent-parent-allowed"></a>

<a id="trm-5-2-3-3"></a>

## Naming

Three bytes are forbidden in a key name component: backslash and
forward slash, both of which are separators, and the null
byte. <a id="cite-key.name.three-forbidden-bytes"></a>

Every other valid UTF-8 sequence is permitted, spaces and arbitrary
Unicode included. <a id="cite-key.name.any-other-utf8-permitted"></a>

Empty components are forbidden, which rules out a leading separator and
consecutive separators (`Machine\\System`). <a id="cite-key.name.empty-components-forbidden"></a>

A trailing separator (`Machine\System\`) is likewise
invalid. <a id="cite-key.name.trailing-separator-invalid"></a>

Length limits are byte counts: `MaxPathComponentLength` per component,
`MaxTotalPathLength` for the whole path, `MaxKeyDepth` for nesting.

Forward slash normalisation is achieved by treating `/` as a separator
wherever a separator is recognised, rather than by rewriting the string
— so a materialised component never contains either separator, and the
canonical form is per-component rather than a canonicalised string.

---

# Symlinks

_Peios Kernel / Internals / LCS / Data model_

> The two load-bearing mechanisms behind a symlink key — the structural flag and the target value — plus resolution, depth and opening the link itself.

<a id="trm-5-2-4"></a>

A symlink key uses two mechanisms, and both are load-bearing.

The **symlink flag** on the key record marks the key's structural type.
It is set at creation by `REG_OPTION_CREATE_LINK` and is immutable
afterwards. <a id="cite-symlink.flag.set-at-creation-and-immutable"></a>

`RSI_WRITE_KEY` can update only the descriptor and the last write time,
so there is no operation that could change it. <a id="cite-symlink.flag.rsi-write-key-cannot-change-it"></a>

The **default value, of type `REG_LINK`,** supplies the target
path. <a id="cite-symlink.target.is-the-reg-link-default-value"></a>

It is an ordinary layered value, which means a higher-precedence layer
can redirect a symlink by writing a different `REG_LINK` default value,
and removing that layer restores the original target. <a id="cite-symlink.target.layer-can-redirect-and-revert"></a>

The flag marks identity; the value provides the target.

<a id="trm-5-2-4-1"></a>

## Resolution

LCS follows symlinks during path resolution and the fd it returns
refers to the resolved target — its GUID, its position in the tree, its
ancestor chain — not to the link. <a id="cite-symlink.resolution.fd-refers-to-the-target"></a>

The target is resolved by issuing a separate `RSI_QUERY_VALUES` for the
key's default value (the empty name) and applying ordinary layer
resolution to the result, so the target participates in the layer
system exactly as any other value does. <a id="cite-symlink.resolution.target-read-with-layer-resolution"></a>

If the effective default value is missing, or is not of type
`REG_LINK`, resolution fails with `EINVAL`. <a id="cite-symlink.resolution.missing-or-wrong-type-is-einval"></a>

LCS does **not** validate the type at write time: a layer that writes a
`REG_SZ` default value over a symlink's target breaks resolution at the
next open, and removing that layer fixes it. <a id="cite-symlink.resolution.target-type-not-validated-at-write-time"></a>

The offending value stays in the registry; a failed resolution writes
nothing. <a id="cite-symlink.resolution.failed-resolution-writes-nothing"></a>

<a id="trm-5-2-4-2"></a>

## The target path

The `REG_LINK` payload is a length-delimited UTF-8 registry path. No
trailing null is required or permitted — the length delimits it, and a
null byte inside that length is rejected like any
other. <a id="cite-symlink.target-path.length-delimited-no-trailing-null"></a> Forward
slashes are handled as separators as everywhere else.

The target is validated with exactly the same rules as a syscall path:
UTF-8, no null bytes, per-component and total length, no empty
components, no trailing separator, maximum depth. <a id="cite-symlink.target-path.validated-like-a-syscall-path"></a> The only difference
is that a syscall path arrives null-terminated and has its terminator
stripped first.

A target is always interpreted as absolute — its first component is
routed as a hive name. <a id="cite-symlink.target-path.always-absolute"></a>

Resolution has no check that rejects a relative-looking target as
malformed. A target of `Sub\Key` is not an error; it is a request for a
hive named `Sub`, and it yields `ENOENT` unless such a hive happens to
be registered, in which case it resolves there. <a id="cite-symlink.target-path.relative-looking-target-not-rejected"></a>

Writing one is different. `REG_IOC_SET_VALUE` of a `REG_LINK` value
routes the target's first component at write time, with the writer's
scope GUIDs, and answers `EINVAL` if it names no registered hive. That
is what stops a dangling target being captured later by whoever
registers a private hive of that name: a target that cannot be written
cannot be captured, and the failure lands on whoever authored it. The
cost is that a symlink cannot forward-reference a hive registered after
it. A target that arrives in source data or a backup stream is not
gated, which is why resolution still has to treat the shape as a hive
request. <a id="cite-symlink.target-path.write-time-routing-gate"></a>

`CurrentUser\` rewriting is not applied ([Hives and Routing](</kernel/internals/lcs/data-model/hives-and-routing.md#trm-5-2-1>)), so a target beginning
with `CurrentUser\` routes as a hive of that name and cannot be
registered, and therefore always fails. Ordinary hive routing does
apply, private hives included, for the resolving thread.

<a id="trm-5-2-4-3"></a>

## Depth

Symlink resolution is bounded by `SymlinkDepthLimit`, default 16,
configurable from 1 to 64. Exceeding it is `ELOOP`. <a id="cite-symlink.depth.exceeding-the-limit-is-eloop"></a>

<a id="trm-5-2-4-4"></a>

## Opening the link itself

`REG_OPEN_LINK` on `reg_open_key` opens the symlink key rather than
following it, which is how a symlink is managed at all — deleted,
retargeted, inspected. <a id="cite-symlink.open-link.opens-the-link-not-the-target"></a>

It applies to the **final path component only**. A symlink encountered
part-way along a path is followed whether or not the flag is
set. <a id="cite-symlink.open-link.final-component-only"></a>

The access check follows the same rule: with `REG_OPEN_LINK` the check
is against the link, otherwise against the target. <a id="cite-symlink.open-link.access-check-follows-the-flag"></a>

<a id="trm-5-2-4-5"></a>

## Creation

Creating a symlink needs all of:

- `KEY_CREATE_SUB_KEY` on the parent, as for any key; <a id="cite-symlink.create.requires-key-create-sub-key"></a>
- `KEY_CREATE_LINK` on the parent; <a id="cite-symlink.create.requires-key-create-link"></a>
- either an enabled `SeTcbPrivilege` or membership of Administrators. <a id="cite-symlink.create.requires-setcbprivilege-or-administrators"></a>

The last is a genuine disjunction — either satisfies it — and the
privilege branch marks the privilege used. <a id="cite-symlink.create.privilege-branch-marks-privilege-used"></a>

Failing it is `EPERM`. <a id="cite-symlink.create.failure-is-eperm"></a>

---

# Path Entries

_Peios Kernel / Internals / LCS / Data model_

> Key existence and naming are layer-qualified while key identity is not — the per-layer path entry that separates them, and hiding.

<a id="trm-5-2-5"></a>

Key existence and naming are layer-qualified; key identity is not. The
source stores a **path entry** per layer, which separates the two. <a id="cite-path-entry.existence-and-naming-are-layer-qualified"></a> The
overlay-filesystem analogy is exact: directory entries are per-layer,
inodes are shared.

| Field | Description |
|---|---|
| Parent GUID | The parent key. |
| Child name | The key's name under that parent — one component, not a path. <a id="cite-path-entry.field.child-name-is-one-component"></a> |
| Layer | The layer this entry belongs to. |
| Target | The GUID of the key at this path in this layer, or HIDDEN. <a id="cite-path-entry.field.target-is-a-guid-or-hidden"></a> |
| Sequence | A monotonic number assigned by LCS at creation, used for tiebreaking within a precedence tier. |

On the wire a HIDDEN entry is a target type of 1 with an all-zero GUID
([LCS ABI Reference](</kernel/userspace/native/lcs/generated-syscall-and-common-abi.md#trm-5-a>)). <a id="cite-path-entry.hidden.wire-form-is-type-1-and-zero-guid"></a>

A source returning a non-zero GUID on a HIDDEN entry is returning
malformed data. <a id="cite-path-entry.hidden.non-zero-guid-is-malformed"></a>

<a id="trm-5-2-5-1"></a>

## Creating a key

Creating a key in a layer always assigns a fresh GUID and produces two
records: a path entry `(parent, name, layer) → GUID` with a new
sequence number, and a key record carrying that GUID. <a id="cite-path-entry.create.fresh-guid-and-two-records"></a>

LCS sends `RSI_CREATE_ENTRY` first and `RSI_CREATE_KEY`
second. <a id="cite-path-entry.create.entry-before-key"></a>

That order matters for the race: if another caller got there first, the
entry creation returns `RSI_ALREADY_EXISTS` and LCS retries the whole
thing as an open, reporting `REG_OPENED_EXISTING`. <a id="cite-path-entry.create.entry-already-exists-retries-as-open"></a> Failure on the
*second* call, for a GUID LCS just minted, is not a race and fails
closed ([Keys](</kernel/internals/lcs/data-model/keys.md#trm-5-2-3>)).

If a different layer already has a key at that path, the new layer gets
its own distinct GUID. Each layer has its own key object, and
resolution decides which is visible. <a id="cite-path-entry.create.other-layer-gets-a-distinct-guid"></a>

**No operation creates a path entry pointing at an existing GUID.**
`reg_create_key` always mints a new one. The namespace is a tree, never
a graph. <a id="cite-path-entry.create.never-points-at-an-existing-guid"></a>

<a id="trm-5-2-5-2"></a>

## No GUID sharing across layers

The path table's shape would technically permit two entries referencing
one GUID, which would be a hard link. No API exposes it. <a id="cite-path-entry.no-hard-links.no-api-exposes-guid-sharing"></a>

Every key has exactly one canonical parent and name, and LCS validates
that a source is not reporting otherwise: the key record's parent must
be the parent the key was reached through, and its name must fold to the
component the key was reached by. A record that says otherwise is
malformed key metadata — `REG_IOC_QUERY_KEY_INFO` answers
`EIO` and the source-data validation failure is audited. <a id="cite-path-entry.no-hard-links.one-canonical-parent-and-name"></a>

Aliasing has an explicit, visible mechanism, and it is symlinks. Hard
links would make parent-GUID semantics, descriptor inheritance, subtree
enumeration and watch dispatch all ambiguous at once.

<a id="trm-5-2-5-3"></a>

## Hiding

A layer can create a HIDDEN entry at a path, making the key invisible
regardless of what lower-precedence layers say. <a id="cite-path-entry.hiding.hidden-entry-makes-a-key-invisible"></a>

It is the path-level equivalent of a value tombstone, and when the
hiding layer is removed the lower key reappears. <a id="cite-path-entry.hiding.removing-the-layer-restores-the-lower-key"></a>

A HIDDEN entry gets a sequence number like any other entry, so a
conflict between a GUID entry in one layer and a HIDDEN entry in
another at the same precedence resolves deterministically: the higher
sequence number wins. <a id="cite-path-entry.hiding.hidden-entry-carries-a-sequence-number"></a>

<a id="trm-5-2-5-4"></a>

## Hide and replace

A single layer can hide an existing key and put a new one at the same
path, and no special mechanism is needed for it. The layer creates its
own path entry pointing at its own new GUID; lower-precedence entries
for the same `(parent, name)` are masked because this layer's entry
wins on precedence. <a id="cite-path-entry.hide-and-replace.layer-entry-masks-lower-entries"></a>

Removing the layer removes both the new key and its masking effect, and
the lower key comes back. <a id="cite-path-entry.hide-and-replace.removing-the-layer-restores-the-lower-key"></a>

This falls out of per-layer path entries and precedence ordering
without a line of code that knows about it.

<a id="trm-5-2-5-5"></a>

## Hive roots

A hive root has no parent GUID and no child name, so there is no
`(parent, name, layer)` tuple to remove or mask. <a id="cite-path-entry.hive-root.has-no-parent-or-child-name"></a>

Deleting or hiding a hive root fd is `EINVAL`, rejected before source
dispatch, before transaction enlistment, before sequence allocation and
before any watch event is generated. <a id="cite-path-entry.hive-root.delete-or-hide-is-einval"></a>

---

# Values

_Peios Kernel / Internals / LCS / Data model_

> A named, typed datum inside a key — one name with many layer entries, the type set, REG_TOMBSTONE, naming and size.

<a id="trm-5-2-6"></a>

A value is a named, typed datum inside a key. Values hold the
configuration data; keys hold values.

| Field | Description |
|---|---|
| Key GUID | The key this value belongs to. |
| Name | The value's name; the empty string is the default value. Case-preserving, compared case-insensitively. <a id="cite-value.field.empty-name-is-the-default-value"></a> |
| Type | A registry value type. |
| Data | An opaque byte array, up to `MaxValueSize` (default 1 MB). <a id="cite-value.field.data-bounded-by-max-value-size"></a> |
| Layer | The layer this entry belongs to. Every write is tagged. <a id="cite-value.field.every-write-is-layer-tagged"></a> |
| Sequence | Assigned by LCS at write time, for tiebreaking within a precedence tier. |

A key holds many values with distinct names, and at most one unnamed
one. <a id="cite-value.at-most-one-unnamed-value-per-key"></a>

<a id="trm-5-2-6-1"></a>

## One name, many entries

A single `(key GUID, value name)` pair can have several entries in the
source — one per layer that has written to it. <a id="cite-value.one-name-many-entries.one-entry-per-writing-layer"></a>

The source stores them all and returns them all. <a id="cite-value.one-name-many-entries.source-returns-every-entry"></a>

LCS resolves the effective value at read time ([Resolution](</kernel/internals/lcs/layers/resolution.md#trm-5-3-6>)).

That is the mechanism that makes layer deletion revert configuration
automatically. Delete the layer, its entries go, and the
next-highest-precedence entry becomes effective. Nothing has to be
recomputed or rewritten.

<a id="trm-5-2-6-2"></a>

## Types

The full Windows type set is supported, for `registry.pol` fidelity:
`REG_NONE`, `REG_SZ`, `REG_EXPAND_SZ`, `REG_BINARY`, `REG_DWORD`,
`REG_DWORD_BIG_ENDIAN`, `REG_LINK`, `REG_MULTI_SZ`,
`REG_RESOURCE_LIST`, `REG_FULL_RESOURCE_DESCRIPTOR`,
`REG_RESOURCE_REQUIREMENTS_LIST` and `REG_QWORD`, numbered 0 to 11. <a id="cite-value.types.full-windows-set-numbered-0-to-11"></a>
Values are in [LCS ABI Reference](</kernel/userspace/native/lcs/generated-syscall-and-common-abi.md#trm-5-a>).

LCS stores the type tag and returns it on read but does not interpret
the data. <a id="cite-value.types.tag-stored-and-returned-uninterpreted"></a> The single exception is `REG_LINK` read as a symlink key's
default value, which triggers target resolution ([Symlinks](</kernel/internals/lcs/data-model/symlinks.md#trm-5-2-4>)).

The three hardware-resource types, 8 to 10, describe device resource
assignments in the Windows `HKLM\HARDWARE` hive, which the Windows
kernel rebuilds at every boot. Peios has no equivalent: hardware
enumeration belongs to the Linux device model, sysfs and `/proc/iomem`,
not to the registry. LCS accepts these tags only so a value carrying
one round-trips without loss. They have no semantics, LCS never
produces one, and for every operation they behave as `REG_BINARY`. <a id="cite-value.types.hardware-resource-types-behave-as-reg-binary"></a>
Rejecting a faithfully-copied value would break the fidelity guarantee
that is the reason the registry exists.

Type tags are validated at every write boundary, before sequence
allocation, transaction enlistment or source dispatch. An unknown code
is `EINVAL`. <a id="cite-value.types.unknown-type-code-is-einval"></a>

<a id="trm-5-2-6-3"></a>

## `REG_TOMBSTONE`

One further type, `REG_TOMBSTONE` (`0xFFFF`), is internal. It is never
returned to a caller reading a value — a caller whose effective entry
is a tombstone gets `ENOENT`, which is exactly what a tombstone
means. <a id="cite-value.reg-tombstone.never-returned-to-a-caller"></a>

There is no separate tombstone flag in the `REG_IOC_SET_VALUE`
argument. Writing type `REG_TOMBSTONE` **is** the explicit tombstone
operation. <a id="cite-value.reg-tombstone.written-by-setting-the-type"></a>

It must carry zero-length data; non-empty tombstone data is `EINVAL`,
again before sequence allocation, enlistment or dispatch. <a id="cite-value.reg-tombstone.non-empty-data-is-einval"></a>

<a id="trm-5-2-6-4"></a>

## Naming

Value names use the same case rules as key names: Unicode Simple Case
Folding, case-preserving, case-insensitive. <a id="cite-value.name.same-case-rules-as-key-names"></a>

They differ in one respect. **Backslash and forward slash are permitted
in a value name.** Value names are not hierarchical, so a separator has
no meaning in one. <a id="cite-value.name.separators-are-permitted"></a>

Only the null byte is forbidden, and invalid UTF-8 is rejected. The
empty string is reserved for the default value. <a id="cite-value.name.only-the-null-byte-is-forbidden"></a>

That difference is why watch event path components are length-prefixed
rather than joined by a separator ([Event Records](</kernel/internals/lcs/watches/event-records.md#trm-5-6-2>)) — a value name can contain
the separator.

<a id="trm-5-2-6-5"></a>

## Size

`MaxValueSize` defaults to 1 MB and is configurable from 4 KB to 64 MB
([Operational Parameters](</kernel/internals/lcs/bootstrap/operational-parameters.md#trm-5-10-3>)).

Value data is opaque bytes and is not subject to the UTF-8 validation
that applies to every string in the interface. <a id="cite-value.data.opaque-and-not-utf8-validated"></a>

<a id="trm-5-2-6-6"></a>

## Tool value encodings

`reg`, Registry Editor and the `peios` Rust crate use these representations:

- `REG_SZ` and `REG_EXPAND_SZ`: UTF-8 ending in one null byte, rather than
  Windows' UTF-16 representation.
- `REG_LINK`: the absolute target path in UTF-8, with no null byte. Its
  length determines its end; a target containing a null is not followed.
- `REG_MULTI_SZ`: each string followed by a null byte, with one additional
  null byte ending the list.
- Integers: little-endian, except for `REG_DWORD_BIG_ENDIAN`.

These are data conventions shared by tools. LCS still treats ordinary
value payloads as opaque bytes; its special handling of a link key's
`REG_LINK` default value is described in [Symlinks](</kernel/internals/lcs/data-model/symlinks.md#trm-5-2-4>). For choosing and entering
a type as an operator, see
[Keys, values, and types](https://learn.peios.org/peios/using-peios/registry/reg/).

---

# Tombstones

_Peios Kernel / Internals / LCS / Data model_

> An overlay that can only add is not enough — value and blanket tombstones, how they compete, and what a watcher sees.

<a id="trm-5-2-7"></a>

An overlay that can only add is not enough. `registry.pol` expresses
*absence* — `**Del.ValueName` deletes a specific value,
`**DelVals` deletes every value in a key before applying new ones — and
a higher-precedence layer that can only override cannot say "this value
must not be configured". Tombstones are how absence is expressed.

Both kinds are per-layer, and both vanish with their layer, restoring
whatever they were masking. <a id="cite-tombstone.per-layer-and-vanish-with-the-layer"></a>

<a id="trm-5-2-7-1"></a>

## Value tombstones

A value tombstone is a layer entry that says the value does not exist
in this layer and lower-precedence layers are masked. <a id="cite-tombstone.value.masks-lower-precedence-layers"></a>

Resolution treats a winning tombstone as "not found" without falling
through. <a id="cite-tombstone.value.winning-tombstone-does-not-fall-through"></a>

In the source's storage it is an entry of type `REG_TOMBSTONE` with no
data. A caller who wins with one gets `ENOENT`.

Removing the tombstone's layer makes the lower-precedence value
effective again, which is the whole point.

<a id="trm-5-2-7-2"></a>

## Blanket tombstones

A blanket tombstone is a per-layer marker on a **key** that masks every
value from lower-precedence layers, whatever its name. <a id="cite-tombstone.blanket.masks-every-value-name"></a>

Where a value tombstone names one value, a blanket names none and
covers all — including values whose names were not known when the
blanket was written, which is exactly what `**DelVals`
requires. <a id="cite-tombstone.blanket.covers-names-unknown-when-written"></a>

It is stored as a flag on the `(key GUID, layer)` relationship and
occupies no per-name entry. It has its own sequence
number. <a id="cite-tombstone.blanket.stored-as-a-flag-with-its-own-sequence"></a>

<a id="trm-5-2-7-2-1"></a>

### How it competes

A blanket does not short-circuit resolution. It enters the candidate
pool as a tombstone candidate **for every value name**, at its own
`(precedence, sequence)`, <a id="cite-tombstone.blanket.enters-the-candidate-pool-for-every-name"></a> and the ordinary rule picks the winner
([Resolution](</kernel/internals/lcs/layers/resolution.md#trm-5-3-6>)).

So a per-value entry that beats the blanket on the tuple overrides it,
and one that loses is masked. <a id="cite-tombstone.blanket.per-value-entry-wins-or-loses-on-the-tuple"></a>

A layer can write a blanket *and* write specific values in the same
layer: the specific values are visible because they were written
afterwards and carry higher sequence numbers, and everything else from
below is masked. <a id="cite-tombstone.blanket.same-layer-writes-after-a-blanket-stay-visible"></a> That is `**DelVals` followed by new writes,
expressed without a special case.

An exact tie — same precedence *and* same sequence — between a blanket
and a per-value entry is not resolved in the blanket's favour or
anyone's. It is malformed source data and the operation fails with
`EIO` ([Resolution](</kernel/internals/lcs/layers/resolution.md#trm-5-3-6>)).

<a id="trm-5-2-7-2-2"></a>

### Enumeration

Enumerating a key with a blanket applies the same per-name rule to each
name, so what a caller sees is the set of names whose winning candidate
is not the blanket. <a id="cite-tombstone.blanket.enumeration-applies-the-per-name-rule"></a>

It is not simply "the blanket's layer and above": a different layer at
the *same* precedence with a higher sequence number surfaces, and one
with a lower sequence number does not. <a id="cite-tombstone.blanket.enumeration-surfaces-higher-sequence-at-same-precedence"></a>

<a id="trm-5-2-7-2-3"></a>

### Removal

Removing a blanket, or the layer holding it, unmasks everything it was
hiding. <a id="cite-tombstone.blanket.removal-unmasks-everything-it-hid"></a>

<a id="trm-5-2-7-3"></a>

## What a watcher sees

Nothing about tombstones. Writing a blanket produces one
`VALUE_DELETED` per name it newly masks; removing one produces one
`VALUE_SET` per name that became visible. A watcher sees per-value
effective state and never has to know the mechanism ([The Watch Model](</kernel/internals/lcs/watches/the-watch-model.md#trm-5-6-1>)).

---

# Names and Case

_Peios Kernel / Internals / LCS / Data model_

> Every string in the LCS interface is UTF-8 — length as byte count, separators, and how case folding works.

<a id="trm-5-2-8"></a>

Every string in the LCS interface — key names, value names, hive names,
layer names, paths — is UTF-8. Invalid UTF-8 is rejected with `EINVAL`
before parsing, routing, folding, layer resolution or source
dispatch. <a id="cite-name.utf8.invalid-utf8-is-einval-before-any-other-work"></a>

Null bytes are rejected in all of them. <a id="cite-name.utf8.null-bytes-rejected-in-every-string"></a>
The rejection is `EINVAL` where the string is length-delimited — ioctl
and RSI strings — because there the null byte sits inside the counted
length. A syscall argument (a path or `reg_create_key`'s layer name) is
a C string, and a null byte there is its terminator: the name the
kernel validates ends at it, and nothing after it is read. <a id="cite-name.utf8.syscall-strings-end-at-the-null"></a>

The one thing that is not a string is value data, which is opaque
bytes.

<a id="trm-5-2-8-1"></a>

## Lengths are byte counts

Every configured length limit is measured in UTF-8 bytes, not Unicode
scalar values and not display characters. <a id="cite-name.length.measured-in-utf8-bytes"></a>

- `MaxPathComponentLength` (default 255) bounds one component or one
  value or layer name. <a id="cite-name.length.max-path-component-length-bounds-a-component"></a>
- `MaxTotalPathLength` (default 16383) bounds a whole
  path. <a id="cite-name.length.max-total-path-length-bounds-a-path"></a>
- `MaxKeyDepth` (default 512) bounds nesting. <a id="cite-name.length.max-key-depth-bounds-nesting"></a>

A syscall path arrives as a null-terminated C string, is copied under a
hard bound, and has its terminator stripped before anything is
measured — so the terminator is not part of the
length. <a id="cite-name.length.syscall-path-terminator-is-not-counted"></a>

Ioctl and RSI strings are length-delimited and need no terminator; a
terminator byte included in the length is a null byte and is therefore
invalid. <a id="cite-name.length.ioctl-and-rsi-strings-are-length-delimited"></a>

<a id="trm-5-2-8-2"></a>

## Separators

Backslash is canonical. Forward slash is accepted on input and treated
as a separator wherever a separator is recognised, so a component can
never contain either. <a id="cite-name.separator.forward-slash-is-a-separator"></a>

There is no string-rewriting step: normalisation is a property of how
paths are split rather than a transformation applied to
them. <a id="cite-name.separator.no-string-rewriting-step"></a>

<a id="trm-5-2-8-3"></a>

## Case folding

Comparison is case-insensitive and storage is
case-preserving. <a id="cite-name.case.insensitive-comparison-preserving-storage"></a>

The algorithm is **Unicode Simple Case Folding** — the `C` and `S`
status entries of `CaseFolding.txt`, with the full (`F`) and Turkic
(`T`) entries excluded. <a id="cite-name.case.simple-case-folding-c-and-s-entries-only"></a>

It is a fixed one-to-one codepoint mapping with no locale input,
applied after decoding from UTF-8, never to raw
bytes. <a id="cite-name.case.folding-applied-to-codepoints-not-bytes"></a>

The Unicode version is **pinned at 16.0**. <a id="cite-name.case.unicode-version-pinned-at-16-0"></a> The table is generated by
`peios/generate-casefold-table.py` and checked in with the
digest of the source data, so adopting a newer Unicode version means
regenerating the table deliberately. It is not something that happens
by updating a dependency.

This gives practical compatibility with Windows'
`RtlCompareUnicodeString` without claiming byte-identical behaviour in
every edge case.

**Unicode normalisation is not performed.** NFC and NFD forms of the
same visual character are different names, matching
Windows. <a id="cite-name.case.no-unicode-normalisation"></a>

Case folding is what "identity" means throughout: a layer's identity is
its folded name, a hive route's identity includes its folded name, and
a duplicate is a folded-equal duplicate. `RoleA` and `rolea` are one
layer, not two. <a id="cite-name.case.identity-is-the-folded-name"></a>

Every comparison folds, on both sides of the kernel boundary. The
Kernel Access Control Subsystem (KACS) parses private layer names into
a token and rejects a duplicate with `EINVAL`; that duplicate check
uses the same folding routine and the same table as LCS, so a pair
that LCS treats as one layer cannot occupy two of a token's slots.
There were two ASCII-only comparators, the `base` check on two of its
call sites and this KACS check, and both are gone ([The Base Layer](</kernel/internals/lcs/layers/the-base-layer.md#trm-5-3-2>) for
`base`). <a id="cite-name.case.every-comparison-folds"></a>

---

# Deletion and Orphans

_Peios Kernel / Internals / LCS / Data model_

> Deletion works on two levels because naming and identity are separate — layer deletion, orphaned keys, and what happens to their watches.

<a id="trm-5-2-9"></a>

Deletion operates on two levels, because naming and identity are
separate things.

<a id="trm-5-2-9-1"></a>

## Deleting a key

`REG_IOC_DELETE_KEY` removes **one layer's path entry**. The key's data
— its GUID, descriptor and values — is untouched; only a name is
removed. <a id="cite-orphan.delete-key.removes-one-layer-path-entry"></a>

LCS derives the parent GUID from the fd's ancestor chain and the child
name from the last component of its resolved path, and sends
`RSI_DELETE_ENTRY`. <a id="cite-orphan.delete-key.parent-and-name-derived-from-the-fd"></a>

If path entries remain in other layers, the key is still visible
through them. <a id="cite-orphan.delete-key.remaining-entries-keep-the-key-visible"></a>

If none remain anywhere, the key is orphaned. <a id="cite-orphan.delete-key.last-entry-removed-orphans-the-key"></a>

A key with **visible children** cannot be deleted:
`ENOTEMPTY`. <a id="cite-orphan.delete-key.visible-children-is-enotempty"></a>

Visibility is evaluated globally, across all enabled layers, and
deliberately ignores the caller's private layer set — so whether a
deletion succeeds does not depend on who is asking. <a id="cite-orphan.delete-key.visibility-ignores-the-callers-private-layers"></a>

Recursive deletion is a client-side tree walk, not a kernel
primitive. <a id="cite-orphan.delete-key.no-recursive-delete-primitive"></a>

Deleting a key does not delete its values. Values belong to the GUID,
not to the path entry, and go when the GUID goes. <a id="cite-orphan.delete-key.values-survive-entry-deletion"></a>

Hive roots cannot be deleted or hidden ([Path Entries](</kernel/internals/lcs/data-model/path-entries.md#trm-5-2-5>)).

<a id="trm-5-2-9-2"></a>

## Layer deletion

Deleting a layer removes all of its path entries, value entries and
blanket tombstones, across every source. <a id="cite-orphan.layer-delete.removes-every-entry-across-all-sources"></a>

LCS broadcasts `RSI_DELETE_LAYER` and each source returns the GUIDs
that lost their last path entry as a
result. <a id="cite-orphan.layer-delete.sources-report-newly-orphaned-guids"></a>

Effects on live state follow from the model with no special cases:

- keys named only by that layer become
  orphaned; <a id="cite-orphan.layer-delete.keys-named-only-by-it-become-orphaned"></a>
- where the layer held the winning value entry, the next layer's value
  becomes effective; <a id="cite-orphan.layer-delete.next-layers-value-becomes-effective"></a>
- blanket tombstones it held are removed and unmask what they were
  hiding;
- and Security Descriptors are unchanged, because they were never
  layered. <a id="cite-orphan.layer-delete.security-descriptors-unchanged"></a>

Watchers are notified by whatever recovery mechanism applies —
per-key events for the orphaned keys, and a source-wide `OVERFLOW` for
the rest ([Dispatch](</kernel/internals/lcs/watches/dispatch.md#trm-5-6-3>)).

Before sending `RSI_DELETE_LAYER`, LCS aborts every bound transaction
whose mutation log touched that layer. <a id="cite-orphan.layer-delete.aborts-transactions-touching-the-layer"></a> Otherwise a transaction could
commit writes into a layer that no longer exists.

Those transactions return `EINVAL` on their next operation or commit
attempt. <a id="cite-orphan.layer-delete.aborted-transactions-return-einval"></a>

Layer deletion is what role uninstallation and Group Policy removal
are.

<a id="trm-5-2-9-3"></a>

## Orphaned keys

An orphaned key is a GUID with no path entry in any layer. It follows
the Linux unlink model: alive but unnamed. <a id="cite-orphan.definition.guid-with-no-path-entry-anywhere"></a>

Existing fds keep working. Operations that address the key by GUID
proceed normally:

- querying, setting and deleting values; <a id="cite-orphan.allowed.value-operations"></a>
- setting and removing blanket tombstones; <a id="cite-orphan.allowed.blanket-tombstone-operations"></a>
- querying and setting the Security Descriptor; <a id="cite-orphan.allowed.security-descriptor-operations"></a>
- querying key metadata; <a id="cite-orphan.allowed.query-key-metadata"></a>
- flushing the key's hive; <a id="cite-orphan.allowed.flush-the-hive"></a>
- closing the fd. <a id="cite-orphan.allowed.close-the-fd"></a>

Namespace operations return `ENOENT`:

- creating a child key under it; <a id="cite-orphan.refused.create-a-child-key"></a>
- opening or creating anything relative to it; <a id="cite-orphan.refused.relative-open-or-create"></a>
- deleting its path entry; <a id="cite-orphan.refused.delete-its-path-entry"></a>
- hiding it; <a id="cite-orphan.refused.hide-it"></a>
- backing it up. <a id="cite-orphan.refused.back-it-up"></a>

The reason is that an orphaned key is no longer a reachable subtree
root. Allowing new names beneath an unnamed key would build a subgraph
nothing can reach.

<a id="trm-5-2-9-4"></a>

## Watches on an orphaned key

A watch armed before the key was orphaned stays armed, and the
transition delivers `KEY_DELETED`. <a id="cite-orphan.watch.stays-armed-and-delivers-key-deleted"></a>

After that the watch may still observe GUID-local changes made through
the surviving fds, though the subtree is no longer expanded through the
orphaned key. <a id="cite-orphan.watch.still-sees-guid-local-changes"></a>

Arming a *new* watch on an already-orphaned key is
`ENOENT`. <a id="cite-orphan.watch.arming-a-new-watch-is-enoent"></a>

Re-arming one that is already armed is allowed. <a id="cite-orphan.watch.re-arming-an-armed-watch-is-allowed"></a>

<a id="trm-5-2-9-5"></a>

## Dropping the GUID

When the last fd to an orphaned key closes and the source is Active,
LCS sends `RSI_DROP_KEY`, which purges the key record, every value
entry across every layer, and any remaining blanket
tombstones. <a id="cite-orphan.drop.last-close-sends-rsi-drop-key"></a>

It is dispatched **before** the in-kernel key state is
released. <a id="cite-orphan.drop.dispatched-before-state-is-released"></a>

The request is asynchronous: nothing waits for the answer, and a valid
response is processed as an ordinary response rather than as a late
one ([Failure and Late Responses](</kernel/internals/lcs/sources/failure-and-late-responses.md#trm-5-8-5>)). <a id="cite-orphan.drop.request-is-asynchronous"></a> That distinction is load-bearing — `RSI_DROP_KEY` is a
mutating operation, and without it the arrival of a perfectly normal
answer to a caller-less request would look like an unaccounted
mutation and tear the source down.

If the source is Down, LCS releases its in-kernel state and does **not**
queue a deferred drop. There is no deferred-drop
queue. <a id="cite-orphan.drop.down-source-queues-no-deferred-drop"></a> Recovering the
key record then falls to the source's own startup obligation, under
the Registry Source Interface specification in PSPK, to purge records
with no path entries before it becomes Active.

`close()` never reports orphan cleanup failure to userspace, and never
can: it returns 0 unconditionally. <a id="cite-orphan.drop.close-always-returns-zero"></a>

<a id="trm-5-2-9-6"></a>

## A new key at the same path

A layer can create a new key where another layer's key already exists.
Each layer has its own path entry pointing at its own GUID, and
resolution decides which is visible.

Fds referencing the other GUID are completely isolated from it:
different identity, different data, different value entries. Nothing
observable connects two keys that merely share a name. <a id="cite-orphan.same-path.fds-to-the-other-guid-stay-isolated"></a>
