ReactOS  0.4.15-dev-1377-ga59cecd
BtrfsBalance Class Reference

#include <balance.h>

Collaboration diagram for BtrfsBalance:

Public Member Functions

 BtrfsBalance (const wstring &drive, bool RemoveDevice=false, bool ShrinkDevice=false)
 
void ShowBalance (HWND hwndDlg)
 
INT_PTR CALLBACK BalanceDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK BalanceOptsDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Private Member Functions

void ShowBalanceOptions (HWND hwndDlg, uint8_t type)
 
void SaveBalanceOpts (HWND hwndDlg)
 
void StartBalance (HWND hwndDlg)
 
void RefreshBalanceDlg (HWND hwndDlg, bool first)
 
void PauseBalance (HWND hwndDlg)
 
void StopBalance (HWND hwndDlg)
 

Private Attributes

uint32_t balance_status
 
btrfs_balance_opts data_opts
 
btrfs_balance_opts metadata_opts
 
btrfs_balance_opts system_opts
 
uint8_t opts_type
 
btrfs_query_balance bqb
 
bool cancelling
 
bool removing
 
bool shrinking
 
wstring fn
 
btrfs_devicedevices
 
bool readonly
 
bool called_from_RemoveDevice
 
bool called_from_ShrinkDevice
 

Detailed Description

Definition at line 27 of file balance.h.

Constructor & Destructor Documentation

◆ BtrfsBalance()

BtrfsBalance::BtrfsBalance ( const wstring &  drive,
bool  RemoveDevice = false,
bool  ShrinkDevice = false 
)
inline

Definition at line 29 of file balance.h.

29  {
30  removing = false;
31  devices = nullptr;
32  called_from_RemoveDevice = RemoveDevice;
33  called_from_ShrinkDevice = ShrinkDevice;
34  fn = drive;
35  }
bool removing
Definition: balance.h:54
bool called_from_RemoveDevice
Definition: balance.h:59
bool called_from_ShrinkDevice
Definition: balance.h:59
wstring fn
Definition: balance.h:56
btrfs_device * devices
Definition: balance.h:57
static char drive[2]
Definition: batch.c:28

Member Function Documentation

◆ BalanceDlgProc()

INT_PTR CALLBACK BtrfsBalance::BalanceDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 859 of file balance.cpp.

859  {
860  try {
861  switch (uMsg) {
862  case WM_INITDIALOG:
863  {
865 
869 
873  cancelling = false;
874  RefreshBalanceDlg(hwndDlg, true);
875 
876  if (readonly) {
877  EnableWindow(GetDlgItem(hwndDlg, IDC_START_BALANCE), false);
878  EnableWindow(GetDlgItem(hwndDlg, IDC_PAUSE_BALANCE), false);
879  EnableWindow(GetDlgItem(hwndDlg, IDC_CANCEL_BALANCE), false);
880  }
881 
885 
886  SetTimer(hwndDlg, 1, 1000, nullptr);
887 
888  break;
889  }
890 
891  case WM_COMMAND:
892  switch (HIWORD(wParam)) {
893  case BN_CLICKED:
894  switch (LOWORD(wParam)) {
895  case IDOK:
896  case IDCANCEL:
897  KillTimer(hwndDlg, 1);
898  EndDialog(hwndDlg, 0);
899  return true;
900 
901  case IDC_DATA:
902  EnableWindow(GetDlgItem(hwndDlg, IDC_DATA_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_DATA) == BST_CHECKED ? true : false);
903 
905  IsDlgButtonChecked(hwndDlg, IDC_METADATA) == BST_CHECKED || IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED) ? true: false);
906  return true;
907 
908  case IDC_METADATA:
910 
912  IsDlgButtonChecked(hwndDlg, IDC_METADATA) == BST_CHECKED || IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED) ? true: false);
913  return true;
914 
915  case IDC_SYSTEM:
916  EnableWindow(GetDlgItem(hwndDlg, IDC_SYSTEM_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED ? true : false);
917 
919  IsDlgButtonChecked(hwndDlg, IDC_METADATA) == BST_CHECKED || IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED) ? true: false);
920  return true;
921 
922  case IDC_DATA_OPTIONS:
923  ShowBalanceOptions(hwndDlg, 1);
924  return true;
925 
927  ShowBalanceOptions(hwndDlg, 2);
928  return true;
929 
930  case IDC_SYSTEM_OPTIONS:
931  ShowBalanceOptions(hwndDlg, 3);
932  return true;
933 
934  case IDC_START_BALANCE:
935  StartBalance(hwndDlg);
936  return true;
937 
938  case IDC_PAUSE_BALANCE:
939  PauseBalance(hwndDlg);
940  RefreshBalanceDlg(hwndDlg, false);
941  return true;
942 
943  case IDC_CANCEL_BALANCE:
944  StopBalance(hwndDlg);
945  RefreshBalanceDlg(hwndDlg, false);
946  return true;
947  }
948  break;
949  }
950  break;
951 
952  case WM_TIMER:
953  RefreshBalanceDlg(hwndDlg, false);
954  break;
955  }
956  } catch (const exception& e) {
957  error_message(hwndDlg, e.what());
958  }
959 
960  return false;
961 }
void StartBalance(HWND hwndDlg)
Definition: balance.cpp:73
#define IDOK
Definition: winuser.h:824
#define IDC_DATA
Definition: resource.h:266
#define BTRFS_BALANCE_STOPPED
Definition: btrfsioctl.h:159
#define IDC_METADATA_OPTIONS
Definition: resource.h:280
btrfs_balance_opts data_opts
Definition: balance.h:50
#define BCM_SETSHIELD
Definition: commctrl.h:4649
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
#define IDC_DATA_OPTIONS
Definition: resource.h:273
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
bool removing
Definition: balance.h:54
uint32_t balance_status
Definition: balance.h:49
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define e
Definition: ke_i.h:82
btrfs_balance_opts metadata_opts
Definition: balance.h:50
bool called_from_RemoveDevice
Definition: balance.h:59
#define IDC_METADATA
Definition: resource.h:268
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
bool called_from_ShrinkDevice
Definition: balance.h:59
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define WM_TIMER
Definition: winuser.h:1724
#define BN_CLICKED
Definition: winuser.h:1907
void ShowBalanceOptions(HWND hwndDlg, uint8_t type)
Definition: balance.cpp:854
#define IDC_START_BALANCE
Definition: resource.h:293
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define IDC_SYSTEM
Definition: resource.h:270
#define IDC_CANCEL_BALANCE
Definition: resource.h:299
#define WM_COMMAND
Definition: winuser.h:1722
bool shrinking
Definition: balance.h:55
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
bool cancelling
Definition: balance.h:53
void RefreshBalanceDlg(HWND hwndDlg, bool first)
Definition: balance.cpp:206
void StopBalance(HWND hwndDlg)
Definition: balance.cpp:174
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
bool readonly
Definition: balance.h:58
#define BST_CHECKED
Definition: winuser.h:197
void PauseBalance(HWND hwndDlg)
Definition: balance.cpp:144
btrfs_balance_opts system_opts
Definition: balance.h:50
#define HIWORD(l)
Definition: typedefs.h:247
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_PAUSE_BALANCE
Definition: resource.h:296
#define IDC_SYSTEM_OPTIONS
Definition: resource.h:285

