Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

cmn_File Class Reference
[Common, basic classes, functions and types]

Basic (super) class for File IO. More...

#include <cmn_File.h>

Inheritance diagram for cmn_File:
Inheritance graph
[legend]
Collaboration diagram for cmn_File:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 cmn_File ()
 cmn_File (const cmn_File &a_file)
 cmn_File (const cmn_Path &a_fullPathUTF8, const ivd_FileSize_t a_fileSize=0)
cmn_Fileoperator= (const cmn_File &a_file)
virtual ~cmn_File ()
cmn_PathGetFullPathRef ()
 Pathname set/get.
void SetFullPath (const cmn_Path &a_fullPathUTF8)
string GetFileSystemID ()
 Get file system ID (where file is located).
void GetFileSystemSize (ivd_FileSystemSize_t &a_fsSize)
 Get file system sizes (FS where file is located) .
void StatF (ivd_FileInfo_t &a_info)
 Get file information (stat()-like).
ivd_FileType_e GetFileType ()
 Get IVD internal file type.
void CreatePipe ()
 Creates named pipe/fifo.
void OpenF (const UInt32_t a_mode=fom_DEFAULT_MODE_d)
 Opens file with specific flags and permissions.
bool IsOpen () const
bool Exists ()
void CloseF ()
 Close the file.
ivd_FileRetSize_t ReadF (void *a_buf, ivd_FileBufSize_t a_size)
 Reads a_size number of bytes to buffer a_buf from file and return the number of bytes read.
ivd_FileRetSize_t WriteF (const void *a_buf, ivd_FileBufSize_t a_size) const
 Writes a_size number of bytes from buffer a_buf to file and return the number of bytes written.
ivd_FilePosition_t SeekF (ivd_FilePosition_t a_offset) const
 Set the file position for next read or write operation.
ivd_FilePosition_t SeekRelF (ivd_FilePosition_t a_offset) const
 Set the file position for next read or write operation using offset from current position.
ivd_FilePosition_t SeekEndF ()
 Set the file position to the end of file for next read or write operation.
ivd_FilePosition_t GetCurrentPosF () const
 Return current position in file.
void SyncF ()
 Commit all changes to disk.
void DataSyncF ()
 In Posix commit only data changes to disk.
void TruncF (ivd_FilePosition_t a_size=0)
 Truncation of file.
void SparseF (ivd_FilePosition_t a_size)
 Create sparse file of specified size.
void DeleteF ()
 Delete the file.
void SymLink (const cmn_Path &a_linkNameUTF8)
 Create symbolic link (shell link on Windows platform) to file.
UInt32_t GetStreamHeader (string &a_streamName, ivd_FilePosition_t &a_streamSize)
 Get stream header of next stream.
ivd_FilePosition_t GetStreamLeft ()
ivd_FileRetSize_t ReadStream (void *a_buf, ivd_FileBufSize_t a_size)
 Reads a_size number of bytes to buffer a_buf from current stream and return the number of bytes read.
void SetStreamHeader (UInt32_t a_streamType, const string &a_streamName, ivd_FilePosition_t a_streamSize)
 Set stream header of next stream.
ivd_FileRetSize_t WriteStream (const void *a_buf, ivd_FileBufSize_t a_size)
 Writes a_size number of bytes from a_buf to current stream and return the number of bytes written.
bool CleanupWriteStream ()
 Releases memory and sets m_context to NULL after each restore operation.
void SetFileHandle (const ivd_FileHandle_t, const UInt32_t)
void GetFileHandle (ivd_FileHandle_t &a_fileHandle, UInt32_t &a_openMode)
ivd_FileSize_t GetSize ()
 Provides the size of the file on the volume.

Static Public Member Functions

static void DeleteFile (const cmn_Path &a_fileUTF8, int *a_errno=NULL)
static void DeleteDir (const cmn_Path &a_dirUTF8, int *a_errno=NULL)
static cmn_Path ReadLink (const cmn_Path &a_linkNameUTF8)
 Reads where the symbolic link (shell link on Windows platform) points to.
static ivd_FileType_e FileTypeFromMode (const UInt32_t a_mode)
 Get file type from attributes/mode.

Private Member Functions

void DuplicateFrom (const cmn_File &a_file)

Private Attributes

 log_CLASSID_m
cmn_Path m_fullPath
string m_localeFullPath
ivd_FileHandle_t m_fileHandle
bool m_opened
bool m_createdPipe
UInt32_t m_openMode
int m_lastError
bool m_dataStream
ivd_FilePosition_t m_streamLeft
ivd_FileSize_t m_fileSize

Detailed Description

Basic (super) class for File IO.

It supports 64-bit seek, but it does not support reading or writing blocks larger than 2 GB!

Definition at line 109 of file cmn_File.h.


Constructor & Destructor Documentation

cmn_File::cmn_File (  ) 

Definition at line 58 of file cmn_File_LNX.cpp.

References log_FUNC_m.

Referenced by cmn_File().

Here is the caller graph for this function:

cmn_File::cmn_File ( const cmn_File a_file  ) 

Definition at line 120 of file cmn_File_LNX.cpp.

References DuplicateFrom().

                                         {
    DuplicateFrom(a_file);
}

Here is the call graph for this function:

cmn_File::cmn_File ( const cmn_Path a_fullPathUTF8,
const ivd_FileSize_t  a_fileSize = 0 
)

Definition at line 69 of file cmn_File_LNX.cpp.

References cmn_File(), log_FUNC_m, and SetFullPath().

    : m_fileHandle(-1),
      m_opened(false),
      m_createdPipe(false),
      m_lastError(0),
      m_dataStream(false),
      m_streamLeft(0),
      m_fileSize(a_fileSize) { 
      // m_fileSize is not used in linux environment yet.
      // implementation needs to be done once we have the evidence
      // that enlarging the file does also help here.

    log_FUNC_m(cmn_File(cmn_Path));

    SetFullPath(a_fullPathUTF8);
}

Here is the call graph for this function:

cmn_File::~cmn_File (  )  [virtual]

Definition at line 90 of file cmn_File_LNX.cpp.

