|
|
|
@ -296,6 +296,13 @@ void clear_array() {
|
|
|
|
|
philos_free_int_array_n2(&main_config.i_o_limit_read_size, main_config.size_tree_view);
|
|
|
|
|
philos_free_int_array_n2(&main_config.i_o_limit_write_size, main_config.size_tree_view);
|
|
|
|
|
gtk_list_store_clear(main_config.list);
|
|
|
|
|
main_config.i_o_limit_read = NULL;
|
|
|
|
|
main_config.i_o_limit_read_size = NULL;
|
|
|
|
|
main_config.i_o_limit_write = NULL;
|
|
|
|
|
main_config.i_o_limit_write_size = NULL;
|
|
|
|
|
main_config.disk_read = NULL;
|
|
|
|
|
main_config.disk_write = NULL;
|
|
|
|
|
|
|
|
|
|
main_config.size_tree_view = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -329,13 +336,27 @@ void template_load_cfg(char* cmd, dictionary* load_cfg) {
|
|
|
|
|
void init_cfg_array(int index) {
|
|
|
|
|
//main_config.disk = yon_char_parsed_append(main_config.disk, &index, "-");
|
|
|
|
|
//index--;
|
|
|
|
|
set_pow_size("-", &main_config.type_quota_size, &main_config.type_quota, index);
|
|
|
|
|
set_pow_size("-", &main_config.quota_volume_size, &main_config.quota_volume, 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_memory("-", &main_config.type_quota_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.type_quota, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.quota_volume_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.quota_volume, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.quota_volume_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.quota_volume, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.cpu_limit_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.cpu_limit, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.soft_raw_limit_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.soft_raw_limit, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.hard_raw_limit_size, index);
|
|
|
|
|
set_size_memory_integer("-", &main_config.hard_raw_limit, index);
|
|
|
|
|
|
|
|
|
|
set_pow_size_memory("-", &main_config.swap_size, index);
|
|
|
|
|
set_size_memory_integer("-",&main_config.swap , index);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void str_split_key(char* source_value, int index) {
|
|
|
|
@ -415,16 +436,20 @@ void str_split_value(char* values, int index) {
|
|
|
|
|
get_param_io_limit(arr_values, index_1, size,index, "IOWriteBandwidthMax");
|
|
|
|
|
}
|
|
|
|
|
if (yon_char_find_count(key, "MemoryHigh") != 0) {
|
|
|
|
|
set_pow_size(value, &main_config.soft_raw_limit_size, &main_config.soft_raw_limit, index);
|
|
|
|
|
set_pow_size_memory(yon_char_new(value), &main_config.soft_raw_limit_size, index);
|
|
|
|
|
set_size_memory_integer(yon_char_new(value), &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);
|
|
|
|
|
set_pow_size_memory(yon_char_new(value), &main_config.hard_raw_limit_size, index);
|
|
|
|
|
set_size_memory_integer(yon_char_new(value), &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);
|
|
|
|
|
set_pow_size_memory(yon_char_new(value), &main_config.swap_size, index);
|
|
|
|
|
set_size_memory_integer(yon_char_new(value), &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);
|
|
|
|
|
set_pow_size_memory(yon_char_new(value), &main_config.cpu_limit_size, index);
|
|
|
|
|
set_size_memory_integer(yon_char_new(value), &main_config.cpu_limit, index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -435,28 +460,6 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
|
|
|
|
|
char** array_disk = NULL;
|
|
|
|
|
int* array_limit_size = NULL;
|
|
|
|
|
int index_n2 = 0;
|
|
|
|
|
if (strstr(key_find, "IOReadBandwidthMax")!=NULL) {
|
|
|
|
|
main_config.i_o_limit_read = yon_remalloc(main_config.i_o_limit_read, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
main_config.i_o_limit_read_size = yon_remalloc(main_config.i_o_limit_read_size, (index_n1 + 1) * sizeof(int*));
|
|
|
|
|
main_config.disk_read = yon_remalloc(main_config.disk_read, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
array_disk = main_config.disk_read[index_n1];
|
|
|
|
|
array_limit = main_config.i_o_limit_read[index_n1];
|
|
|
|
|
array_limit_size = main_config.i_o_limit_read_size[index_n1];
|
|
|
|
|
//array_disk = yon_remalloc(array_disk, sizeof(char*));
|
|
|
|
|
//array_limit_size = yon_remalloc(array_limit_size, sizeof(int));
|
|
|
|
|
//array_limit = yon_remalloc(array_limit, sizeof(char*));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
main_config.i_o_limit_write = yon_remalloc(main_config.i_o_limit_write, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
main_config.i_o_limit_write_size = yon_remalloc(main_config.i_o_limit_read_size, (index_n1 + 1) * sizeof(int*));
|
|
|
|
|
main_config.disk_write = yon_remalloc(main_config.disk_write, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
array_disk = main_config.disk_write[index_n1];
|
|
|
|
|
array_limit = main_config.i_o_limit_write[index_n1];
|
|
|
|
|
array_limit_size = main_config.i_o_limit_write_size[index_n1];
|
|
|
|
|
//array_disk = yon_remalloc(array_disk, sizeof(char*));
|
|
|
|
|
//array_limit_size = yon_remalloc(array_limit_size, sizeof(int));
|
|
|
|
|
//array_limit = yon_remalloc(array_limit, sizeof(char*));
|
|
|
|
|
}
|
|
|
|
|
int flag_parsed = 0;
|
|
|
|
|
int flag_exit = 0;
|
|
|
|
|
for (int i = index_start; i < size; i++) {
|
|
|
|
@ -466,10 +469,12 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
|
|
|
|
|
if (strstr(arr_values[i], key_find)!=NULL) {
|
|
|
|
|
// Найден ключ в массив
|
|
|
|
|
char* disk = yon_char_divide_search(yon_char_new(value), " ", -1);
|
|
|
|
|
array_disk = yon_char_parsed_append(array_disk, &index_n2, yon_char_new(disk));
|
|
|
|
|
array_disk = yon_char_parsed_append(array_disk, &index_n2, disk);
|
|
|
|
|
index_n2--;
|
|
|
|
|
set_pow_size(yon_char_new(value), &array_limit_size, &array_limit, index_n2);
|
|
|
|
|
set_pow_size_memory(yon_char_new(value), &array_limit_size, index_n2);
|
|
|
|
|
set_size_memory_integer(yon_char_new(value), &array_limit, index_n2);
|
|
|
|
|
flag_parsed = 1;
|
|
|
|
|
index_n2++;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(arr_values[i], "BandwidthMax")!=NULL &&
|
|
|
|
|
strstr(arr_values[i], key_find)==NULL && flag_parsed == 1) {
|
|
|
|
@ -481,31 +486,67 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
|
|
|
|
|
}
|
|
|
|
|
else if (flag_parsed == 1) {
|
|
|
|
|
char* disk = yon_char_divide_search(yon_char_new(arr_values[i]), " ", -1);
|
|
|
|
|
array_disk = yon_char_parsed_append(array_disk, &index_n2, yon_char_new(disk));
|
|
|
|
|
array_disk = yon_char_parsed_append(array_disk, &index_n2, disk);
|
|
|
|
|
index_n2--;
|
|
|
|
|
set_pow_size(yon_char_new(arr_values[i]), &array_limit_size, &array_limit, index_n2);
|
|
|
|
|
set_pow_size_memory(yon_char_new(arr_values[i]), &array_limit_size, index_n2);
|
|
|
|
|
set_size_memory_integer(yon_char_new(arr_values[i]), &array_limit, index_n2);
|
|
|
|
|
index_n2++;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_exit == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
index_n2++;
|
|
|
|
|
}
|
|
|
|
|
if (index_n2 != 0) {
|
|
|
|
|
index_n2 += 1;
|
|
|
|
|
}
|
|
|
|
|
array_limit = yon_char_parsed_append(array_limit, &index_n2, NULL);
|
|
|
|
|
index_n2--;
|
|
|
|
|
array_limit = yon_char_parsed_append(array_disk, &index_n2, NULL);
|
|
|
|
|
array_disk = yon_char_parsed_append(array_disk, &index_n2, NULL);
|
|
|
|
|
index_n2--;
|
|
|
|
|
array_limit_size = philos_int_append(array_limit_size, &index_n2, -2);
|
|
|
|
|
if (strstr(key_find, "IOReadBandwidthMax")!=NULL) {
|
|
|
|
|
main_config.i_o_limit_read = yon_remalloc(main_config.i_o_limit_read, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
main_config.i_o_limit_read_size = yon_remalloc(main_config.i_o_limit_read_size, (index_n1 + 1) * sizeof(int*));
|
|
|
|
|
main_config.disk_read = yon_remalloc(main_config.disk_read, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
yon_char_parsed_copy(&main_config.i_o_limit_read[index_n1], &array_limit);
|
|
|
|
|
philos_array_int_copy(&main_config.i_o_limit_read_size[index_n1], &array_limit_size);
|
|
|
|
|
yon_char_parsed_copy(&main_config.disk_read[index_n1], &array_disk);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
main_config.i_o_limit_write = yon_remalloc(main_config.i_o_limit_write, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
main_config.i_o_limit_write_size = yon_remalloc(main_config.i_o_limit_write_size, (index_n1 + 1) * sizeof(int*));
|
|
|
|
|
main_config.disk_write = yon_remalloc(main_config.disk_write, (index_n1 + 1) * sizeof(char**));
|
|
|
|
|
yon_char_parsed_copy(&main_config.i_o_limit_write[index_n1], &array_limit);
|
|
|
|
|
philos_array_int_copy(&main_config.i_o_limit_write_size[index_n1], &array_limit_size);
|
|
|
|
|
yon_char_parsed_copy(&main_config.disk_write[index_n1], &array_disk);
|
|
|
|
|
}
|
|
|
|
|
philos_free_string_array(&array_limit, index_n2);
|
|
|
|
|
philos_free_string_array(&array_disk, index_n2);
|
|
|
|
|
philos_free_int_array(&array_limit_size, index_n2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_pow_size(char* str_find, int** array_size, char*** array_data , int index) {
|
|
|
|
|
void set_size_memory_integer(char* str_find, char*** array_data, int index) {
|
|
|
|
|
if (strstr(str_find, " ") != NULL) {
|
|
|
|
|
char* mem_s = yon_char_new(str_find);
|
|
|
|
|
yon_char_divide_search(mem_s, " ", -1);
|
|
|
|
|
size_t len = strlen(mem_s);
|
|
|
|
|
mem_s = yon_char_divide(mem_s, len-1);
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, mem_s);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
if (strstr(str_find, " ") == NULL) {
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, str_find);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_pow_size_memory(char* str_find, int** array_size,int index) {
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
if (strstr(str_find,"K") != NULL) {
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 0);
|
|
|
|
@ -541,19 +582,8 @@ void set_pow_size(char* str_find, int** array_size, char*** array_data , int ind
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, -1);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
*array_data = yon_char_parsed_append(*array_data, &index, str_find);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void main_cbx_2_event() {
|
|
|
|
|
int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfoLevel2));
|
|
|
|
@ -661,15 +691,15 @@ void fill_tree_view(int start, int size, int flag_gui_add) {
|
|
|
|
|
|
|
|
|
|
char* format_io_limit_in_tree_view(config_str* disk, config_str* i_o_limit, int** i_o_limit_size, int index) {
|
|
|
|
|
int index_to_n2 = 0;
|
|
|
|
|
char* str = NULL;
|
|
|
|
|
char* str = "";
|
|
|
|
|
while (1) {
|
|
|
|
|
if (i_o_limit[index]!= NULL) {
|
|
|
|
|
if (i_o_limit[index][index_to_n2] != NULL) {
|
|
|
|
|
if (index_to_n2!=0) {
|
|
|
|
|
str = yon_char_unite(str, ", ", disk[index][index_to_n2], " ", i_o_limit[index][index_to_n2], i_o_limit_size[index][index_to_n2], NULL);
|
|
|
|
|
str = yon_char_unite(str, ", ", disk[index][index_to_n2], " ", i_o_limit[index][index_to_n2], NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
str = yon_char_unite(str, disk[index][index_to_n2], " ", i_o_limit[index][index_to_n2], i_o_limit_size[index][index_to_n2], NULL);
|
|
|
|
|
str = yon_char_unite(str, disk[index][index_to_n2], " ", i_o_limit[index][index_to_n2], NULL);
|
|
|
|
|
}
|
|
|
|
|
index_to_n2++;
|
|
|
|
|
}
|
|
|
|
@ -1186,7 +1216,7 @@ int main(int argc, char *argv[]){
|
|
|
|
|
GTK_STYLE_PROVIDER(css),
|
|
|
|
|
-1);
|
|
|
|
|
//load_global_cfg();
|
|
|
|
|
load_system_cfg();
|
|
|
|
|
//load_system_cfg();
|
|
|
|
|
gtk_main();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|