|
|
|
@ -269,6 +269,7 @@ void clear_array() {
|
|
|
|
|
philos_free_string_array(&main_config.cpu_limit , main_config.size_tree_view);
|
|
|
|
|
philos_free_string_array(&main_config.i_o_limit_read , main_config.size_tree_view);
|
|
|
|
|
philos_free_string_array(&main_config.i_o_limit_write , main_config.size_tree_view);
|
|
|
|
|
philos_free_string_array(&main_config.disk, main_config.size_tree_view);
|
|
|
|
|
|
|
|
|
|
philos_free_int_array(&main_config.type_quota_size, main_config.size_tree_view);
|
|
|
|
|
philos_free_int_array(&main_config.quota_volume_size, main_config.size_tree_view);
|
|
|
|
@ -303,8 +304,18 @@ void template_cfg(char* cmd) {
|
|
|
|
|
if (main_config.size_tree_view != 0) {
|
|
|
|
|
fill_tree_view(0, main_config.size_tree_view, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void init_cfg_array(int index) {
|
|
|
|
|
main_config.disk = yon_char_parsed_append(main_config.disk, &index, "-");
|
|
|
|
|
index--;
|
|
|
|
|
set_pow_size("-", &main_config.cpu_limit_size, &main_config.cpu_limit, index);
|
|
|
|
|
set_pow_size("-", &main_config.cpu_limit_size, &main_config.cpu_limit, index);
|
|
|
|
|
set_pow_size("-", &main_config.soft_raw_limit_size, &main_config.soft_raw_limit, index);
|
|
|
|
|
set_pow_size("-", &main_config.hard_raw_limit_size, &main_config.hard_raw_limit, index);
|
|
|
|
|
set_pow_size("-", &main_config.swap_size, &main_config.swap, index);
|
|
|
|
|
set_pow_size("-", &main_config.i_o_limit_read_size, &main_config.i_o_limit_read, index);
|
|
|
|
|
set_pow_size("-", &main_config.i_o_limit_write_size, &main_config.i_o_limit_write, index);
|
|
|
|
|
}
|
|
|
|
|
void str_split_key(char* value, int index) {
|
|
|
|
|
yon_char_divide_search(value, "[", -1);
|
|
|
|
@ -371,6 +382,7 @@ void str_split_value(char* values, int index) {
|
|
|
|
|
if (arr_values == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
init_cfg_array(index);
|
|
|
|
|
char* value_i = NULL;
|
|
|
|
|
for (int index_1 = 0; index_1 < size; index_1++) {
|
|
|
|
|
value = arr_values[index_1];
|
|
|
|
@ -378,86 +390,85 @@ void str_split_value(char* values, int index) {
|
|
|
|
|
if (yon_char_find_count(key, "MemoryHigh") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.soft_raw_limit_size, &main_config.soft_raw_limit, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.soft_raw_limit_size, &main_config.soft_raw_limit, index);
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "MemoryMax") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.hard_raw_limit_size, &main_config.hard_raw_limit, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.hard_raw_limit_size, &main_config.hard_raw_limit, index);
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "MemorySwapMax") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.swap_size, &main_config.swap, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.swap_size, &main_config.swap, index);
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "CPUQuota") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.cpu_limit_size, &main_config.cpu_limit, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.cpu_limit_size, &main_config.cpu_limit, index);
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "IOReadBandwidthMax") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.i_o_limit_read_size, &main_config.i_o_limit_read, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.i_o_limit_read_size, &main_config.i_o_limit_read, index);
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "IOWriteBandwidthMax") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.i_o_limit_write_size, &main_config.i_o_limit_write, index);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
set_pow_size("-", &main_config.i_o_limit_write_size, &main_config.i_o_limit_write, index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_pow_size(char* str_find, int** array_size, char*** array_data , int index) {
|
|
|
|
|
char* disk = NULL;
|
|
|
|
|
if (strstr(str_find,"\"") != NULL) {
|
|
|
|
|
yon_char_divide(str_find, 0);
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-2);
|
|
|
|
|
if (str_find[0] == '\"') {
|
|
|
|
|
if (strstr(str_find, " ") != NULL) {
|
|
|
|
|
disk = yon_char_divide_search(str_find, " ", -1);
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, disk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
if (strstr(str_find,"K") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 0);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
str_find = yon_char_unite(str_find, " ", STR_KB);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"M") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 1);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
str_find = yon_char_unite(str_find," ", STR_MB);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"G") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 2);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
str_find = yon_char_unite(str_find," ", STR_GB);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"T") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 3);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
str_find = yon_char_unite(str_find," ", STR_TB);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"\%") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, -1);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"\"") != NULL) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"-") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, -1);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
if (strstr(str_find, "-") == NULL) {
|
|
|
|
|
if (strstr(str_find, "-") != NULL) {
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, "-");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (str_find[0] == '\"') {
|
|
|
|
|
yon_char_divide(str_find, 0);
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-2);
|
|
|
|
|
}
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, str_find);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, "-");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main_cbx_2_event() {
|
|
|
|
|
int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfo));
|
|
|
|
|
char* cmd_text_param = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtMainInfo));
|
|
|
|
@ -547,7 +558,6 @@ void fill_tree_view(int start, int size, int flag_gui_add) {
|
|
|
|
|
gtk_list_store_append(main_config.list,&iter);
|
|
|
|
|
gtk_list_store_set(main_config.list,&iter,0,main_config.type_quota[index],
|
|
|
|
|
1,main_config.quota_volume[index],
|
|
|
|
|
// === NULL === О
|
|
|
|
|
2,main_config.soft_raw_limit[index],
|
|
|
|
|
3,main_config.hard_raw_limit[index],
|
|
|
|
|
4,main_config.swap[index],
|
|
|
|
|