VirtualBox

Changeset 28343 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 15, 2010 2:47:36 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60102
Message:

Main: Added QueryLogFilename for getting the full log file path of an given index.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r28304 r28343  
    49684968}
    49694969
     4970STDMETHODIMP Machine::QueryLogFilename(ULONG aIdx, BSTR *aName)
     4971{
     4972    CheckComArgOutPointerValid(aName);
     4973
     4974    AutoCaller autoCaller(this);
     4975    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     4976
     4977    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     4978
     4979    Utf8Str log = queryLogFilename(aIdx);
     4980    if (RTFileExists(log.c_str()))
     4981        log.cloneTo(aName);
     4982
     4983    return S_OK;
     4984}
     4985
    49704986STDMETHODIMP Machine::ReadLog(ULONG aIdx, ULONG64 aOffset, ULONG64 aSize, ComSafeArrayOut(BYTE, aData))
    49714987{
     
    49794995
    49804996    HRESULT rc = S_OK;
    4981     Utf8Str logFolder;
    4982     getLogFolder(logFolder);
    4983     Assert(logFolder.length());
    4984     ULONG uLogHistoryCount = 3;
    4985     ComPtr<ISystemProperties> systemProperties;
    4986     mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam());
    4987     if (!systemProperties.isNull())
    4988         systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount);
    4989     Utf8Str log;
    4990     if (aIdx == 0)
    4991         log = Utf8StrFmt("%s%cVBox.log",
    4992                          logFolder.raw(), RTPATH_DELIMITER);
    4993     else
    4994         log = Utf8StrFmt("%s%cVBox.log.%d",
    4995                          logFolder.raw(), RTPATH_DELIMITER, aIdx);
     4997    Utf8Str log = queryLogFilename(aIdx);
    49964998
    49974999    /* do not unnecessarily hold the lock while doing something which does
     
    51505152                                 RTPATH_DELIMITER);
    51515153    }
     5154}
     5155
     5156/**
     5157 *  Returns the full path to the machine's log file for an given index.
     5158 */
     5159Utf8Str Machine::queryLogFilename(ULONG idx)
     5160{
     5161    Utf8Str logFolder;
     5162    getLogFolder(logFolder);
     5163    Assert(logFolder.length());
     5164    Utf8Str log;
     5165    if (idx == 0)
     5166        log = Utf8StrFmt("%s%cVBox.log",
     5167                         logFolder.raw(), RTPATH_DELIMITER);
     5168    else
     5169        log = Utf8StrFmt("%s%cVBox.log.%d",
     5170                         logFolder.raw(), RTPATH_DELIMITER, idx);
     5171    return log;
    51525172}
    51535173
     
    87558775 *  @note Not thread safe (must be called from this object's lock).
    87568776 */
    8757 bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */)
     8777bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const
    87588778{
    87598779    Utf8Str settingsDir = mData->m_strConfigFileFull;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r28290 r28343  
    41444144  <interface
    41454145     name="IMachine" extends="$unknown"
    4146      uuid="21f56f5d-d0fc-49e5-9ea7-91639278f424"
     4146     uuid="fe51e0c8-7e48-4847-95f0-fc8532f3b480"
    41474147     wsmap="managed"
    41484148     >
     
    60036003    </method>
    60046004
     6005    <method name="queryLogFilename">
     6006      <desc>
     6007        Queries for the VM log file name of an given index. Returns an empty
     6008        string if a log file with that index doesn't exists.
     6009      </desc>
     6010      <param name="idx" type="unsigned long" dir="in">
     6011        <desc>
     6012          Which log file name to query. 0=current log file.
     6013        </desc>
     6014      </param>
     6015      <param name="filename" type="wstring" dir="return">
     6016        <desc>
     6017          On return the full path to the log file or an empty string on error.
     6018        </desc>
     6019      </param>
     6020    </method>
     6021
    60056022    <method name="readLog">
    60066023      <desc>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r28149 r28343  
    518518    STDMETHOD(HotUnplugCPU(ULONG aCpu));
    519519    STDMETHOD(GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached));
     520    STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName));
    520521    STDMETHOD(ReadLog(ULONG aIdx, ULONG64 aOffset, ULONG64 aSize, ComSafeArrayOut(BYTE, aData)));
    521522
     
    628629
    629630    void getLogFolder(Utf8Str &aLogFolder);
     631    Utf8Str queryLogFilename(ULONG idx);
    630632
    631633    HRESULT openSession(IInternalSessionControl *aControl);
     
    786788    void rollbackMedia();
    787789
    788     bool isInOwnDir(Utf8Str *aSettingsDir = NULL);
     790    bool isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
    789791
    790792    void rollback(bool aNotify);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette