usertools/devbind: support all possible values sysfs flag
PATCH 1/1 usertools/devbind: support all possible values sysfs flag
This patch adds support for 'y' and 'Y' values when reading vfio-pci unsafe_noiommu_mode flag.
Possible values were taken from linux kernel
(sysfs__read_bool() in tools/lib/api/fs/fs.c)
--- usertools/dpdk-devbind.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
usertools/dpdk-devbind.py +2 -1
@@ -490,7 +490,8 @@ def check_noiommu_mode(): try: with open(filename, "r") as f: - if f.read(1) == "1": + value = f.read(1) + if value == "1" or value == "y" or value == "Y": return except OSError as err: sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")
Signature · 1 line
2.45.2
Hi,
Rogelio Domínguez Hernández, Nov 12, 2024 at 14:15:
Quoted 16 lines
This patch adds support for 'y' and 'Y' values when reading vfio-pci
unsafe_noiommu_modeflag.Possible values were taken from linux kernel
(sysfs__read_bool()intools/lib/api/fs/fs.c)Signed-off-by Rogelio Domínguez Hernández <[email protected]>--- usertools/dpdk-devbind.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)usertools/dpdk-devbind.py +0
-0
usertools/dpdk-devbind.py def check_noiommu_mode(): · line 494
Quoted 6 lines
usertools/dpdk-devbind.py +2
-1@@ -490,7 +490,8 @@ def check_noiommu_mode(): try: with open(filename, "r") as f: - if f.read(1) == "1": + value = f.read(1) + if value == "1" or value == "y" or value == "Y":
Minor detail, could you rewrite it as:
if value in ("1", "y", "Y"):Quoted 5 lines
usertools/dpdk-devbind.py +0
-0return except OSError as err: sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")Signature · 1 line
2.45.2
Thanks!
PATCH v2 1/1 usertools/devbind: support all possible values in sysfs flag
In reply to Rogelio Domínguez HernándezThis patch adds support for 'y' and 'Y' values when reading vfio-pci unsafe_noiommu_mode flag.
Possible values were taken from linux kernel
(sysfs__read_bool() in tools/lib/api/fs/fs.c)
--- usertools/dpdk-devbind.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
usertools/dpdk-devbind.py +2 -1
@@ -490,7 +490,8 @@ def check_noiommu_mode(): try: with open(filename, "r") as f: - if f.read(1) == "1": + value = f.read(1) + if value in ("1", "y" ,"Y"): return except OSError as err: sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")
Signature · 1 line
2.45.2
Re: [PATCH v2] usertools/devbind: support all possible values in sysfs flag
Rogelio Domínguez Hernández, Nov 12, 2024 at 15:07:
Quoted 7 lines
This patch adds support for 'y' and 'Y' values when reading vfio-pci
unsafe_noiommu_modeflag.Possible values were taken from linux kernel
(sysfs__read_bool()intools/lib/api/fs/fs.c)Signed-off-by Rogelio Domínguez Hernández <[email protected]>
Thanks!
Thomas Monjalon
AppliedRe: [PATCH v2] usertools/devbind: support all possible values in sysfs flag
12/11/2024 15:08, Robin Jarry:
Quoted 4 lines
Rogelio Domínguez Hernández, Nov 12, 2024 at 15:07:
Quoted 3 lines
This patch adds support for 'y' and 'Y' values when reading vfio-pci
unsafe_noiommu_modeflag.
Quoted 8 lines
Quoted 4 lines
Possible values were taken from linux kernel
(sysfs__read_bool()intools/lib/api/fs/fs.c)Signed-off-by Rogelio Domínguez Hernández <[email protected]>Thanks!
Reviewed-by Robin Jarry <[email protected]>
Applied, thanks.