Referenced by stub_BalanceDlgProc().

◆ BalanceOptsDlgProc()

INT_PTR CALLBACK BtrfsBalance::BalanceOptsDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 512 of file balance.cpp.

512  {
513  try {
514  switch (uMsg) {
515  case WM_INITDIALOG:
516  {
517  HWND devcb, convcb;
518  btrfs_device* bd;
519  btrfs_balance_opts* opts;
521  int i, num_devices = 0, num_writeable_devices = 0;
522  wstring s, u;
523  bool balance_started = balance_status & (BTRFS_BALANCE_RUNNING | BTRFS_BALANCE_PAUSED);
524 
525  switch (opts_type) {
526  case 1:
527  opts = balance_started ? &bqb.data_opts : &data_opts;
528  break;
529 
530  case 2:
531  opts = balance_started ? &bqb.metadata_opts : &metadata_opts;
532  break;
533 
534  case 3:
535  opts = balance_started ? &bqb.system_opts : &system_opts;
536  break;
537 
538  default:
539  return true;
540  }
541 
543 
544  devcb = GetDlgItem(hwndDlg, IDC_DEVID_COMBO);
545 
547  throw last_error(GetLastError());
548 
549  bd = devices;
550  while (true) {
551  wstring t, v;
552 
553  if (bd->device_number == 0xffffffff)
554  s = wstring(bd->name, bd->namelen);
555  else if (bd->partition_number == 0) {
557  throw last_error(GetLastError());
558 
560  } else {
562  throw last_error(GetLastError());
563 
565  }
566 
567  wstring_sprintf(t, u, bd->dev_id, s.c_str());
568 
569  SendMessage(devcb, CB_ADDSTRING, 0, (LPARAM)t.c_str());
570 
571  if (opts->devid == bd->dev_id)
572  SendMessage(devcb, CB_SETCURSEL, num_devices, 0);
573 
574  num_devices++;
575 
576  if (!bd->readonly)
577  num_writeable_devices++;
578 
579  if (bd->next_entry > 0)
580  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
581  else
582  break;
583  }
584 
585  convcb = GetDlgItem(hwndDlg, IDC_CONVERT_COMBO);
586 
587  if (num_writeable_devices == 0)
588  num_writeable_devices = num_devices;
589 
590  i = 0;
591  while (convtypes[i] != 0) {
592  if (!load_string(module, convtypes[i], s))
593  throw last_error(GetLastError());
594 
595  SendMessage(convcb, CB_ADDSTRING, 0, (LPARAM)s.c_str());
596 
597  if (opts->convert == convtypes2[i])
598  SendMessage(convcb, CB_SETCURSEL, i, 0);
599 
600  i++;
601 
602  if (num_writeable_devices < 2 && i == 2)
603  break;
604  else if (num_writeable_devices < 3 && i == 4)
605  break;
606  else if (num_writeable_devices < 4 && i == 6)
607  break;
608  }
609 
610  // profiles
611 
622 
623  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_SINGLE), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
624  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_DUP), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
625  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID0), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
626  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID1), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
627  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID10), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
628  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID5), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
629  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID6), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
630  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID1C3), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
631  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES_RAID1C4), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_PROFILES ? true : false);
632  EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILES), balance_started ? false : true);
633 
634  // usage
635 
637 
638  s = to_wstring(opts->usage_start);
639  SetDlgItemTextW(hwndDlg, IDC_USAGE_START, s.c_str());
641 
642  s = to_wstring(opts->usage_end);
643  SetDlgItemTextW(hwndDlg, IDC_USAGE_END, s.c_str());
645 
646  EnableWindow(GetDlgItem(hwndDlg, IDC_USAGE_START), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_USAGE ? true : false);
647  EnableWindow(GetDlgItem(hwndDlg, IDC_USAGE_START_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_USAGE ? true : false);
648  EnableWindow(GetDlgItem(hwndDlg, IDC_USAGE_END), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_USAGE ? true : false);
649  EnableWindow(GetDlgItem(hwndDlg, IDC_USAGE_END_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_USAGE ? true : false);
650  EnableWindow(GetDlgItem(hwndDlg, IDC_USAGE), balance_started ? false : true);
651 
652  // devid
653 
654  if (num_devices < 2 || balance_started)
655  EnableWindow(GetDlgItem(hwndDlg, IDC_DEVID), false);
656 
658  EnableWindow(devcb, (opts->flags & BTRFS_BALANCE_OPTS_DEVID && num_devices >= 2 && !balance_started) ? true : false);
659 
660  // drange
661 
663 
664  s = to_wstring(opts->drange_start);
665  SetDlgItemTextW(hwndDlg, IDC_DRANGE_START, s.c_str());
666 
667  s = to_wstring(opts->drange_end);
668  SetDlgItemTextW(hwndDlg, IDC_DRANGE_END, s.c_str());
669 
670  EnableWindow(GetDlgItem(hwndDlg, IDC_DRANGE_START), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_DRANGE ? true : false);
671  EnableWindow(GetDlgItem(hwndDlg, IDC_DRANGE_END), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_DRANGE ? true : false);
672  EnableWindow(GetDlgItem(hwndDlg, IDC_DRANGE), balance_started ? false : true);
673 
674  // vrange
675 
677 
678  s = to_wstring(opts->vrange_start);
679  SetDlgItemTextW(hwndDlg, IDC_VRANGE_START, s.c_str());
680 
681  s = to_wstring(opts->vrange_end);
682  SetDlgItemTextW(hwndDlg, IDC_VRANGE_END, s.c_str());
683 
684  EnableWindow(GetDlgItem(hwndDlg, IDC_VRANGE_START), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_VRANGE ? true : false);
685  EnableWindow(GetDlgItem(hwndDlg, IDC_VRANGE_END), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_VRANGE ? true : false);
686  EnableWindow(GetDlgItem(hwndDlg, IDC_VRANGE), balance_started ? false : true);
687 
688  // limit
689 
691 
692  s = to_wstring(opts->limit_start);
693  SetDlgItemTextW(hwndDlg, IDC_LIMIT_START, s.c_str());
695 
696  s = to_wstring(opts->limit_end);
697  SetDlgItemTextW(hwndDlg, IDC_LIMIT_END, s.c_str());
698  SendMessageW(GetDlgItem(hwndDlg, IDC_LIMIT_END_SPINNER), UDM_SETRANGE32, 0, 0x7fffffff);
699 
700  EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT_START), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_LIMIT ? true : false);
701  EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT_START_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_LIMIT ? true : false);
702  EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT_END), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_LIMIT ? true : false);
703  EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT_END_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_LIMIT ? true : false);
704  EnableWindow(GetDlgItem(hwndDlg, IDC_LIMIT), balance_started ? false : true);
705 
706  // stripes
707 
709 
710  s = to_wstring(opts->stripes_start);
711  SetDlgItemTextW(hwndDlg, IDC_STRIPES_START, s.c_str());
713 
714  s = to_wstring(opts->stripes_end);
715  SetDlgItemTextW(hwndDlg, IDC_STRIPES_END, s.c_str());
717 
718  EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPES_START), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_STRIPES ? true : false);
719  EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPES_START_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_STRIPES ? true : false);
720  EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPES_END), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_STRIPES ? true : false);
721  EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPES_END_SPINNER), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_STRIPES ? true : false);
722  EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPES), balance_started ? false : true);
723 
724  // convert
725 
728 
729  EnableWindow(GetDlgItem(hwndDlg, IDC_SOFT), !balance_started && opts->flags & BTRFS_BALANCE_OPTS_CONVERT ? true : false);
730  EnableWindow(convcb, !balance_started && opts->flags & BTRFS_BALANCE_OPTS_CONVERT ? true : false);
731  EnableWindow(GetDlgItem(hwndDlg, IDC_CONVERT), balance_started ? false : true);
732 
733  break;
734  }
735 
736  case WM_COMMAND:
737  switch (HIWORD(wParam)) {
738  case BN_CLICKED:
739  switch (LOWORD(wParam)) {
740  case IDOK:
742  EndDialog(hwndDlg, 0);
743  else
744  SaveBalanceOpts(hwndDlg);
745  return true;
746 
747  case IDCANCEL:
748  EndDialog(hwndDlg, 0);
749  return true;
750 
751  case IDC_PROFILES: {
752  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_PROFILES) == BST_CHECKED ? true : false;
753 
763  break;
764  }
765 
766  case IDC_USAGE: {
767  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_USAGE) == BST_CHECKED ? true : false;
768 
773  break;
774  }
775 
776  case IDC_DEVID: {
777  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_DEVID) == BST_CHECKED ? true : false;
778 
780  break;
781  }
782 
783  case IDC_DRANGE: {
784  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_DRANGE) == BST_CHECKED ? true : false;
785 
788  break;
789  }
790 
791  case IDC_VRANGE: {
792  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_VRANGE) == BST_CHECKED ? true : false;
793 
796  break;
797  }
798 
799  case IDC_LIMIT: {
800  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_LIMIT) == BST_CHECKED ? true : false;
801 
806  break;
807  }
808 
809  case IDC_STRIPES: {
810  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_STRIPES) == BST_CHECKED ? true : false;
811 
816  break;
817  }
818 
819  case IDC_CONVERT: {
820  bool enabled = IsDlgButtonChecked(hwndDlg, IDC_CONVERT) == BST_CHECKED ? true : false;
821 
824  break;
825  }
826  }
827  break;
828  }
829  break;
830  }
831  } catch (const exception& e) {
832  error_message(hwndDlg, e.what());
833  }
834 
835  return false;
836 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
WCHAR name[1]
Definition: btrfsioctl.h:112
#define IDC_LIMIT_START
Definition: resource.h:278
#define IDS_RAID10
Definition: resource.h:47
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDC_USAGE_END_SPINNER
Definition: resource.h:256
#define IDC_STRIPES
Definition: resource.h:297
USHORT namelen
Definition: btrfsioctl.h:111
#define IDOK
Definition: winuser.h:824
btrfs_balance_opts metadata_opts
Definition: btrfsioctl.h:172
#define IDC_LIMIT_END_SPINNER
Definition: resource.h:292
#define BTRFS_BALANCE_OPTS_PROFILES
Definition: btrfsioctl.h:130
#define IDC_USAGE_START_SPINNER
Definition: resource.h:254
#define IDC_STRIPES_START
Definition: resource.h:301
uint32_t next_entry
Definition: btrfsioctl.h:102
#define IDC_DEVID_COMBO
Definition: resource.h:259
#define IDC_PROFILES_RAID5
Definition: resource.h:251
#define IDS_RAID1C3
Definition: resource.h:137
btrfs_balance_opts data_opts
Definition: balance.h:50
GLdouble GLdouble t
Definition: gl.h:2047
uint16_t stripes_end
Definition: btrfsioctl.h:153
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define BTRFS_BALANCE_OPTS_VRANGE
Definition: btrfsioctl.h:133
#define IDC_PROFILES
Definition: resource.h:241
btrfs_balance_opts data_opts
Definition: btrfsioctl.h:171
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
uint64_t limit_start
Definition: btrfsioctl.h:150
#define IDC_STRIPES_END
Definition: resource.h:305
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define BLOCK_FLAG_SINGLE
Definition: btrfsioctl.h:140
#define BTRFS_BALANCE_OPTS_USAGE
Definition: btrfsioctl.h:136
#define IDC_DEVID
Definition: resource.h:258
#define true
Definition: osdep.h:36
uint64_t vrange_start
Definition: btrfsioctl.h:148
ULONG device_number
Definition: btrfsioctl.h:108
uint32_t balance_status
Definition: balance.h:49
#define BTRFS_BALANCE_OPTS_CONVERT
Definition: btrfsioctl.h:137
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:785
#define IDS_RAID5
Definition: resource.h:48
static uint64_t convtypes2[]
Definition: balance.cpp:45
#define e
Definition: ke_i.h:82
btrfs_balance_opts metadata_opts
Definition: balance.h:50
#define IDC_VRANGE
Definition: resource.h:269
#define IDS_RAID0
Definition: resource.h:45
#define BLOCK_FLAG_RAID1C3
Definition: btrfs.h:83
#define IDC_LIMIT_END
Definition: resource.h:295
#define IDC_PROFILES_RAID1
Definition: resource.h:249
#define CB_ADDSTRING
Definition: winuser.h:1918
#define IDS_DISK_PART_NUM
Definition: resource.h:103
#define IDS_DISK_NUM
Definition: resource.h:102
#define ETDT_ENABLETAB
Definition: dxdiag.c:30
#define BLOCK_FLAG_RAID10
Definition: shellext.h:81
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_CONVERT
Definition: resource.h:307
#define IDC_PROFILES_SINGLE
Definition: resource.h:243
#define IDC_PROFILES_RAID1C4
Definition: resource.h:316
ULONG partition_number
Definition: btrfsioctl.h:109
#define UDM_SETRANGE32
Definition: commctrl.h:2147
#define IDC_PROFILES_RAID1C3
Definition: resource.h:314
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDC_PROFILES_RAID6
Definition: resource.h:252
#define IDC_LIMIT
Definition: resource.h:267
#define IDC_LIMIT_START_SPINNER
Definition: resource.h:271
#define BTRFS_BALANCE_OPTS_SOFT
Definition: btrfsioctl.h:138
#define IDC_DRANGE_START
Definition: resource.h:260
#define IDC_SOFT
Definition: resource.h:311
#define IDC_VRANGE_END
Definition: resource.h:283
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
#define BLOCK_FLAG_RAID0
Definition: shellext.h:78
uint64_t limit_end
Definition: btrfsioctl.h:151
void SaveBalanceOpts(HWND hwndDlg)
Definition: balance.cpp:354
btrfs_query_balance bqb
Definition: balance.h:52
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HRESULT WINAPI EnableThemeDialogTexture(_In_ HWND hwnd, _In_ DWORD dwFlags)
Definition: uxthemesupp.c:55
#define IDS_DUP
Definition: resource.h:44
uint64_t drange_end
Definition: btrfsioctl.h:147
#define BTRFS_BALANCE_OPTS_LIMIT
Definition: btrfsioctl.h:134
#define BN_CLICKED
Definition: winuser.h:1907
#define IDS_RAID6
Definition: resource.h:49
#define BLOCK_FLAG_RAID6
Definition: shellext.h:83
#define IDC_USAGE
Definition: resource.h:253
#define BLOCK_FLAG_RAID1C4
Definition: btrfs.h:84
#define IDC_VRANGE_START
Definition: resource.h:288
#define BTRFS_BALANCE_OPTS_DRANGE
Definition: btrfsioctl.h:132
#define IDS_DEVID_LIST
Definition: resource.h:63
GLdouble s
Definition: gl.h:2039
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
BYTE uint8_t
Definition: msvideo1.c:66
#define IDC_PROFILES_RAID10
Definition: resource.h:250
btrfs_device * devices
Definition: balance.h:57
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_PROFILES_RAID0
Definition: resource.h:246
uint8_t opts_type
Definition: balance.h:51
uint16_t stripes_start
Definition: btrfsioctl.h:152
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
btrfs_balance_opts system_opts
Definition: btrfsioctl.h:173
#define IDS_SINGLE2
Definition: resource.h:62
#define IDC_STRIPES_START_SPINNER
Definition: resource.h:300
#define IDC_DRANGE_END
Definition: resource.h:265
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
uint64_t vrange_end
Definition: btrfsioctl.h:149
uint64_t drange_start
Definition: btrfsioctl.h:146
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define BST_CHECKED
Definition: winuser.h:197
uint64_t dev_id
Definition: btrfsioctl.h:103
#define IDS_RAID1C4
Definition: resource.h:149
btrfs_balance_opts system_opts
Definition: balance.h:50
#define IDC_USAGE_START
Definition: resource.h:255
#define SendMessage
Definition: winuser.h:5818
#define IDC_STRIPES_END_SPINNER
Definition: resource.h:303
#define BTRFS_BALANCE_OPTS_DEVID
Definition: btrfsioctl.h:131
#define IDC_USAGE_END
Definition: resource.h:257
#define HIWORD(l)
Definition: typedefs.h:247
#define BLOCK_FLAG_DUPLICATE
Definition: shellext.h:80
#define IDS_RAID1
Definition: resource.h:46
#define BLOCK_FLAG_RAID5
Definition: shellext.h:82
#define IDCANCEL
Definition: winuser.h:825
#define BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:161
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_CONVERT_COMBO
Definition: resource.h:309
#define BTRFS_BALANCE_OPTS_STRIPES
Definition: btrfsioctl.h:135
#define IDC_DRANGE
Definition: resource.h:261
#define IDC_PROFILES_DUP
Definition: resource.h:244
#define BLOCK_FLAG_RAID1
Definition: shellext.h:79

