Moved Linux-specific routines out of ftkmisc and into ftkunix.

git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@373 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
ahodgkinson
2006-05-05 16:48:29 +00:00
parent 2b4f58edb5
commit 86bbf5f33d
4 changed files with 69 additions and 65 deletions

View File

@@ -113,8 +113,6 @@ private:
F_UNREFERENCED_PARM( pszBasePath);
#endif
IF_FileSystem * pFileSystem = f_getFileSysPtr();
if( m_pLockFileHdl)
{
@@ -127,7 +125,8 @@ private:
#ifdef FLM_UNIX
if( bDelete)
{
char szTmpPath[ F_PATH_MAX_SIZE];
IF_FileSystem * pFileSystem = f_getFileSysPtr();
char szTmpPath[ F_PATH_MAX_SIZE];
// Delete the lock file
@@ -403,9 +402,7 @@ RCODE F_MultiFileHdl::create(
Exit:
/*
Release the lock file
*/
// Release the lock file
if( RC_BAD( rc))
{
@@ -483,27 +480,21 @@ RCODE F_MultiFileHdl::createUnique(
f_strcpy( m_szPath, szTmpPath);
bCreatedDir = TRUE;
/*
Create the lock file
*/
// Create the lock file
if( RC_BAD( rc = createLockFile( m_szPath)))
{
goto Exit;
}
/*
Initialize the EOF to 0 and set the state to open
*/
// Initialize the EOF to 0 and set the state to open
m_ui64EOF = 0;
m_bOpen = TRUE;
Exit:
/*
Release the lock file
*/
// Release the lock file
if( RC_BAD( rc))
{
@@ -546,27 +537,21 @@ RCODE F_MultiFileHdl::open(
f_strcpy( m_szPath, pszPath);
/*
Create the lock file
*/
// Create the lock file
if( RC_BAD( rc = createLockFile( m_szPath)))
{
goto Exit;
}
/*
Need to determine the current EOF
*/
// Need to determine the current EOF
if( RC_BAD( rc = pFileSystem->openDir( m_szPath, (char *)"*.64", &pDir)))
{
goto Exit;
}
/*
Find all data files to determine the EOF
*/
// Find all data files to determine the EOF
for( rc = pDir->next(); !RC_BAD( rc) ; rc = pDir->next())
{
@@ -591,9 +576,7 @@ Exit:
pDir->Release();
}
/*
Release the lock file
*/
// Release the lock file
if( RC_BAD( rc))
{

View File

@@ -32,13 +32,7 @@ static IF_RandomGenerator * gv_pSerialRandom = NULL;
static FLMUINT32 * gv_pui32CRCTbl = NULL;
static IF_ThreadMgr * gv_pThreadMgr = NULL;
static IF_FileSystem * gv_pFileSystem = NULL;
static FLMUINT gv_uiMaxFileSize = 0xFFFC0000;
#ifdef FLM_LINUX
static FLMUINT gv_uiLinuxMajorVer = 0;
static FLMUINT gv_uiLinuxMinorVer = 0;
static FLMUINT gv_uiLinuxRevision = 0;
#endif
static FLMUINT gv_uiMaxFileSize = FLM_MAXIMUM_FILE_SIZE;
FSTATIC RCODE f_initSerialNumberGenerator( void);
@@ -96,14 +90,13 @@ RCODE FLMAPI ftkStartup( void)
}
#if defined( FLM_LINUX)
f_getLinuxKernelVersion( &gv_uiLinuxMajorVer, &gv_uiLinuxMinorVer,
&gv_uiLinuxRevision);
f_setupLinuxKernelVersion();
gv_uiMaxFileSize = f_getLinuxMaxFileSize();
#elif defined( FLM_AIX)
// Call set setrlimit to increase the max allowed file size.
// Call setrlimit to increase the max allowed file size.
// We don't have a good way to deal with any errors returned by
// setrlimit(), so we just hope that there aren't any...
// setrlimit(), so we just hope that there aren't any ...
struct rlimit rlim;
@@ -1004,32 +997,6 @@ FLMINT FLMAPI F_Object::Release( void)
return( iRefCnt);
}
/***************************************************************************
Desc: Determines if the linux system we are running on is 2.4 or greater.
***************************************************************************/
#ifdef FLM_LINUX
FLMUINT f_getLinuxMaxFileSize( void)
{
#ifdef FLM_32BIT
return( FLM_MAXIMUM_FILE_SIZE);
#else
FLMUINT uiMaxFileSize = 0x7FF00000;
f_assert( gv_uiLinuxMajorVer);
// Is version 2.4 or greater?
if( gv_uiLinuxMajorVer > 2 ||
(gv_uiLinuxMajorVer == 2 && gv_uiLinuxMinorVer >= 4))
{
uiMaxFileSize = FLM_MAXIMUM_FILE_SIZE;
}
return( uiMaxFileSize);
#endif
}
#endif
/**********************************************************************
Desc:
**********************************************************************/

View File

@@ -1916,6 +1916,9 @@
FLMBYTE * pszFileName);
#if defined( FLM_LINUX)
void f_setupLinuxKernelVersion( void);
void f_getLinuxKernelVersion(
FLMUINT * puiMajor,
FLMUINT * puiMinor,

View File

@@ -59,6 +59,12 @@
#include <sys/mount.h>
#endif
#ifdef FLM_LINUX
static FLMUINT gv_uiLinuxMajorVer = 0;
static FLMUINT gv_uiLinuxMinorVer = 0;
static FLMUINT gv_uiLinuxRevision = 0;
#endif
/******************************************************************************
Desc:
*******************************************************************************/
@@ -1312,7 +1318,15 @@ void f_getLinuxKernelVersion(
FLMUINT uiMajorVer = 0;
FLMUINT uiMinorVer = 0;
FLMUINT uiRevision = 0;
if( gv_uiLinuxMajorVer)
{
uiMajorVer = gv_uiLinuxMajorVer;
uiMinorVer = gv_uiLinuxMinorVer;
uiRevision = gv_uiLinuxRevision;
goto Exit;
}
if( (fd = open( "/proc/version", O_RDONLY, 0600)) == -1)
{
goto Exit;
@@ -1381,6 +1395,43 @@ Exit:
}
#endif
/***************************************************************************
Desc:
***************************************************************************/
#ifdef FLM_LINUX
void f_setupLinuxKernelVersion( void)
{
f_getLinuxKernelVersion( &gv_uiLinuxMajorVer,
&gv_uiLinuxMinorVer, &gv_uiLinuxRevision);
}
#endif
/***************************************************************************
Desc: Determines if the linux system we are running on is 2.4 or greater.
***************************************************************************/
#ifdef FLM_LINUX
FLMUINT f_getLinuxMaxFileSize( void)
{
#ifdef FLM_32BIT
return( FLM_MAXIMUM_FILE_SIZE);
#else
FLMUINT uiMaxFileSize = 0x7FF00000;
f_assert( gv_uiLinuxMajorVer);
// Is version 2.4 or greater?
if( gv_uiLinuxMajorVer > 2 ||
(gv_uiLinuxMajorVer == 2 && gv_uiLinuxMinorVer >= 4))
{
uiMaxFileSize = FLM_MAXIMUM_FILE_SIZE;
}
return( uiMaxFileSize);
#endif
}
#endif
/***************************************************************************
Desc:
***************************************************************************/