nwnss: import NSS extended attribute runtime

This commit is contained in:
Mario Fetka
2026-06-19 05:51:49 +00:00
parent 40cda1a468
commit 945f8c7b45
6 changed files with 1655 additions and 0 deletions

View File

@@ -10,8 +10,28 @@ struct page {
void *data;
};
struct super_block {
void *s_fs_info;
};
struct NssRuntimeTime_s {
long tv_sec;
long tv_nsec;
};
struct inode {
void *i_mapping;
struct super_block *i_sb;
unsigned long i_ino;
long i_mode;
long i_uid;
struct NssRuntimeTime_s i_atime;
struct NssRuntimeTime_s i_ctime;
struct NssRuntimeTime_s i_mtime;
};
struct dentry {
struct inode *d_inode;
};
typedef struct NssRuntimeKmemCache_s {

View File

@@ -0,0 +1,71 @@
/****************************************************************************
|
| (C) Copyright 1995 - 2000 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
|
|***************************************************************************
|
| Novell Storage Services (NSS) support module
|
|---------------------------------------------------------------------------
|
| $Author: taysom $
| $Date: 2008-05-08 21:52:15 +0530 (Thu, 08 May 2008) $
|
| $RCSfile$
| $Revision: 2335 $
|
|---------------------------------------------------------------------------
| This module is used to:
| Define common functions that are private to lsa (should move most
| of lsa.h to here).
+-------------------------------------------------------------------------*/
#ifndef _LSAPRIVATE_H_
#define _LSAPRIVATE_H_ 1
#include <sys/types.h>
struct dentry;
extern BOOL LSASendfile;
extern BOOL LSACtimeIsMetadataModTime;
extern BOOL LSAReturnNWmetadata;
extern BOOL LSAUpdateDirAccessTime;
extern LONG LSAPosixPermissionMask;
extern LONG getMode (LONG attr);
extern LONG getUid (UserID_t *ownerGuid);
extern ssize_t netware_setxattr (
struct dentry *dentry,
const char *name,
const void *value,
size_t size);
extern ssize_t netware_getxattr (
struct dentry *dentry,
const char *name,
void *value,
size_t size);
extern int netware_removexattr (
struct dentry *dentry,
const char *name);
#endif

View File

@@ -0,0 +1,207 @@
/****************************************************************************
|
| (C) Copyright 2005 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
|
|***************************************************************************
|
| Novell Storage Services (NSS) support module
|
|---------------------------------------------------------------------------
|
| $Author: vandana $
| $Date: 2006-11-14 05:57:30 +0530 (Tue, 14 Nov 2006) $
|
| $RCSfile$
| $Revision: 1632 $
|
|---------------------------------------------------------------------------
| This module is used to:
| Defines the <name, value> pairs for the netware extended attributes.
+-------------------------------------------------------------------------*/
#ifndef _ZXATTR_H_
#define _ZXATTR_H_ 1
#ifndef _ZOMNI_H_
#include <zOmni.h>
#endif
#define zNW_PREFIX "netware."
#define zNW_NCPSTAT zNW_PREFIX "ncpstat"
#define zNW_QUOTA zNW_PREFIX "quota"
#define zNW_METADATA zNW_PREFIX "metadata"
#define zNW_USERQUOTA zNW_PREFIX "userquota"
//#define zNW_TRUSTEE zNW_PREFIX "trustee"
#define zNW_BYTEORDER 0xfeff
#define zNW_NCPSTAT_VERSION 1
#define zNW_QUOTA_VERSION 2
#define zNW_METADATA_VERSION 1
#define zNW_USERQUOTA_VERSION 1
//#define zNW_TRUSTEE_VERSION 1
#define zNW_ALLOWED_MODIFY_FLAGS (zMOD_FILE_ATTRIBUTES \
| zMOD_CREATED_TIME \
| zMOD_MODIFIED_TIME \
| zMOD_ACCESSED_TIME)
typedef struct zNW_ncpstat_s {
WORD nws_byteorder;
WORD nws_version;
LONG nws_reserved_1;
QUAD nws_info_mask; /* Modify information indicated by mask
* (see zParams.h zMOD_*) */
QUAD nws_file_attributes;/* All the NSS file attributes
* (see zParams.h) */
QUAD nws_file_attr_mask; /* All the NSS file attributes */
QUAD nws_zid; /* File ID, for hard links, this will be
* the secondary zid */
QUAD nws_zid_primary; /* Primary ZID */
QUAD nws_zid_parent; /* File id of parent */
GUID_t nws_volume_id; /* 128 bit volume id */
QUAD nws_size_logical; /* Logical size of the file in bytes */
QUAD nws_size_physical; /* Physical size of the file in bytes */
QUAD nws_created; /* UTC time created */
// QUAD nws_archived;
QUAD nws_modified; /* UTC time modified */
QUAD nws_accessed; /* UTC time last accessed */
// QUAD nws_metaDataModified;
} zNW_ncpstat_s;
typedef struct zNW_quota_V1_s {
WORD nwq_byteorder;
WORD nwq_version;
LONG nwq_reserved_1;
QUAD nwq_user_used; /* Quota used by user */
QUAD nwq_user_limit; /* Quota limit assigned to user */
QUAD nwq_dir_left; /* Quota min left in directory ancestors */
} zNW_quota_V1_s;
typedef struct zNW_quota_s {
WORD nwq_byteorder;
WORD nwq_version;
LONG nwq_reserved_1;
QUAD nwq_user_used; /* Quota used by user */
QUAD nwq_user_limit; /* Quota limit assigned to user */
QUAD nwq_dir_left; /* Quota min left in directory ancestors */
QUAD nwq_dir_quota; /* Quota set on the directory */
} zNW_quota_s;
/*
* We have picked a value for zMAX_TRUSTEES that will let the
* structure fit in 64K.
*/
#define zMAX_TRUSTEES 2043
typedef struct zNW_trustee_s {
GUID_t nwt_id;
QUAD nwt_rights;
QUAD nwt_reserved_2;
} zNW_trustee_s;
typedef struct zNW_metadata_s {
WORD nwm_byteorder;
WORD nwm_version;
LONG nwm_reserved_1;
QUAD nwm_modify_mask;
QUAD nwm_file_attributes;
QUAD nwm_file_attributes_mask;
QUAD nwm_time_created;
QUAD nwm_time_archived;
QUAD nwm_time_modified;
QUAD nwm_time_accessed;
QUAD nwm_time_meta_data_modified;
QUAD nwm_reserved_2;
GUID_t nwm_id_owner;
GUID_t nwm_id_archiver;
GUID_t nwm_id_modifier;
GUID_t nwm_id_metadata_modifier;
SQUAD nwm_quota_limit;
LONG nwm_inherited_rights_mask;
LONG nwm_trustee_num;
zNW_trustee_s nwm_trustee[zMAX_TRUSTEES];
} zNW_metadata_s;
/*
* We have picked a value for zMAX_USERS that will let the
* structure fit in 64K.
*/
#define zMAX_XATTR_USERS 2047
typedef struct zNW_user_restriction_s {
GUID_t nwur_user;
SQUAD nwur_restriction;
QUAD nwur_reserved_2;
} zNW_user_restriction_s;
typedef struct zNW_user_quota_s {
WORD nwuq_byteorder;
WORD nwuq_version;
LONG nwuq_num_users;
LONG nwuq_index;
LONG nwuq_reserved_1;
zNW_user_restriction_s nwuq_user[zMAX_XATTR_USERS];
} zNW_user_quota_s;
#if 0
#define zMAX_FDN_NAME 256
#define zMAX_XATTR_USERS 124
typedef struct zNW_user_restriction_s {
QUAD nwur_restriction;
QUAD nwur_reserved_2;
unicode_t nwur_dnsname[zMAX_FDN_NAME];
} zNW_user_restriction_s;
typedef struct zNW_user_quota_s {
WORD nwuq_byteorder;
WORD nwuq_version;
LONG nwuq_num_users;
LONG nwuq_index;
LONG nwuq_reserved_1;
zNW_user_restriction_s nwuq_user[zMAX_XATTR_USERS];
} zNW_user_quota_s;
typedef struct zNW_user_trustee_s{
QUAD nwut_rights;
QUAD nwut_reserved_2;
unicode_t nwut_dnsname[zMAX_FDN_NAME];
} zNW_user_trustee_s;
typedef struct zNW_trustee_name_s {
WORD nwtn_byteorder;
WORD nwtn_version;
LONG nwtn_num_trustees;
LONG nwtn_index;
LONG nwtn_reserved_1;
zNW_user_trustee_s nwtn_user[zMAX_XATTR_USERS];
} zNW_trustee_name_s;
#endif
#endif

