Changeset 71261 in vbox
- Timestamp:
- Mar 7, 2018 2:55:23 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r66857 r71261 5 5 6 6 /* 7 * Copyright (C) 2011-201 7Oracle Corporation7 * Copyright (C) 2011-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 635 635 struct GuestFsObjData 636 636 { 637 /** Helper function to extract the data from638 * a certin VBoxService tool's guest stream block.*/637 /** @name Helper functions to extract the data from a certin VBoxService tool's guest stream block. 638 * @{ */ 639 639 int FromLs(const GuestProcessStreamBlock &strmBlk); 640 640 int FromMkTemp(const GuestProcessStreamBlock &strmBlk); 641 641 int FromStat(const GuestProcessStreamBlock &strmBlk); 642 /** @} */ 643 644 /** @name Static helper functions to work with time from stream block keys. 645 * @{ */ 646 static PRTTIMESPEC TimeSpecFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey, PRTTIMESPEC pTimeSpec); 647 static int64_t UnixEpochNsFromKey(const GuestProcessStreamBlock &strmBlk, const Utf8Str &strKey); 648 /** @} */ 642 649 643 650 int64_t mAccessTime; -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r67914 r71261 5 5 6 6 /* 7 * Copyright (C) 2011-201 7Oracle Corporation7 * Copyright (C) 2011-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 36 36 # include <iprt/file.h> 37 37 #endif /* DEBUG */ 38 38 #include <iprt/time.h> 39 39 40 40 … … 102 102 } 103 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 } 143 104 144 int GuestFsObjData::FromStat(const GuestProcessStreamBlock &strmBlk) 105 145 { … … 125 165 else if (strType.equalsIgnoreCase("d")) 126 166 mType = FsObjType_Directory; 127 /** @todo Add more types! */ 128 else 167 else /** @todo Add more types! */ 129 168 mType = FsObjType_Unknown; 169 /* Dates. */ 170 mAccessTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_atime"); 171 mBirthTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_birthtime"); 172 mChangeTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_ctime"); 173 mModificationTime = GuestFsObjData::UnixEpochNsFromKey(strmBlk, "st_mtime"); 130 174 /* Object size. */ 131 175 rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
Note:
See TracChangeset
for help on using the changeset viewer.