|
|
@ -975,15 +975,14 @@ void wrapper_system_save() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* save_format_key(int index) {
|
|
|
|
char* save_format_key(int index) {
|
|
|
|
char* key = NULL;
|
|
|
|
if (strstr(main_config.quota_volume[index], "-") != NULL) {
|
|
|
|
if (strstr(main_config.quota_volume[index], "-") == NULL) {
|
|
|
|
return yon_char_unite("CGROUP_QUOTA[", main_config.quota_volume[index] , "]", NULL);
|
|
|
|
key = yon_char_unite("CGROUP_QUOTA[", main_config.quota_volume[index] , "]", NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return key;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char* save_format_value(int index) {
|
|
|
|
char* save_format_value(int index) {
|
|
|
|
char* value = "";
|
|
|
|
char* value = yon_char_new("");
|
|
|
|
char split_simvol[2] = {0};
|
|
|
|
char split_simvol[2] = {0};
|
|
|
|
split_simvol[0] = 0;
|
|
|
|
split_simvol[0] = 0;
|
|
|
|
split_simvol[1] = 0;
|
|
|
|
split_simvol[1] = 0;
|
|
|
@ -1019,30 +1018,46 @@ char* save_format_value(int index) {
|
|
|
|
split_simvol[0] = ',';
|
|
|
|
split_simvol[0] = ',';
|
|
|
|
split_simvol[1] = '\0';
|
|
|
|
split_simvol[1] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
value = add_io_str_format_ubconfig(value, "IOReadBandwidthMax", main_config.i_o_limit_read, main_config.i_o_limit_read_size, main_config.disk, index);
|
|
|
|
|
|
|
|
value = add_io_str_format_ubconfig(value, "IOWriteBandwidthMax", main_config.i_o_limit_write, main_config.i_o_limit_write_size, main_config.disk, index);
|
|
|
|
char* value_read = add_io_str_format_ubconfig("IOReadBandwidthMax", main_config.i_o_limit_read, main_config.i_o_limit_read_size, main_config.disk, index);
|
|
|
|
|
|
|
|
char* value_write = add_io_str_format_ubconfig("IOWriteBandwidthMax", main_config.i_o_limit_write, main_config.i_o_limit_write_size, main_config.disk, index);
|
|
|
|
|
|
|
|
if (strlen(value_read) > 5){
|
|
|
|
|
|
|
|
if (strlen(value) > 5) {
|
|
|
|
|
|
|
|
value = yon_char_unite(value, ",", value_read, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
value = yon_char_unite(value_read, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(value_write)> 5) {
|
|
|
|
|
|
|
|
if (strlen(value) > 5) {
|
|
|
|
|
|
|
|
value = yon_char_unite(value, ",", value_write, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
value = yon_char_unite(value_write, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char* add_io_str_format_ubconfig(char* cmd_io, char* key, int** i_o_limit, int** i_o_limit_size, char*** disk, int index) {
|
|
|
|
char* add_io_str_format_ubconfig(char* key, int** i_o_limit, int** i_o_limit_size, char*** disk, int index) {
|
|
|
|
char split_simvol[2] = {0};
|
|
|
|
char split_simvol[2] = {0};
|
|
|
|
if (i_o_limit== NULL) {return cmd_io;}
|
|
|
|
char* cmd_io = "";
|
|
|
|
if (i_o_limit_size[index] == NULL) {return cmd_io;}
|
|
|
|
if (i_o_limit== NULL) {return NULL;}
|
|
|
|
if (i_o_limit[index] == NULL) {return cmd_io;}
|
|
|
|
if (i_o_limit_size[index] == NULL) {return NULL;}
|
|
|
|
|
|
|
|
if (i_o_limit[index] == NULL) {return NULL;}
|
|
|
|
int len_array = 0;
|
|
|
|
int len_array = 0;
|
|
|
|
for (int i = 0;i_o_limit[index][i] != -2; i++) {
|
|
|
|
for (int i = 0;i_o_limit[index][i] != -2; i++) {
|
|
|
|
len_array += 1;
|
|
|
|
len_array += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i=0; i<len_array; i++) {
|
|
|
|
for (int i=0; i<len_array; i++) {
|
|
|
|
if (i==0 && strlen(cmd_io) < 3) {
|
|
|
|
|
|
|
|
cmd_io = yon_char_unite(cmd_io, key, "=", NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (i==0 && strlen(cmd_io) > 3) {
|
|
|
|
|
|
|
|
cmd_io = yon_char_unite(cmd_io, ",", key, "=", NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int read_limit = i_o_limit[index][i];
|
|
|
|
int read_limit = i_o_limit[index][i];
|
|
|
|
char* read_disk = disk[index][i];
|
|
|
|
char* read_disk = disk[index][i];
|
|
|
|
int read_limit_size = i_o_limit_size[index][i];
|
|
|
|
int read_limit_size = i_o_limit_size[index][i];
|
|
|
|
if (read_limit >= 0 && read_disk && read_limit_size >= 0) {
|
|
|
|
if (read_limit >= 0 && read_disk && read_limit_size >= 0) {
|
|
|
|
|
|
|
|
if (i==0 && strlen(cmd_io) < 3) {
|
|
|
|
|
|
|
|
cmd_io = yon_char_unite(cmd_io, key, "=", NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
char* num_and_pow_size = philos_format_cfg_str_size_memory("",read_limit, read_limit_size);
|
|
|
|
char* num_and_pow_size = philos_format_cfg_str_size_memory("",read_limit, read_limit_size);
|
|
|
|
cmd_io = yon_char_unite(cmd_io, split_simvol, read_disk, " ",num_and_pow_size, NULL);
|
|
|
|
cmd_io = yon_char_unite(cmd_io, split_simvol, read_disk, " ",num_and_pow_size, NULL);
|
|
|
|
split_simvol[0] = ',';
|
|
|
|
split_simvol[0] = ',';
|
|
|
@ -1091,24 +1106,23 @@ int template_format_str_save(char* source_set_cmd, char* source_remove_cmd) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char* template_format_str_set_save(char* source_set_cmd) {
|
|
|
|
char* template_format_str_set_save(char* source_set_cmd) {
|
|
|
|
char* cmd = yon_char_new(source_set_cmd);
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
for (size_t index = 0; index < main_config.size_tree_view; index++) {
|
|
|
|
for (size_t index = 0; index < main_config.size_tree_view; index++) {
|
|
|
|
char* key = NULL;
|
|
|
|
char* key = save_format_key(index);
|
|
|
|
char* value = NULL;
|
|
|
|
char* value = save_format_value(index);
|
|
|
|
key = yon_char_new(save_format_key(index));
|
|
|
|
|
|
|
|
value = yon_char_new(save_format_value(index));
|
|
|
|
|
|
|
|
if (key != NULL && value != NULL) {
|
|
|
|
if (key != NULL && value != NULL) {
|
|
|
|
cmd = yon_char_unite(cmd, " " , key, "=\"" , value, "\" ", NULL);
|
|
|
|
cmd = yon_char_unite(cmd, " " , key, "=\"" , value, "\" ", NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (key != NULL) {
|
|
|
|
if (key != NULL) {
|
|
|
|
free(key);
|
|
|
|
free(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (value != NULL) {
|
|
|
|
if (value != NULL) {
|
|
|
|
free(value);
|
|
|
|
free(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd != NULL && check_save()== 0) {
|
|
|
|
if (strlen(cmd) > 1 && check_save()== 0) {
|
|
|
|
cmd = yon_char_unite(source_set_cmd, " " ,cmd, NULL);
|
|
|
|
|
|
|
|
puts(cmd);
|
|
|
|
return cmd;
|
|
|
|
return cmd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(cmd);
|
|
|
|
free(cmd);
|
|
|
|