Referenced by stub_BalanceOptsDlgProc().

◆ PauseBalance()

void BtrfsBalance::PauseBalance ( HWND  hwndDlg)
private

Definition at line 144 of file balance.cpp.

144  {
145  WCHAR modfn[MAX_PATH];
146  wstring t;
147  SHELLEXECUTEINFOW sei;
148 
149  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
150 
151 #ifndef __REACTOS__
152  t = L"\""s + modfn + L"\",PauseBalance " + fn;
153 #else
154  t = wstring(L"\"") + modfn + wstring(L"\",PauseBalance ") + fn;
155 #endif
156 
157  RtlZeroMemory(&sei, sizeof(sei));
158 
159  sei.cbSize = sizeof(sei);
160  sei.hwnd = hwndDlg;
161  sei.lpVerb = L"runas";
162  sei.lpFile = L"rundll32.exe";
163  sei.lpParameters = t.c_str();
164  sei.nShow = SW_SHOW;
166 
167  if (!ShellExecuteExW(&sei))
168  throw last_error(GetLastError());
169 
171  CloseHandle(sei.hProcess);
172 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define CloseHandle
Definition: compat.h:598
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
#define SW_SHOW
Definition: winuser.h:769
wstring fn
Definition: balance.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
LPCWSTR lpParameters
Definition: shellapi.h:331
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define INFINITE
Definition: serial.h:102

Referenced by BalanceDlgProc().

◆ RefreshBalanceDlg()

void BtrfsBalance::RefreshBalanceDlg ( HWND  hwndDlg,
bool  first 
)
private

Definition at line 206 of file balance.cpp.

206  {
207  bool balancing = false;
208  wstring s, t;
209 
210  {
213 
214  if (h != INVALID_HANDLE_VALUE) {
217 
218  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_QUERY_BALANCE, nullptr, 0, &bqb, sizeof(btrfs_query_balance));
219 
220  if (!NT_SUCCESS(Status))
221  throw ntstatus_error(Status);
222  } else
223  throw last_error(GetLastError());
224  }
225 
226  if (cancelling)
228 
230 
231  if (!balancing) {
233  int resid;
234 
235  EnableWindow(GetDlgItem(hwndDlg, IDC_PAUSE_BALANCE), false);
236  EnableWindow(GetDlgItem(hwndDlg, IDC_CANCEL_BALANCE), false);
237  SendMessageW(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), PBM_SETSTATE, PBST_NORMAL, 0);
238  EnableWindow(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), false);
239  EnableWindow(GetDlgItem(hwndDlg, IDC_DATA), true);
240  EnableWindow(GetDlgItem(hwndDlg, IDC_METADATA), true);
241  EnableWindow(GetDlgItem(hwndDlg, IDC_SYSTEM), true);
242 
247 
249  }
250 
251  EnableWindow(GetDlgItem(hwndDlg, IDC_DATA_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_DATA) == BST_CHECKED ? true : false);
253  EnableWindow(GetDlgItem(hwndDlg, IDC_SYSTEM_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED ? true : false);
254 
256  if (removing)
258  else if (shrinking)
260  else
261  resid = IDS_BALANCE_FAILED;
262 
263  if (!load_string(module, resid, s))
264  throw last_error(GetLastError());
265 
267 
268  SetDlgItemTextW(hwndDlg, IDC_BALANCE_STATUS, t.c_str());
269  } else {
270  if (cancelling)
274  else
275  resid = IDS_NO_BALANCE;
276 
277  if (!load_string(module, resid, s))
278  throw last_error(GetLastError());
279 
280  SetDlgItemTextW(hwndDlg, IDC_BALANCE_STATUS, s.c_str());
281  }
282 
284  IsDlgButtonChecked(hwndDlg, IDC_METADATA) == BST_CHECKED || IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED) ? true: false);
285 
287  cancelling = false;
288  }
289 
290  return;
291  }
292 
294  EnableWindow(GetDlgItem(hwndDlg, IDC_PAUSE_BALANCE), true);
295  EnableWindow(GetDlgItem(hwndDlg, IDC_CANCEL_BALANCE), true);
297  EnableWindow(GetDlgItem(hwndDlg, IDC_DATA), false);
298  EnableWindow(GetDlgItem(hwndDlg, IDC_METADATA), false);
299  EnableWindow(GetDlgItem(hwndDlg, IDC_SYSTEM), false);
300 
304 
308 
309  EnableWindow(GetDlgItem(hwndDlg, IDC_START_BALANCE), false);
310  }
311 
314 
316  SendMessageW(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), PBM_SETSTATE, PBST_PAUSED, 0);
318  SendMessageW(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), PBM_SETSTATE, PBST_NORMAL, 0);
319 
321 
324  throw last_error(GetLastError());
325 
327  (float)(bqb.total_chunks - bqb.chunks_left) * 100.0f / (float)bqb.total_chunks);
328 
329  removing = true;
330  shrinking = false;
331  } else if (bqb.status & BTRFS_BALANCE_SHRINKING) {
333  throw last_error(GetLastError());
334 
336  (float)(bqb.total_chunks - bqb.chunks_left) * 100.0f / (float)bqb.total_chunks);
337 
338  removing = false;
339  shrinking = true;
340  } else {
342  throw last_error(GetLastError());
343 
345  (float)(bqb.total_chunks - bqb.chunks_left) * 100.0f / (float)bqb.total_chunks);
346 
347  removing = false;
348  shrinking = false;
349  }
350 
351  SetDlgItemTextW(hwndDlg, IDC_BALANCE_STATUS, t.c_str());
352 }
#define FSCTL_BTRFS_QUERY_BALANCE
Definition: btrfsioctl.h:15
#define IDS_NO_BALANCE
Definition: resource.h:61
uint64_t total_chunks
Definition: btrfsioctl.h:169
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define PBM_SETRANGE32
Definition: commctrl.h:2184
btrfs_balance_opts metadata_opts
Definition: btrfsioctl.h:172
wstring format_ntstatus(NTSTATUS Status)
Definition: main.cpp:184
#define IDC_DATA
Definition: resource.h:266
#define IDS_BALANCE_RUNNING
Definition: resource.h:64
#define BTRFS_BALANCE_STOPPED
Definition: btrfsioctl.h:159
#define IDC_METADATA_OPTIONS
Definition: resource.h:280
const GLint * first
Definition: glext.h:5794
uint64_t chunks_left
Definition: btrfsioctl.h:168
LONG NTSTATUS
Definition: precomp.h:26
#define IDS_BALANCE_FAILED_REMOVAL
Definition: resource.h:101
GLdouble GLdouble t
Definition: gl.h:2047
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define PBM_SETPOS
Definition: commctrl.h:2180
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
UINT_PTR WPARAM
Definition: windef.h:207
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
btrfs_balance_opts data_opts
Definition: btrfsioctl.h:171
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
#define IDS_BALANCE_PAUSED_SHRINK
Definition: resource.h:196
#define IDS_BALANCE_CANCELLED_SHRINK
Definition: resource.h:197
#define IDC_DATA_OPTIONS
Definition: resource.h:273
bool removing
Definition: balance.h:54
#define FILE_SHARE_READ
Definition: compat.h:136
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_BALANCE_STATUS
Definition: resource.h:289
#define FILE_TRAVERSE
Definition: nt_native.h:643
uint32_t balance_status
Definition: balance.h:49
#define IDC_METADATA
Definition: resource.h:268
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_BALANCE_FAILED_SHRINK
Definition: resource.h:199
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define OPEN_EXISTING
Definition: compat.h:634
wstring fn
Definition: balance.h:56
Status
Definition: gdiplustypes.h:24
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
btrfs_query_balance bqb
Definition: balance.h:52
#define IDS_BALANCE_RUNNING_REMOVAL
Definition: resource.h:85
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IDS_BALANCE_CANCELLED_REMOVAL
Definition: resource.h:89
#define BTRFS_BALANCE_SHRINKING
Definition: btrfsioctl.h:164
#define IDS_BALANCE_FAILED
Definition: resource.h:100
#define IDC_START_BALANCE
Definition: resource.h:293
#define BTRFS_BALANCE_OPTS_ENABLED
Definition: btrfsioctl.h:129
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define BTRFS_BALANCE_ERROR
Definition: btrfsioctl.h:163
#define BTRFS_BALANCE_REMOVAL
Definition: btrfsioctl.h:162
#define IDC_SYSTEM
Definition: resource.h:270
#define IDC_CANCEL_BALANCE
Definition: resource.h:299
GLdouble s
Definition: gl.h:2039
#define BST_UNCHECKED
Definition: winuser.h:199
#define IDS_BALANCE_PAUSED_REMOVAL
Definition: resource.h:87
bool shrinking
Definition: balance.h:55
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
bool cancelling
Definition: balance.h:53
btrfs_balance_opts system_opts
Definition: btrfsioctl.h:173
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_BALANCE_RUNNING_SHRINK
Definition: resource.h:195
bool readonly
Definition: balance.h:58
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define BST_CHECKED
Definition: winuser.h:197
#define CreateFileW
Definition: compat.h:600
#define SendMessage
Definition: winuser.h:5818
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define IDS_BALANCE_COMPLETE_SHRINK
Definition: resource.h:198
#define IDS_BALANCE_COMPLETE_REMOVAL
Definition: resource.h:91
#define BTRFS_BALANCE_PAUSED
Definition: btrfsioctl.h:161
#define IDS_BALANCE_COMPLETE
Definition: resource.h:71
#define IDS_BALANCE_PAUSED
Definition: resource.h:72
#define IDC_PAUSE_BALANCE
Definition: resource.h:296
#define IDC_BALANCE_PROGRESS
Definition: resource.h:263
#define IDS_BALANCE_CANCELLED
Definition: resource.h:73
#define IDC_SYSTEM_OPTIONS
Definition: resource.h:285

