|
|
|
@ -2,20 +2,45 @@
|
|
|
|
|
|
|
|
|
|
device_config obj_device_config;
|
|
|
|
|
|
|
|
|
|
device_config* get_device_cfg() {
|
|
|
|
|
device_config *get_device_cfg()
|
|
|
|
|
{
|
|
|
|
|
return &obj_device_config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void device_disk_parsed() {
|
|
|
|
|
char* cmd = "lsblk --fs --raw --output PATH,FSTYPE --exclude 7,11,253";
|
|
|
|
|
// findmnt -lo source,target,fstype,label -t ext4
|
|
|
|
|
char *cmd = "lsblk --fs --raw --output PATH,FSTYPE --exclude 7,11,253";
|
|
|
|
|
int size = 0;
|
|
|
|
|
char** responce = yon_config_load(cmd, &size);
|
|
|
|
|
char **responce = yon_config_load(cmd, &size);
|
|
|
|
|
obj_device_config.size_disk = 0;
|
|
|
|
|
char* split_simvol = " ";
|
|
|
|
|
for (int index = 1; index < size; index++ ) {
|
|
|
|
|
char* disk = yon_char_divide_search(responce[index], "\n", -1);
|
|
|
|
|
if (yon_char_find_count(disk, " ") != 0) {
|
|
|
|
|
char* name_disk = yon_char_divide_search(disk, " ", -1);
|
|
|
|
|
char *split_simvol = " ";
|
|
|
|
|
for (int index = 1; index < size; index++)
|
|
|
|
|
{
|
|
|
|
|
char *disk = yon_char_divide_search(responce[index], "\n", -1);
|
|
|
|
|
if (yon_char_find_count(disk, " ") != 0)
|
|
|
|
|
{
|
|
|
|
|
int size_str = 0;
|
|
|
|
|
char* str_info = yon_char_parse(disk, size_str, ' ');
|
|
|
|
|
char** name_disk = yon_char_divide_search(disk, " ", -1);
|
|
|
|
|
int flag = 0;
|
|
|
|
|
for (int index_1 = 0; index_1 < size_str; index_1++) {
|
|
|
|
|
if (!strstr(name_disk[index_1], " ")) {
|
|
|
|
|
flag+=1;
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
obj_device_config.name_disk = yon_char_new(name_disk[index_1])
|
|
|
|
|
}
|
|
|
|
|
if (flag == 1) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (flag == 2) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (flag == 3) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj_device_config.name_disk = yon_char_parsed_append(obj_device_config.name_disk, &obj_device_config.size_disk, name_disk);
|
|
|
|
|
obj_device_config.size_disk--;
|
|
|
|
|
obj_device_config.file_system = yon_char_parsed_append(obj_device_config.file_system, &obj_device_config.size_disk, disk);
|
|
|
|
@ -24,27 +49,26 @@ void device_disk_parsed() {
|
|
|
|
|
obj_device_config.size_disk--;
|
|
|
|
|
obj_device_config.type_dick = yon_char_parsed_append(obj_device_config.type_dick, &obj_device_config.size_disk, "");
|
|
|
|
|
obj_device_config.size_disk--;
|
|
|
|
|
disk = yon_char_replace(disk," ", "");
|
|
|
|
|
if (strlen(disk)!=0) {
|
|
|
|
|
char* description_disk = yon_char_unite(name_disk,
|
|
|
|
|
split_simvol,
|
|
|
|
|
disk,
|
|
|
|
|
NULL);
|
|
|
|
|
disk = yon_char_replace(disk, " ", "");
|
|
|
|
|
if (strlen(disk) != 0)
|
|
|
|
|
{
|
|
|
|
|
char *description_disk = yon_char_unite(name_disk,
|
|
|
|
|
split_simvol,
|
|
|
|
|
disk,
|
|
|
|
|
NULL);
|
|
|
|
|
obj_device_config.description_disk = yon_char_parsed_append(obj_device_config.description_disk, &obj_device_config.size_disk, description_disk);
|
|
|
|
|
free(description_disk);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
free(name_disk);
|
|
|
|
|
}
|
|
|
|
|
free(disk);
|
|
|
|
|
}
|
|
|
|
|
philos_free_string_array(&responce, size);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void device_fill_disk(GtkWidget* combo_box_text) {
|
|
|
|
|
for (int index = 0; index < obj_device_config.size_disk; index++) {
|
|
|
|
|
void device_fill_disk(GtkWidget *combo_box_text)
|
|
|
|
|
{
|
|
|
|
|
for (int index = 0; index < obj_device_config.size_disk; index++)
|
|
|
|
|
{
|
|
|
|
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box_text), obj_device_config.description_disk[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|