mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
tools: fix sysfs error path
Attached patch fixes sysfs error path. NetBSD also has a /proc/mounts file but no sysfs. On Linux you can test this with sysfs not mounted. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
This commit is contained in:
1 parent
92181f1829
commit
b304702a73
3 files changed
+8
-1
No files matched your search
@@ -441,6 +441,8 @@ def find_sysfs_mnt():
|
||||
|
||||
def get_all_pci_names():
|
||||
sysfs_mnt = find_sysfs_mnt()
|
||||
if sysfs_mnt is None:
|
||||
return None
|
||||
pci_names = os.popen('ls ' + sysfs_mnt + SYSFS_PCI_DEVS_PATH).read().split()
|
||||
return pci_names
|
||||
|
||||
|
||||
@@ -68,7 +68,9 @@ def find_sysfs_mount():
|
||||
continue
|
||||
if sline[2] == 'sysfs':
|
||||
sysfs_mount_point= sline[1]
|
||||
return sysfs_mount_point
|
||||
break
|
||||
mounts_file.close()
|
||||
return sysfs_mount_point
|
||||
except IOError, (errno, strerr):
|
||||
raise
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ def _vscsi_get_scsidevices_by_sysfs():
|
||||
except:
|
||||
return devices
|
||||
|
||||
if sysfs_mnt is None:
|
||||
return devices
|
||||
|
||||
for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
|
||||
for hctl in dirnames:
|
||||
paths = os.path.join(dirpath, hctl)
|
||||
|
||||