Changeset 79155 in vbox for trunk/src/VBox/Runtime/r3/fs.cpp
- Timestamp:
- Jun 14, 2019 4:33:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/fs.cpp
r78205 r79155 44 44 * Converts dos-style attributes to Unix attributes. 45 45 * 46 * @returns 46 * @returns Normalized mode mask. 47 47 * @param fMode The mode mask containing dos-style attributes only. 48 48 * @param pszName The filename which this applies to (exe check). 49 49 * @param cbName The length of that filename. (optional, set 0) 50 50 * @param uReparseTag The reparse tag if RTFS_DOS_NT_REPARSE_POINT is set. 51 */ 52 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag) 53 { 51 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 52 */ 53 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag, RTFMODE fType) 54 { 55 Assert(!(fType & ~RTFS_TYPE_MASK)); 56 54 57 fMode &= ~((1 << RTFS_DOS_SHIFT) - 1); 55 58 56 /* everything is readable. */ 59 /* Forcibly set the directory attribute if caller desires it. */ 60 if (fType == RTFS_TYPE_DIRECTORY) 61 fMode |= RTFS_DOS_DIRECTORY; 62 63 /* Everything is readable. */ 57 64 fMode |= RTFS_UNIX_IRUSR | RTFS_UNIX_IRGRP | RTFS_UNIX_IROTH; 58 65 if (fMode & RTFS_DOS_DIRECTORY) 59 /* directories are executable. */66 /* Directories are executable. */ 60 67 fMode |= RTFS_TYPE_DIRECTORY | RTFS_UNIX_IXUSR | RTFS_UNIX_IXGRP | RTFS_UNIX_IXOTH; 61 68 else … … 108 115 * @param pszName The filename which this applies to (hidden check). 109 116 * @param cbName The length of that filename. (optional, set 0) 110 */ 111 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName) 112 { 117 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 118 */ 119 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType) 120 { 121 Assert(!(fType & ~RTFS_TYPE_MASK)); 113 122 NOREF(cbName); 114 123 115 124 fMode &= RTFS_UNIX_MASK; 125 126 if (!(fType & RTFS_TYPE_MASK) && fType) 127 fMode |= fType; 116 128 117 129 if (!(fMode & (RTFS_UNIX_IWUSR | RTFS_UNIX_IWGRP | RTFS_UNIX_IWOTH))) … … 142 154 * @param pszName The filename which this applies to (exe check). 143 155 * @param cbName The length of that filename. (optional, set 0) 144 */ 145 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName) 146 { 156 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 157 */ 158 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType) 159 { 160 Assert(!(fType & ~RTFS_TYPE_MASK)); 161 147 162 if (!(fMode & RTFS_UNIX_MASK)) 148 fMode = rtFsModeFromDos(fMode, pszName, cbName, RTFSMODE_SYMLINK_REPARSE_TAG );163 fMode = rtFsModeFromDos(fMode, pszName, cbName, RTFSMODE_SYMLINK_REPARSE_TAG, fType); 149 164 else if (!(fMode & RTFS_DOS_MASK)) 150 fMode = rtFsModeFromUnix(fMode, pszName, cbName );165 fMode = rtFsModeFromUnix(fMode, pszName, cbName, fType); 151 166 else if (!(fMode & RTFS_TYPE_MASK)) 152 167 fMode |= fMode & RTFS_DOS_DIRECTORY ? RTFS_TYPE_DIRECTORY : RTFS_TYPE_FILE;
Note:
See TracChangeset
for help on using the changeset viewer.