add a file type for IBM i (AS/400) native objects

This commit is contained in:
Brian Cox 2019-09-22 23:33:48 -07:00
parent 458d8652b3
commit b3f86242a8
8 changed files with 52 additions and 21 deletions

View File

@ -137,9 +137,10 @@ struct cFSStatArgs
TY_DOOR,
TY_PORT,
TY_NAMED,
TY_MESSAGE_QUEUE,
TY_SEMAPHORE,
TY_SHARED_MEMORY
TY_NATIVE,
TY_MESSAGE_QUEUE,
TY_SEMAPHORE,
TY_SHARED_MEMORY
};
// attr is fs dependent?

View File

@ -127,6 +127,16 @@
#define TW_SLASH _T('/')
#if (IS_AIX || IS_OS400)
#ifndef _S_IFNATIVE
#define _S_IFNATIVE 02000000 /* OS/400 native object, of any object type that isn't treated as a directory */
#endif
#ifndef S_ISNATIVE
#define S_ISNATIVE(x) (((x) & 0370000) == _S_IFNATIVE)
#endif
#endif
//=========================================================================
// OTHER DIRECTIVES
//=========================================================================
@ -425,6 +435,11 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& statArgs) const
statArgs.mFileType = cFSStatArgs::TY_NAMED;
#endif
#ifdef S_ISNATIVE
else if (S_ISNATIVE(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_NATIVE;
#endif
#ifdef S_TYPEISMQ
else if (S_TYPEISMQ(&statbuf))
statArgs.mFileType = cFSStatArgs::TY_MESSAGE_QUEUE;

View File

@ -274,6 +274,9 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO)
case cFSStatArgs::TY_NAMED:
propSet.SetFileType(cFSPropSet::FT_NAMED);
break;
case cFSStatArgs::TY_NATIVE:
propSet.SetFileType(cFSPropSet::FT_NATIVE);
break;
case cFSStatArgs::TY_MESSAGE_QUEUE:
propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE);
break;

View File

@ -302,6 +302,9 @@ void cFSPropCalc::HandleStatProperties(const cFCOPropVector& propsToCheck, const
case cFSStatArgs::TY_NAMED:
propSet.SetFileType(cFSPropSet::FT_NAMED);
break;
case cFSStatArgs::TY_NATIVE:
propSet.SetFileType(cFSPropSet::FT_NATIVE);
break;
case cFSStatArgs::TY_MESSAGE_QUEUE:
propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE);
break;
@ -325,11 +328,17 @@ void cFSPropCalc::HandleHashes(const cFCOPropVector& propsToCheck, const TSTRING
// if the file type is not a regular file, we will
// not try to open the file for signature generation
ASSERT(propSet.GetValidVector().ContainsItem(cFSPropSet::PROP_FILETYPE));
if (propSet.GetFileType() == cFSPropSet::FT_FILE || propSet.GetFileType() == cFSPropSet::FT_SYMLINK)
if ( propSet.GetFileType() == cFSPropSet::FT_FILE
|| propSet.GetFileType() == cFSPropSet::FT_SYMLINK
#if (IS_AIX || IS_OS400)
|| propSet.GetFileType() == cFSPropSet::FT_NATIVE
#endif
)
{
if ( // if we need to open the file
propsToCheck.ContainsItem(cFSPropSet::PROP_CRC32) || propsToCheck.ContainsItem(cFSPropSet::PROP_MD5) ||
propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL))
propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL))
{
cFileArchive arch;
cMemoryArchive memArch;

View File

@ -60,6 +60,7 @@ TSTRING cFCOPropFileType::AsString() const
fs::STR_FT_DOOR,
fs::STR_FT_PORT,
fs::STR_FT_NAMED,
fs::STR_FT_NATIVE,
fs::STR_FT_MESSAGE_QUEUE,
fs::STR_FT_SEMAPHORE,
fs::STR_FT_SHARED_MEMORY};

View File

@ -112,9 +112,10 @@ public:
FT_DOOR,
FT_PORT,
FT_NAMED,
FT_MESSAGE_QUEUE,
FT_SEMAPHORE,
FT_SHARED_MEMORY,
FT_NATIVE,
FT_MESSAGE_QUEUE,
FT_SEMAPHORE,
FT_SHARED_MEMORY,
FT_NUMITEMS
};

View File

@ -41,19 +41,20 @@
TSS_BeginStringtable(cFS)
TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")),
TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")),
TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")),
TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")),
TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")),
TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")),
TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")),
TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")),
TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")),
TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")),
TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")),
TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")),
TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")),
TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")),
TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")),
TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")),
TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")),
TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")),
TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")),
TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")),
TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")),
TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")),
TSS_StringEntry(fs::STR_FT_NATIVE, _T("Native Object")),
TSS_StringEntry(fs::STR_FT_MESSAGE_QUEUE, _T("Message Queue")),
TSS_StringEntry(fs::STR_FT_SEMAPHORE, _T("Semaphore")),
TSS_StringEntry(fs::STR_FT_SEMAPHORE, _T("Semaphore")),
TSS_StringEntry(fs::STR_FT_SHARED_MEMORY, _T("Shared Memory")),
// property names

View File

@ -46,7 +46,7 @@ TSS_BeginStringIds(fs)
// file types
STR_FT_INVALID,
STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, STR_FT_NAMED,
STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, STR_FT_NAMED, STR_FT_NATIVE,
STR_FT_MESSAGE_QUEUE, STR_FT_SEMAPHORE, STR_FT_SHARED_MEMORY,
// property names
STR_PROP_DEV, STR_PROP_RDEV, STR_PROP_INODE, STR_PROP_MODE, STR_PROP_NLINK, STR_PROP_UID, STR_PROP_GID,