ReactOS  0.4.13-dev-235-g7373cb3
Defragment.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Defragment
4 
5 *****************************************************************************/
6 
7 
8 #ifndef DEFRAGMENT_H
9 #define DEFRAGMENT_H
10 
11 
12 #include "Unfrag.h"
13 #include "DriveVolume.h"
14 #include "Mutex.h"
15 
16 
17 extern int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename, uint32 totalWidth);
18 
19 
20 typedef struct DefragReport
21 {
22  wstring RootPath;
31  double AverageFragments; // = FilesFragments / FilesCount
33  double PercentSlack;
34 
35  vector<uint32> FraggedFiles;
36  vector<uint32> UnfraggedFiles;
37  vector<uint32> UnmovableFiles;
38 } DefragReport;
39 
40 
42 {
43 public:
45  ~Defragment ();
46 
47  // Commands
48  void Start (void);
49  void TogglePause (void);
50  void Stop (void);
51 
52  // Info
53  bool IsDoneYet (void);
54  bool HasError (void);
55  wstring GetStatusString (void);
56  double GetStatusPercent (void);
57  DefragType GetDefragType (void) { return (Method); }
58  DefragReport &GetDefragReport (void) { return (Report); }
59  DriveVolume &GetVolume (void) { return (Volume); }
60 
61  // Mutex
62  void Lock (void) { DefragMutex.Lock (); }
63  void Unlock (void) { DefragMutex.Unlock (); }
64 
65  // Limit length of status string to 70 chars?
66  bool GetDoLimitLength (void) { return (DoLimitLength); }
67  void SetDoLimitLength (bool L) { DoLimitLength = L; }
68 
69 private:
70  void FastDefrag (void);
71  void ExtensiveDefrag (void);
72  void SetStatusString (wstring NewStatus);
73 
74  DWORD LastBMPUpdate; // Last time volume bitmap was updated
78  wstring DriveName;
80  wstring StatusString;
81  wstring ErrorString;
82  double StatusPercent;
84  bool Error;
85  bool Done;
86  bool PleaseStop;
89 };
90 
91 
92 #endif // DEFRAGMENT_H
unsigned long long uint64
Definition: platform.h:18
vector< uint32 > UnfraggedFiles
Definition: Defragment.h:36
uint64 FilesSizeClusters
Definition: Defragment.h:28
double PercentSlack
Definition: Defragment.h:33
vector< uint32 > UnmovableFiles
Definition: Defragment.h:37
void Stop(void)
Definition: Defragment.cpp:443
uint64 DirsCount
Definition: Defragment.h:24
DWORD LastBMPUpdate
Definition: Defragment.h:74
Mutex DefragMutex
Definition: Defragment.h:83
bool IsDoneYet(void)
Definition: Defragment.cpp:151
unsigned int uint32
Definition: types.h:32
void FastDefrag(void)
const char * filename
Definition: ioapi.h:135
double PercentFragged
Definition: Defragment.h:32
Definition: Mutex.h:15
void Start(void)
Definition: Defragment.cpp:157
double GetStatusPercent(void)
Definition: Defragment.cpp:145
void Unlock(void)
Definition: Mutex.h:52
uint64 FilesSlackBytes
Definition: Defragment.h:29
wstring RootPath
Definition: Defragment.h:22
void SetDoLimitLength(bool L)
Definition: Defragment.h:67
uint64 FilesCount
Definition: Defragment.h:25
DefragReport & GetDefragReport(void)
Definition: Defragment.h:58
void ExtensiveDefrag(void)
double AverageFragments
Definition: Defragment.h:31
double StatusPercent
Definition: Defragment.h:82
wstring StatusString
Definition: Defragment.h:80
wstring ErrorString
Definition: Defragment.h:81
DefragType Method
Definition: Defragment.h:77
vector< uint32 > FraggedFiles
Definition: Defragment.h:35
DefragType DefragMethod
Definition: Defragment.h:88
bool PleasePause
Definition: Defragment.h:87
struct DefragReport DefragReport
unsigned long DWORD
Definition: ntddk_ex.h:95
void Lock(void)
Definition: Defragment.h:62
uint64 FilesSizeOnDisk
Definition: Defragment.h:27
Defragment(wstring Name, DefragType DefragMethod)
Definition: Defragment.cpp:81
void Lock(void)
Definition: Mutex.h:43
wstring DriveName
Definition: Defragment.h:78
bool HasError(void)
Definition: Defragment.cpp:454
static const WCHAR L[]
Definition: oid.c:1250
DefragType GetDefragType(void)
Definition: Defragment.h:57
DefragReport Report
Definition: Defragment.h:75
uint64 DiskSizeBytes
Definition: Defragment.h:23
DriveVolume & GetVolume(void)
Definition: Defragment.h:59
DriveVolume Volume
Definition: Defragment.h:79
void SetStatusString(wstring NewStatus)
Definition: Defragment.cpp:123
Definition: services.c:325
bool DoLimitLength
Definition: Defragment.h:76
void Unlock(void)
Definition: Defragment.h:63
DefragType
Definition: Unfrag.h:66
bool GetDoLimitLength(void)
Definition: Defragment.h:66
uint64 FilesSizeBytes
Definition: Defragment.h:26
uint32 FilesFragments
Definition: Defragment.h:30
bool Error
Definition: Defragment.h:84
int FitName(wchar_t *destination, const wchar_t *path, const wchar_t *filename, uint32 totalWidth)
Definition: Defragment.cpp:9
wstring GetStatusString(void)
Definition: Defragment.cpp:133
void TogglePause(void)
Definition: Defragment.cpp:432
bool PleaseStop
Definition: Defragment.h:86
bool Done
Definition: Defragment.h:85