- Timestamp:
- Nov 11, 2010 5:16:37 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r33945 r34002 1294 1294 /** The tar end of file record was read. */ 1295 1295 #define VERR_TAR_END_OF_FILE (-926) 1296 /** The tar file ended unexpectedly. */ 1297 #define VERR_TAR_UNEXPECTED_EOS (-927) 1296 1298 /** @} */ 1297 1299 -
trunk/include/iprt/fs.h
r33993 r34002 263 263 /** No additional information is available / requested. */ 264 264 RTFSOBJATTRADD_NOTHING = 1, 265 /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available / requested. */ 265 /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available / 266 * requested. */ 266 267 RTFSOBJATTRADD_UNIX, 268 /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are 269 * available / requested. */ 270 RTFSOBJATTRADD_UNIX_OWNER, 271 /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are 272 * available / requested. */ 273 RTFSOBJATTRADD_UNIX_GROUP, 267 274 /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */ 268 275 RTFSOBJATTRADD_EASIZE, … … 275 282 } RTFSOBJATTRADD; 276 283 284 /** The number of bytes reserved for the additional attribute union. */ 285 #define RTFSOBJATTRUNION_MAX_SIZE 128 286 287 /** 288 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX). 289 */ 290 typedef struct RTFSOBJATTRUNIX 291 { 292 /** The user owning the filesystem object (st_uid). 293 * This field is NIL_UID if not supported. */ 294 RTUID uid; 295 296 /** The group the filesystem object is assigned (st_gid). 297 * This field is NIL_GID if not supported. */ 298 RTGID gid; 299 300 /** Number of hard links to this filesystem object (st_nlink). 301 * This field is 1 if the filesystem doesn't support hardlinking or 302 * the information isn't available. 303 */ 304 uint32_t cHardlinks; 305 306 /** The device number of the device which this filesystem object resides on (st_dev). 307 * This field is 0 if this information is not available. */ 308 RTDEV INodeIdDevice; 309 310 /** The unique identifier (within the filesystem) of this filesystem object (st_ino). 311 * Together with INodeIdDevice, this field can be used as a OS wide unique id 312 * when both their values are not 0. 313 * This field is 0 if the information is not available. */ 314 RTINODE INodeId; 315 316 /** User flags (st_flags). 317 * This field is 0 if this information is not available. */ 318 uint32_t fFlags; 319 320 /** The current generation number (st_gen). 321 * This field is 0 if this information is not available. */ 322 uint32_t GenerationId; 323 324 /** The device number of a character or block device type object (st_rdev). 325 * This field is 0 if the file isn't of a character or block device type and 326 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */ 327 RTDEV Device; 328 } RTFSOBJATTRUNIX; 329 330 331 /** 332 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_OWNER). 333 * 334 * @remarks This interface is mainly for TAR. 335 */ 336 typedef struct RTFSOBJATTRUNIXOWNER 337 { 338 /** The user owning the filesystem object (st_uid). 339 * This field is NIL_UID if not supported. */ 340 RTUID uid; 341 /** The user name. 342 * Empty if not available or not supported, truncated if too long. */ 343 char szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)]; 344 } RTFSOBJATTRUNIXOWNER; 345 346 347 /** 348 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_GROUP). 349 * 350 * @remarks This interface is mainly for TAR. 351 */ 352 typedef struct RTFSOBJATTRUNIXGROUP 353 { 354 /** The user owning the filesystem object (st_uid). 355 * This field is NIL_GID if not supported. */ 356 RTGID gid; 357 /** The group name. 358 * Empty if not available or not supported, truncated if too long. */ 359 char szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)]; 360 } RTFSOBJATTRUNIXGROUP; 361 277 362 278 363 /** 279 364 * Filesystem object attributes. 280 365 */ 281 #pragma pack(1)282 366 typedef struct RTFSOBJATTR 283 367 { … … 296 380 union RTFSOBJATTRUNION 297 381 { 298 /** Additional Unix Attributes 299 * These are available when RTFSOBJATTRADD is set in fUnix. 300 */ 301 struct RTFSOBJATTRUNIX 302 { 303 /** The user owning the filesystem object (st_uid). 304 * This field is ~0U if not supported. */ 305 RTUID uid; 306 307 /** The group the filesystem object is assigned (st_gid). 308 * This field is ~0U if not supported. */ 309 RTGID gid; 310 311 /** Number of hard links to this filesystem object (st_nlink). 312 * This field is 1 if the filesystem doesn't support hardlinking or 313 * the information isn't available. 314 */ 315 uint32_t cHardlinks; 316 317 /** The device number of the device which this filesystem object resides on (st_dev). 318 * This field is 0 if this information is not available. */ 319 RTDEV INodeIdDevice; 320 321 /** The unique identifier (within the filesystem) of this filesystem object (st_ino). 322 * Together with INodeIdDevice, this field can be used as a OS wide unique id 323 * when both their values are not 0. 324 * This field is 0 if the information is not available. */ 325 RTINODE INodeId; 326 327 /** User flags (st_flags). 328 * This field is 0 if this information is not available. */ 329 uint32_t fFlags; 330 331 /** The current generation number (st_gen). 332 * This field is 0 if this information is not available. */ 333 uint32_t GenerationId; 334 335 /** The device number of a character or block device type object (st_rdev). 336 * This field is 0 if the file isn't of a character or block device type and 337 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */ 338 RTDEV Device; 339 } Unix; 382 /** Additional Unix Attributes - RTFSOBJATTRADD_UNIX. */ 383 RTFSOBJATTRUNIX Unix; 384 /** Additional Unix Owner Attributes - RTFSOBJATTRADD_UNIX_OWNER. */ 385 RTFSOBJATTRUNIXOWNER UnixOwner; 386 /** Additional Unix Group Attributes - RTFSOBJATTRADD_UNIX_GROUP. */ 387 RTFSOBJATTRUNIXGROUP UnixGroup; 340 388 341 389 /** … … 347 395 RTFOFF cb; 348 396 } EASize; 397 /** Reserved space. */ 398 uint8_t abReserveSpace[128]; 349 399 } u; 350 400 } RTFSOBJATTR; 351 #pragma pack()352 401 /** Pointer to a filesystem object attributes structure. */ 353 402 typedef RTFSOBJATTR *PRTFSOBJATTR; … … 361 410 * This is returned by the RTPathQueryInfo(), RTFileQueryInfo() and RTDirRead() APIs. 362 411 */ 363 #pragma pack(1)364 412 typedef struct RTFSOBJINFO 365 413 { … … 395 443 396 444 } RTFSOBJINFO; 397 #pragma pack()398 445 /** Pointer to a filesystem object information structure. */ 399 446 typedef RTFSOBJINFO *PRTFSOBJINFO; -
trunk/include/iprt/path.h
r33802 r34002 628 628 * 629 629 * @param pszPath Path to the file system object. 630 * @param pObjInfo Object information structure to be filled on successful return. 630 * @param pObjInfo Object information structure to be filled on successful 631 * return. 631 632 * @param enmAdditionalAttribs 632 633 * Which set of additional attributes to request. -
trunk/include/iprt/vfs.h
r33973 r34002 119 119 120 120 121 /** @defgroup grp_vfs_dir VFS DirectoryAPI121 /** @defgroup grp_vfs_dir VFS Base Object API 122 122 * @{ 123 123 */ 124 124 125 RTDECL(RTVFS) RTVfsObjToVfs(RTVFSOBJ hVfsObj); 126 RTDECL(RTVFSFSSTREAM) RTVfsObjToFsStream(RTVFSOBJ hVfsObj); 127 RTDECL(RTVFSDIR) RTVfsObjToDir(RTVFSOBJ hVfsObj); 128 RTDECL(RTVFSIOSTREAM) RTVfsObjToIoStream(RTVFSOBJ hVfsObj); 129 RTDECL(RTVFSFILE) RTVfsObjToFile(RTVFSOBJ hVfsObj); 130 RTDECL(RTVFSSYMLINK) RTVfsObjToSymlink(RTVFSOBJ hVfsObj); 131 132 RTDECL(RTVFSOBJ) RTVfsObjFromVfs(RTVFS hVfs); 133 RTDECL(RTVFSOBJ) RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss); 134 RTDECL(RTVFSOBJ) RTVfsObjFromDir(RTVFSDIR hVfsDir); 135 RTDECL(RTVFSOBJ) RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos); 136 RTDECL(RTVFSOBJ) RTVfsObjFromFile(RTVFSFILE hVfsFile); 137 RTDECL(RTVFSOBJ) RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym); 125 /** 126 * Retains a reference to the VFS base object handle. 127 * 128 * @returns New reference count on success, UINT32_MAX on failure. 129 * @param hVfsObj The VFS base object handle. 130 */ 131 RTDECL(uint32_t) RTVfsObjRetain(RTVFSOBJ hVfsObj); 132 133 /** 134 * Releases a reference to the VFS base handle. 135 * 136 * @returns New reference count on success (0 if closed), UINT32_MAX on failure. 137 * @param hVfsObj The VFS base object handle. 138 */ 139 RTDECL(uint32_t) RTVfsObjRelease(RTVFSOBJ hVfsObj); 138 140 139 141 /** … … 141 143 * 142 144 * @returns IPRT status code. 145 * @retval VERR_NOT_SUPPORTED if the @a enmAddAttr value is not handled by the 146 * implementation. 147 * 143 148 * @param hVfsObj The VFS object handle. 144 149 * @param pObjInfo Where to return the info. … … 146 151 * @sa RTFileQueryInfo, RTPathQueryInfo 147 152 */ 148 RTDECL(int) RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); 153 RTDECL(int) RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); 154 155 156 /** 157 * Converts a VFS base object handle to a VFS handle. 158 * 159 * @returns Referenced handle on success, NIL on failure. 160 * @param hVfsObj The VFS base object handle. 161 */ 162 RTDECL(RTVFS) RTVfsObjToVfs(RTVFSOBJ hVfsObj); 163 164 /** 165 * Converts a VFS base object handle to a VFS filesystem stream handle. 166 * 167 * @returns Referenced handle on success, NIL on failure. 168 * @param hVfsObj The VFS base object handle. 169 */ 170 RTDECL(RTVFSFSSTREAM) RTVfsObjToFsStream(RTVFSOBJ hVfsObj); 171 172 /** 173 * Converts a VFS base object handle to a VFS directory handle. 174 * 175 * @returns Referenced handle on success, NIL on failure. 176 * @param hVfsObj The VFS base object handle. 177 */ 178 RTDECL(RTVFSDIR) RTVfsObjToDir(RTVFSOBJ hVfsObj); 179 180 /** 181 * Converts a VFS base object handle to a VFS I/O stream handle. 182 * 183 * @returns Referenced handle on success, NIL on failure. 184 * @param hVfsObj The VFS base object handle. 185 */ 186 RTDECL(RTVFSIOSTREAM) RTVfsObjToIoStream(RTVFSOBJ hVfsObj); 187 188 /** 189 * Converts a VFS base object handle to a VFS file handle. 190 * 191 * @returns Referenced handle on success, NIL on failure. 192 * @param hVfsObj The VFS base object handle. 193 */ 194 RTDECL(RTVFSFILE) RTVfsObjToFile(RTVFSOBJ hVfsObj); 195 196 /** 197 * Converts a VFS base object handle to a VFS symbolic link handle. 198 * 199 * @returns Referenced handle on success, NIL on failure. 200 * @param hVfsObj The VFS base object handle. 201 */ 202 RTDECL(RTVFSSYMLINK) RTVfsObjToSymlink(RTVFSOBJ hVfsObj); 203 204 205 /** 206 * Converts a VFS handle to a VFS base object handle. 207 * 208 * @returns Referenced handle on success, NIL if the input handle was invalid. 209 * @param hVfs The VFS handle. 210 */ 211 RTDECL(RTVFSOBJ) RTVfsObjFromVfs(RTVFS hVfs); 212 213 /** 214 * Converts a VFS filesystem stream handle to a VFS base object handle. 215 * 216 * @returns Referenced handle on success, NIL if the input handle was invalid. 217 * @param hVfsFSs The VFS filesystem stream handle. 218 */ 219 RTDECL(RTVFSOBJ) RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss); 220 221 /** 222 * Converts a VFS directory handle to a VFS base object handle. 223 * 224 * @returns Referenced handle on success, NIL if the input handle was invalid. 225 * @param hVfsDir The VFS directory handle. 226 */ 227 RTDECL(RTVFSOBJ) RTVfsObjFromDir(RTVFSDIR hVfsDir); 228 229 /** 230 * Converts a VFS I/O stream handle to a VFS base object handle. 231 * 232 * @returns Referenced handle on success, NIL if the input handle was invalid. 233 * @param hVfsIos The VFS I/O stream handle. 234 */ 235 RTDECL(RTVFSOBJ) RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos); 236 237 /** 238 * Converts a VFS file handle to a VFS base object handle. 239 * 240 * @returns Referenced handle on success, NIL if the input handle was invalid. 241 * @param hVfsFile The VFS file handle. 242 */ 243 RTDECL(RTVFSOBJ) RTVfsObjFromFile(RTVFSFILE hVfsFile); 244 245 /** 246 * Converts a VFS symbolic link handle to a VFS base object handle. 247 * 248 * @returns Referenced handle on success, NIL if the input handle was invalid. 249 * @param hVfsSym The VFS symbolic link handle. 250 */ 251 RTDECL(RTVFSOBJ) RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym); 149 252 150 253 /** @} */ … … 182 285 * @retval VINF_SUCCESS if a new object was retrieved. 183 286 * @retval VERR_EOF when there are no more objects. 287 * 184 288 * @param pvThis The implementation specific directory data. 185 289 * @param ppszName Where to return the object name. Must be freed by … … 323 427 * @retval VERR_EOF when trying to read __beyond__ the end of the stream and 324 428 * @a pcbRead is NULL. 429 * @retval VERR_ACCESS_DENIED if the stream is not readable. 325 430 * 326 431 * @param hVfsIos The VFS I/O stream handle. … … 339 444 * 340 445 * @returns IPRT status code. 446 * @retval VERR_ACCESS_DENIED if the stream is not writable. 447 * 341 448 * @param hVfsIos The VFS I/O stream handle. 342 449 * @param pvBuf The bytes to write. … … 366 473 * @retval VERR_EOF when trying to read __beyond__ the end of the stream and 367 474 * @a pcbRead is NULL. 475 * @retval VERR_ACCESS_DENIED if the stream is not readable. 368 476 * 369 477 * @param hVfsIos The VFS I/O stream handle. … … 383 491 * 384 492 * @returns IPRT status code. 493 * @retval VERR_ACCESS_DENIED if the stream is not writable. 494 * 385 495 * @param hVfsIos The VFS I/O stream handle. 386 496 * @param pSgBuf Pointer to a gather buffer descriptor. The number -
trunk/include/iprt/vfslowlevel.h
r33973 r34002 125 125 * Get information about the file. 126 126 * 127 * @returns IPRT status code. 127 * @returns IPRT status code. See RTVfsObjQueryInfo. 128 128 * @param pvThis The implementation specific file data. 129 129 * @param pObjInfo Where to return the object info on success. 130 130 * @param enmAddAttr Which set of additional attributes to request. 131 * @sa RT FileQueryInfo131 * @sa RTVfsObjQueryInfo, RTFileQueryInfo, RTPathQueryInfo 132 132 */ 133 133 DECLCALLBACKMEMBER(int, pfnQueryInfo)(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); … … 234 234 * @param hVfsObj Where to return the object handle (referenced). 235 235 * This must be cast to the desired type before use. 236 * @sa RTVfsFsStrmNext 236 237 */ 237 238 DECLCALLBACKMEMBER(int, pfnNext)(void *pvThis, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj); … … 245 246 /** The RTVFSFSSTREAMOPS structure version. */ 246 247 #define RTVFSFSSTREAMOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x3f,1,0) 248 249 250 /** 251 * Creates a new VFS filesystem stream handle. 252 * 253 * @returns IPRT status code 254 * @param pFsStreamOps The filesystem stream operations. 255 * @param cbInstance The size of the instance data. 256 * @param hVfs The VFS handle to associate this filesystem 257 * steram with. NIL_VFS is ok. 258 * @param hSemRW The read-write semaphore to use to protect the 259 * handle if this differs from the one the VFS 260 * uses. NIL_RTSEMRW is ok if no locking is 261 * desired. 262 * @param phVfsFss Where to return the new handle. 263 * @param ppvInstance Where to return the pointer to the instance data 264 * (size is @a cbInstance). 265 */ 266 RTDECL(int) RTVfsNewFsStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTSEMRW hSemRW, 267 PRTVFSFSSTREAM phVfsFss, void **ppvInstance); 247 268 248 269 … … 553 574 * @param cbInstance The size of the instance data. 554 575 * @param fOpen The open flags. The minimum is the access mask. 555 * @param hVfs The VFS handle to associate this file with.556 * NIL_VFS is ok.576 * @param hVfs The VFS handle to associate this I/O stream 577 * with. NIL_VFS is ok. 557 578 * @param hSemRW The read-write semaphore to use to protect the 558 579 * handle if this differs from the one the VFS -
trunk/src/VBox/Runtime/Makefile.kmk
r33982 r34002 372 372 common/vfs/vfsstdfile.cpp \ 373 373 common/zip/tar.cpp \ 374 common/zip/tarvfs.cpp \ 374 375 common/zip/zip.cpp \ 375 376 common/zip/zipgzip.cpp \ -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r33979 r34002 68 68 /** The max number of symbolic links to resolve in a path. */ 69 69 #define RTVFS_MAX_LINKS 20U 70 71 72 /** Asserts that the VFS base object vtable is valid. */ 73 #define RTVFSOBJ_ASSERT_OPS(pObj, enmTypeArg) \ 74 do \ 75 { \ 76 Assert((pObj)->uVersion == RTVFSOBJOPS_VERSION); \ 77 Assert((pObj)->enmType == (enmTypeArg) || (enmTypeArg) == RTVFSOBJTYPE_INVALID); \ 78 AssertPtr((pObj)->pszName); \ 79 Assert(*(pObj)->pszName); \ 80 AssertPtr((pObj)->pfnClose); \ 81 AssertPtr((pObj)->pfnQueryInfo); \ 82 Assert((pObj)->uEndMarker == RTVFSOBJOPS_VERSION); \ 83 } while (0) 84 85 /** Asserts that the VFS I/O stream vtable is valid. */ 86 #define RTVFSIOSTREAM_ASSERT_OPS(pIoStreamOps, enmTypeArg) \ 87 do { \ 88 RTVFSOBJ_ASSERT_OPS(&(pIoStreamOps)->Obj, enmTypeArg); \ 89 Assert((pIoStreamOps)->uVersion == RTVFSIOSTREAMOPS_VERSION); \ 90 Assert(!(pIoStreamOps)->fReserved); \ 91 AssertPtr((pIoStreamOps)->pfnRead); \ 92 AssertPtr((pIoStreamOps)->pfnWrite); \ 93 AssertPtr((pIoStreamOps)->pfnFlush); \ 94 AssertPtr((pIoStreamOps)->pfnPollOne); \ 95 AssertPtr((pIoStreamOps)->pfnTell); \ 96 AssertPtrNull((pIoStreamOps)->pfnSkip); \ 97 AssertPtrNull((pIoStreamOps)->pfnZeroFill); \ 98 Assert((pIoStreamOps)->uEndMarker == RTVFSIOSTREAMOPS_VERSION); \ 99 } while (0) 70 100 71 101 … … 1095 1125 PRTVFSFSSTREAM phVfsFss, void **ppvInstance) 1096 1126 { 1097 return VERR_NOT_IMPLEMENTED; 1127 /* 1128 * Validate the input, be extra strict in strict builds. 1129 */ 1130 AssertPtr(pFsStreamOps); 1131 AssertReturn(pFsStreamOps->uVersion == RTVFSFSSTREAMOPS_VERSION, VERR_VERSION_MISMATCH); 1132 AssertReturn(pFsStreamOps->uEndMarker == RTVFSFSSTREAMOPS_VERSION, VERR_VERSION_MISMATCH); 1133 Assert(!pFsStreamOps->fReserved); 1134 RTVFSOBJ_ASSERT_OPS(&pFsStreamOps->Obj, RTVFSOBJTYPE_FS_STREAM); 1135 AssertPtr(pFsStreamOps->pfnNext); 1136 Assert(cbInstance > 0); 1137 AssertPtr(ppvInstance); 1138 AssertPtr(phVfsFss); 1139 1140 RTVFSINTERNAL *pVfs = NULL; 1141 if (hVfs != NIL_RTVFS) 1142 { 1143 pVfs = hVfs; 1144 AssertPtrReturn(pVfs, VERR_INVALID_HANDLE); 1145 AssertReturn(pVfs->uMagic == RTVFS_MAGIC, VERR_INVALID_HANDLE); 1146 } 1147 1148 /* 1149 * Allocate the handle + instance data. 1150 */ 1151 size_t const cbThis = RT_ALIGN_Z(sizeof(RTVFSFSSTREAMINTERNAL), RTVFS_INST_ALIGNMENT) 1152 + RT_ALIGN_Z(cbInstance, RTVFS_INST_ALIGNMENT); 1153 RTVFSFSSTREAMINTERNAL *pThis = (RTVFSFSSTREAMINTERNAL *)RTMemAllocZ(cbThis); 1154 if (!pThis) 1155 return VERR_NO_MEMORY; 1156 1157 pThis->uMagic = RTVFSFSSTREAM_MAGIC; 1158 pThis->fFlags = RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE; 1159 pThis->pOps = pFsStreamOps; 1160 pThis->Base.uMagic = RTVFSOBJ_MAGIC; 1161 pThis->Base.pvThis = (char *)pThis + RT_ALIGN_Z(sizeof(*pThis), RTVFS_INST_ALIGNMENT); 1162 pThis->Base.pOps = &pFsStreamOps->Obj; 1163 pThis->Base.hSemRW = hSemRW != NIL_RTSEMRW ? hSemRW : pVfs ? pVfs->Base.hSemRW : NIL_RTSEMRW; 1164 pThis->Base.hVfs = hVfs; 1165 pThis->Base.cRefs = 1; 1166 if (hVfs != NIL_RTVFS) 1167 rtVfsObjRetainVoid(&pVfs->Base); 1168 1169 *phVfsFss = pThis; 1170 *ppvInstance = pThis->Base.pvThis; 1171 return VINF_SUCCESS; 1098 1172 } 1099 1173 … … 1233 1307 AssertReturn(pIoStreamOps->uEndMarker == RTVFSIOSTREAMOPS_VERSION, VERR_VERSION_MISMATCH); 1234 1308 Assert(!pIoStreamOps->fReserved); 1309 RTVFSIOSTREAM_ASSERT_OPS(pIoStreamOps, RTVFSOBJTYPE_IO_STREAM); 1235 1310 Assert(cbInstance > 0); 1236 1311 Assert(fOpen & RTFILE_O_ACCESS_MASK); … … 1539 1614 AssertReturn(pFileOps->uEndMarker == RTVFSFILEOPS_VERSION, VERR_VERSION_MISMATCH); 1540 1615 Assert(!pFileOps->fReserved); 1616 RTVFSIOSTREAM_ASSERT_OPS(&pFileOps->Stream, RTVFSOBJTYPE_FILE); 1541 1617 Assert(cbInstance > 0); 1542 1618 Assert(fOpen & RTFILE_O_ACCESS_MASK); -
trunk/src/VBox/Runtime/common/zip/tar.cpp
r33982 r34002 30 30 ******************************************************************************/ 31 31 #include "internal/iprt.h" 32 #include "internal/magics.h"33 32 #include <iprt/tar.h> 34 33 … … 40 39 #include <iprt/path.h> 41 40 #include <iprt/string.h> 41 42 #include "internal/magics.h" 42 43 43 44 -
trunk/src/VBox/Runtime/common/zip/zipgzip.cpp
r33973 r34002 341 341 int rc; 342 342 343 NOREF(fBlocking);344 343 if (!pThis->fDecompress) 345 344 return VERR_ACCESS_DENIED; -
trunk/src/VBox/Runtime/include/internal/fs.h
r28800 r34002 43 43 #ifndef RT_OS_WINDOWS 44 44 void rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat, const char *pszName, unsigned cbName); 45 void rtFsObjInfoAttrSetUnixOwner(PRTFSOBJINFO pObjInfo, RTUID uid); 46 void rtFsObjInfoAttrSetUnixGroup(PRTFSOBJINFO pObjInfo, RTUID gid); 45 47 #endif 46 48 -
trunk/src/VBox/Runtime/r3/fs.cpp
r33540 r34002 37 37 # define DEV_BSIZE S_BLKSIZE /** @todo bird: add DEV_BSIZE to sys/param.h on OS/2. */ 38 38 # endif 39 # include <grp.h> 40 # include <pwd.h> 39 41 #endif 40 42 … … 192 194 } 193 195 194 195 196 #ifndef RT_OS_WINDOWS 197 196 198 /** 197 199 * Internal worker function which setups RTFSOBJINFO based on a UNIX stat struct. … … 300 302 pObjInfo->Attr.u.Unix.Device = pStat->st_rdev; 301 303 } 304 305 306 /** 307 * Set user-owner additional attributes. 308 * 309 * @param pObjInfo The object info to fill add attrs for. 310 * @param uid The user id. 311 */ 312 void rtFsObjInfoAttrSetUnixOwner(PRTFSOBJINFO pObjInfo, RTUID uid) 313 { 314 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_UNIX_OWNER; 315 pObjInfo->Attr.u.UnixOwner.uid = uid; 316 pObjInfo->Attr.u.UnixOwner.szName[0] = '\0'; 317 318 char achBuf[_4K]; 319 struct passwd Pwd; 320 struct passwd *pPwd; 321 int rc = getpwuid_r(uid, &Pwd, achBuf, sizeof(achBuf), &pPwd); 322 if (!rc && pPwd) 323 RTStrCopy(pObjInfo->Attr.u.UnixOwner.szName, sizeof(pObjInfo->Attr.u.UnixOwner.szName), pPwd->pw_name); 324 } 325 326 327 /** 328 * Set user-group additional attributes. 329 * 330 * @param pObjInfo The object info to fill add attrs for. 331 * @param gid The group id. 332 */ 333 void rtFsObjInfoAttrSetUnixGroup(PRTFSOBJINFO pObjInfo, RTUID gid) 334 { 335 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_UNIX_GROUP; 336 pObjInfo->Attr.u.UnixGroup.gid = gid; 337 pObjInfo->Attr.u.UnixGroup.szName[0] = '\0'; 338 339 char achBuf[_4K]; 340 struct group Grp; 341 struct group *pGrp; 342 343 int rc = getgrgid_r(gid, &Grp, achBuf, sizeof(achBuf), &pGrp); 344 if (!rc && pGrp) 345 RTStrCopy(pObjInfo->Attr.u.UnixGroup.szName, sizeof(pObjInfo->Attr.u.UnixGroup.szName), pGrp->gr_name); 346 } 347 302 348 #endif /* !RT_OS_WINDOWS */ 303 349 -
trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
r33103 r34002 658 658 switch (enmAdditionalAttribs) 659 659 { 660 case RTFSOBJATTRADD_NOTHING: 661 case RTFSOBJATTRADD_UNIX: 662 /* done */ 663 break; 664 665 case RTFSOBJATTRADD_UNIX_OWNER: 666 rtFsObjInfoAttrSetUnixOwner(pObjInfo, Stat.st_uid); 667 break; 668 669 case RTFSOBJATTRADD_UNIX_GROUP: 670 rtFsObjInfoAttrSetUnixGroup(pObjInfo, Stat.st_gid); 671 break; 672 660 673 case RTFSOBJATTRADD_EASIZE: 661 674 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 662 675 pObjInfo->Attr.u.EASize.cb = 0; 663 break;664 665 case RTFSOBJATTRADD_NOTHING:666 case RTFSOBJATTRADD_UNIX:667 /* done */668 676 break; 669 677 -
trunk/src/VBox/Runtime/r3/posix/path-posix.cpp
r33602 r34002 39 39 #include <sys/types.h> 40 40 #include <pwd.h> 41 #include <grp.h> 41 42 42 43 #include <iprt/path.h> … … 340 341 switch (enmAdditionalAttribs) 341 342 { 343 case RTFSOBJATTRADD_NOTHING: 344 case RTFSOBJATTRADD_UNIX: 345 Assert(pObjInfo->Attr.enmAdditional == RTFSOBJATTRADD_UNIX); 346 break; 347 348 case RTFSOBJATTRADD_UNIX_OWNER: 349 rtFsObjInfoAttrSetUnixOwner(pObjInfo, Stat.st_uid); 350 break; 351 352 case RTFSOBJATTRADD_UNIX_GROUP: 353 rtFsObjInfoAttrSetUnixGroup(pObjInfo, Stat.st_gid); 354 break; 355 342 356 case RTFSOBJATTRADD_EASIZE: 343 357 /** @todo Use SGI extended attribute interface to query EA info. */ 344 358 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 345 359 pObjInfo->Attr.u.EASize.cb = 0; 346 break;347 348 case RTFSOBJATTRADD_NOTHING:349 case RTFSOBJATTRADD_UNIX:350 Assert(pObjInfo->Attr.enmAdditional == RTFSOBJATTRADD_UNIX);351 360 break; 352 361 -
trunk/src/VBox/Runtime/r3/win/dir-win.cpp
r28918 r34002 437 437 break; 438 438 439 case RTFSOBJATTRADD_UNIX_OWNER: 440 pDirEntry->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_OWNER; 441 pDirEntry->Info.Attr.u.UnixOwner.uid = ~0U; 442 pDirEntry->Info.Attr.u.UnixOwner.szName[0] = '\0'; /** @todo return something sensible here. */ 443 break; 444 445 case RTFSOBJATTRADD_UNIX_GROUP: 446 pDirEntry->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_GROUP; 447 pDirEntry->Info.Attr.u.UnixGroup.gid = ~0U; 448 pDirEntry->Info.Attr.u.UnixGroup.szName[0] = '\0'; 449 break; 450 439 451 default: 440 452 AssertMsgFailed(("Impossible!\n")); -
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r33540 r34002 680 680 switch (enmAdditionalAttribs) 681 681 { 682 case RTFSOBJATTRADD_EASIZE: 683 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 684 pObjInfo->Attr.u.EASize.cb = 0; 682 case RTFSOBJATTRADD_NOTHING: 683 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_NOTHING; 685 684 break; 686 685 … … 697 696 break; 698 697 699 case RTFSOBJATTRADD_NOTHING: 700 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_NOTHING; 698 case RTFSOBJATTRADD_UNIX_OWNER: 699 pObjInfo->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_OWNER; 700 pObjInfo->Info.Attr.u.UnixOwner.uid = ~0U; 701 pObjInfo->Info.Attr.u.UnixOwner.szName[0] = '\0'; /** @todo return something sensible here. */ 702 break; 703 704 case RTFSOBJATTRADD_UNIX_GROUP: 705 pObjInfo->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_GROUP; 706 pObjInfo->Info.Attr.u.UnixGroup.gid = ~0U; 707 pObjInfo->Info.Attr.u.UnixGroup.szName[0] = '\0'; 708 break; 709 710 case RTFSOBJATTRADD_EASIZE: 711 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 712 pObjInfo->Attr.u.EASize.cb = 0; 701 713 break; 702 714 -
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r33439 r34002 300 300 switch (enmAdditionalAttribs) 301 301 { 302 case RTFSOBJATTRADD_EASIZE: 303 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 304 pObjInfo->Attr.u.EASize.cb = 0; 302 case RTFSOBJATTRADD_NOTHING: 303 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_NOTHING; 305 304 break; 306 305 … … 317 316 break; 318 317 319 case RTFSOBJATTRADD_NOTHING: 320 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_NOTHING; 318 case RTFSOBJATTRADD_UNIX_OWNER: 319 pObjInfo->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_OWNER; 320 pObjInfo->Info.Attr.u.UnixOwner.uid = ~0U; 321 pObjInfo->Info.Attr.u.UnixOwner.szName[0] = '\0'; /** @todo return something sensible here. */ 322 break; 323 324 case RTFSOBJATTRADD_UNIX_GROUP: 325 pObjInfo->Info.Attr.enmAdditional = RTFSOBJATTRADD_UNIX_GROUP; 326 pObjInfo->Info.Attr.u.UnixGroup.gid = ~0U; 327 pObjInfo->Info.Attr.u.UnixGroup.szName[0] = '\0'; 328 break; 329 330 case RTFSOBJATTRADD_EASIZE: 331 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_EASIZE; 332 pObjInfo->Attr.u.EASize.cb = 0; 321 333 break; 322 334
Note:
See TracChangeset
for help on using the changeset viewer.