|
|
|
@ -70,11 +70,11 @@ char* wrapper_save_format_status_cmd_all(config_all* _all_config) {
|
|
|
|
|
|
|
|
|
|
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 == 1) {
|
|
|
|
|
if (config_disk_status->status == 2) {
|
|
|
|
|
cmd = yon_char_unite(cmd,"enable", NULL);
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
else if (config_disk_status->status == 0) {
|
|
|
|
|
else if (config_disk_status->status == 1) {
|
|
|
|
|
return yon_char_unite(cmd,"disable", NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -105,28 +105,53 @@ char* template_format_remove_save(config_all* _all_config, char* source_remove_c
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
char* template_format_remove_save_device(config_all* _all_config, char* source_remove_cmd) {
|
|
|
|
|
if (_all_config->v_disk_status.vectorList.total > 0) {
|
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
|
for (int i=0; i < _all_config->v_disk_status.vectorList.total; i++) {
|
|
|
|
|
disk_status* _config = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, i);
|
|
|
|
|
if (_config->status == 0) {
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota" , _config->device, "] ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota" , _config->device, "] ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota" , _config->device, "] ", NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* source_remove_cmd) {
|
|
|
|
|
char* str_cmd_remove = template_format_remove_save(_all_config,source_remove_cmd);
|
|
|
|
|
char* str_cmd_remove_device = template_format_remove_save_device(_all_config,source_remove_cmd);
|
|
|
|
|
char* str_cmd_set = wrapper_template_format_save(_all_config,source_set_cmd);
|
|
|
|
|
if (str_cmd_set != NULL && str_cmd_remove != NULL) {
|
|
|
|
|
philos_config_save(yon_char_unite(str_cmd_remove, "; " , str_cmd_set, NULL));
|
|
|
|
|
}
|
|
|
|
|
else if (str_cmd_remove != NULL) {
|
|
|
|
|
philos_config_save(str_cmd_remove);
|
|
|
|
|
}
|
|
|
|
|
else if (str_cmd_set != NULL) {
|
|
|
|
|
philos_config_save(str_cmd_set);
|
|
|
|
|
if (str_cmd_set != NULL && str_cmd_remove != NULL && str_cmd_remove_device != NULL) {
|
|
|
|
|
philos_config_save(yon_char_unite(str_cmd_remove, " " ,str_cmd_remove_device, "; " , str_cmd_set, NULL));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
if (str_cmd_remove != NULL) {
|
|
|
|
|
philos_config_save(str_cmd_remove);
|
|
|
|
|
}
|
|
|
|
|
if (str_cmd_set != NULL) {
|
|
|
|
|
philos_config_save(str_cmd_set);
|
|
|
|
|
}
|
|
|
|
|
if (str_cmd_remove_device != NULL) {
|
|
|
|
|
philos_config_save(yon_char_unite(source_remove_cmd, " " , str_cmd_set, NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (str_cmd_remove != NULL) {
|
|
|
|
|
free(str_cmd_remove);
|
|
|
|
|
}
|
|
|
|
|
if (str_cmd_set != NULL) {
|
|
|
|
|
free(str_cmd_set);
|
|
|
|
|
}
|
|
|
|
|
if (str_cmd_remove_device != NULL) {
|
|
|
|
|
free(str_cmd_remove_device);
|
|
|
|
|
}
|
|
|
|
|
_all_config->flag_set_data = 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|