DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Robin Jarry" <rjarry@redhat.com>
To: "Rogelio Domínguez Hernández" <rogelio.dominguez@gmail.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] usertools/devbind: support all possible values sysfs flag
Date: Tue, 12 Nov 2024 15:00:32 +0100	[thread overview]
Message-ID: <D5K96E4MMZ22.SL52F1UJG8CJ@redhat.com> (raw)
In-Reply-To: <20241112131548.102992-1-rogelio.dominguez@gmail.com>

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!


  reply	other threads:[~2024-11-12 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 13:15 Rogelio Domínguez Hernández
2024-11-12 14:00 ` Robin Jarry [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D5K96E4MMZ22.SL52F1UJG8CJ@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=rogelio.dominguez@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).