nwvolume: allow OS2 namespace with ONE_DEV volumes

When ONE_DEV is active, handles encode the raw inode and cannot also
encode a namespace map index.  Reuse the same device map entry across
namespaces so volumes using both 'o' and 'O' can serve OS/2 namespace
clients.
This commit is contained in:
Mario Fetka
2026-05-20 20:05:55 +02:00
parent 2858be16e7
commit f4f1afead8

View File

@@ -393,8 +393,27 @@ static int look_name_space_map(NW_VOL *v, DEV_NAMESPACE_MAP *dnm,
int k=-1;
while (++k < v->maps_count) {
mp=v->dev_namespace_maps[k];
if (mp->dev == dnm->dev && mp->namespace == dnm->namespace)
return(k);
if (mp->dev == dnm->dev) {
/*
* VOL_OPTION_ONE_DEV encodes handles as the raw 32-bit inode:
*
* handle = inode
*
* In that mode there is no room in the handle for the dev/namespace
* map index. All namespaces on this one Unix device therefore have
* to share the same map entry. Otherwise a volume with both 'o' and
* 'O' set can map the DOS root entry, but later OS/2 namespace lookups
* fail with:
*
* Cannot map inode=..., dev=..., namespace=4 to vol=... handle
*
* Non-ONE_DEV volumes keep the old behaviour and still distinguish
* mappings by both device and namespace.
*/
if ((v->options & VOL_OPTION_ONE_DEV)
|| mp->namespace == dnm->namespace)
return(k);
}
}
if (do_insert && v->maps_count < v->max_maps_count) {
/* now do insert the new map */