More changes to support X-FLAIM.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@376 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
158
ftk/src/ftk.h
158
ftk/src/ftk.h
@@ -349,41 +349,6 @@
|
||||
|
||||
#define flminterface struct flmnovtbl
|
||||
|
||||
FLM_DEFINE_GUID( Internal_IID_FLMIUnknown, 0x00000000, 0x0000, 0x0000,
|
||||
0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46);
|
||||
|
||||
flminterface FLMIUnknown
|
||||
{
|
||||
virtual ~FLMIUnknown()
|
||||
{
|
||||
}
|
||||
|
||||
virtual RCODE FLMAPI QueryInterface(
|
||||
RFLMIID riid,
|
||||
void ** ppv) = 0;
|
||||
|
||||
virtual FLMINT FLMAPI AddRef( void) = 0;
|
||||
|
||||
virtual FLMINT FLMAPI Release( void) = 0;
|
||||
};
|
||||
|
||||
// FLMIClassFactory
|
||||
// uuid: 00000001-0000-0000-C000-000000000046 (same as MSCOM IClassFactory)
|
||||
|
||||
FLM_DEFINE_GUID( Internal_IID_FLMIClassFactory, 0x00000001, 0x0000, 0x0000,
|
||||
0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46);
|
||||
|
||||
flminterface FLMIClassFactory : public FLMIUnknown
|
||||
{
|
||||
virtual RCODE FLMAPI CreateInstance(
|
||||
FLMIUnknown * piuouter,
|
||||
RFLMIID riid,
|
||||
void ** ppv) = 0;
|
||||
|
||||
virtual RCODE FLMAPI LockServer(
|
||||
bool lockf) = 0;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Forward References
|
||||
****************************************************************************/
|
||||
@@ -473,18 +438,18 @@
|
||||
Desc: Collation flags and constants
|
||||
****************************************************************************/
|
||||
|
||||
#define HAD_SUB_COLLATION 0x01 // Set if had sub-collating values-diacritics
|
||||
#define HAD_LOWER_CASE 0x02 // Set if you hit a lowercase character
|
||||
#define COLL_FIRST_SUBSTRING 0x03 // First substring marker
|
||||
#define COLL_MARKER 0x04 // Marks place of sub-collation
|
||||
#define HAD_SUB_COLLATION 0x01 // Set if had sub-collating values-diacritics
|
||||
#define HAD_LOWER_CASE 0x02 // Set if you hit a lowercase character
|
||||
#define COLL_FIRST_SUBSTRING 0x03 // First substring marker
|
||||
#define COLL_MARKER 0x04 // Marks place of sub-collation
|
||||
|
||||
#define SC_LOWER 0x00 // Only lowercase characters exist
|
||||
#define SC_MIXED 0x01 // Lower/uppercase flags follow in next byte
|
||||
#define SC_UPPER 0x02 // Only upper characters exist
|
||||
#define SC_SUB_COL 0x03 // Sub-collation follows (diacritics|extCh)
|
||||
#define SC_LOWER 0x00 // Only lowercase characters exist
|
||||
#define SC_MIXED 0x01 // Lower/uppercase flags follow in next byte
|
||||
#define SC_UPPER 0x02 // Only upper characters exist
|
||||
#define SC_SUB_COL 0x03 // Sub-collation follows (diacritics|extCh)
|
||||
|
||||
#define COLL_TRUNCATED 0x0C // This key piece has been truncated from original
|
||||
#define MAX_COL_OPCODE COLL_TRUNCATED
|
||||
#define COLL_TRUNCATED 0x0C // This key piece has been truncated from original
|
||||
#define MAX_COL_OPCODE COLL_TRUNCATED
|
||||
|
||||
/****************************************************************************
|
||||
Desc: I/O Flags
|
||||
@@ -561,44 +526,33 @@
|
||||
FLM_NUM_COLORS
|
||||
} eColorType;
|
||||
|
||||
#define F_BLACK "%0C"
|
||||
#define F_BLUE "%1C"
|
||||
#define F_GREEN "%2C"
|
||||
#define F_CYAN "%3C"
|
||||
#define F_RED "%4C"
|
||||
#define F_PURPLE "%5C"
|
||||
#define F_BROWN "%6C"
|
||||
#define F_LIGHTGRAY "%7C"
|
||||
#define F_DARKGRAY "%8C"
|
||||
#define F_LIGHTBLUE "%9C"
|
||||
#define F_LIGHTGREEN "%10C"
|
||||
#define F_LIGHTCYAN "%11C"
|
||||
#define F_LIGHTRED "%12C"
|
||||
#define F_LIGHTPURPLE "%13C"
|
||||
#define F_YELLOW "%14C"
|
||||
#define F_WHITE "%15C"
|
||||
#define F_BLACK "%0C"
|
||||
#define F_BLUE "%1C"
|
||||
#define F_GREEN "%2C"
|
||||
#define F_CYAN "%3C"
|
||||
#define F_RED "%4C"
|
||||
#define F_PURPLE "%5C"
|
||||
#define F_BROWN "%6C"
|
||||
#define F_LIGHTGRAY "%7C"
|
||||
#define F_DARKGRAY "%8C"
|
||||
#define F_LIGHTBLUE "%9C"
|
||||
#define F_LIGHTGREEN "%10C"
|
||||
#define F_LIGHTCYAN "%11C"
|
||||
#define F_LIGHTRED "%12C"
|
||||
#define F_LIGHTPURPLE "%13C"
|
||||
#define F_YELLOW "%14C"
|
||||
#define F_WHITE "%15C"
|
||||
|
||||
#define F_PUSHFORECOLOR "%+0C"
|
||||
#define F_PUSHBACKCOLOR "%+1C"
|
||||
#define F_POPFORECOLOR "%-0C"
|
||||
#define F_POPBACKCOLOR "%-1C"
|
||||
#define F_PUSHFORECOLOR "%+0C"
|
||||
#define F_PUSHBACKCOLOR "%+1C"
|
||||
#define F_POPFORECOLOR "%-0C"
|
||||
#define F_POPBACKCOLOR "%-1C"
|
||||
|
||||
#define F_PUSHCOLOR F_PUSHFORECOLOR F_PUSHBACKCOLOR
|
||||
#define F_POPCOLOR F_POPFORECOLOR F_POPBACKCOLOR
|
||||
#define F_PUSHCOLOR F_PUSHFORECOLOR F_PUSHBACKCOLOR
|
||||
#define F_POPCOLOR F_POPFORECOLOR F_POPBACKCOLOR
|
||||
|
||||
#define F_BLUE_ON_WHITE "%1.15C"
|
||||
#define F_BLUE_ON_WHITE "%1.15C"
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Data types
|
||||
****************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
FLM_NODATA_TYPE = 0,
|
||||
FLM_TEXT_TYPE,
|
||||
FLM_NUMBER_TYPE,
|
||||
FLM_BINARY_TYPE
|
||||
} eFlmDataType;
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Slab stats
|
||||
****************************************************************************/
|
||||
@@ -695,15 +649,19 @@
|
||||
void FLMAPI operator delete(
|
||||
void * ptr);
|
||||
|
||||
#ifndef FLM_WATCOM_NLM
|
||||
void FLMAPI operator delete(
|
||||
void * ptr,
|
||||
const char * file,
|
||||
int line);
|
||||
#endif
|
||||
|
||||
#ifndef FLM_WATCOM_NLM
|
||||
void FLMAPI operator delete[](
|
||||
void * ptr,
|
||||
const char * file,
|
||||
int line);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
@@ -739,15 +697,19 @@
|
||||
void operator delete(
|
||||
void * ptr);
|
||||
|
||||
#ifndef FLM_WATCOM_NLM
|
||||
void operator delete(
|
||||
void * ptr,
|
||||
const char * file,
|
||||
int line);
|
||||
#endif
|
||||
|
||||
#ifndef FLM_WATCOM_NLM
|
||||
void operator delete[](
|
||||
void * ptr,
|
||||
const char * file,
|
||||
int line);
|
||||
#endif
|
||||
|
||||
virtual FINLINE FLMINT FLMAPI AddRef( void)
|
||||
{
|
||||
@@ -1173,6 +1135,8 @@
|
||||
virtual FLMBOOL FLMAPI doesFileMatch(
|
||||
const char * pszFileName,
|
||||
const char * pszTemplate) = 0;
|
||||
|
||||
virtual FLMBOOL FLMAPI canDoAsync( void) = 0;
|
||||
};
|
||||
|
||||
RCODE FLMAPI FlmGetFileSystem(
|
||||
@@ -1355,7 +1319,7 @@
|
||||
|
||||
virtual void FLMAPI notifyComplete(
|
||||
RCODE rc) = 0;
|
||||
|
||||
|
||||
virtual void FLMAPI setCompletionCallback(
|
||||
WRITE_COMPLETION_CB fnCompletion) = 0;
|
||||
|
||||
@@ -1371,6 +1335,13 @@
|
||||
virtual eBufferMgrList FLMAPI getList( void) = 0;
|
||||
|
||||
virtual void FLMAPI makePending( void) = 0;
|
||||
|
||||
virtual void FLMAPI startTimer(
|
||||
void * pvStats) = 0;
|
||||
|
||||
virtual void * FLMAPI getStats( void) = 0;
|
||||
|
||||
virtual FLMUINT64 FLMAPI getElapTime( void) = 0;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1598,7 +1569,8 @@
|
||||
};
|
||||
|
||||
RCODE FLMAPI FlmAllocPool(
|
||||
IF_Pool ** ppPool);
|
||||
IF_Pool ** ppPool,
|
||||
FLMUINT uiBlockSize = 0);
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Dynamic buffer
|
||||
@@ -3376,10 +3348,26 @@
|
||||
#endif
|
||||
|
||||
#define FTK_ERROR_BASE(e) ((RCODE)((int)(0x81055000+(e))))
|
||||
#define FTK_ERROR_END ((RCODE)((int)(0x81055FFF)))
|
||||
|
||||
const char * FLMAPI f_errorString(
|
||||
RCODE rc);
|
||||
|
||||
RCODE FLMAPI f_mapPlatformError(
|
||||
FLMINT iError,
|
||||
RCODE defaultRc);
|
||||
|
||||
FINLINE FLMBOOL FLMAPI f_isToolkitError(
|
||||
RCODE rc)
|
||||
{
|
||||
if( rc > FTK_ERROR_BASE( 0) && rc < FTK_ERROR_END)
|
||||
{
|
||||
return( TRUE);
|
||||
}
|
||||
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: FTX
|
||||
****************************************************************************/
|
||||
@@ -3992,12 +3980,4 @@
|
||||
#define NE_FLM_STREAM_TOO_MANY_FILES FTK_ERROR_BASE( 0x403) // Too many files in input stream.
|
||||
#define NE_FLM_LAST_STREAM_ERROR FTK_ERROR_BASE( 0x404) // NOTE: This is not an error code - do not document
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Stream Errors
|
||||
****************************************************************************/
|
||||
|
||||
RCODE f_mapPlatformError(
|
||||
FLMINT iError,
|
||||
RCODE defaultRc);
|
||||
|
||||
#endif // FTK_H
|
||||
|
||||
@@ -12237,3 +12237,9 @@ Exit:
|
||||
return( rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FLM_WATCOM_NLM
|
||||
void gv_ftkbtree( void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -294,7 +294,7 @@ const char * FLMAPI f_errorString(
|
||||
Desc: Map POSIX errno to Flaim IO errors.
|
||||
***************************************************************************/
|
||||
#if defined( FLM_UNIX) || defined( FLM_NLM)
|
||||
RCODE f_mapPlatformError(
|
||||
RCODE FLMAPI f_mapPlatformError(
|
||||
FLMINT iError,
|
||||
RCODE defaultRc)
|
||||
{
|
||||
@@ -362,7 +362,7 @@ RCODE f_mapPlatformError(
|
||||
Desc:
|
||||
***************************************************************************/
|
||||
#ifdef FLM_WIN
|
||||
RCODE f_mapPlatformError(
|
||||
RCODE FLMAPI f_mapPlatformError(
|
||||
FLMINT iErrCode,
|
||||
RCODE defaultRc)
|
||||
{
|
||||
|
||||
@@ -65,11 +65,14 @@ public:
|
||||
|
||||
F_FileSystem()
|
||||
{
|
||||
m_bCanDoAsync = FALSE;
|
||||
}
|
||||
|
||||
virtual ~F_FileSystem()
|
||||
{
|
||||
}
|
||||
|
||||
RCODE setup( void);
|
||||
|
||||
RCODE FLMAPI createFile(
|
||||
const char * pszFileName,
|
||||
@@ -185,6 +188,8 @@ public:
|
||||
const char * pszFileName,
|
||||
FLMBOOL bReadOnly);
|
||||
|
||||
FLMBOOL FLMAPI canDoAsync( void);
|
||||
|
||||
private:
|
||||
|
||||
RCODE removeEmptyDir(
|
||||
@@ -199,6 +204,8 @@ private:
|
||||
const char * tpath,
|
||||
FLMBOOL * isdir);
|
||||
#endif
|
||||
|
||||
FLMBOOL m_bCanDoAsync;
|
||||
};
|
||||
|
||||
FSTATIC FLMBOOL f_canReducePath(
|
||||
@@ -417,6 +424,35 @@ RCODE f_allocFileHdl(
|
||||
|
||||
return( NE_FLM_OK);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE F_FileSystem::setup( void)
|
||||
{
|
||||
#if defined( FLM_WIN)
|
||||
OSVERSIONINFO versionInfo;
|
||||
|
||||
versionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO);
|
||||
if( !GetVersionEx( &versionInfo))
|
||||
{
|
||||
return( f_mapPlatformError( GetLastError(), NE_FLM_FAILURE));
|
||||
}
|
||||
|
||||
// Async writes are not supported on Win32s (3.1) or
|
||||
// Win95, 98, ME, etc.
|
||||
|
||||
m_bCanDoAsync =
|
||||
(versionInfo.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS &&
|
||||
versionInfo.dwPlatformId != VER_PLATFORM_WIN32s)
|
||||
? TRUE
|
||||
: FALSE;
|
||||
#else
|
||||
m_bCanDoAsync = TRUE;
|
||||
#endif
|
||||
|
||||
return( NE_FLM_OK);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Create a file, return a file handle to created file.
|
||||
@@ -1451,6 +1487,14 @@ Exit:
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: stat tpath to see if it is a directory
|
||||
****************************************************************************/
|
||||
FLMBOOL FLMAPI F_FileSystem::canDoAsync( void)
|
||||
{
|
||||
return( m_bCanDoAsync);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: stat tpath to see if it is a directory
|
||||
****************************************************************************/
|
||||
|
||||
@@ -359,6 +359,7 @@ F_IOBuffer::F_IOBuffer()
|
||||
#elif defined( FLM_NLM)
|
||||
m_hSem = F_SEM_NULL;
|
||||
#endif
|
||||
m_pStats = NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -624,3 +625,32 @@ void FLMAPI F_IOBuffer::signalComplete(
|
||||
kSemaphoreSignal( (SEMAPHORE)m_hSem);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
void FLMAPI F_IOBuffer::startTimer(
|
||||
void * pStats)
|
||||
{
|
||||
if ((m_pStats = pStats) != NULL)
|
||||
{
|
||||
m_ui64ElapMilli = 0;
|
||||
f_timeGetTimeStamp( &m_StartTime);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
FLMUINT64 FLMAPI F_IOBuffer::getElapTime( void)
|
||||
{
|
||||
return( m_ui64ElapMilli);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
void * FLMAPI F_IOBuffer::getStats( void)
|
||||
{
|
||||
return( m_pStats);
|
||||
}
|
||||
|
||||
@@ -732,12 +732,18 @@ private:
|
||||
Desc:
|
||||
*************************************************************************/
|
||||
RCODE FLMAPI FlmAllocPool(
|
||||
IF_Pool ** ppPool)
|
||||
IF_Pool ** ppPool,
|
||||
FLMUINT uiBlockSize)
|
||||
{
|
||||
if( (*ppPool = f_new F_Pool) == NULL)
|
||||
{
|
||||
return( RC_SET( NE_FLM_MEM));
|
||||
}
|
||||
|
||||
if( uiBlockSize)
|
||||
{
|
||||
(*ppPool)->poolInit( uiBlockSize);
|
||||
}
|
||||
|
||||
return( NE_FLM_OK);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "ftk.h"
|
||||
|
||||
class F_FileHdl;
|
||||
class F_Thread;
|
||||
class F_ThreadMgr;
|
||||
class F_IOBufferMgr;
|
||||
@@ -330,8 +331,6 @@
|
||||
****************************************************************************/
|
||||
#ifdef FLM_NLM
|
||||
typedef SEMAPHORE F_SEM;
|
||||
typedef SEMAPHORE * F_SEM_p;
|
||||
#define F_SEM_NULL 0
|
||||
#elif defined( FLM_WIN)
|
||||
typedef struct
|
||||
{
|
||||
@@ -517,6 +516,13 @@
|
||||
|
||||
void FLMAPI makePending( void);
|
||||
|
||||
void FLMAPI startTimer(
|
||||
void * pvStats);
|
||||
|
||||
void * FLMAPI getStats( void);
|
||||
|
||||
FLMUINT64 FLMAPI getElapTime( void);
|
||||
|
||||
#ifdef FLM_WIN
|
||||
FINLINE OVERLAPPED * getOverlapped( void)
|
||||
{
|
||||
@@ -578,6 +584,7 @@
|
||||
RCODE m_completionRc;
|
||||
F_TMSTAMP m_StartTime;
|
||||
FLMUINT64 m_ui64ElapMilli;
|
||||
void * m_pStats;
|
||||
|
||||
friend class F_IOBufferMgr;
|
||||
};
|
||||
|
||||
@@ -207,14 +207,20 @@ RCODE F_FileHdl::openOrCreate(
|
||||
(uiMajor == 2 && uiMinor == 6 && uiRevision >= 5))
|
||||
{
|
||||
openFlags |= O_DIRECT;
|
||||
m_bCanDoAsync = TRUE;
|
||||
if( pFileSystem->canDoAsync())
|
||||
{
|
||||
m_bCanDoAsync = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bDoDirectIO = FALSE;
|
||||
}
|
||||
#elif defined( FLM_SOLARIS)
|
||||
m_bCanDoAsync = TRUE;
|
||||
if( pFileSystem->canDoAsync())
|
||||
{
|
||||
m_bCanDoAsync = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ RCODE F_FileHdl::openOrCreate(
|
||||
|
||||
// Only enable asynchronous writes if direct I/O is enabled.
|
||||
|
||||
if (m_bDoDirectIO)
|
||||
if (m_bDoDirectIO && pFileSystem->canDoAsync())
|
||||
{
|
||||
m_bCanDoAsync = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user