|
|
|
@ -11,10 +11,16 @@ char* save_str_users(config_u_g_p* config, int index) {
|
|
|
|
|
char* str_actors = NULL;
|
|
|
|
|
if (vec_actors->vectorList.total> 0) {
|
|
|
|
|
for (int i = 0; i < vec_actors->vectorList.total; i++) {
|
|
|
|
|
if (i==0) {
|
|
|
|
|
cmd = yon_char_unite(cmd, ":", NULL);
|
|
|
|
|
}
|
|
|
|
|
str_actors = (char*)vec_actors->pfVectorGet(vec_actors, i);
|
|
|
|
|
cmd = yon_char_unite(",", str_actors, NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, split_simvol, str_actors, NULL);
|
|
|
|
|
split_simvol[0] = ',';
|
|
|
|
|
split_simvol[1] = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -35,12 +41,44 @@ char* template_format_save(vector* vec_temp) {
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* save_format_status_cmd_all(vector* vec_temp, vector* vec_status_disk) {
|
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
|
if (vec_status_disk->vectorList.total > 0 && vec_status_disk->vectorList.total > 0) {
|
|
|
|
|
for (int i=0; i < vec_status_disk->vectorList.total; i++) {
|
|
|
|
|
config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i);
|
|
|
|
|
for (int j=0; j < vec_status_disk->vectorList.total;j++) {
|
|
|
|
|
disk_status* config_disk_status = (disk_status*)vec_status_disk->pfVectorGet(vec_status_disk, j);
|
|
|
|
|
if (strstr(config_disk_status->device, _config->device) && strstr(config_disk_status->device, _config->type_arr) ) {
|
|
|
|
|
cmd = yon_char_unite(cmd, " ", save_format_status_cmd(config_disk_status, _config));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
char* wrapper_save_format_status_cmd_all(config_all* _all_config) {
|
|
|
|
|
char* cmd = save_format_status_cmd_all(&_all_config->v_user, &_all_config->v_disk_status);
|
|
|
|
|
cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_group ,&_all_config->v_disk_status), NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_project, &_all_config->v_disk_status), NULL);
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* save_format_status_cmd(disk_status* config_disk_status, config_u_g_p* config) {
|
|
|
|
|
char* cmd = yon_char_unite("DISK_QUOTA[", config->type_arr, ":", config->UNIX_file,"]=", NULL);;
|
|
|
|
|
if (config_disk_status->status) {
|
|
|
|
|
cmd = yon_char_unite(cmd,"enable", NULL);
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
return yon_char_unite(cmd,"disable", NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* wrapper_template_format_save(config_all* _all_config, char* source_set_cmd) {
|
|
|
|
|
char* cmd_user = template_format_save(&_all_config->v_user);
|
|
|
|
|
char* cmd_group = template_format_save(&_all_config->v_group);
|
|
|
|
|
char* cmd_project = template_format_save(&_all_config->v_project);
|
|
|
|
|
if ((strlen(cmd_user) > 3 || strlen(cmd_group) > 3 || strlen(cmd_project) > 3) && !save_check_save(_all_config)) {
|
|
|
|
|
return yon_char_unite(source_set_cmd," ", cmd_user, " ", cmd_group, " ", cmd_project, NULL);
|
|
|
|
|
char* cmd_status_disk = wrapper_save_format_status_cmd_all(_all_config);
|
|
|
|
|
if ((strlen(cmd_status_disk) > 3 || strlen(cmd_user) > 3 || strlen(cmd_group) > 3 || strlen(cmd_project) > 3) && !save_check_save(_all_config)) {
|
|
|
|
|
return yon_char_unite(source_set_cmd," ", cmd_status_disk, " ", cmd_user, " ", cmd_group, " ", cmd_project, NULL);
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
@ -50,7 +88,7 @@ char* template_format_remove_save(config_all* _all_config, char* source_remove_c
|
|
|
|
|
char* cmd = yon_char_new(source_remove_cmd);
|
|
|
|
|
for (int i = 0; i < _all_config->v_remove.vectorList.total; i++) {
|
|
|
|
|
char* str_remove = (char*)_all_config->v_remove.pfVectorGet(&_all_config->v_remove, i);
|
|
|
|
|
cmd = yon_char_unite(cmd, " " , str_remove, " ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[" , str_remove, "] ", NULL);
|
|
|
|
|
}
|
|
|
|
|
if (strlen(cmd) > strlen(source_remove_cmd) && save_check_save(_all_config)== 0) {
|
|
|
|
|
return cmd;
|
|
|
|
@ -84,38 +122,37 @@ int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* s
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* save_format_key(config_u_g_p* config, int index) {
|
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
|
char* value = yon_char_new("");
|
|
|
|
|
char* key = yon_char_new("");
|
|
|
|
|
int number = config->id;
|
|
|
|
|
key = yon_char_unite("CGROUP_QUOTA[", config->type_arr, ":", NULL);
|
|
|
|
|
key = yon_char_unite("DISK_QUOTA[", config->type_arr, ":", NULL);
|
|
|
|
|
if (strstr(config->type_arr, "prjquota")) {
|
|
|
|
|
if (number!=-1) {
|
|
|
|
|
key = yon_char_unite(config->UNIX_file,":",yon_char_from_int(number), NULL);
|
|
|
|
|
key = yon_char_unite(key, config->UNIX_file,":",yon_char_from_int(number), NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
key = yon_char_unite(config->UNIX_file,":AUTO", NULL);
|
|
|
|
|
key = yon_char_unite(key, config->UNIX_file,":AUTO", NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
key = yon_char_unite(config->UNIX_file, NULL);
|
|
|
|
|
key = yon_char_unite(key, config->UNIX_file, NULL);
|
|
|
|
|
}
|
|
|
|
|
key = yon_char_unite(key, save_str_users(config, index) , "]", NULL);
|
|
|
|
|
return cmd;
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* save_format_str_value(config_u_g_p* config, int index) {
|
|
|
|
|
char* value = yon_char_new("");
|
|
|
|
|
value = philos_format_cfg_str_size_memory(value, config->soft_restriction_size,config->soft_restriction_size_pow);
|
|
|
|
|
value = yon_char_unite(value, ",", NULL);
|
|
|
|
|
value = yon_char_unite(value, yon_char_from_int(config->soft_restriction_file));
|
|
|
|
|
value = yon_char_unite(value, ",", NULL);
|
|
|
|
|
value = yon_char_unite(value, ":", NULL);
|
|
|
|
|
value = philos_format_cfg_str_size_memory(value, config->severe_limitation_size,config->severe_limitation_size_pow);
|
|
|
|
|
value = yon_char_unite(value, ",", NULL);
|
|
|
|
|
value = yon_char_unite(value, ":", NULL);
|
|
|
|
|
value = yon_char_unite(value, yon_char_from_int(config->soft_restriction_file), NULL);
|
|
|
|
|
value = yon_char_unite(value, ":", NULL);
|
|
|
|
|
value = yon_char_unite(value, yon_char_from_int(config->severe_limitation_file), NULL);
|
|
|
|
|
value = yon_char_unite(value, ",", NULL);
|
|
|
|
|
value = yon_char_unite(value, philos_char_from_size_t(config->deferring_size), ",", NULL);
|
|
|
|
|
value = yon_char_unite(value, ":", NULL);
|
|
|
|
|
value = yon_char_unite(value, philos_char_from_size_t(config->deferring_size), ":", NULL);
|
|
|
|
|
value = yon_char_unite(value, philos_char_from_size_t(config->deferring_file), NULL);
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
@ -129,15 +166,6 @@ int save_check_save(config_all* _all_config) {
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
char* save_format_status_cmd(config_u_g_p* config, int index) {
|
|
|
|
|
/*if (config->status) {
|
|
|
|
|
return yon_char_new("enable");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return yon_char_new("disable");
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return yon_char_new("disable");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|