View File

@@ -186,6 +186,7 @@ add_library(nwnss SHARED
comn/common/beastHash.c
comn/common/beastRelease.c
comn/common/beastClass.c
comn/common/extAttrBeast.c
comn/common/comnMacShortName.c
comn/common/comnUnicode.c
comn/common/registerLSS.c
@@ -307,6 +308,7 @@ add_library(nwnss SHARED
nss/lib/setErrno.c
nss/msg/slab.c
nsslnxlib/unilib.c
lsa/lsaXattr.c
utcUserland.c)
add_library(mars_nwe::nwnss ALIAS nwnss)

View File

@@ -0,0 +1,210 @@
/****************************************************************************
|
| (C) Copyright 1995-1997 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) module
|
|---------------------------------------------------------------------------
|
| $Author: blarsen $
| $Date: 2006-01-21 04:09:53 +0530 (Sat, 21 Jan 2006) $
|
| $RCSfile$
| $Revision: 1315 $
|
|---------------------------------------------------------------------------
| This module is used to:
| This defines all of the primitive BEASTS inside of PSS
+-------------------------------------------------------------------------*/
#include <xError.h>
#include <string.h>
#include "comnBeasts.h"
#include "comnParams.h"
#include "comnPublics.h"
#include "zParams.h"
#include "extAttrBeast.h"
///****************************************************************************
// *
// *****************************************************************************/
//STATUS extAttrConstruct(
// GeneralMsg_s *genMsg,
// ExtAttrBeast_s *beast)
//{
// return zOK;
//}
/****************************************************************************
*
*****************************************************************************/
//void extAttrDestruct(
// ExtAttrBeast_s *beast)
//{
//}
/****************************************************************************
* This function returns metadata information for an extAttrBeast object
*****************************************************************************/
STATUS EXTATTR_BST_GetInfo(
GeneralMsg_s *genMsg,
RootBeast_s *extAttr_LX,
GetInfoMsg_s *infoMsg)
{
ExtAttrBeast_s *extAttr = (ExtAttrBeast_s *)extAttr_LX;
zExtAttrInfo_s *extAttrInfo;
statusfunc_t derivedFromGetInfo;
ASSERT_MPKNSS_LOCK();
/*---------------------------------------------------------------------------
* First, call the generic namedBeast information routine and fill in any
* requested named beast information. If it fails, do not continue...
*---------------------------------------------------------------------------*/
derivedFromGetInfo = COMN_GetNextParentBeastComnOp(extAttr->EAbeastClass,
COMNOPS_INDEX(BST_getInfo),EXTATTR_BST_GetInfo);
if (derivedFromGetInfo(genMsg,extAttr,infoMsg) != zOK)
return(zFAILURE);
/*---------------------------------------------------------------------------
* Now, if the caller requested, fill in any extAttr specific information
*---------------------------------------------------------------------------*/
if ((extAttrInfo = infoMsg->ret_getTypeInfo) == NULL)
return(zOK); /* No type specific info requeted */
if (infoMsg->sizeRetGetTypeInfo < sizeof(zExtAttrInfo_s))
{
SetErrno(genMsg,zERR_BUFFER_TOO_SMALL);
return(zFAILURE);
}
/*---------------------------------------------------------------------------
* Make sure the beast is latched to access its meta data
*---------------------------------------------------------------------------*/
ASSERT_LATCH(&extAttr->EAbeastLatch);
/*---------------------------------------------------------------------------
* Return optional information
*---------------------------------------------------------------------------*/
if (infoMsg->getTypeInfoMask & zGET_EXTATTR_FLAGS)
{
extAttrInfo->extAttrUserFlags = extAttr->EAextAttrUserFlags;
}
return zOK;
}
/****************************************************************************
* This function modifies metadata information for an extAttr beast object
*****************************************************************************/
STATUS EXTATTR_BST_ModifyInfo(
GeneralMsg_s *genMsg,
RootBeast_s *extAttr_LX,
ModifyInfoMsg_s *modifyMsg,
Xaction_s *xaction) /* Optional xaction, may be NULL */
{
ExtAttrBeast_s *extAttr = (ExtAttrBeast_s *)extAttr_LX;
zExtAttrInfo_s *extAttrInfo;
ASSERT_MPKNSS_LOCK();
// statusfunc_t derivedFromModifyInfo;
///*---------------------------------------------------------------------------
// * First, call the generic namedBeast information routine and fill in any
// * requested named beast information. If it fails, do not continue...
// *---------------------------------------------------------------------------*/
// derivedFromModifyInfo = BST_GetNextParentMethod(extAttr->EAbeastClass,
// COMNOPS_INDEX(modifyInfo),extAttrModifyInfo);
// if (derivedFromModifyInfo(genMsg,extAttr,modifyMsg) != zOK)
// return(zFAILURE);
/*---------------------------------------------------------------------------
* Now, if the caller requested, modify any extAttr specific information
*---------------------------------------------------------------------------*/
if ((extAttrInfo = modifyMsg->modifyTypeInfo) == NULL)
return(zOK); /* No type specific info to modify */
ASSERT_XLATCH(&extAttr->EAbeastLatch);
zASSERT(!(modifyMsg->modifyTypeInfoMask & ~zVALID_MOD_EXTATTR_INFO_MASK));
if (modifyMsg->modifyTypeInfoMask & zMOD_EXTATTR_FLAGS)
{
extAttr->EAextAttrUserFlags = extAttrInfo->extAttrUserFlags;
if (xaction == NULL)
{
/* No transaction. Just mark the beast dirty and let it get flushed
* at some later point in time */
COMN_MARK_BEAST_DIRTY(&extAttr->EAroot);
}
else
{
/* We have a transaction. Mark the beast as part of that
* transaction and force write it as part of that transaction */
COMN_MARK_BEAST_XLOCAL(&extAttr->EAroot,xaction);
if (COMN_ForceBeastWrite(genMsg,extAttr,xaction) != zOK)
{
return zFAILURE;
}
}
}
return zOK;
}
/****************************************************************************
* COMMON OPS definition
*
*****************************************************************************/
/*---------------------------------------------------------------------------
* Defines all of the FileBeast operations
*---------------------------------------------------------------------------*/
CommonBeastOps_s ExtAttrBeastComnOps =
{
NULL, /* construct */
NULL, /* destruct */
// cnt NULL, /* BST_getNameUniquifier */
NULL, /* BST_setupNameTypeSpecificInfo */
NULL, /* BST_lookupByNameInDirectory*/
NULL, /* BST_isDirectoryEmpty*/
NULL, /* BST_addNameToDirectory*/
NULL, /* BST_removeNameFromDirectory*/
NULL, /* BST_modifyNameSpaceMaskInDirectory*/
NULL, /* BST_setMatchAttributesInDirectory*/
NULL, /* BST_wildcardLookup*/
NULL, /* BST_truncateFile*/
NULL, /* BST_getStorageInfo*/
NULL, /* BST_getExtentList*/
NULL, /* BST_getPhysicalExtent*/
NULL, /* BST_isBlockInBeast*/
NULL, /* BST_asyncReadFileBlk*/
NULL, /* BST_getFileBlk*/
NULL, /* BST_dfsReadUnits*/
NULL, /* BST_dfsWriteUnits*/
NULL, /* BST_getZID*/
NULL, /* BST_beastNotify*/
EXTATTR_BST_GetInfo, /* BST_getInfo*/
EXTATTR_BST_ModifyInfo, /* BST_modifyInfo*/
NULL, /* BST_getInfoXML*/
NULL /* BST_modifyInfoXML*/
};

1145
src/nwnss/lsa/lsaXattr.c Normal file

File diff suppressed because it is too large Load Diff