Referenced by BalanceDlgProc().

◆ SaveBalanceOpts()

void BtrfsBalance::SaveBalanceOpts ( HWND  hwndDlg)
private

Definition at line 354 of file balance.cpp.

354  {
355  btrfs_balance_opts* opts;
356 
357  switch (opts_type) {
358  case 1:
359  opts = &data_opts;
360  break;
361 
362  case 2:
363  opts = &metadata_opts;
364  break;
365 
366  case 3:
367  opts = &system_opts;
368  break;
369 
370  default:
371  return;
372  }
373 
374  RtlZeroMemory(opts, sizeof(btrfs_balance_opts));
375 
376  if (IsDlgButtonChecked(hwndDlg, IDC_PROFILES) == BST_CHECKED) {
378 
388  }
389 
390  if (IsDlgButtonChecked(hwndDlg, IDC_DEVID) == BST_CHECKED) {
392 
393  auto sel = SendMessageW(GetDlgItem(hwndDlg, IDC_DEVID_COMBO), CB_GETCURSEL, 0, 0);
394 
395  if (sel == CB_ERR)
397  else {
398  btrfs_device* bd = devices;
399  int i = 0;
400 
401  while (true) {
402  if (i == sel) {
403  opts->devid = bd->dev_id;
404  break;
405  }
406 
407  i++;
408 
409  if (bd->next_entry > 0)
410  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
411  else
412  break;
413  }
414 
415  if (opts->devid == 0)
417  }
418  }
419 
420  if (IsDlgButtonChecked(hwndDlg, IDC_DRANGE) == BST_CHECKED) {
421  WCHAR s[255];
422 
424 
425  GetWindowTextW(GetDlgItem(hwndDlg, IDC_DRANGE_START), s, sizeof(s) / sizeof(WCHAR));
426  opts->drange_start = _wtoi64(s);
427 
428  GetWindowTextW(GetDlgItem(hwndDlg, IDC_DRANGE_END), s, sizeof(s) / sizeof(WCHAR));
429  opts->drange_end = _wtoi64(s);
430 
431  if (opts->drange_end < opts->drange_start)
433  }
434 
435  if (IsDlgButtonChecked(hwndDlg, IDC_VRANGE) == BST_CHECKED) {
436  WCHAR s[255];
437 
439 
440  GetWindowTextW(GetDlgItem(hwndDlg, IDC_VRANGE_START), s, sizeof(s) / sizeof(WCHAR));
441  opts->vrange_start = _wtoi64(s);
442 
443  GetWindowTextW(GetDlgItem(hwndDlg, IDC_VRANGE_END), s, sizeof(s) / sizeof(WCHAR));
444  opts->vrange_end = _wtoi64(s);
445 
446  if (opts->vrange_end < opts->vrange_start)
448  }
449 
450  if (IsDlgButtonChecked(hwndDlg, IDC_LIMIT) == BST_CHECKED) {
451  WCHAR s[255];
452 
454 
455  GetWindowTextW(GetDlgItem(hwndDlg, IDC_LIMIT_START), s, sizeof(s) / sizeof(WCHAR));
456  opts->limit_start = _wtoi64(s);
457 
458  GetWindowTextW(GetDlgItem(hwndDlg, IDC_LIMIT_END), s, sizeof(s) / sizeof(WCHAR));
459  opts->limit_end = _wtoi64(s);
460 
461  if (opts->limit_end < opts->limit_start)
463  }
464 
465  if (IsDlgButtonChecked(hwndDlg, IDC_STRIPES) == BST_CHECKED) {
466  WCHAR s[255];
467 
469 
470  GetWindowTextW(GetDlgItem(hwndDlg, IDC_STRIPES_START), s, sizeof(s) / sizeof(WCHAR));
471  opts->stripes_start = (uint8_t)_wtoi(s);
472 
473  GetWindowTextW(GetDlgItem(hwndDlg, IDC_STRIPES_END), s, sizeof(s) / sizeof(WCHAR));
474  opts->stripes_end = (uint8_t)_wtoi(s);
475 
476  if (opts->stripes_end < opts->stripes_start)
478  }
479 
480  if (IsDlgButtonChecked(hwndDlg, IDC_USAGE) == BST_CHECKED) {
481  WCHAR s[255];
482 
484 
485  GetWindowTextW(GetDlgItem(hwndDlg, IDC_USAGE_START), s, sizeof(s) / sizeof(WCHAR));
486  opts->usage_start = (uint8_t)_wtoi(s);
487 
488  GetWindowTextW(GetDlgItem(hwndDlg, IDC_USAGE_END), s, sizeof(s) / sizeof(WCHAR));
489  opts->usage_end = (uint8_t)_wtoi(s);
490 
491  if (opts->usage_end < opts->usage_start)
493  }
494 
495  if (IsDlgButtonChecked(hwndDlg, IDC_CONVERT) == BST_CHECKED) {
497 
498  auto sel = SendMessageW(GetDlgItem(hwndDlg, IDC_CONVERT_COMBO), CB_GETCURSEL, 0, 0);
499 
500  if (sel == CB_ERR || (unsigned int)sel >= sizeof(convtypes2) / sizeof(convtypes2[0]))
502  else {
503  opts->convert = convtypes2[sel];
504 
506  }
507  }
508 
509  EndDialog(hwndDlg, 0);
510 }
#define IDC_LIMIT_START
Definition: resource.h:278
#define IDC_STRIPES
Definition: resource.h:297
#define IDS_USAGE_END_BEFORE_START
Definition: resource.h:69
#define BTRFS_BALANCE_OPTS_PROFILES
Definition: btrfsioctl.h:130
#define IDC_STRIPES_START
Definition: resource.h:301
uint32_t next_entry
Definition: btrfsioctl.h:102
#define IDC_DEVID_COMBO
Definition: resource.h:259
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define IDC_PROFILES_RAID5
Definition: resource.h:251
btrfs_balance_opts data_opts
Definition: balance.h:50
uint16_t stripes_end
Definition: btrfsioctl.h:153
#define IDS_STRIPES_END_BEFORE_START
Definition: resource.h:68
#define IDS_VRANGE_END_BEFORE_START
Definition: resource.h:66
#define BTRFS_BALANCE_OPTS_VRANGE
Definition: btrfsioctl.h:133
#define IDC_PROFILES
Definition: resource.h:241
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
uint64_t limit_start
Definition: btrfsioctl.h:150
#define IDC_STRIPES_END
Definition: resource.h:305
#define BLOCK_FLAG_SINGLE
Definition: btrfsioctl.h:140
#define IDS_LIMIT_END_BEFORE_START
Definition: resource.h:67
#define BTRFS_BALANCE_OPTS_USAGE
Definition: btrfsioctl.h:136
#define IDC_DEVID
Definition: resource.h:258
uint64_t vrange_start
Definition: btrfsioctl.h:148
#define BTRFS_BALANCE_OPTS_CONVERT
Definition: btrfsioctl.h:137
static uint64_t convtypes2[]
Definition: balance.cpp:45
btrfs_balance_opts metadata_opts
Definition: balance.h:50
#define IDC_VRANGE
Definition: resource.h:269
#define BLOCK_FLAG_RAID1C3
Definition: btrfs.h:83
#define IDC_LIMIT_END
Definition: resource.h:295
#define IDC_PROFILES_RAID1
Definition: resource.h:249
#define BLOCK_FLAG_RAID10
Definition: shellext.h:81
#define IDC_CONVERT
Definition: resource.h:307
#define IDC_PROFILES_SINGLE
Definition: resource.h:243
#define IDC_PROFILES_RAID1C4
Definition: resource.h:316
#define IDC_PROFILES_RAID1C3
Definition: resource.h:314
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDC_PROFILES_RAID6
Definition: resource.h:252
#define IDC_LIMIT
Definition: resource.h:267
#define CB_ERR
Definition: winuser.h:2410
#define BTRFS_BALANCE_OPTS_SOFT
Definition: btrfsioctl.h:138
#define IDC_DRANGE_START
Definition: resource.h:260
#define IDC_SOFT
Definition: resource.h:311
#define IDC_VRANGE_END
Definition: resource.h:283
#define BLOCK_FLAG_RAID0
Definition: shellext.h:78
uint64_t limit_end
Definition: btrfsioctl.h:151
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t drange_end
Definition: btrfsioctl.h:147
#define BTRFS_BALANCE_OPTS_LIMIT
Definition: btrfsioctl.h:134
_Check_return_ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(_In_z_ const wchar_t *_Str)
#define BLOCK_FLAG_RAID6
Definition: shellext.h:83
#define IDC_USAGE
Definition: resource.h:253
#define BLOCK_FLAG_RAID1C4
Definition: btrfs.h:84
#define IDC_VRANGE_START
Definition: resource.h:288
#define BTRFS_BALANCE_OPTS_DRANGE
Definition: btrfsioctl.h:132
GLdouble s
Definition: gl.h:2039
BYTE uint8_t
Definition: msvideo1.c:66
#define IDC_PROFILES_RAID10
Definition: resource.h:250
btrfs_device * devices
Definition: balance.h:57
#define IDC_PROFILES_RAID0
Definition: resource.h:246
uint8_t opts_type
Definition: balance.h:51
uint16_t stripes_start
Definition: btrfsioctl.h:152
#define uint8_t
Definition: nsiface.idl:59
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define IDC_DRANGE_END
Definition: resource.h:265
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
uint64_t vrange_end
Definition: btrfsioctl.h:149
uint64_t drange_start
Definition: btrfsioctl.h:146
#define BST_CHECKED
Definition: winuser.h:197
uint64_t dev_id
Definition: btrfsioctl.h:103
btrfs_balance_opts system_opts
Definition: balance.h:50
#define IDC_USAGE_START
Definition: resource.h:255
#define IDC_USAGE_END
Definition: resource.h:257
#define BTRFS_BALANCE_OPTS_DEVID
Definition: btrfsioctl.h:131
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IDS_DRANGE_END_BEFORE_START
Definition: resource.h:65
#define BLOCK_FLAG_DUPLICATE
Definition: shellext.h:80
#define BLOCK_FLAG_RAID5
Definition: shellext.h:82
#define IDC_CONVERT_COMBO
Definition: resource.h:309
#define BTRFS_BALANCE_OPTS_STRIPES
Definition: btrfsioctl.h:135
#define IDC_DRANGE
Definition: resource.h:261
#define IDC_PROFILES_DUP
Definition: resource.h:244
#define BLOCK_FLAG_RAID1
Definition: shellext.h:79

