|
|
|
@ -433,10 +433,10 @@ char* philos_pard_array_add_cmd(char* cmd, temp_config* _config, char* key, int*
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int philos_check_activ_disk(temp_set_window *widgets, temp_config* _config, int size_disk) {
|
|
|
|
|
int philos_check_activ_disk(temp_set_window *widgets, temp_config* _config) {
|
|
|
|
|
char* disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtTempDevice));
|
|
|
|
|
disk = yon_char_divide_search(disk," ", -1);
|
|
|
|
|
if (disk == NULL || size_disk == 0) {
|
|
|
|
|
if (disk == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
@ -483,12 +483,12 @@ void philos_temp_generate_cmd(temp_set_window *widgets, temp_config* _config) {
|
|
|
|
|
split_simvol[1] = '\0';
|
|
|
|
|
}
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempDevice))!=-1) {
|
|
|
|
|
if (_config->size_read!=0) {
|
|
|
|
|
str_cmd = philos_pard_array_add_cmd(str_cmd, _config, "IOReadBandwidthMax=", _config->i_o_limit_read, _config->i_o_limit_read_size, _config->disk_read, _config->size_read);
|
|
|
|
|
if (_config->size_disk!=0) {
|
|
|
|
|
str_cmd = philos_pard_array_add_cmd(str_cmd, _config, "IOReadBandwidthMax=", _config->i_o_limit_read, _config->i_o_limit_read_size, _config->disk_read, _config->size_disk);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (_config->size_write!=0) {
|
|
|
|
|
str_cmd = philos_pard_array_add_cmd(str_cmd, _config, "IOWriteBandwidthMax=", _config->i_o_limit_write, _config->i_o_limit_write_size, _config->disk_write, _config->size_write);
|
|
|
|
|
if (_config->size_disk!=0) {
|
|
|
|
|
str_cmd = philos_pard_array_add_cmd(str_cmd, _config, "IOWriteBandwidthMax=", _config->i_o_limit_write, _config->i_o_limit_write_size, _config->disk_write, _config->size_disk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -506,20 +506,19 @@ void philos_temp_del_disk(temp_set_window *widgets, temp_config* _config, int fl
|
|
|
|
|
int size = 0;
|
|
|
|
|
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
size = _config->size_read;
|
|
|
|
|
if (philos_check_activ_disk(widgets, _config, size) == 0) {
|
|
|
|
|
size = _config->size_disk;
|
|
|
|
|
if (philos_check_activ_disk(widgets, _config) == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ptr_disk = _config->disk_read;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array == 1) {
|
|
|
|
|
size = _config->size_write;
|
|
|
|
|
if (philos_check_activ_disk(widgets, _config, size) == 0) {
|
|
|
|
|
size = _config->size_disk;
|
|
|
|
|
if (philos_check_activ_disk(widgets, _config) == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ptr_disk = _config->disk_write;
|
|
|
|
|
}
|
|
|
|
|
if (size) {
|
|
|
|
|
int index_find = -1;
|
|
|
|
|
if (ptr_disk) {
|
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
@ -540,31 +539,28 @@ void philos_temp_del_disk(temp_set_window *widgets, temp_config* _config, int fl
|
|
|
|
|
_config->i_o_limit_read[index_find] = -3;
|
|
|
|
|
_config->i_o_limit_write[index_find] = -3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (ptr_disk) {
|
|
|
|
|
_config->disk_read = ptr_disk;
|
|
|
|
|
_config->size_read = size;
|
|
|
|
|
yon_char_parsed_copy(&_config->disk_read, &ptr_disk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array == 1) {
|
|
|
|
|
if (ptr_disk) {
|
|
|
|
|
_config->disk_write = ptr_disk;
|
|
|
|
|
_config->size_write = size;
|
|
|
|
|
yon_char_parsed_copy(&_config->disk_write, &ptr_disk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void philos_temp_config_init(temp_config* _config) {
|
|
|
|
|
if (_config->size_read != 0) {
|
|
|
|
|
philos_free_string_array(&_config->disk_read, _config->size_read);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_read, _config->size_read);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_read_size, _config->size_read);
|
|
|
|
|
if (_config->size_disk != 0) {
|
|
|
|
|
philos_free_string_array(&_config->disk_read, _config->size_disk);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_read, _config->size_disk);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_read_size, _config->size_disk);
|
|
|
|
|
}
|
|
|
|
|
else if (_config->size_write != 0) {
|
|
|
|
|
philos_free_string_array(&_config->disk_write, _config->size_write);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_write, _config->size_write);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_write_size, _config->size_write);
|
|
|
|
|
else if (_config->size_disk != 0) {
|
|
|
|
|
philos_free_string_array(&_config->disk_write, _config->size_disk);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_write, _config->size_disk);
|
|
|
|
|
philos_free_int_array(&_config->i_o_limit_write_size, _config->size_disk);
|
|
|
|
|
}
|
|
|
|
|
_config->disk_read = NULL;
|
|
|
|
|
_config->disk_write = NULL;
|
|
|
|
@ -572,8 +568,8 @@ void philos_temp_config_init(temp_config* _config) {
|
|
|
|
|
_config->i_o_limit_write = NULL;
|
|
|
|
|
_config->i_o_limit_read_size = NULL;
|
|
|
|
|
_config->i_o_limit_write_size = NULL;
|
|
|
|
|
_config->size_read = 0;
|
|
|
|
|
_config->size_write = 0;
|
|
|
|
|
_config->size_disk = 0;
|
|
|
|
|
_config->size_disk = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flag_check_array = 0 READ
|
|
|
|
@ -586,7 +582,7 @@ void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _confi
|
|
|
|
|
int index_find = -1;
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (_config->disk_read) {
|
|
|
|
|
for (int index = 0; index < _config->size_read; index++) {
|
|
|
|
|
for (int index = 0; index < _config->size_disk; index++) {
|
|
|
|
|
char* disk_cfg = _config->disk_read[index];
|
|
|
|
|
if (disk_cfg) {
|
|
|
|
|
if (strstr(disk_cfg, disk) != NULL) {
|
|
|
|
@ -599,7 +595,7 @@ void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _confi
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array == 1) {
|
|
|
|
|
if (_config->disk_write) {
|
|
|
|
|
for (int index = 0; index < _config->size_write; index++) {
|
|
|
|
|
for (int index = 0; index < _config->size_disk; index++) {
|
|
|
|
|
char* disk_cfg = _config->disk_write[index];
|
|
|
|
|
if (disk_cfg) {
|
|
|
|
|
if (strstr(disk_cfg, disk) != NULL) {
|
|
|
|
@ -677,11 +673,11 @@ void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config, int fl
|
|
|
|
|
int size = 0;
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
ptr_disk = _config->disk_read;
|
|
|
|
|
size = _config->size_read;
|
|
|
|
|
size = _config->size_disk;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array == 1) {
|
|
|
|
|
ptr_disk = _config->disk_write;
|
|
|
|
|
size = _config->size_write;
|
|
|
|
|
size = _config->size_disk;
|
|
|
|
|
}
|
|
|
|
|
if (disk_id >= 0 && size !=0) {
|
|
|
|
|
int index_find = -1;
|
|
|
|
@ -697,46 +693,14 @@ void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config, int fl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (index_find == -1 || index_find>=0) {
|
|
|
|
|
if (index_find == -1) {
|
|
|
|
|
// Добавление
|
|
|
|
|
ptr_disk = yon_char_parsed_append(ptr_disk,&size, disk);
|
|
|
|
|
size--;
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempRead))) {
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size,&size,(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read,&size,gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempRead)));
|
|
|
|
|
size--;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_check_array == 1) {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempWrite))) {
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size,&size,(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempWrite)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write,&size,gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempWrite)));
|
|
|
|
|
size--;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
index_find = find_null_array(_config);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
size++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Редактирование
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempRead))) {
|
|
|
|
|
_config->i_o_limit_read_size[index_find] =(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead));
|
|
|
|
|
_config->i_o_limit_read_size[index_find] = (int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead));
|
|
|
|
|
_config->i_o_limit_read[index_find] = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempRead));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -754,59 +718,62 @@ void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config, int fl
|
|
|
|
|
_config->i_o_limit_write[index_find] = -3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (bool_read == 1 || bool_write == 1) {
|
|
|
|
|
ptr_disk = yon_char_parsed_append(ptr_disk,&size, disk);
|
|
|
|
|
size--;
|
|
|
|
|
int index_find = find_null_array(_config);
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempRead))) {
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size,&size,(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read,&size,gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempRead)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read_size[index_find] = (int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead));
|
|
|
|
|
_config->i_o_limit_read[index_find] = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempRead));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_read_size[index_find] = -3;
|
|
|
|
|
_config->i_o_limit_read[index_find] = -3;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_check_array == 1) {
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempWrite))) {
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size,&size,(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempWrite)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write,&size,gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempWrite)));
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write_size[index_find] = (int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempWrite));
|
|
|
|
|
_config->i_o_limit_write[index_find] = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempWrite));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write,&size,-3);
|
|
|
|
|
size--;
|
|
|
|
|
_config->i_o_limit_write_size[index_find] = -3;
|
|
|
|
|
_config->i_o_limit_write[index_find] = -3;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_check_array == 0) {
|
|
|
|
|
if (ptr_disk) {
|
|
|
|
|
_config->disk_read = ptr_disk;
|
|
|
|
|
_config->size_read = size;
|
|
|
|
|
yon_char_parsed_copy(&_config->disk_read, &ptr_disk);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array == 1) {
|
|
|
|
|
if (ptr_disk) {
|
|
|
|
|
_config->disk_write = ptr_disk;
|
|
|
|
|
_config->size_write = size;
|
|
|
|
|
yon_char_parsed_copy(&_config->disk_write, &ptr_disk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int find_null_array(temp_config* _config) {
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (index = 0; (_config->disk_read[index]!=NULL && _config->disk_write[index]!=NULL); index++) {
|
|
|
|
|
if (strcmp(_config->disk_read[index], "-") == 0 && strcmp(_config->disk_write[index], "-") == 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return index;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int* philos_int_append(int* array, int* size, int value) {
|
|
|
|
|
array = yon_remalloc(array, (*size+1)*sizeof(int));
|
|
|
|
@ -1141,3 +1108,29 @@ void philos_array_char_pars_to(char*** array, char* to) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void init_device_disk(temp_config* _config) {
|
|
|
|
|
for (int index = 0;index< (get_device_cfg()->size_disk*2);index++){
|
|
|
|
|
_config->disk_read = yon_char_parsed_append(_config->disk_read,&_config->size_disk, "-");
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size, &_config->size_disk, -3);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write, &_config->size_disk, -3);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size, &_config->size_disk, -3);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->disk_write = yon_char_parsed_append(_config->disk_write,&_config->size_disk, "-");
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read, &_config->size_disk, -3);
|
|
|
|
|
}
|
|
|
|
|
_config->i_o_limit_write_size = philos_int_append(_config->i_o_limit_write_size, &_config->size_disk, -2);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->disk_write = yon_char_parsed_append(_config->disk_write, &_config->size_disk, NULL);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->disk_read = yon_char_parsed_append(_config->disk_read, &_config->size_disk, NULL);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_write = philos_int_append(_config->i_o_limit_write, &_config->size_disk, -2);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_read = philos_int_append(_config->i_o_limit_read, &_config->size_disk, -2);
|
|
|
|
|
_config->size_disk--;
|
|
|
|
|
_config->i_o_limit_read_size = philos_int_append(_config->i_o_limit_read_size, &_config->size_disk, -2);
|
|
|
|
|
}
|