0563 nwnss: import COMN LSS feature registry runtime

This commit is contained in:
ChatGPT
2026-06-15 18:56:43 +00:00
committed by Mario Fetka
parent 0d90365ac8
commit d0b712c19e
3 changed files with 202 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ add_library(nwnss SHARED
comn/common/beastHash.c
comn/common/comnMacShortName.c
comn/common/comnUnicode.c
comn/common/registerLSS.c
comn/common/comnVariableData.c
comn/common/zAPI.c
comn/namespace/dosNSWild.c

View File

@@ -0,0 +1,172 @@
/****************************************************************************
|
| (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public
| License as published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
|
| NetWare Advance File Services (NSS) Name Msg module
|
|---------------------------------------------------------------------------
|
| $Author: taysom $
| $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $
|
| $RCSfile$
| $Revision: 465 $
|
|---------------------------------------------------------------------------
| This module is used to:
| This modules contains code to track registered LSS's and some of
| their features. It was needed for CONSOLE one stuff.
+-------------------------------------------------------------------------*/
#include <string.h>
#include <stdlib.h>
#include "zParams.h"
#include "comnPublics.h"
#include "que.h"
/* FixFixFix
* FixFixFix
* FixFixFix - If and when LSS's are ever given their own objects in the
* FixFixFix - Admin volume, this module should be removed, and this
* FixFixFix - functionality should be replaced with an "LSS Info" function.
* FixFixFix
* FixFixFix
*/
/*---------------------------------------------------------------------------
* This is a dummy structure used for the buffer list stack code
*---------------------------------------------------------------------------*/
typedef struct _LSSFeaturesList_s
{
DQlink_t link;
LSSInfo_s lssInfo;
} _LSSFeaturesList_s;
/*---------------------------------------------------------------------------
* Global variables for the Registered LSS List
*---------------------------------------------------------------------------*/
NINT RegisteredLSSCount = 0;
DQhead_t RegisteredLSSList = DQ_STATIC_INIT(RegisteredLSSList);
/****************************************************************************
*
*****************************************************************************/
STATUS COMN_RegisterLSSFeatures(
GeneralMsg_s *genMsg,
LSSInfo_s *lssInfo)
{
_LSSFeaturesList_s *lp;
ASSERT_MPKNSS_LOCK();
DQ_FOREACH (&RegisteredLSSList, lp, _LSSFeaturesList_s, link)
{
if (lp->lssInfo.lssID == lssInfo->lssID)
{
/* This is already registered */
SetErrno(genMsg, zERR_TYPE_ALREADY_REGISTERED);
return(zFAILURE);
}
}
lp = zalloc(sizeof(_LSSFeaturesList_s));
if (lp == NULL)
{
SetErrno(genMsg, zERR_NO_MEMORY);
return(zFAILURE);
}
lp->lssInfo.lssID = lssInfo->lssID;
lp->lssInfo.canCreateNew = lssInfo->canCreateNew;
lp->lssInfo.poolSupportedFeatures = lssInfo->poolSupportedFeatures;
lp->lssInfo.poolDefaultEnabledFeatures = lssInfo->poolDefaultEnabledFeatures;
lp->lssInfo.poolChangableFeatures = lssInfo->poolChangableFeatures;
lp->lssInfo.volSupportedFeatures = lssInfo->volSupportedFeatures;
lp->lssInfo.volDefaultEnabledFeatures = lssInfo->volDefaultEnabledFeatures;
lp->lssInfo.volChangableFeatures = lssInfo->volChangableFeatures;
DQ_ENQ(&RegisteredLSSList, lp, link);
++RegisteredLSSCount;
return(zOK);
}
/****************************************************************************
* This function locates the record for this LSS volume type and removes
* the node from the list and frees it.
*****************************************************************************/
void COMN_UnregisterLSSFeatures(
NINT lssID)
{
_LSSFeaturesList_s *lp;
ASSERT_MPKNSS_LOCK();
DQ_FOREACH (&RegisteredLSSList, lp, _LSSFeaturesList_s, link)
{
if (lp->lssInfo.lssID == lssID)
{
/* This is already registered */
DQ_RMV(lp, link);
free(lp);
--RegisteredLSSCount;
break;
}
}
return;
}
/****************************************************************************
* This function returns the LSS feature information in a buffer. If there
* is not room, an error is returned.
*****************************************************************************/
STATUS COMN_GetRegisteredLSSFeatures(
GeneralMsg_s *genMsg,
NINT *numberOfLSSs,
BYTE *buffer,
NINT bufferLen)
{
_LSSFeaturesList_s *lp;
LSSInfo_s *lssPtr;
ASSERT_MPKNSS_LOCK();
*numberOfLSSs = RegisteredLSSCount;
if (bufferLen < (RegisteredLSSCount * sizeof(LSSInfo_s)))
{
SetErrno(genMsg, zERR_BUFFER_TOO_SMALL);
return(zFAILURE);
}
lssPtr = (LSSInfo_s *)buffer;
DQ_FOREACH (&RegisteredLSSList, lp, _LSSFeaturesList_s, link)
{
memcpy(lssPtr, &lp->lssInfo, sizeof(LSSInfo_s));
lssPtr++;
}
zASSERT((BYTE *)lssPtr <= (buffer + bufferLen));
return(zOK);
}

View File

@@ -115,6 +115,35 @@ int main(void)
CHECK(CACHE_Startup == CACHE_Startup);
CHECK(BEASTHASH_Remove == BEASTHASH_Remove);
CHECK(COMN_RegisterRootVariableDataType == COMN_RegisterRootVariableDataType);
{
GeneralMsg_s gen_msg;
LSSInfo_s in_info;
LSSInfo_s out_info;
NINT number_of_lsss = 0;
memset(&gen_msg, 0, sizeof(gen_msg));
memset(&in_info, 0, sizeof(in_info));
memset(&out_info, 0, sizeof(out_info));
in_info.lssID = 0x4242;
in_info.canCreateNew = 1;
in_info.poolSupportedFeatures = 0x10;
in_info.poolDefaultEnabledFeatures = 0x20;
in_info.poolChangableFeatures = 0x30;
in_info.volSupportedFeatures = 0x40;
in_info.volDefaultEnabledFeatures = 0x50;
in_info.volChangableFeatures = 0x60;
COMN_UnregisterLSSFeatures(in_info.lssID);
CHECK(COMN_RegisterLSSFeatures(&gen_msg, &in_info) == zOK);
CHECK(COMN_GetRegisteredLSSFeatures(&gen_msg, &number_of_lsss,
(BYTE *)&out_info, sizeof(out_info)) == zOK);
CHECK(number_of_lsss >= 1);
CHECK(out_info.lssID == in_info.lssID);
CHECK(out_info.volChangableFeatures == in_info.volChangableFeatures);
CHECK(COMN_RegisterLSSFeatures(&gen_msg, &in_info) == zFAILURE);
COMN_UnregisterLSSFeatures(in_info.lssID);
}
CHECK(sizeof(NSSConnection_s) >= sizeof(AuthCtrl_s));
CHECK(sizeof(ContextHandleCtrl_s) >= sizeof(Latch_s));
CHECK(sizeof(SAgentHandleCtrl_s) >= sizeof(Latch_s));