Changeset 30365 in vbox
- Timestamp:
- Jun 22, 2010 12:08:20 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
include/iprt/fs.h (modified) (2 diffs)
-
src/VBox/Main/ConsoleImpl2.cpp (modified) (7 diffs)
-
src/VBox/Runtime/r3/fs.cpp (modified) (3 diffs)
-
src/VBox/Runtime/r3/posix/fs-posix.cpp (modified) (6 diffs)
-
src/VBox/Runtime/r3/win/fs-win.cpp (modified) (1 diff)
-
src/VBox/Runtime/testcase/tstRTFsQueries.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/fs.h
r30281 r30365 180 180 181 181 182 /** @name Filesystem type IDs. Used by RTFsQueryType. */ 183 #define RTFS_FS_TYPE_UNKNOWN 0 184 #define RTFS_FS_TYPE_EXT 1 185 #define RTFS_FS_TYPE_EXT2 2 186 #define RTFS_FS_TYPE_EXT3 3 187 #define RTFS_FS_TYPE_EXT4 4 188 #define RTFS_FS_TYPE_TMPFS 5 189 #define RTFS_FS_TYPE_JFS 6 190 #define RTFS_FS_TYPE_NFS 7 191 #define RTFS_FS_TYPE_HFS 8 192 #define RTFS_FS_TYPE_CIFS 9 193 #define RTFS_FS_TYPE_FAT 10 194 #define RTFS_FS_TYPE_NTFS 11 195 #define RTFS_FS_TYPE_ZFS 12 196 #define RTFS_FS_TYPE_XFS 13 197 #define RTFS_FS_TYPE_AUTOFS 14 198 #define RTFS_FS_TYPE_DEVFS 15 182 /** 183 * Filesystem type IDs returned by RTFsQueryType. 184 * 185 * This enum is subject to changes and must not be used as part of any ABI or 186 * binary format (file, network, etc). 187 * 188 * @remarks When adding new entries, please update RTFsTypeName(). Also, try 189 * add them to the most natural group. 190 */ 191 typedef enum RTFSTYPE 192 { 193 /** Unknown file system. */ 194 RTFSTYPE_UNKNOWN = 0, 195 196 /** Universal Disk Format. */ 197 RTFSTYPE_UDF, 198 /** ISO 9660, aka Compact Disc File System (CDFS). */ 199 RTFSTYPE_ISO9660, 200 /** Filesystem in Userspace. */ 201 RTFSTYPE_FUSE, 202 /** VirtualBox shared folders. */ 203 RTFSTYPE_VBOXSHF, 204 205 /* Linux: */ 206 RTFSTYPE_EXT, 207 RTFSTYPE_EXT2, 208 RTFSTYPE_EXT3, 209 RTFSTYPE_EXT4, 210 RTFSTYPE_XFS, 211 RTFSTYPE_CIFS, 212 RTFSTYPE_SMBFS, 213 RTFSTYPE_TMPFS, 214 RTFSTYPE_SYSFS, 215 RTFSTYPE_PROC, 216 217 /* Windows: */ 218 /** New Technology File System. */ 219 RTFSTYPE_NTFS, 220 /** FAT12, FAT16 and FAT32 lumped into one basket. 221 * The partition size limit of FAT12 and FAT16 will be the factor 222 * limiting the file size (except, perhaps for the 64KB cluster case on 223 * non-Windows hosts). */ 224 RTFSTYPE_FAT, 225 226 /* Solaris: */ 227 /** Zettabyte File System. */ 228 RTFSTYPE_ZFS, 229 /** Unix File System. */ 230 RTFSTYPE_UFS, 231 /** Network File System. */ 232 RTFSTYPE_NFS, 233 234 /* Mac OS X: */ 235 /** Hierarchical File System. */ 236 RTFSTYPE_HFS, 237 /** @todo RTFSTYPE_HFS_PLUS? */ 238 RTFSTYPE_AUTOFS, 239 RTFSTYPE_DEVFS, 240 241 /* *BSD: */ 242 243 /* OS/2: */ 244 /** High Performance File System. */ 245 RTFSTYPE_HPFS, 246 /** Journaled File System (v2). */ 247 RTFSTYPE_JFS, 248 249 /** The end of valid Filesystem types IDs. */ 250 RTFSTYPE_END, 251 /** The usual 32-bit type blow up. */ 252 RTFSTYPE_32BIT_HACK = 0x7fffffff 253 } RTFSTYPE; 254 /** Pointer to a Filesystem type ID. */ 255 typedef RTFSTYPE *PRTFSTYPE; 199 256 200 257 … … 408 465 * 409 466 * @returns iprt status code. 410 * @param pszFsPath Path within the mounted filesystem. 411 * In case this is a symlink, the file it refers to 412 * isevaluated.413 * @param p u32Type Where to store the filesystem type.414 * See RTFS_FS_TYPE_xxx constants.415 */ 416 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type);467 * @param pszFsPath Path within the mounted filesystem. It must exist. 468 * In case this is a symlink, the file it refers to is 469 * evaluated. 470 * @param penmType Where to store the filesystem type, this is always 471 * set. See RTFSTYPE for the values. 472 */ 473 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType); 417 474 418 475 #endif /* IN_RING3 */ 476 477 /** 478 * Gets the name of a filesystem type. 479 * 480 * @returns Pointer to a read-only string containing the name. 481 * @param enmType A valid filesystem ID. If outside the valid range, 482 * the returned string will be pointing to a static 483 * memory buffer which will be changed on subsequent 484 * calls to this function by any thread. 485 */ 486 RTDECL(const char *) RTFsTypeName(RTFSTYPE enmType); 419 487 420 488 /** -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r30324 r30365 2421 2421 hrc = pMachine->COMGETTER(SnapshotFolder)(strSnap.asOutParam()); H(); 2422 2422 Utf8Str utfSnap = Utf8Str(strSnap); 2423 uint32_t typeFile, typeSnap; 2424 rc = RTFsQueryType(utfFile.c_str(), &typeFile); 2423 RTFSTYPE enmFsTypeFile; 2424 RTFSTYPE enmFsTypeSnap; 2425 rc = RTFsQueryType(utfFile.c_str(), &enmFsTypeFile); 2425 2426 if (RT_SUCCESS(rc)) 2426 rc = RTFsQueryType(utfSnap.c_str(), & typeSnap);2427 rc = RTFsQueryType(utfSnap.c_str(), &enmFsTypeSnap); 2427 2428 ULONG64 u64Size; 2428 2429 hrc = pMedium->COMGETTER(LogicalSize)(&u64Size); H(); … … 2431 2432 { 2432 2433 #ifdef RT_OS_WINDOWS 2433 if ( typeFile == RTFS_FS_TYPE_FAT2434 if ( enmFsTypeFile == RTFSTYPE_FAT 2434 2435 && u64Size >= _4G) 2435 2436 { … … 2446 2447 } 2447 2448 #else /* !RT_OS_WINDOWS */ 2448 if ( typeFile == RTFS_FS_TYPE_FAT2449 || typeFile == RTFS_FS_TYPE_EXT2450 || typeFile == RTFS_FS_TYPE_EXT22451 || typeFile == RTFS_FS_TYPE_EXT32452 || typeFile == RTFS_FS_TYPE_EXT4)2449 if ( enmFsTypeFile == RTFSTYPE_FAT 2450 || enmFsTypeFile == RTFSTYPE_EXT 2451 || enmFsTypeFile == RTFSTYPE_EXT2 2452 || enmFsTypeFile == RTFSTYPE_EXT3 2453 || enmFsTypeFile == RTFSTYPE_EXT4) 2453 2454 { 2454 2455 RTFILE file; … … 2486 2487 * Here we test only for a FAT partition as we had to create a dummy file otherwise 2487 2488 */ 2488 if ( typeSnap == RTFS_FS_TYPE_FAT2489 if ( enmFsTypeSnap == RTFSTYPE_FAT 2489 2490 && u64Size >= _4G 2490 2491 && !mfSnapshotFolderSizeWarningShown) … … 2522 2523 if ( (uCaps & MediumFormatCapabilities_Asynchronous) 2523 2524 && !fUseHostIOCache 2524 && ( typeFile == RTFS_FS_TYPE_EXT42525 || typeFile == RTFS_FS_TYPE_XFS))2525 && ( enmFsTypeFile == RTFSTYPE_EXT4 2526 || enmFsTypeFile == RTFSTYPE_XFS)) 2526 2527 { 2527 2528 setVMRuntimeErrorCallbackF(pVM, this, 0, … … 2536 2537 "onto a different file system.\n" 2537 2538 "The host I/O cache will now be enabled for this medium"), 2538 strFile.raw(), typeFile == RTFS_FS_TYPE_EXT4 ? "ext4" : "xfs");2539 strFile.raw(), enmFsTypeFile == RTFSTYPE_EXT4 ? "ext4" : "xfs"); 2539 2540 fUseHostIOCache = true; 2540 2541 } 2541 2542 else if ( (uCaps & MediumFormatCapabilities_Asynchronous) 2542 2543 && !fUseHostIOCache 2543 && ( typeSnap == RTFS_FS_TYPE_EXT42544 || typeSnap == RTFS_FS_TYPE_XFS)2544 && ( enmFsTypeSnap == RTFSTYPE_EXT4 2545 || enmFsTypeSnap == RTFSTYPE_XFS) 2545 2546 && !mfSnapshotFolderExt4WarningShown) 2546 2547 { … … 2556 2557 "onto a different file system.\n" 2557 2558 "The host I/O cache will now be enabled for this medium"), 2558 typeSnap == RTFS_FS_TYPE_EXT4 ? "ext4" : "xfs");2559 enmFsTypeSnap == RTFSTYPE_EXT4 ? "ext4" : "xfs"); 2559 2560 fUseHostIOCache = true; 2560 2561 mfSnapshotFolderExt4WarningShown = true; -
trunk/src/VBox/Runtime/r3/fs.cpp
r28800 r30365 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 40 40 41 41 #include <iprt/fs.h> 42 #include "internal/iprt.h" 43 44 #include <iprt/asm.h> 42 45 #include <iprt/assert.h> 46 #include <iprt/ctype.h> 47 #include <iprt/path.h> 48 #include <iprt/string.h> 43 49 #include <iprt/time.h> 44 #include <iprt/string.h>45 #include <iprt/path.h>46 #include <iprt/ctype.h>47 50 #include "internal/fs.h" 48 51 … … 292 295 pObjInfo->Attr.u.Unix.Device = pStat->st_rdev; 293 296 } 294 295 297 #endif /* !RT_OS_WINDOWS */ 298 299 300 RTDECL(const char *) RTFsTypeName(RTFSTYPE enmType) 301 { 302 switch (enmType) 303 { 304 case RTFSTYPE_UNKNOWN: return "unknown"; 305 case RTFSTYPE_UDF: return "udf"; 306 case RTFSTYPE_ISO9660: return "iso9660"; 307 case RTFSTYPE_FUSE: return "fuse"; 308 case RTFSTYPE_VBOXSHF: return "vboxshf"; 309 310 case RTFSTYPE_EXT: return "ext"; 311 case RTFSTYPE_EXT2: return "ext2"; 312 case RTFSTYPE_EXT3: return "ext3"; 313 case RTFSTYPE_EXT4: return "ext4"; 314 case RTFSTYPE_XFS: return "xfs"; 315 case RTFSTYPE_CIFS: return "cifs"; 316 case RTFSTYPE_SMBFS: return "smbfs"; 317 case RTFSTYPE_TMPFS: return "tmpfs"; 318 case RTFSTYPE_SYSFS: return "sysfs"; 319 case RTFSTYPE_PROC: return "proc"; 320 321 case RTFSTYPE_NTFS: return "ntfs"; 322 case RTFSTYPE_FAT: return "fat"; 323 324 case RTFSTYPE_ZFS: return "zfs"; 325 case RTFSTYPE_UFS: return "ufs"; 326 case RTFSTYPE_NFS: return "nfs"; 327 328 case RTFSTYPE_HFS: return "hfs"; 329 case RTFSTYPE_AUTOFS: return "autofs"; 330 case RTFSTYPE_DEVFS: return "devfs"; 331 332 case RTFSTYPE_HPFS: return "hpfs"; 333 case RTFSTYPE_JFS: return "jfs"; 334 335 case RTFSTYPE_END: return "end"; 336 case RTFSTYPE_32BIT_HACK: break; 337 } 338 339 /* Don't put this in as 'default:', we wish GCC to warn about missing cases. */ 340 static char s_asz[4][64]; 341 static uint32_t volatile s_i = 0; 342 uint32_t i = ASMAtomicIncU32(&s_i) % RT_ELEMENTS(s_asz); 343 RTStrPrintf(s_asz[i], sizeof(s_asz[i]), "type=%d", enmType); 344 return s_asz[i]; 345 } 346 -
trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp
r30324 r30365 171 171 172 172 173 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type) 174 { 173 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType) 174 { 175 *penmType = RTFSTYPE_UNKNOWN; 176 175 177 /* 176 178 * Validate input. 177 179 */ 178 AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER); 180 AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER); 181 AssertReturn(*pszFsPath, VERR_INVALID_PARAMETER); 179 182 180 183 /* … … 186 189 if (RT_SUCCESS(rc)) 187 190 { 188 *pu32Type = RTFS_FS_TYPE_UNKNOWN;189 190 191 struct stat Stat; 191 192 if (!stat(pszNativeFsPath, &Stat)) … … 197 198 if (mounted) 198 199 { 199 char szBuf[1024];200 struct stat mntStat;201 struct mntent mntEnt;200 char szBuf[1024]; 201 struct stat mntStat; 202 struct mntent mntEnt; 202 203 while (getmntent_r(mounted, &mntEnt, szBuf, sizeof(szBuf))) 203 204 { … … 207 208 { 208 209 if (!strcmp("ext4", mntEnt.mnt_type)) 209 *p u32Type = RTFS_FS_TYPE_EXT4;210 *penmType = RTFSTYPE_EXT4; 210 211 else if (!strcmp("ext3", mntEnt.mnt_type)) 211 *p u32Type = RTFS_FS_TYPE_EXT3;212 *penmType = RTFSTYPE_EXT3; 212 213 else if (!strcmp("ext2", mntEnt.mnt_type)) 213 *pu32Type = RTFS_FS_TYPE_EXT2; 214 *penmType = RTFSTYPE_EXT2; 215 else if (!strcmp("jfs", mntEnt.mnt_type)) 216 *penmType = RTFSTYPE_JFS; 214 217 else if (!strcmp("xfs", mntEnt.mnt_type)) 215 *p u32Type = RTFS_FS_TYPE_XFS;218 *penmType = RTFSTYPE_XFS; 216 219 else if ( !strcmp("vfat", mntEnt.mnt_type) 217 220 || !strcmp("msdos", mntEnt.mnt_type)) 218 *pu32Type = RTFS_FS_TYPE_FAT; 221 *penmType = RTFSTYPE_FAT; 222 else if (!strcmp("ntfs", mntEnt.mnt_type)) 223 *penmType = RTFSTYPE_NTFS; 224 else if (!strcmp("hpfs", mntEnt.mnt_type)) 225 *penmType = RTFSTYPE_HPFS; 226 else if (!strcmp("ufs", mntEnt.mnt_type)) 227 *penmType = RTFSTYPE_UFS; 219 228 else if (!strcmp("tmpfs", mntEnt.mnt_type)) 220 *p u32Type = RTFS_FS_TYPE_TMPFS;229 *penmType = RTFSTYPE_TMPFS; 221 230 else if (!strcmp("hfsplus", mntEnt.mnt_type)) 222 *pu32Type = RTFS_FS_TYPE_HFS; 231 *penmType = RTFSTYPE_HFS; 232 else if (!strcmp("udf", mntEnt.mnt_type)) 233 *penmType = RTFSTYPE_UDF; 234 else if (!strcmp("iso9660", mntEnt.mnt_type)) 235 *penmType = RTFSTYPE_ISO9660; 236 else if (!strcmp("smbfs", mntEnt.mnt_type)) 237 *penmType = RTFSTYPE_SMBFS; 238 else if (!strcmp("cifs", mntEnt.mnt_type)) 239 *penmType = RTFSTYPE_CIFS; 240 else if (!strcmp("nfs", mntEnt.mnt_type)) 241 *penmType = RTFSTYPE_NFS; 242 else if (!strcmp("nfs4", mntEnt.mnt_type)) 243 *penmType = RTFSTYPE_NFS; 244 else if (!strcmp("sysfs", mntEnt.mnt_type)) 245 *penmType = RTFSTYPE_SYSFS; 246 else if (!strcmp("proc", mntEnt.mnt_type)) 247 *penmType = RTFSTYPE_PROC; 248 else if ( !strcmp("fuse", mntEnt.mnt_type) 249 || !strncmp("fuse.", mntEnt.mnt_type, 5)) 250 *penmType = RTFSTYPE_FUSE; 223 251 else 224 252 { … … 232 260 endmntent(mounted); 233 261 } 262 234 263 #elif defined(RT_OS_SOLARIS) 235 264 if (!strcmp("zfs", Stat.st_fstype)) 236 *pu32Type = RTFS_FS_TYPE_ZFS; 265 *penmType = RTFSTYPE_ZFS; 266 else if (!strcmp("ufs", Stat.st_fstype)) 267 *penmType = RTFSTYPE_UFS; 268 else if (!strcmp("nfs", Stat.st_fstype)) 269 *penmType = RTFSTYPE_NFS; 270 237 271 #elif defined(RT_OS_DARWIN) 238 272 struct statfs statfsBuf; … … 240 274 { 241 275 if (!strcmp("hfs", statfsBuf.f_fstypename)) 242 *p u32Type = RTFS_FS_TYPE_HFS;276 *penmType = RTFSTYPE_HFS; 243 277 else if ( !strcmp("fat", statfsBuf.f_fstypename) 244 278 || !strcmp("msdos", statfsBuf.f_fstypename)) 245 *p u32Type = RTFS_FS_TYPE_FAT;279 *penmType = RTFSTYPE_FAT; 246 280 else if (!strcmp("ntfs", statfsBuf.f_fstypename)) 247 *p u32Type = RTFS_FS_TYPE_NTFS;281 *penmType = RTFSTYPE_NTFS; 248 282 else if (!strcmp("autofs", statfsBuf.f_fstypename)) 249 *p u32Type = RTFS_FS_TYPE_AUTOFS;283 *penmType = RTFSTYPE_AUTOFS; 250 284 else if (!strcmp("devfs", statfsBuf.f_fstypename)) 251 *p u32Type = RTFS_FS_TYPE_DEVFS;285 *penmType = RTFSTYPE_DEVFS; 252 286 else if (!strcmp("nfs", statfsBuf.f_fstypename)) 253 *p u32Type = RTFS_FS_TYPE_NFS;287 *penmType = RTFSTYPE_NFS; 254 288 } 255 289 else -
trunk/src/VBox/Runtime/r3/win/fs-win.cpp
r30279 r30365 334 334 } 335 335 336 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, uint32_t *pu32Type) 337 { 338 int rc = VINF_SUCCESS; 339 340 *pu32Type = RTFS_FS_TYPE_UNKNOWN; 341 342 HANDLE hFile = CreateFile(pszFsPath, 343 GENERIC_READ, 344 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 345 NULL, 346 OPEN_EXISTING, 347 FILE_FLAG_BACKUP_SEMANTICS, 348 NULL); 349 if (hFile != INVALID_HANDLE_VALUE) 350 { 351 char abBuf[8192]; 352 IO_STATUS_BLOCK Ios; 353 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, 354 abBuf, sizeof(abBuf), 355 FileFsAttributeInformation); 356 if (rcNt >= 0) 357 { 358 PFILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PFILE_FS_ATTRIBUTE_INFORMATION)abBuf; 359 if ( pFsAttrInfo->FileSystemName[0] == 'N' 360 && pFsAttrInfo->FileSystemName[1] == 'T' 361 && pFsAttrInfo->FileSystemName[2] == 'F' 362 && pFsAttrInfo->FileSystemName[3] == 'S' 363 && pFsAttrInfo->FileSystemName[4] == '\0') 364 *pu32Type = RTFS_FS_TYPE_NTFS; 365 else if ( pFsAttrInfo->FileSystemName[0] == 'F' 366 && pFsAttrInfo->FileSystemName[1] == 'A' 367 && pFsAttrInfo->FileSystemName[2] == 'T' 368 && ( ( pFsAttrInfo->FileSystemName[3] == '3' 369 && pFsAttrInfo->FileSystemName[4] == '2' 370 && pFsAttrInfo->FileSystemName[5] == '\0') 371 || pFsAttrInfo->FileSystemName[3] == '\0')) 372 /* This is either FAT32 or FAT12/16. IMO it doesn't make 373 * sense to distinguish more detailed because we cannot 374 * easily distinguish between these FAT types on Linux 375 * and users who put some image file on an FAT16 partition 376 * should know what they are doing. */ 377 *pu32Type = RTFS_FS_TYPE_FAT; 336 337 /** 338 * Internal helper for comparing a WCHAR string with a char string. 339 * 340 * @returns 0 if equal, -1 if @a psz1 < @a psz2, 1 if @a psz1 < @a psz2. 341 * @param pwsz1 The first string. 342 * @param psz2 The second string. 343 */ 344 static int rtFsWinCmpUtf16(WCHAR const *pwsz1, const char *psz2) 345 { 346 for (;;) 347 { 348 unsigned ch1 = *pwsz1++; 349 unsigned ch2 = (unsigned char)*psz2++; 350 if (ch1 != ch2) 351 return ch1 < ch2 ? -1 : 1; 352 if (!ch1) 353 return 0; 354 } 355 } 356 357 358 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType) 359 { 360 *penmType = RTFSTYPE_UNKNOWN; 361 362 AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER); 363 AssertReturn(*pszFsPath, VERR_INVALID_PARAMETER); 364 365 /* 366 * Convert the path and try open it. 367 */ 368 PRTUTF16 pwszFsPath; 369 int rc = RTStrToUtf16(pszFsPath, &pwszFsPath); 370 if (RT_SUCCESS(rc)) 371 { 372 HANDLE hFile = CreateFileW(pwszFsPath, 373 GENERIC_READ, 374 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 375 NULL, 376 OPEN_EXISTING, 377 FILE_FLAG_BACKUP_SEMANTICS, 378 NULL); 379 if (hFile != INVALID_HANDLE_VALUE) 380 { 381 /* 382 * Use the NT api directly to get the file system name. 383 */ 384 char abBuf[8192]; 385 IO_STATUS_BLOCK Ios; 386 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, 387 abBuf, sizeof(abBuf), 388 FileFsAttributeInformation); 389 if (rcNt >= 0) 390 { 391 PFILE_FS_ATTRIBUTE_INFORMATION pFsAttrInfo = (PFILE_FS_ATTRIBUTE_INFORMATION)abBuf; 392 393 if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "NTFS")) 394 *penmType = RTFSTYPE_NTFS; 395 else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "FAT")) 396 *penmType = RTFSTYPE_FAT; 397 else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "FAT32")) 398 *penmType = RTFSTYPE_FAT; 399 else if (!rtFsWinCmpUtf16(pFsAttrInfo->FileSystemName, "VBoxSharedFolderFS")) 400 *penmType = RTFSTYPE_VBOXSHF; 401 } 402 else 403 rc = RTErrConvertFromNtStatus(rcNt); 404 CloseHandle(hFile); 378 405 } 379 /* else: Is RTFS_FS_UNKNOWN suffient or should we return an error? */380 CloseHandle(hFile);381 }382 406 else 407 rc = RTErrConvertFromWin32(GetLastError()); 408 RTUtf16Free(pwszFsPath); 409 } 383 410 return rc; 384 411 } -
trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp
r30281 r30365 77 77 } 78 78 79 uint32_t u32Type; 80 rc = RTFsQueryType(argv[i], &u32Type); 81 if (RT_FAILURE(rc)) 79 RTFSTYPE enmType; 80 rc = RTFsQueryType(argv[i], &enmType); 81 if (RT_SUCCESS(rc)) 82 RTPrintf("tstRTFsQueries: file system type is '%s'\n", RTFsTypeName(enmType)); 83 else 82 84 { 83 85 RTPrintf("tstRTFsQueries: RTFsQueryType failed, rc=%Rrc\n", rc); 84 86 cErrors++; 85 }86 else87 {88 static const char *s_apszType[] =89 {90 "unknown",91 "ext",92 "ext2",93 "ext3",94 "ext4",95 "tmpfs",96 "jfs",97 "nfs",98 "hfs",99 "cifs",100 "fat",101 "ntfs",102 "zfs",103 "xfs",104 "autofs",105 "devfs"106 };107 108 if (u32Type < RT_ELEMENTS(s_apszType))109 RTPrintf("tstRTFsQueries: file system type is '%s'\n", s_apszType[u32Type]);110 else111 RTPrintf("tstRTFsQueries: unknown file system type %d\n", u32Type);112 87 } 113 88
Note:
See TracChangeset
for help on using the changeset viewer.

