2628 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountReturn, MODULEUID, r); |
2628 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountReturn, MODULEUID, r); |
2629 return r; |
2629 return r; |
2630 } |
2630 } |
2631 |
2631 |
2632 |
2632 |
2633 |
2633 /** |
2634 /** |
2634 Checks the integrity of the File System mounted on the specified drive. |
2635 Checks the integrity of the disk on the specified drive. |
2635 The behaviour of this API and return codes are File System specific, |
2636 On FAT, this checks if a cluster number is invalid, if a cluster is allocated to |
2636 dependent on how the File System implements its CheckDisk functionality. |
2637 more than one file entry, if an unallocated cluster is not set free, and if size |
2637 Note that CheckDisk does not fix any errors that may be found, |
2638 of an entry is invalid. |
2638 it just reports the first problem it has found. |
2639 |
2639 |
2640 @param aDrive Path indicating the drive which contains the disk to be checked. If the drive |
2640 @param aDrive Path containing the drive to be checked. |
2641 information is not specified the current session drive is taken by default. |
2641 If the drive letter is not specified, the current session drive is taken by default. |
2642 Checkdisk is performed on the requested drive irrespective of the correctness or |
2642 |
2643 existance of the given path. |
2643 @return KErrNone If CheckDisk has not found any errors it knows about. |
2644 |
2644 KErrNotReady If the specified drive is not ready. |
2645 @return KErrNone, if successful; |
2645 KErrNotSupported If this functionality is not supported. |
2646 1, if successful but a file cluster contains a bad value; |
2646 KErrPermissionDenied If the caller does not have DiskAdmin capability. |
2647 2, if successful but two files are linked to the same cluster; |
2647 Other system-wide error codes. |
2648 3, if successful but an unallocated cluster contains a value; |
2648 |
2649 4, if successful but the size of a file is not equal to the number of clusters in chain; |
2649 @capability DiskAdmin |
2650 KErrNotReady, if the specified drive is empty; |
2650 |
2651 KErrNotSupported, if the drive cannot handle this request; |
2651 FAT File System specific information: |
2652 KErrPermissionDenied, if the caller doesn't have DiskAdmin capability; |
2652 |
2653 Other system wide error codes may also be returned. |
2653 CheckDisk checks for a limited amount of possible corruption cases such as |
2654 |
2654 invalid cluster numbers in the FAT table, lost and cross-linked cluster chains, |
2655 @capability DiskAdmin |
2655 various errors within the directory entry etc. |
|
2656 |
|
2657 If CheckDisk returns KErrNone, this means that there are no errors that CheckDisk on FAT is aware of. |
|
2658 |
|
2659 Error codes returned by the FAT version of CheckDisk include: |
|
2660 1 Bad cluster value in FAT table detected. |
|
2661 2 Cross-linked cluster chain detected. |
|
2662 3 Lost cluster chain detected. |
|
2663 4 File size does not correspond to the number of clusters reported in the FAT table. |
2656 */ |
2664 */ |
2657 EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const |
2665 EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const |
2658 { |
2666 { |
2659 TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive); |
2667 TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive); |
2660 TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive)); |
2668 TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive)); |
2666 |
2674 |
2667 |
2675 |
2668 |
2676 |
2669 EFSRV_EXPORT_C TInt RFs::ScanDrive(const TDesC& aDrive) const |
2677 EFSRV_EXPORT_C TInt RFs::ScanDrive(const TDesC& aDrive) const |
2670 /** |
2678 /** |
2671 Checks the specified drive for errors and corrects them. Specifically, it |
2679 Checks the integrity of the File System mounted on the specified drive |
2672 checks if long file name entries' IDs are in sequence and short name is valid, |
2680 and attempts to correct some known File System errors. |
2673 and file's allocated clusters are not used by other files. |
2681 The behaviour of this API and return codes are File System specific, |
2674 |
2682 dependent on how the File System implements its ScanDrive functionality. |
2675 This does not run on the internal RAM drive, and only applies to a |
2683 |
2676 FAT file system. |
2684 ScanDrive will not run on drives that have files or directories opened. |
2677 |
2685 |
2678 @param aDrive Path indicating the drive which contains the disk to be checked. If the drive |
2686 @param aDrive Path indicating the drive which contains the disk to be checked. |
2679 information is not specified the current session drive is taken by default. |
2687 If the drive letter is not specified, the current session drive is taken by default. |
2680 ScanDrive is performed on the requested drive irrespective of the correctness or |
2688 |
2681 existance of the given path. |
2689 @return KErrNone On success. |
2682 |
2690 KErrInUse If drive is in use (i.e. if there are files and/or directories opened in the drive). |
2683 @return KErrNone if successful, |
2691 KErrCorrupt If ScanDrive has detected a file system corruption that it cannot fix. |
2684 KErrPermissionDenied if caller doesn't have capability DiskAdmin, |
2692 KErrNotSupported If this functionality is not supported. |
2685 KErrInUse if drive is in use, |
2693 KErrPermissionDenied If the caller does not have DiskAdmin capability. |
2686 otherwise one of the other system-wide error codes |
2694 Other system-wide error codes. |
2687 |
2695 |
2688 @capability DiskAdmin |
2696 @capability DiskAdmin |
|
2697 |
|
2698 FAT File System specific information: |
|
2699 |
|
2700 ScanDrive is intended to be run ONLY on "Rugged-FAT" file system |
|
2701 which is applicable to internal non-removable drives. |
|
2702 Internal RAM drives are not supported. |
|
2703 |
|
2704 The "Rugged FAT" file system is designed in such a way that only a limited number |
|
2705 of known cases of corruption can be caused by sudden power loss. |
|
2706 All of these known cases can be corrected by ScanDrive. |
|
2707 Hence, running ScanDrive on "Rugged FAT" file system will result in: |
|
2708 KErrNone If there was no File System corruption or ScanDrive has successfully repaired the File System. |
|
2709 KErrCorrupt If ScanDrive has found a File System error that it cannot repair. |
|
2710 Other system-wide error codes, see above. |
|
2711 |
|
2712 Running ScanDrive on removable media or media that has FAT file system not in |
|
2713 "Rugged FAT" mode is not practical, because ScanDrive is not designed for this. |
|
2714 Therefore, do not treat ScanDrive on removable media as a generic "disk repair utility". |
2689 */ |
2715 */ |
2690 { |
2716 { |
2691 TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive); |
2717 TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive); |
2692 TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive)); |
2718 TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive)); |
2693 |
2719 |