References CloseF(), dbg_NORM, errno, log_DBG_m, log_FUNC_m, m_createdPipe, m_fullPath, m_lastError, m_localeFullPath, and m_opened.

                     {
    log_FUNC_m(~cmn_File);

    // if file was not closed yet -> close it
    try {
        if (m_opened) {
            CloseF();
        }
    }
    catch (...) {
        // Ignore all exceptions in destructors
    }

    // if FIFO was created, we will remove it to not load /var/opt/ivd/tmp
    if (m_createdPipe) {
        if (unlink(m_localeFullPath.c_str()) == -1) {
            m_lastError = errno;
            log_DBG_m(dbg_NORM,
                "Can't unlink() fifo=" << m_fullPath
                << ": errno=" << m_lastError
                << " IGNORED IN DTOR!" );
        }
        m_createdPipe = false;
    }
}

Here is the call graph for this function:


Member Function Documentation

bool cmn_File::CleanupWriteStream (  ) 

Releases memory and sets m_context to NULL after each restore operation.

Must be when performing sequential restores from the same stream.

Definition at line 472 of file cmn_File_LNX.cpp.

References log_FUNC_m.

Referenced by UnpackFile().

                                 {
    log_FUNC_m(CleanupWriteStream);

    // This function is dummy on Linux. It completes the stream
    // on Windows.
    return(true);
}

Here is the caller graph for this function:

void cmn_File::CloseF (  ) 

Close the file.

Definition at line 349 of file cmn_File_LNX.cpp.

References errno, log_FUNC_A_m, m_fileHandle, m_fullPath, m_lastError, and m_opened.

Referenced by _tmain(), hsm_HL7CacheFile::AddMessageToCache(), fsc_DataCollectorStorage::CheckHeader(), ivd_FS_File::Close(), i_DownloadAgent_i::Close(), i_UploadAgent_i::Close(), ui_MsgWriter::CloseFile(), hsm_HL7CacheFile::CreateFile(), fsc_DataCollectorStorage::CreateFile(), bea_DiskVolume::CreateNewFile(), DeleteF(), DumpBSEnd(), DumpFile(), bea_DiskVolume::Erase(), fsc_MedVolWriter::Flush(), fsc_DataCollectorStorage::Flush(), cfg_CollocationInfo::GenerateCollocationInfoFile(), cfg_HL7Info::GenerateHL7InfoFile(), fsc_MedVolReader::GetNextBuff(), fsc_DataCollectorStorage::GetNextRecord(), hsm_HL7CacheFile::hsm_HL7CacheFile(), ipc_ReadFromFile(), Collocation::IsReplicated(), ivd_AccessFsAttr(), main(), PackFile(), ParseDiskMedium(), ParseDiskMediumVolume(), ParseFile(), RecOpen::ProcessEntry(), RecAccess::ProcessEntry(), fsc_DataCollectorStorage::ReadContent(), pf_File::ReadFile(), bea_DupReadThread::ReadMedVolume(), hsm_HL7CacheFile::ReadNextFile(), ReadOneBackupFromMedium(), bea_DiskVolume::ReadRaw(), bea_DiskVolume::ReadVolInfo(), RenameToBadFile(), bea_DiskVolume::SeekBlock(), bea_DiskVolume::SeekEOD(), bea_DiskVolume::SeekFileMark(), SetFileHandle(), UnpackFile(), cfg_CollocationInfo::WriteCollocationInfo(), pf_File::WriteFile(), cfg_HL7Info::WriteGroupToFile(), cfg_CollocationInfo::WriteGroupToFile(), cfg_HL7Info::WriteHL7Info(), bea_DupWriteThread::WriteMedVolume(), WriteToMedium(), bea_DiskVolume::WriteVolInfo(), ~cmn_File(), fsc_MedVolReader::~fsc_MedVolReader(), and fsc_RawMediumContentCollector::~fsc_RawMediumContentCollector().

                      {
    log_FUNC_A_m(CloseF, "path=" << m_fullPath);

    if (m_opened) {
        m_opened = false;
        if (close(m_fileHandle) == -1) {
            m_lastError = errno;
            ostringstream sstr;
            sstr << "close(" << m_fullPath << ")";
            throw ivd_SysError(m_lastError, sstr.str(), true);
        }
    }
}

void cmn_File::CreatePipe (  ) 

Creates named pipe/fifo.

Caller needs to call OpenF() to wait the other side to connect to/open pipe.

Definition at line 249 of file cmn_File_LNX.cpp.

References dbg_NORM, cmn_Global::dirs, errno, g_cmn, log_DBG_m, log_FUNC_A_m, m_createdPipe, m_fullPath, m_lastError, m_localeFullPath, SetFullPath(), and ivd_Directories::tmp.

