- Timestamp:
- Mar 7, 2018 6:20:22 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121190
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h ¶
r71261 r71264 637 637 /** @name Helper functions to extract the data from a certin VBoxService tool's guest stream block. 638 638 * @{ */ 639 int FromLs(const GuestProcessStreamBlock &strmBlk );639 int FromLs(const GuestProcessStreamBlock &strmBlk, bool fLong); 640 640 int FromMkTemp(const GuestProcessStreamBlock &strmBlk); 641 641 int FromStat(const GuestProcessStreamBlock &strmBlk); -
TabularUnified trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp ¶
r71261 r71264 39 39 40 40 41 int GuestFsObjData::FromLs(const GuestProcessStreamBlock &strmBlk) 41 /** 42 * Extracts the timespec from a given stream block key. 43 * 44 * @return Pointer to handed-in timespec, or NULL if invalid / not found. 45 * @param strmBlk Stream block to extract timespec from. 46 * @param strKey Key to get timespec for. 47 * @param pTimeSpec Where to store the extracted timespec. 48 */ 49 /* static */ 50 PRTTIMESPEC GuestFsObjData::TimeSpecFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey, PRTTIMESPEC pTimeSpec) 51 { 52 AssertPtrReturn(pTimeSpec, NULL); 53 54 Utf8Str strTime = strmBlk.GetString(strKey.c_str()); 55 if (strTime.isEmpty()) 56 return NULL; 57 58 if (!RTTimeSpecFromString(pTimeSpec, strTime.c_str())) 59 return NULL; 60 61 return pTimeSpec; 62 } 63 64 /** 65 * Extracts the in nanoseconds relative from Unix epoch for a given stream block key. 66 * 67 * @return Nanoseconds relative from Unix epoch, or 0 if invalid / not found. 68 * @param strmBlk Stream block to extract nanoseconds from. 69 * @param strKey Key to get nanoseconds for. 70 */ 71 /* static */ 72 int64_t GuestFsObjData::UnixEpochNsFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey) 73 { 74 RTTIMESPEC TimeSpec; 75 if (!GuestFsObjData::TimeSpecFromKey(strmBlk, strKey, &TimeSpec)) 76 return 0; 77 78 return TimeSpec.i64NanosecondsRelativeToUnixEpoch; 79 } 80 81 /** 82 * Initializes this object data with a stream block from VBOXSERVICE_TOOL_LS. 83 * 84 * @return VBox status code. 85 * @param strmBlk Stream block to use for initialization. 86 * @param fLong Whether the stream block contains long (detailed) information or not. 87 */ 88 int GuestFsObjData::FromLs(const GuestProcessStreamBlock &strmBlk, bool fLong) 42 89 { 43 90 LogFlowFunc(("\n")); … … 62 109 else 63 110 mType = FsObjType_Unknown; 111 if (fLong) 112 { 113 /* Dates. */ 114 mAccessTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_atime"); 115 mBirthTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_birthtime"); 116 mChangeTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_ctime"); 117 mModificationTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_mtime"); 118 } 64 119 /* Object size. */ 65 120 rc = strmBlk.GetInt64Ex("st_size", &mObjectSize); … … 100 155 LogFlowFuncLeaveRC(rc); 101 156 return rc; 102 }103 104 /**105 * Extracts the timespec from a given stream block key.106 *107 * @return Pointer to handed-in timespec, or NULL if invalid / not found.108 * @param strmBlk Stream block to extract timespec from.109 * @param strKey Key to get timespec for.110 * @param pTimeSpec Where to store the extracted timespec.111 */112 /* static */113 PRTTIMESPEC GuestFsObjData::TimeSpecFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey, PRTTIMESPEC pTimeSpec)114 {115 AssertPtrReturn(pTimeSpec, NULL);116 117 Utf8Str strTime = strmBlk.GetString(strKey.c_str());118 if (strTime.isEmpty())119 return NULL;120 121 if (!RTTimeSpecFromString(pTimeSpec, strTime.c_str()))122 return NULL;123 124 return pTimeSpec;125 }126 127 /**128 * Extracts the in nanoseconds relative from Unix epoch for a given stream block key.129 *130 * @return Nanoseconds relative from Unix epoch, or 0 if invalid / not found.131 * @param strmBlk Stream block to extract nanoseconds from.132 * @param strKey Key to get nanoseconds for.133 */134 /* static */135 int64_t GuestFsObjData::UnixEpochNsFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey)136 {137 RTTIMESPEC TimeSpec;138 if (!GuestFsObjData::TimeSpecFromKey(strmBlk, strKey, &TimeSpec))139 return 0;140 141 return TimeSpec.i64NanosecondsRelativeToUnixEpoch;142 157 } 143 158 -
TabularUnified trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp ¶
r71263 r71264 299 299 { 300 300 GuestFsObjData objData; 301 rc = objData.FromLs(curBlock );301 rc = objData.FromLs(curBlock, true /* fLong */); 302 302 if (RT_SUCCESS(rc)) 303 303 {
Note:
See TracChangeset
for help on using the changeset viewer.