* [PATCH] usertools/devbind: support all possible values sysfs flag
@ 2024-11-12 13:15 Rogelio Domínguez Hernández
2024-11-12 14:00 ` Robin Jarry
2024-11-12 14:07 ` [PATCH v2] usertools/devbind: support all possible values in " Rogelio Domínguez Hernández
0 siblings, 2 replies; 4+ messages in thread
From: Rogelio Domínguez Hernández @ 2024-11-12 13:15 UTC (permalink / raw)
To: Robin Jarry; +Cc: dev, Rogelio Domínguez Hernández
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)
Signed-off-by: Rogelio Domínguez Hernández <rogelio.dominguez@gmail.com>
---
usertools/dpdk-devbind.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 80c35f9ab6..548898d59e 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -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}")
--
2.45.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usertools/devbind: support all possible values sysfs flag
2024-11-12 13:15 [PATCH] usertools/devbind: support all possible values sysfs flag Rogelio Domínguez Hernández
@ 2024-11-12 14:00 ` Robin Jarry
2024-11-12 14:07 ` [PATCH v2] usertools/devbind: support all possible values in " Rogelio Domínguez Hernández
1 sibling, 0 replies; 4+ messages in thread
From: Robin Jarry @ 2024-11-12 14:00 UTC (permalink / raw)
To: Rogelio Domínguez Hernández; +Cc: dev
Hi,
Rogelio Domínguez Hernández, Nov 12, 2024 at 14:15:
> 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)
>
> Signed-off-by: Rogelio Domínguez Hernández <rogelio.dominguez@gmail.com>
> ---
> usertools/dpdk-devbind.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index 80c35f9ab6..548898d59e 100755
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> @@ -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"):
> return
> except OSError as err:
> sys.exit(f"Error: failed to check unsafe noiommu mode - Cannot open {filename}: {err}")
> --
> 2.45.2
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] usertools/devbind: support all possible values in sysfs flag
2024-11-12 13:15 [PATCH] usertools/devbind: support all possible values sysfs flag Rogelio Domínguez Hernández
2024-11-12 14:00 ` Robin Jarry
@ 2024-11-12 14:07 ` Rogelio Domínguez Hernández
2024-11-12 14:08 ` Robin Jarry
1 sibling, 1 reply; 4+ messages in thread
From: Rogelio Domínguez Hernández @ 2024-11-12 14:07 UTC (permalink / raw)
To: Robin Jarry; +Cc: dev, Rogelio Domínguez Hernández
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)
Signed-off-by: Rogelio Domínguez Hernández <rogelio.dominguez@gmail.com>
---
usertools/dpdk-devbind.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 80c35f9ab6..e8660098fd 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -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}")
--
2.45.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usertools/devbind: support all possible values in sysfs flag
2024-11-12 14:07 ` [PATCH v2] usertools/devbind: support all possible values in " Rogelio Domínguez Hernández
@ 2024-11-12 14:08 ` Robin Jarry
0 siblings, 0 replies; 4+ messages in thread
From: Robin Jarry @ 2024-11-12 14:08 UTC (permalink / raw)
To: Rogelio Domínguez Hernández; +Cc: dev
Rogelio Domínguez Hernández, Nov 12, 2024 at 15:07:
> 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)
>
> Signed-off-by: Rogelio Domínguez Hernández <rogelio.dominguez@gmail.com>
Thanks!
Reviewed-by: Robin Jarry <rjarry@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-12 14:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-12 13:15 [PATCH] usertools/devbind: support all possible values sysfs flag Rogelio Domínguez Hernández
2024-11-12 14:00 ` Robin Jarry
2024-11-12 14:07 ` [PATCH v2] usertools/devbind: support all possible values in " Rogelio Domínguez Hernández
2024-11-12 14:08 ` Robin Jarry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).