# ----------------------------------- Disk - Get disk_model_name, parent_disk, disk_mount_point Values Function -----------------------------------
# ----------------------------------- Disk - Get disk_vendor_model, disk_parent_name, disk_mount_point Values Function -----------------------------------
# Check if disk exists in the disk list and if disk directory exists in order to prevent errors when disk is removed suddenly when the same disk is selected on the GUI. This error occurs because foreground thread and background thread are different for performance monitoring. Tracking of disk list changes is performed by background thread and there may be a time difference between these two threads. This situtation may cause errors when viewed list is removed suddenly. There may be a better way for preventing these errors/fixing this problem.
selected_disk_name=disk_list[selected_disk_number]# This definition is made in order to reduce CPU usage because this value is used multiple times in this function.
ifos.path.isdir("/sys/class/block/"+selected_disk_name+"/device"):# Checking "DEVTYPE" information in "/sys/class/block/[DISKNAME]/uevent" causes getting wrong "parent-child disk" information for "loop" devices. Checking "/device" folder is a more secure way.
elif"zram"inselected_disk_name:# SWAP partitions on some systems are named as "zram0, zram1, etc.) and these partitions are defined as "disk" instead pf "partition" in the "uevent" file.
disk_parent_name=""# Initial value of "disk_parent_name" variable. This value will be used if disk has no parent disk or disk parent name could not be detected.
disk_vendor_model="-"# Initial value of "disk_vendor_model" variable. This value will be used if disk vendor and model could not be detected. The same value is also used for disk partitions.