|
|
|
@ -61,11 +61,41 @@ char* save_format_status_cmd_all(vector* vec_temp, vector* vec_status_disk) {
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* set_status_and_del(config_all* _all_config) {
|
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
|
for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) {
|
|
|
|
|
disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j);
|
|
|
|
|
if (config_disk_status->status == 2) {
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , config_disk_status->device, "]=enable ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , config_disk_status->device, "]=enable ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , config_disk_status->device, "]=enable ", NULL);
|
|
|
|
|
}
|
|
|
|
|
else if (config_disk_status->status == 1) {
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , config_disk_status->device, "]=disable ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , config_disk_status->device, "]=disable ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , config_disk_status->device, "]=disable ", NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (strlen(cmd) > 5) {
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
if (strlen(cmd) > 5) {
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return set_status_and_del(_all_config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* save_format_status_cmd(disk_status* config_disk_status, config_u_g_p* config) {
|
|
|
|
@ -108,18 +138,25 @@ char* template_format_remove_save(config_all* _all_config, char* source_remove_c
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
char* template_format_remove_save_device(config_all* _all_config, char* source_remove_cmd) {
|
|
|
|
|
char* cmd = NULL;
|
|
|
|
|
char* cmd = yon_char_new("");
|
|
|
|
|
if (_all_config->v_disk_remove.vectorList.total > 0) {
|
|
|
|
|
for (int i=0; i < _all_config->v_disk_remove.vectorList.total; i++) {
|
|
|
|
|
disk_status* _config = (disk_status*)_all_config->v_disk_remove.pfVectorGet(&_all_config->v_disk_remove, 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);
|
|
|
|
|
}
|
|
|
|
|
char* str_del = (char*)_all_config->v_disk_remove.pfVectorGet(&_all_config->v_disk_remove, i);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , str_del, "] ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , str_del, "] ", NULL);
|
|
|
|
|
cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , str_del, "] ", NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
if (strlen(cmd)>5) {
|
|
|
|
|
for (int i=0; i < _all_config->v_disk_remove.vectorList.total; i++) {
|
|
|
|
|
_all_config->v_disk_remove.pfVectorDelete(&_all_config->v_disk_remove, i);
|
|
|
|
|
}
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|