mirror of
https://github.com/Lekensteyn/lglaf.git
synced 2024-11-14 19:35:41 -05:00
partitions: make partition_info faster
This commit is contained in:
parent
c8e27d445d
commit
6f078543ca
1 changed files with 2 additions and 2 deletions
|
@ -51,8 +51,8 @@ def partition_info(comm, part_name):
|
||||||
disk_path = "/sys/class/block/%s" % part_name
|
disk_path = "/sys/class/block/%s" % part_name
|
||||||
try:
|
try:
|
||||||
# Convert sector sizes to bytes.
|
# Convert sector sizes to bytes.
|
||||||
start = 512 * int(cat_file(comm, "%s/start" % disk_path))
|
output = cat_file(comm, '{0}/start {0}/size'.format(disk_path)).split()
|
||||||
size = 512 * int(cat_file(comm, "%s/size" % disk_path))
|
start, size = (512 * int(x) for x in output)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise RuntimeError("Partition %s not found" % part_name)
|
raise RuntimeError("Partition %s not found" % part_name)
|
||||||
return start, size
|
return start, size
|
||||||
|
|
Loading…
Reference in a new issue