linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Olaf Hering <olaf@aepfle.de>
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>
Subject: Re: [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper
Date: Sat, 7 Dec 2024 07:17:36 +0000	[thread overview]
Message-ID: <Z1P2kKZQuPX-LH4x@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <20241202120432.21115-1-olaf@aepfle.de>

On Mon, Dec 02, 2024 at 01:04:10PM +0100, Olaf Hering wrote:
> Remove the usage of cat. Replace the shell process with awk with 'exec'.
> Also use a generic shell because no bash specific features will be used.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

The resource saving is not a lot, but nonetheless:

Acked-by: Wei Liu <wei.liu@kernel.org>

> ---
>  tools/hv/hv_get_dns_info.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/hv/hv_get_dns_info.sh b/tools/hv/hv_get_dns_info.sh
> index 058c17b46ffc..268521234d4b 100755
> --- a/tools/hv/hv_get_dns_info.sh
> +++ b/tools/hv/hv_get_dns_info.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  # This example script parses /etc/resolv.conf to retrive DNS information.
>  # In the interest of keeping the KVP daemon code free of distro specific
> @@ -10,4 +10,4 @@
>  # this script can be based on the Network Manager APIs for retrieving DNS
>  # entries.
>  
> -cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'
> +exec awk '/^nameserver/ { print $2 }' /etc/resolv.conf 2>/dev/null
> 

      reply	other threads:[~2024-12-07  7:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02 12:04 [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper Olaf Hering
2024-12-07  7:17 ` Wei Liu [this message]

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=Z1P2kKZQuPX-LH4x@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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).