Referenced by BalanceOptsDlgProc().

◆ ShowBalance()

void BtrfsBalance::ShowBalance ( HWND  hwndDlg)

Definition at line 979 of file balance.cpp.

979  {
980  btrfs_device* bd;
981 
982  if (devices) {
983  free(devices);
984  devices = nullptr;
985  }
986 
987  {
990 
991  if (h != INVALID_HANDLE_VALUE) {
994  ULONG devsize, i;
995 
996  i = 0;
997  devsize = 1024;
998 
999  devices = (btrfs_device*)malloc(devsize);
1000 
1001  while (true) {
1002  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_DEVICES, nullptr, 0, devices, devsize);
1003  if (Status == STATUS_BUFFER_OVERFLOW) {
1004  if (i < 8) {
1005  devsize += 1024;
1006 
1007  free(devices);
1008  devices = (btrfs_device*)malloc(devsize);
1009 
1010  i++;
1011  } else
1012  return;
1013  } else
1014  break;
1015  }
1016 
1017  if (!NT_SUCCESS(Status))
1018  throw ntstatus_error(Status);
1019  } else
1020  throw last_error(GetLastError());
1021  }
1022 
1023  readonly = true;
1024  bd = devices;
1025 
1026  while (true) {
1027  if (!bd->readonly) {
1028  readonly = false;
1029  break;
1030  }
1031 
1032  if (bd->next_entry > 0)
1033  bd = (btrfs_device*)((uint8_t*)bd + bd->next_entry);
1034  else
1035  break;
1036  }
1037 
1039 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define IDD_BALANCE
Definition: resource.h:19
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static INT_PTR CALLBACK stub_BalanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: balance.cpp:963
uint32_t next_entry
Definition: btrfsioctl.h:102
#define free
Definition: debug_ros.c:5
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:136
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FILE_TRAVERSE
Definition: nt_native.h:643
LONG_PTR LPARAM
Definition: windef.h:208
#define OPEN_EXISTING
Definition: compat.h:634
wstring fn
Definition: balance.h:56
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
BYTE uint8_t
Definition: msvideo1.c:66
btrfs_device * devices
Definition: balance.h:57
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
bool readonly
Definition: balance.h:58
#define FSCTL_BTRFS_GET_DEVICES
Definition: btrfsioctl.h:12
#define CreateFileW
Definition: compat.h:600
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by BtrfsDeviceResize::do_resize(), PropSheetDlgProc(), and RemoveDeviceW().

