xref: /reactos/dll/shellext/shellbtrfs/balance.h (revision 1734f297)
1 /* Copyright (c) Mark Harmstone 2016-17
2  *
3  * This file is part of WinBtrfs.
4  *
5  * WinBtrfs is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public Licence as published by
7  * the Free Software Foundation, either version 3 of the Licence, or
8  * (at your option) any later version.
9  *
10  * WinBtrfs is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public Licence for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public Licence
16  * along with WinBtrfs.  If not, see <http://www.gnu.org/licenses/>. */
17 
18 #pragma once
19 
20 #include <windows.h>
21 #ifndef __REACTOS__
22 #include "../btrfsioctl.h"
23 #else
24 #include "btrfsioctl.h"
25 #endif
26 
27 class BtrfsBalance {
28 public:
29     BtrfsBalance(const wstring& drive, bool RemoveDevice = false, bool ShrinkDevice = false) {
30         removing = false;
31         devices = nullptr;
32         called_from_RemoveDevice = RemoveDevice;
33         called_from_ShrinkDevice = ShrinkDevice;
34         fn = drive;
35     }
36 
37     void ShowBalance(HWND hwndDlg);
38     INT_PTR CALLBACK BalanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
39     INT_PTR CALLBACK BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
40 
41 private:
42     void ShowBalanceOptions(HWND hwndDlg, uint8_t type);
43     void SaveBalanceOpts(HWND hwndDlg);
44     void StartBalance(HWND hwndDlg);
45     void RefreshBalanceDlg(HWND hwndDlg, bool first);
46     void PauseBalance(HWND hwndDlg);
47     void StopBalance(HWND hwndDlg);
48 
49     uint32_t balance_status;
50     btrfs_balance_opts data_opts, metadata_opts, system_opts;
51     uint8_t opts_type;
52     btrfs_query_balance bqb;
53     bool cancelling;
54     bool removing;
55     bool shrinking;
56     wstring fn;
57     btrfs_device* devices;
58     bool readonly;
59     bool called_from_RemoveDevice, called_from_ShrinkDevice;
60 };
61