Referenced by DuplicateFrom(), i_DownloadAgent_i::i_DownloadAgent_i(), and i_UploadAgent_i::i_UploadAgent_i().

                          {
    log_FUNC_A_m(CreatePipe, "name=" << m_fullPath);

    // FIFO is always created on /var/opt/ivd/tmp (relative path)
    m_fullPath = g_cmn.dirs.tmp + m_fullPath;
    SetFullPath(m_fullPath);

    log_DBG_m(dbg_NORM, "mkfifo(): path=" << m_fullPath);
    if (mkfifo(m_localeFullPath.c_str(), S_IRUSR | S_IWUSR) == -1) { // 0600
        m_lastError = errno;
        ostringstream sstr;
        sstr << "mkfifo(" << m_fullPath << ")";
        throw ivd_SysError(m_lastError, sstr.str(), true);
    }

    m_createdPipe = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::DataSyncF (  ) 

In Posix commit only data changes to disk.

Attributes stay as is. In Windows work the same as SyncF method.

See also:
SyncF

Definition at line 643 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

                         {
    log_FUNC_m(DataSyncF);

    if (fdatasync(m_fileHandle) == -1) {
        m_lastError = errno;

        ostringstream sstr;
        sstr << "fdatasync(" << m_fullPath << ")";

        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
}

void cmn_File::DeleteDir ( const cmn_Path a_dirUTF8,
int *  a_errno = NULL 
) [static]

Definition at line 773 of file cmn_File_LNX.cpp.

References cmn_UTF8ToLocale(), dbg_DETAIL, dbg_NORM, errno, log_DBG_m, log_FUNC_m, and NULL.

Referenced by cmn_CleanDir(), i_HSM_i::DoDeletion(), i_Service_i::Execute(), bea_DiskMedium::Format(), i_HSM_i::IVDFSPrepareRecovery(), RecRemove::ProcessEntry(), mif_CfgRep::RemoveCfg(), i_ManagementInterface_i::RemovePartition(), and fsc_MedVolReader::~fsc_MedVolReader().

                                                                {
    log_FUNC_m(DeleteDir);

    if (a_dirUTF8.empty()) {
        return;
    }

    string csDir(cmn_UTF8ToLocale(a_dirUTF8));

    log_DBG_m(dbg_DETAIL,
        "delete dir \'" << a_dirUTF8 << "\'.");

    if (rmdir(csDir.c_str()) == -1) {
        if (a_errno != NULL) {
            *a_errno = errno;
        }
        log_DBG_m(dbg_NORM,
            "Can't delete directory \'" << a_dirUTF8 << "\'." <<
            ": errno=" << errno );

        ostringstream sstr;
        sstr << "rmdir(" << csDir << ")";

        throw ivd_SysError(errno, sstr.str(), true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::DeleteF (  ) 
void cmn_File::DeleteFile ( const cmn_Path a_fileUTF8,
int *  a_errno = NULL 
) [static]

Definition at line 744 of file cmn_File_LNX.cpp.

References cmn_UTF8ToLocale(), dbg_DETAIL, dbg_NORM, errno, log_DBG_m, log_FUNC_m, and NULL.

Referenced by _tmain(), cmn_CleanDir(), cmn_MoveFile(), DeleteF(), fsc_FLSPerVolume::fsc_FLSPerVolume(), fsc_RawMedVolPathCollector::fsc_RawMedVolPathCollector(), bea_Volume::Init(), bea_FRI::MoveFromWorkToFRI(), nsc_ScanForIVDFSRecovery(), RecRemove::ProcessEntry(), ReadRefFromFile(), fio_JourMgr::RemoveArhivedJourFile(), RemoveJournalFiles(), RevertUpdate(), bea_FRI::SaveFRIOnError(), SimulateMediumError(), SimulateUVStructureError(), cmn_TreeWalk::Start(), and Update().

                                                                  {
    log_FUNC_m(DeleteFile);

    if (a_fileUTF8.empty()) {
        return;
    }

    string csName(cmn_UTF8ToLocale(a_fileUTF8));

    log_DBG_m(dbg_DETAIL,
        "delete file \'" << a_fileUTF8 << "\'.");
    if (unlink(csName.c_str()) == -1) {
        if (a_errno != NULL) {
            *a_errno = errno;
        }
        log_DBG_m(dbg_NORM,
            "Can't delete file \'" << a_fileUTF8 << "\'." <<
            ": errno=" << errno );

        ostringstream sstr;
        sstr << "unlink(" << csName << ")";

        throw ivd_SysError(errno, sstr.str());
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::DuplicateFrom ( const cmn_File a_file  )  [private]

Definition at line 137 of file cmn_File_LNX.cpp.

References CreatePipe(), GetCurrentPosF(), m_createdPipe, m_dataStream, m_fileHandle, m_fullPath, m_lastError, m_localeFullPath, m_opened, m_openMode, m_streamLeft, OpenF(), and SeekF().

Referenced by cmn_File(), and operator=().

                                                   {
    m_fullPath = a_file.m_fullPath;
    m_localeFullPath = a_file.m_localeFullPath;
    m_fileHandle = -1;

    m_opened = false;
    m_createdPipe = false;
    m_openMode = 0;

    m_lastError = a_file.m_lastError;

    m_dataStream = a_file.m_dataStream;
    m_streamLeft = a_file.m_streamLeft;

    if (a_file.m_opened) {
        OpenF(a_file.m_openMode);
        SeekF(a_file.GetCurrentPosF());
    }
    if (a_file.m_createdPipe) {
        CreatePipe();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool cmn_File::Exists (  ) 

Definition at line 318 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fullPath, m_localeFullPath, and m_opened.

Referenced by CheckForOpenedFile(), i_MaintFriJob_i::CheckReadFri(), cmn_CleanDir(), i_VvCopyJob_i::Execute(), api_Partition::GetFileLocations(), api_Partition::GetFileStatus(), hsm_HL7CacheFile::hsm_HL7CacheFile(), hsm_HL7MessageProxy::hsm_HL7MessageProxy(), ClientConf_t::Init(), main(), i_HSM_i::MigrateByAPI(), i_MaintFriJob_i::PrepareVolumes(), hsm_IVDFSRecoverer::ProcRecFileHdr(), cfg_CollocationInfo::WriteCollocationInfo(), cmn_FileTest::WriteContents(), cfg_HL7Info::WriteHL7Info(), and fsc_MedVolReader::~fsc_MedVolReader().

                      {
    log_FUNC_m(Exists);

    if (m_opened) {
        return true;
    }

    // File is not open. Try to open and close it.

    ivd_FileHandle_t h = open(m_localeFullPath.c_str(), O_RDONLY, S_IRUSR | S_IWUSR); // 0600
    if (h != -1) {
        close(h);
        return true;
    }
    int err(errno);
    if (err == ENOENT || err == ENXIO) {
        return false;
    }
    else {
        ostringstream sstr;
        sstr
            << "open(" << m_fullPath
            << ", mode=0x"  << hex << O_RDONLY << ") to check existence.";
        throw ivd_SysError(err, sstr.str());
    }
    return false;
}

Here is the caller graph for this function:

static ivd_FileType_e cmn_File::FileTypeFromMode ( const UInt32_t  a_mode  )  [inline, static]

Get file type from attributes/mode.

Definition at line 263 of file cmn_File.h.

References S_ISBLK, S_ISCHR, S_ISDIR, and S_ISREG.

Referenced by ivd_FS_File::GetProperties(), and StatF().

                                                                  {
                    if (S_ISREG(a_mode))
                        return ift_FILE;
                    else if (S_ISDIR(a_mode))
                        return ift_DIR;
                    else if (S_ISCHR(a_mode))
                        return ift_CHR_DEV;
                    else if (S_ISBLK(a_mode))
                        return ift_BLK_DEV;
                    else if (S_ISFIFO(a_mode))
                        return ift_FIFO;
                    else if (S_ISLNK(a_mode))
                        return ift_SYMLINK;
                    else if (S_ISSOCK(a_mode))
                        return ift_SOCKET;

                    return ift_UNKNOWN;
                }

Here is the caller graph for this function:

ivd_FilePosition_t cmn_File::GetCurrentPosF (  )  const

Return current position in file.

Definition at line 596 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by i_UploadAgent_i::Close(), DuplicateFrom(), bea_DiskVolume::Erase(), bea_DiskVolume::GetPosition(), bea_DiskVolume::ReadRaw(), blk_DiskFRIWriter::Write(), blk_DiskBufferWriter::Write(), and bea_DiskVolume::WriteRaw().

                                                  {

    ivd_FilePosition_t pos = lseek(m_fileHandle, 0, SEEK_CUR);
    if (pos == -1) {
        log_FUNC_m(SeekCurrentF);
        m_lastError = errno;
        ostringstream sstr;
        sstr << "lseek(" << m_fullPath << ", 0, SEEK_CUR)";
        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
    return pos;
}

Here is the caller graph for this function:

void cmn_File::GetFileHandle ( ivd_FileHandle_t a_fileHandle,
UInt32_t a_openMode 
)

Definition at line 1314 of file cmn_File_WIN32.cpp.

References ie_INVALID_ARG, ivd_Error, log_FUNC_m, m_fileHandle, m_opened, and m_openMode.

{
    log_FUNC_m(GetFileHandle);

    if ((NULL == m_fileHandle) || (INVALID_HANDLE_VALUE == m_fileHandle) || (false == m_opened))
    {
        ostringstream sstr;
        sstr << "File not open or invalid file handle=" << hex << a_fileHandle;
        throw ivd_Error(ie_INVALID_ARG, sstr.str(), true);
    };

    a_fileHandle = m_fileHandle;
    a_openMode = m_openMode;
}

string cmn_File::GetFileSystemID (  ) 

Get file system ID (where file is located).

This ID is used by IVD for identification of IVD FS. Note: Can be called, even if file is not opened.

Definition at line 221 of file cmn_File_LNX.cpp.

References cmn_Num2Str(), errno, log_FUNC_m, lstat, m_fileHandle, m_fullPath, m_lastError, m_localeFullPath, m_opened, major, minor, and stat().

Referenced by _tmain(), cmn_IsMounted(), FileName2IPCFileList(), FileName2IPCStringList(), InputFile2IPCFileList(), and bea_DiskMedium::Refresh().

                                 {
    log_FUNC_m(GetFileSystemID);

    struct stat statdata;

    int ret(0);
    if (m_opened) {
        // use fstat() on open file descriptor
        ret = fstat(m_fileHandle, &statdata);
    }
    else {
        // use lstat() in order to work with symlinks
        ret = lstat(m_localeFullPath.c_str(), &statdata);
    }

    if (ret == -1) {
        m_lastError = errno;
        ostringstream sstr;
        sstr << (m_opened ? "fstat(" : "lstat('") << m_fullPath << "')";
        throw ivd_SysError(m_lastError, sstr.str() );
    }

    return cmn_Num2Str(major(statdata.st_dev)) + ":" +
           cmn_Num2Str(minor(statdata.st_dev));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::GetFileSystemSize ( ivd_FileSystemSize_t a_fsSize  ) 

Get file system sizes (FS where file is located) .

Note: Can be called, even if file is not opened.

Definition at line 182 of file cmn_File_LNX.cpp.

References ivd_FileSystemSize_t::bytesAvail, ivd_FileSystemSize_t::bytesFree, ivd_FileSystemSize_t::bytesTotal, dbg_DETAIL, errno, ivd_FileSystemSize_t::inodeFree, ivd_FileSystemSize_t::inodeTotal, log_DBG_m, log_FUNC_m, m_fileHandle, m_fullPath, m_lastError, m_localeFullPath, and m_opened.

Referenced by bea_DiskVolume::ReadEstimSizes(), bea_DiskMedium::Refresh(), rm_DiskBuffer::rm_DiskBuffer(), hsm_FHrelc::SetAvailBytes(), hsm_FHrelc::SpaceCheck(), and hsm_FHrelc::TruncationCheck().

                                                             {
    log_FUNC_m(GetFileSystemSize);

    struct statfs statfsdata;

    int ret(0);
    if (m_opened) {
        // use fstatfs() on open file descriptor
        ret = fstatfs(m_fileHandle, &statfsdata);
    }
    else {
        ret = statfs(m_localeFullPath.c_str(), &statfsdata);
        int timeout = 30;
        while((ret == -1) && (timeout != 0)) {
            log_DBG_m(dbg_DETAIL, "Mount retry!");
            sleep(1);
            timeout--;
            ret = statfs(m_localeFullPath.c_str(), &statfsdata);
        }

    }

    if (ret == -1) {
        m_lastError = errno;
        ostringstream sstr;
        sstr << (m_opened ? "fstatfs(" : "statfs(") << m_fullPath << ")";
        throw ivd_SysError(m_lastError, sstr.str());
    }

    a_info.bytesTotal       = UInt64_t(statfsdata.f_bsize) * UInt64_t(statfsdata.f_blocks);
    a_info.bytesFree        = UInt64_t(statfsdata.f_bsize) * UInt64_t(statfsdata.f_bfree);
    a_info.bytesAvail       = UInt64_t(statfsdata.f_bsize) * UInt64_t(statfsdata.f_bavail);

    a_info.inodeTotal       = statfsdata.f_files;
    a_info.inodeFree        = statfsdata.f_ffree;
}

Here is the caller graph for this function:

ivd_FileType_e cmn_File::GetFileType ( void   )  [inline]

Get IVD internal file type.

Definition at line 154 of file cmn_File.h.

Referenced by _tmain(), api_Partition::GetFileLocations(), api_Partition::GetFileStatus(), and hsm_Recall::ProcRecBSStart().

                                 {
        ivd_FileInfo_t fileInfo;
        StatF(fileInfo);
        return fileInfo.type;
    };

Here is the caller graph for this function:

cmn_Path& cmn_File::GetFullPathRef (  )  [inline]
ivd_FileSize_t cmn_File::GetSize (  ) 

Provides the size of the file on the volume.

Returns:
size of a file

Definition at line 864 of file cmn_File_LNX.cpp.

References StatF().

Referenced by hsm_HL7CacheFile::CountNumberOfMsgs(), and hsm_HL7CacheFile::ReadNextFile().

                                 {
    ivd_FileInfo_t fi;
    StatF(fi);

    return fi.size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt32_t cmn_File::GetStreamHeader ( string &  a_streamName,
ivd_FilePosition_t a_streamSize 
)

Get stream header of next stream.

Returns stream type (return value), name and size of stream. Returns stt_NONE if there is no stream; Note: Should be called only on begining of the stream

Definition at line 365 of file cmn_File_LNX.cpp.

References errno, fom_STREAM, fom_STREAM_NO_DATA, ie_IMPOSSIBLE, ie_PRECONDITION, ivd_Error, log_ERR_m, log_FUNC_m, m_dataStream, m_fileHandle, m_fullPath, m_lastError, m_opened, m_openMode, m_streamLeft, and stat().

Referenced by ivd_FS_File::GetStreamHeader(), and PackFile().

                                                                     {
    log_FUNC_m(GetStreamHeader);

    if (!m_opened || !(m_openMode & fom_STREAM)) {
        throw ivd_Error(ie_PRECONDITION, "File not opened for stream IO", true);
    }

    if (m_streamLeft > 0) {
        ostringstream sstr;
        sstr << "GetStreamHeader called but still left: " << m_streamLeft;
        throw ivd_Error(ie_IMPOSSIBLE, sstr.str(), true);
    }

    // if data stream not yet sent and not opened with NO DATA
    if (   !m_dataStream
        && !(m_openMode & fom_STREAM_NO_DATA)) {

        struct stat statdata;
        if (fstat(m_fileHandle, &statdata) == -1) {
            m_lastError = errno;
            log_ERR_m(
                "Cannot get data stream size file=" << m_fullPath
                << ": errno=" << m_lastError );

            ostringstream sstr;
            sstr << "fstat(" << m_fullPath << ")";
            throw ivd_SysError(m_lastError, sstr.str(), true);
        }

        a_streamSize = m_streamLeft = statdata.st_size;
        a_streamName = "";

        m_dataStream = true;

        return stt_DATA;
    }

    return stt_NONE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FilePosition_t cmn_File::GetStreamLeft (  )  [inline]

Definition at line 304 of file cmn_File.h.

{ return m_streamLeft; };

bool cmn_File::IsOpen (  )  const [inline]
void cmn_File::OpenF ( const UInt32_t  a_mode = fom_DEFAULT_MODE_d  ) 

Opens file with specific flags and permissions.

fom_LINK is used to open link file instead of it's target

Definition at line 270 of file cmn_File_LNX.cpp.

References errno, fom_APPEND, fom_CREATE_ALWAYS, fom_CREATE_NEW, fom_OPEN_ALWAYS, fom_READ, fom_READWRITE, fom_WRITE, log_ERR_m, log_FUNC_A_m, m_fileHandle, m_fullPath, m_lastError, m_localeFullPath, m_opened, m_openMode, and SeekEndF().

Referenced by hsm_HL7CacheFile::AddMessageToCache(), blk_DiskBufferReader::blk_DiskBufferReader(), blk_DiskBufferWriter::blk_DiskBufferWriter(), blk_DiskFRIReader::blk_DiskFRIReader(), fsc_DataCollectorStorage::CheckHeader(), ClearPDBI(), cmn_CopyFile(), fsc_DataCollectorStorage::CreateFile(), bea_DiskVolume::CreateNewFile(), df_FileBlockReader::df_FileBlockReader(), DumpBSStart(), DumpFile(), DuplicateFrom(), bea_DiskVolume::Erase(), fio_File::fio_File(), fsc_MedVolWriter::Flush(), fsc_DataCollectorStorage::Flush(), fsc_RawMediumContentCollector::fsc_RawMediumContentCollector(), cfg_CollocationInfo::GenerateCollocationInfoFile(), cfg_HL7Info::GenerateHL7InfoFile(), fsc_MedVolReader::GetFSCdata(), fsc_DataCollectorStorage::GetNextRecord(), GetPDBI(), hsm_HL7CacheFile::hsm_HL7CacheFile(), i_BackupAgent_i::i_BackupAgent_i(), i_DownloadAgent_i::i_DownloadAgent_i(), i_RestoreAgent_i::i_RestoreAgent_i(), i_UploadAgent_i::i_UploadAgent_i(), ipc_ReadFromFile(), Collocation::IsReplicated(), ivd_AccessFsAttr(), main(), ivd_FS_File::Open(), cmn_FileTest::OpenContents(), ui_MsgWriter::OpenFile(), blk_DiskFRIWriter::OpenFRIFile(), PackFile(), ParseDiskMedium(), ParseDiskMediumVolume(), ParseFile(), RecOpen::ProcessEntry(), fsc_DataCollectorStorage::ReadContent(), cmn_FileTest::ReadContents(), pf_File::ReadFile(), bea_DupReadThread::ReadMedVolume(), hsm_HL7CacheFile::ReadNextFile(), ReadOneBackupFromMedium(), bea_DiskVolume::ReadRaw(), bea_DiskVolume::ReadVolInfo(), hsm_FHADPRecall::RecallFileFromADP(), bea_DiskVolume::SeekBlock(), bea_DiskVolume::SeekEOD(), bea_DiskVolume::SeekFileMark(), UnpackFile(), cmn_FileTest::WriteContents(), pf_File::WriteFile(), cfg_HL7Info::WriteGroupToFile(), cfg_CollocationInfo::WriteGroupToFile(), bea_DupWriteThread::WriteMedVolume(), bea_DiskVolume::WriteRaw(), WriteToMedium(), and bea_DiskVolume::WriteVolInfo().

                                          {
    log_FUNC_A_m(OpenF,
        "path=" << m_fullPath <<
        ", mode=0x" << hex << a_mode);

    if (m_opened) {
        log_ERR_m("Open called twice for " << m_fullPath);
        return;
    }

    int flags(0);

    if ((a_mode & fom_READWRITE) == fom_READWRITE) {
        flags |= O_RDWR;
    }
    else {
        if (a_mode & fom_READ)  flags |= O_RDONLY;
        if (a_mode & fom_WRITE) flags |= O_WRONLY;
        if (a_mode & fom_APPEND) flags |= O_WRONLY;
    }

    if (a_mode & fom_CREATE_ALWAYS)     flags |= O_CREAT | O_TRUNC;
    else if (a_mode & fom_CREATE_NEW)   flags |= O_CREAT | O_EXCL;
    else if (a_mode & fom_OPEN_ALWAYS)  flags |= O_CREAT;

    m_fileHandle = open(m_localeFullPath.c_str(), flags, S_IRUSR | S_IWUSR); // 0600

    if (m_fileHandle == -1) {
        m_lastError = errno;
        ostringstream sstr;
        sstr
            << "open(" << m_fullPath
            << ", mode=0x"  << hex << a_mode
            << ", flags=0x" << hex << flags << ")";
        throw ivd_SysError(m_lastError, sstr.str());
    }

    if (a_mode & fom_APPEND) {
        SeekEndF();
    }

    m_opened = true;
    m_openMode = a_mode;
}

Here is the call graph for this function:

cmn_File & cmn_File::operator= ( const cmn_File a_file  ) 

Definition at line 128 of file cmn_File_LNX.cpp.

References DuplicateFrom().

                                                     {
    DuplicateFrom(a_file);
    return *this;
}

Here is the call graph for this function:

ivd_FileRetSize_t cmn_File::ReadF ( void *  a_buf,
ivd_FileBufSize_t  a_size 
)
cmn_Path cmn_File::ReadLink ( const cmn_Path a_linkNameUTF8  )  [static]

Reads where the symbolic link (shell link on Windows platform) points to.

Definition at line 715 of file cmn_File_LNX.cpp.

References cmn_LocaleToUTF8(), cmn_UTF8ToLocale(), dbg_NORM, errno, log_DBG_m, log_FUNC_m, and size.

Referenced by mif_CfgRep::SetLastRevNum().

                                                      {
    log_FUNC_m(ReadLink);

    string csLink(cmn_UTF8ToLocale(a_linkUTF8));
    char buffer[ivd_MAX_PATHNAME];
    Int32_t size = readlink(csLink.c_str(), buffer, ivd_MAX_PATHNAME);

    if (size == -1) {
        log_DBG_m(dbg_NORM,
            "Can't read symlink: " << a_linkUTF8 <<
            ": errno=" << errno );

        ostringstream sstr;
        sstr << "readlink(" << csLink << ")";

        throw ivd_SysError(errno, sstr.str());
    };
    buffer[size] = '\0';

    // Convert read symlink to UTF-8
    string ut8String = cmn_LocaleToUTF8(string(buffer));

    return cmn_Path(ut8String);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FileRetSize_t cmn_File::ReadStream ( void *  a_buf,
ivd_FileBufSize_t  a_size 
)

Reads a_size number of bytes to buffer a_buf from current stream and return the number of bytes read.

Definition at line 408 of file cmn_File_LNX.cpp.

References m_streamLeft, and ReadF().

Referenced by PackFile(), and ivd_FS_File::ReadStream().

                                                                            {

    if (m_streamLeft == 0) {
        return 0;
    }

    // only data stream for now -> just read
    ivd_FileRetSize_t readBytes = ReadF(a_buf, a_size);
    m_streamLeft -= readBytes;
    return readBytes;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FilePosition_t cmn_File::SeekEndF (  ) 

Set the file position to the end of file for next read or write operation.

Returns actual position after seek.

Definition at line 582 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by hsm_HL7CacheFile::AddMessageToCache(), blk_DiskBufferWriter::blk_DiskBufferWriter(), bea_DiskVolume::Erase(), fio_StartTransaction_t::FindStart(), fio_JourFile::fio_JourFile(), fio_PermDBinfoMgr::fio_PermDBinfoMgr(), fio_RelFile::fio_RelFile(), fio_RelFile::FirstNewIDX(), fsc_MedVolWriter::Flush(), fsc_DataCollectorStorage::Flush(), OpenF(), ui_MsgWriter::OpenFile(), blk_DiskFRIWriter::OpenFRIFile(), bea_DiskVolume::SeekEOD(), and bea_DiskVolume::SeekFileMark().

                                      {
    ivd_FilePosition_t pos = lseek(m_fileHandle, 0, SEEK_END);
    if (pos == -1) {
        log_FUNC_m(SeekEndF);
        m_lastError = errno;
        ostringstream sstr;
        sstr << "lseek(" << m_fullPath << ", 0, SEEK_END)";
        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
    return pos;
}

Here is the caller graph for this function:

ivd_FilePosition_t cmn_File::SeekF ( ivd_FilePosition_t  a_offset  )  const

Set the file position for next read or write operation.

Returns actual position after seek.

Definition at line 567 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by blk_DiskBufferWriter::blk_DiskBufferWriter(), ClearPDBI(), hsm_HL7CacheFile::CountNumberOfMsgs(), fio_RelFile::CreateFile(), DuplicateFrom(), cmn_FastFileSearch::Find(), fio_RelFileHeader_t::fio_RelFileHeader_t(), fsc_DataCollectorStorage::GetNextRecord(), GetPDBI(), ivd_AccessFsAttr(), main(), fio_File::PosRead(), fio_File::PosWrite(), fsc_DataCollectorStorage::ReadContent(), fio_PermDBinfoMgr::ReadInfo(), bea_DiskVolume::SeekBlock(), ivd_FS_File::SeekF(), and fio_PermDBinfoMgr::WriteInfo().

                                                                    {

    ivd_FilePosition_t pos = lseek(m_fileHandle, a_offset , SEEK_SET);
    if (pos == -1) {
        log_FUNC_m(SeekF);
        m_lastError = errno;
        ostringstream sstr;
        sstr << "lseek(" << m_fullPath << ", " << a_offset << ", SEEK_SET)";
        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
    return pos;
}

Here is the caller graph for this function:

ivd_FilePosition_t cmn_File::SeekRelF ( ivd_FilePosition_t  a_offset  )  const

Set the file position for next read or write operation using offset from current position.

Returns actual position after seek.

Definition at line 611 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by fio_JourHandle::JourSkip(), blk_DiskBufferWriter::Seek(), and i_UploadAgent_i::Write().

                                                                       {

    ivd_FilePosition_t pos = lseek(m_fileHandle, a_offset , SEEK_CUR);
    if (pos == -1) {
        log_FUNC_m(SeekRelF);
        m_lastError = errno;

        ostringstream sstr;
        sstr << "lseek(" << m_fullPath << ", " << a_offset << ", SEEK_CUR)";

        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
    return pos;
}

Here is the caller graph for this function:

void cmn_File::SetFileHandle ( const ivd_FileHandle_t  a_FileHandle,
const UInt32_t  a_mode 
)

Definition at line 1292 of file cmn_File_WIN32.cpp.

References CloseF(), ie_INVALID_ARG, ivd_Error, log_FUNC_m, m_fileHandle, m_opened, and m_openMode.

{
    log_FUNC_m(SetFileHandle);

    if (m_opened) {
        CloseF();
    };

    if ((NULL == a_FileHandle) || (INVALID_HANDLE_VALUE == a_FileHandle))
    {
        ostringstream sstr;
        sstr << "Invalid file handle=" << hex << a_FileHandle;
        throw ivd_Error(ie_INVALID_ARG, sstr.str(), true);
    };

    m_fileHandle = a_FileHandle;
    m_opened = true;
    m_openMode = a_mode;
}

Here is the call graph for this function:

void cmn_File::SetFullPath ( const cmn_Path a_fullPathUTF8  ) 
void cmn_File::SetStreamHeader ( UInt32_t  a_streamType,
const string &  a_streamName,
ivd_FilePosition_t  a_streamSize 
)

Set stream header of next stream.

Note: Should be called only on begining of the stream

Definition at line 422 of file cmn_File_LNX.cpp.

References fom_STREAM, ie_IMPOSSIBLE, ie_PRECONDITION, ivd_Error, log_FUNC_m, m_dataStream, m_opened, m_openMode, m_streamLeft, and stt_DATA.

Referenced by ivd_FS_File::SetStreamHeader(), and UnpackFile().

                                                                {
    log_FUNC_m(SetStreamHeader);

    if (!m_opened || !(m_openMode & fom_STREAM)) {
        throw ivd_Error(ie_PRECONDITION, "File not opened for stream IO", true);
    }

    if (m_streamLeft > 0) {
        ostringstream sstr;
        sstr << "SetStreamHeader called but still left: " << m_streamLeft;
        throw ivd_Error(ie_IMPOSSIBLE, sstr.str(), true);
    }

    switch (a_streamType) {
        case stt_DATA:
            m_dataStream = true;
            m_streamLeft = a_streamSize;
            break;

        default:
            ostringstream sstr;
            sstr << "SetStreamHeader called with unsupported type: " << a_streamType;
            throw ivd_InternalError(ie_IMPOSSIBLE, sstr.str());
    }
}

Here is the caller graph for this function:

void cmn_File::SparseF ( ivd_FilePosition_t  a_size  ) 

Create sparse file of specified size.

Note: this function removes existing contents of the file!

Definition at line 673 of file cmn_File_LNX.cpp.

References log_FUNC_A_m, m_fullPath, and TruncF().

Referenced by main(), and ivd_FS_File::Release().

                                                {
    log_FUNC_A_m(SparseF, "path=" << m_fullPath << ", size=" << a_size);

    // first remove existing contents
    TruncF(0);

    // now extend the file to new size
    TruncF(a_size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::StatF ( ivd_FileInfo_t &  a_info  ) 

Get file information (stat()-like).

Can be also used on non-file objects (directories, special files). Note: Can be called, even if file is not opened.

Definition at line 482 of file cmn_File_LNX.cpp.

References errno, FileTypeFromMode(), log_FUNC_m, lstat, m_fileHandle, m_fullPath, m_lastError, m_localeFullPath, m_opened, and stat().

Referenced by Backup(), blk_DiskFRIReader::blk_DiskFRIReader(), TreeWalkBackup::CheckDir(), FileName2IPCFileList(), FileName2IPCStringList(), mif_CfgRep::GetCfg(), fsc_MedVolReader::GetFSCdata(), cmn_FastDirLst::GetNextName(), GetSize(), ClientConf_t::Init(), InputFile2IPCFileList(), ipc_ReadFromFile(), Collocation::IsReplicated(), ivd_AccessFsAttr(), ivd_FS_File::ivd_FS_File(), ivd_GetMountPoint(), main(), hsm_FileHeader::MakeStat(), bea_Volume::MustDumpFRI(), PackFile(), ParseMedium(), fsc_DataCollectorStorage::ReadContent(), pf_File::ReadFile(), hsm_FHADPRecall::RecallFileFromADP(), bea_DiskMedium::Refresh(), bea_DiskVolume::ReparseFiles(), and Restore().

                                           {
    log_FUNC_m(StatF);

    struct stat statdata;

    int ret(0);
    if (m_opened) {
        // use fstat() on open file descriptor
        ret = fstat(m_fileHandle, &statdata);
    }
    else {
        // use lstat() in order to work with symlinks
        ret = lstat(m_localeFullPath.c_str(), &statdata);
    }

    if (ret == -1) {
        m_lastError = errno;
        ostringstream sstr;
        sstr
            << (m_opened ? "fstat(" : "lstat(")
            << m_fullPath << ")";

        throw ivd_SysError(m_lastError, sstr.str());
    }


    a_info.idOnFS       = statdata.st_ino;
    a_info.fsID         = statdata.st_dev;
    a_info.type         = FileTypeFromMode(statdata.st_mode);
    a_info.size         = statdata.st_size;
    // Block size of Unix file systems is 512 bytes. See "man 2 stat"
    a_info.allocated    = statdata.st_blocks * 512;

    a_info.attr         = statdata.st_rdev;
    a_info.attr         = (a_info.attr << 32) + statdata.st_mode;

    a_info.owner        = statdata.st_uid;
    a_info.group        = statdata.st_gid;
    a_info.numLinks     = statdata.st_nlink;
    a_info.timeCreate   = 0;
    a_info.timeAccess   = statdata.st_atime;
    a_info.timeModify   = statdata.st_mtime;
    a_info.timeChange   = statdata.st_ctime;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_File::SymLink ( const cmn_Path a_linkNameUTF8  ) 

Create symbolic link (shell link on Windows platform) to file.

Definition at line 697 of file cmn_File_LNX.cpp.

References cmn_UTF8ToLocale(), errno, log_FUNC_m, m_fullPath, m_lastError, and m_localeFullPath.

                                                    {
    log_FUNC_m(SymLink);

    string csLink(cmn_UTF8ToLocale(a_linkNameUTF8));
    if (symlink(m_localeFullPath.c_str(), csLink.c_str()) == -1) {
        m_lastError = errno;

        ostringstream sstr;
        sstr << "symlink(" << m_fullPath << "," << a_linkNameUTF8 << ")";

        throw ivd_SysError(m_lastError, sstr.str());
    }
}

Here is the call graph for this function:

void cmn_File::SyncF (  ) 

Commit all changes to disk.

Data and meta data (attributes).

See also:
DataSyncF

Definition at line 628 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by bea_DiskVolume::Flush(), fio_JourHandle::JourSync(), bea_DupReadThread::ReadMedVolume(), and blk_DiskFRIWriter::~blk_DiskFRIWriter().

                     {
    log_FUNC_m(SyncF);

    if (fsync(m_fileHandle) == -1) {
        m_lastError = errno;

        ostringstream sstr;
        sstr << "fsync(" << m_fullPath << ")";

        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
}

Here is the caller graph for this function:

void cmn_File::TruncF ( ivd_FilePosition_t  a_size = 0  ) 

Truncation of file.

Definition at line 658 of file cmn_File_LNX.cpp.

References errno, log_FUNC_A_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by blk_DiskBufferWriter::blk_DiskBufferWriter(), i_UploadAgent_i::Close(), bea_DiskVolume::Erase(), bea_DiskVolume::ExtendToFullBlock(), SparseF(), ui_MsgWriter::TruncFile(), blk_DiskFRIWriter::Write(), blk_DiskBufferWriter::Write(), and bea_DiskVolume::WriteRaw().

                                               {
    log_FUNC_A_m(TruncF, "path=" << m_fullPath << ", size=" << a_size);

    if (ftruncate(m_fileHandle, a_size) == -1) {
        m_lastError = errno;

        ostringstream sstr;
        sstr << "ftruncate(" << m_fullPath << ")";

        throw ivd_SysError(m_lastError, sstr.str(), true);
    }
}

Here is the caller graph for this function:

ivd_FileRetSize_t cmn_File::WriteF ( const void *  a_buf,
ivd_FileBufSize_t  a_size 
) const

Writes a_size number of bytes from buffer a_buf to file and return the number of bytes written.

Definition at line 529 of file cmn_File_LNX.cpp.

References errno, log_FUNC_m, log_WRN_m, m_fileHandle, m_fullPath, and m_lastError.

Referenced by hsm_HL7CacheFile::AddMessageToCache(), ClearPDBI(), cmn_CopyFile(), fsc_DataCollectorStorage::CreateFile(), fio_RelFile::CreateFile(), ui_MsgWriter::DisplayError(), ui_MsgWriter::DisplayMessage(), ui_MsgWriter::DisplayWarning(), DumpEmbData(), DumpFile(), fsc_MedVolWriter::Flush(), fsc_DataCollectorStorage::Flush(), cfg_CollocationInfo::GenerateCollocationInfoFile(), cfg_HL7Info::GenerateHL7InfoFile(), ivd_AccessFsAttr(), ParseBlock(), fio_File::PosWrite(), fsc_RawMediumContentCollector::ProcRecMedPosMgr(), bea_DupReadThread::ReadMedVolume(), ReadOneBackupFromMedium(), i_UploadAgent_i::Write(), blk_DiskFRIWriter::Write(), blk_DiskBufferWriter::Write(), cmn_FileTest::WriteContents(), ivd_FS_File::WriteF(), pf_File::WriteFile(), cfg_HL7Info::WriteGroupToFile(), cfg_CollocationInfo::WriteGroupToFile(), fio_PermDBinfoMgr::WriteInfo(), bea_DiskVolume::WriteRaw(), WriteStream(), and bea_DiskVolume::WriteVolInfo().

                                                                   {

    ivd_FileRetSize_t ret = write(m_fileHandle, a_buf, a_size);
    if (ret == -1) {
        log_FUNC_m(WriteF);
        m_lastError = errno;
        ostringstream sstr;
        sstr << "Write to " << m_fullPath << ", size " << a_size;
        throw ivd_SysError(m_lastError, sstr.str());
    }
    if (ret < static_cast<ivd_FileRetSize_t>(a_size) ) {
        log_FUNC_m(WriteF);
        log_WRN_m(
            "Write request to " << m_fullPath << ", size " << a_size <<
            " wrote only " << ret);
    }

    return ret;
}

Here is the caller graph for this function:

ivd_FileRetSize_t cmn_File::WriteStream ( const void *  a_buf,
ivd_FileBufSize_t  a_size 
)

Writes a_size number of bytes from a_buf to current stream and return the number of bytes written.

Definition at line 452 of file cmn_File_LNX.cpp.

References ie_PRECONDITION, ivd_Error, log_FUNC_m, m_streamLeft, and WriteF().

Referenced by UnpackFile(), and ivd_FS_File::WriteStream().

                                                                                   {

    if (m_streamLeft < a_size) {
        log_FUNC_m(WriteStream);
        ostringstream sstr;
        sstr
            << "Can't write more than stream size. Got: "
            << a_size << ", left: " << m_streamLeft;

        throw ivd_Error(ie_PRECONDITION, sstr.str());
    }

    // only data stream for now -> just write
    ivd_FileRetSize_t writeBytes = WriteF(a_buf, a_size);
    m_streamLeft -= writeBytes;
    return writeBytes;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool cmn_File::m_createdPipe [private]

Definition at line 352 of file cmn_File.h.

Referenced by CreatePipe(), DuplicateFrom(), and ~cmn_File().

bool cmn_File::m_dataStream [private]

Definition at line 360 of file cmn_File.h.

Referenced by DuplicateFrom(), GetStreamHeader(), and SetStreamHeader().

Definition at line 363 of file cmn_File.h.

int cmn_File::m_lastError [mutable, private]
string cmn_File::m_localeFullPath [private]
bool cmn_File::m_opened [private]

Definition at line 362 of file cmn_File.h.

Referenced by DuplicateFrom(), GetStreamHeader(), ReadStream(), SetStreamHeader(), and WriteStream().


The documentation for this class was generated from the following files: