From affecd91853de692c28430ef51b8ef2ec0f192f8 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 29 May 2026 23:09:18 +0200 Subject: [PATCH] nwconn: enable Release Physical Record Wire NCP 0x1c Release Physical Record to the existing physical-record unlock path. The Novell SDK documents NCP 0x2222/28 as releasing one byte range held by the calling client without removing it from the client data byte range table. The byte range remains logged and may be relocked by a later Lock Physical Record Set call. The request carries a reserved byte, a 6-byte NetWare file handle, a start offset, and a record length; the reply carries no data and reports Unlock Error through the completion code. The neighboring handler already supported NCP 0x1a Log Physical Record and NCP 0x1e Clear Physical Record. Reuse the same request layout and distinguish release from clear by passing lock_flag -1 for release/unlock only and lock_flag -2 for clear/unlock plus unlog. Add the SDK request/reply semantics to the inline endpoint comment and make the previously missing 0x1c endpoint reachable. This only enables the documented endpoint path; the underlying physical-record locking implementation is unchanged. --- src/nwconn.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/nwconn.c b/src/nwconn.c index 61b0553..8883e34 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -1983,15 +1983,39 @@ static int handle_ncp_serv(void) return(-1); /* nwbind must do a little rest */ break; - case 0x1a : /* Log Physical Record */ - case 0x1e : /* Clear Physical Record */ + case 0x1a : /* Log Physical Record */ + case 0x1c : /* Release Physical Record */ + case 0x1e : /* Clear Physical Record */ { + /* + * SDK: NCP 0x2222/26 Log Physical Record records one + * byte range in the caller's logged data block table. + * Lock Flag 0 logs for future locking, 1 locks + * exclusive, and 3 locks shareable/read-only. + * + * SDK: NCP 0x2222/28 Release Physical Record releases + * one locked byte range but leaves it in the logged + * table so a later Lock Physical Record Set can relock + * it. The request carries a reserved byte, a 6-byte + * NetWare file handle, Start Offset, and Record Length; + * it returns no reply data and reports Unlock Error + * through the completion code. + * + * SDK: NCP 0x2222/30 Clear Physical Record releases the + * range if it is locked and removes it from the logged + * table. + * + * MARS-NWE currently routes both release and clear through + * the existing physical-record unlock path; the low-level + * physical-record table is still shared with the existing + * nw_log_physical_record() implementation. + */ struct INPUT { uint8 header[7]; /* Requestheader */ - uint8 lock_flag; /* 0=log, 1=excl */ - /* 3=shared */ - uint8 ext_fhandle[2]; /* all zero */ - uint8 fhandle[4]; /* Filehandle */ + uint8 lock_flag; /* 0=log/reserved, 1=excl */ + /* 3=shared */ + uint8 ext_fhandle[2]; /* all zero / high handle */ + uint8 fhandle[4]; /* Filehandle */ uint8 offset[4]; uint8 size[4]; uint8 timeout[2]; @@ -2000,7 +2024,7 @@ static int handle_ncp_serv(void) uint32 offset= GET_BE32(input->offset); uint32 size = GET_BE32(input->size); uint16 timeout = GET_BE16(input->timeout); - if (function == 0x1a) /* lockfile */ + if (function == 0x1a) /* log or lock */ completition = (uint8)(-nw_log_physical_record( fhandle, offset, @@ -2013,7 +2037,9 @@ static int handle_ncp_serv(void) offset, size, timeout, - -2 /* unlock + unlog */ + (function == 0x1c) + ? -1 /* unlock only */ + : -2 /* unlock + unlog */ )); } break;