◆ ShowBalanceOptions()

void BtrfsBalance::ShowBalanceOptions ( HWND  hwndDlg,
uint8_t  type 
)
private

Definition at line 854 of file balance.cpp.

854  {
855  opts_type = type;
857 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static INT_PTR CALLBACK stub_BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: balance.cpp:838
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_BALANCE_OPTIONS
Definition: resource.h:17
uint8_t opts_type
Definition: balance.h:51
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by BalanceDlgProc().

◆ StartBalance()

void BtrfsBalance::StartBalance ( HWND  hwndDlg)
private

Definition at line 73 of file balance.cpp.

73  {
74  wstring t;
75  WCHAR modfn[MAX_PATH], u[600];
78 
79  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
80 
81 #ifndef __REACTOS__
82  t = L"\""s + modfn + L"\",StartBalance "s + fn + L" "s;
83 #else
84  t = wstring(L"\"") + modfn + wstring(L"\",StartBalance ") + fn + wstring(L" ");
85 #endif
86 
87  RtlCopyMemory(&bsb.opts[0], &data_opts, sizeof(btrfs_balance_opts));
90 
91  if (IsDlgButtonChecked(hwndDlg, IDC_DATA) == BST_CHECKED)
93  else
95 
98  else
100 
101  if (IsDlgButtonChecked(hwndDlg, IDC_SYSTEM) == BST_CHECKED)
103  else
105 
106  serialize(&bsb, sizeof(btrfs_start_balance), u);
107 
108  t += u;
109 
110  RtlZeroMemory(&sei, sizeof(sei));
111 
112  sei.cbSize = sizeof(sei);
113  sei.hwnd = hwndDlg;
114  sei.lpVerb = L"runas";
115  sei.lpFile = L"rundll32.exe";
116  sei.lpParameters = t.c_str();
117  sei.nShow = SW_SHOW;
119 
120  if (!ShellExecuteExW(&sei))
121  throw last_error(GetLastError());
122 
123  cancelling = false;
124  removing = false;
125  shrinking = false;
127 
128  EnableWindow(GetDlgItem(hwndDlg, IDC_PAUSE_BALANCE), true);
129  EnableWindow(GetDlgItem(hwndDlg, IDC_CANCEL_BALANCE), true);
131  EnableWindow(GetDlgItem(hwndDlg, IDC_DATA), false);
132  EnableWindow(GetDlgItem(hwndDlg, IDC_METADATA), false);
133  EnableWindow(GetDlgItem(hwndDlg, IDC_SYSTEM), false);
137 
138  EnableWindow(GetDlgItem(hwndDlg, IDC_START_BALANCE), false);
139 
141  CloseHandle(sei.hProcess);
142 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define CloseHandle
Definition: compat.h:598
#define IDC_DATA
Definition: resource.h:266
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
#define IDC_METADATA_OPTIONS
Definition: resource.h:280
btrfs_balance_opts data_opts
Definition: balance.h:50
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define BTRFS_BALANCE_RUNNING
Definition: btrfsioctl.h:160
#define IDC_DATA_OPTIONS
Definition: resource.h:273
bool removing
Definition: balance.h:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t balance_status
Definition: balance.h:49
btrfs_balance_opts metadata_opts
Definition: balance.h:50
#define IDC_METADATA
Definition: resource.h:268
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
#define SW_SHOW
Definition: winuser.h:769
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
wstring fn
Definition: balance.h:56
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define IDC_START_BALANCE
Definition: resource.h:293
#define BTRFS_BALANCE_OPTS_ENABLED
Definition: btrfsioctl.h:129
static const WCHAR L[]
Definition: oid.c:1250
#define IDC_SYSTEM
Definition: resource.h:270
#define IDC_CANCEL_BALANCE
Definition: resource.h:299
GLdouble s
Definition: gl.h:2039
btrfs_balance_opts opts[3]
Definition: btrfsioctl.h:177
bool shrinking
Definition: balance.h:55
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
bool cancelling
Definition: balance.h:53
LPCWSTR lpParameters
Definition: shellapi.h:331
#define BST_CHECKED
Definition: winuser.h:197
btrfs_balance_opts system_opts
Definition: balance.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
static void serialize(void *data, ULONG len, WCHAR *s)
Definition: balance.cpp:54
#define INFINITE
Definition: serial.h:102
#define IDC_PAUSE_BALANCE
Definition: resource.h:296
#define IDC_BALANCE_PROGRESS
Definition: resource.h:263
#define IDC_SYSTEM_OPTIONS
Definition: resource.h:285

Referenced by BalanceDlgProc().

◆ StopBalance()

void BtrfsBalance::StopBalance ( HWND  hwndDlg)
private

Definition at line 174 of file balance.cpp.

174  {
175  WCHAR modfn[MAX_PATH];
176  wstring t;
177  SHELLEXECUTEINFOW sei;
178 
179  GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR));
180 
181 #ifndef __REACTOS__
182  t = L"\""s + modfn + L"\",StopBalance " + fn;
183 #else
184  t = wstring(L"\"") + modfn + wstring(L"\",StopBalance ") + fn;
185 #endif
186 
187  RtlZeroMemory(&sei, sizeof(sei));
188 
189  sei.cbSize = sizeof(sei);
190  sei.hwnd = hwndDlg;
191  sei.lpVerb = L"runas";
192  sei.lpFile = L"rundll32.exe";
193  sei.lpParameters = t.c_str();
194  sei.nShow = SW_SHOW;
196 
197  if (!ShellExecuteExW(&sei))
198  throw last_error(GetLastError());
199 
200  cancelling = true;
201 
203  CloseHandle(sei.hProcess);
204 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define CloseHandle
Definition: compat.h:598
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
#define SW_SHOW
Definition: winuser.h:769
wstring fn
Definition: balance.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
bool cancelling
Definition: balance.h:53
LPCWSTR lpParameters
Definition: shellapi.h:331
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define INFINITE
Definition: serial.h:102

Referenced by BalanceDlgProc().

Member Data Documentation

◆ balance_status

uint32_t BtrfsBalance::balance_status
private

Definition at line 49 of file balance.h.

Referenced by BalanceDlgProc(), BalanceOptsDlgProc(), RefreshBalanceDlg(), and StartBalance().

◆ bqb

btrfs_query_balance BtrfsBalance::bqb
private

Definition at line 52 of file balance.h.

Referenced by BalanceOptsDlgProc(), and RefreshBalanceDlg().

◆ called_from_RemoveDevice

bool BtrfsBalance::called_from_RemoveDevice
private

Definition at line 59 of file balance.h.

Referenced by BalanceDlgProc(), and BtrfsBalance().

◆ called_from_ShrinkDevice

bool BtrfsBalance::called_from_ShrinkDevice
private

Definition at line 59 of file balance.h.

Referenced by BalanceDlgProc(), and BtrfsBalance().

◆ cancelling

bool BtrfsBalance::cancelling
private

Definition at line 53 of file balance.h.

Referenced by BalanceDlgProc(), RefreshBalanceDlg(), StartBalance(), and StopBalance().

◆ data_opts

btrfs_balance_opts BtrfsBalance::data_opts
private

Definition at line 50 of file balance.h.

Referenced by BalanceDlgProc(), BalanceOptsDlgProc(), SaveBalanceOpts(), and StartBalance().

◆ devices

btrfs_device* BtrfsBalance::devices
private

Definition at line 57 of file balance.h.

Referenced by BalanceOptsDlgProc(), BtrfsBalance(), SaveBalanceOpts(), and ShowBalance().

◆ fn

wstring BtrfsBalance::fn
private

◆ metadata_opts

btrfs_balance_opts BtrfsBalance::metadata_opts
private

Definition at line 50 of file balance.h.

Referenced by BalanceDlgProc(), BalanceOptsDlgProc(), SaveBalanceOpts(), and StartBalance().

◆ opts_type

uint8_t BtrfsBalance::opts_type
private

Definition at line 51 of file balance.h.

Referenced by BalanceOptsDlgProc(), SaveBalanceOpts(), and ShowBalanceOptions().

◆ readonly

bool BtrfsBalance::readonly
private

Definition at line 58 of file balance.h.

Referenced by BalanceDlgProc(), RefreshBalanceDlg(), and ShowBalance().

◆ removing

bool BtrfsBalance::removing
private

Definition at line 54 of file balance.h.

Referenced by BalanceDlgProc(), BtrfsBalance(), RefreshBalanceDlg(), and StartBalance().

◆ shrinking

bool BtrfsBalance::shrinking
private

Definition at line 55 of file balance.h.

Referenced by BalanceDlgProc(), RefreshBalanceDlg(), and StartBalance().

◆ system_opts

btrfs_balance_opts BtrfsBalance::system_opts
private

Definition at line 50 of file balance.h.

Referenced by BalanceDlgProc(), BalanceOptsDlgProc(), SaveBalanceOpts(), and StartBalance().


The documentation for this class was generated from the following files: