public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, David Gibson <david@gibson.dropbear.id.au>,
	Minxi Hou <mhou@redhat.com>
Subject: Re: [PATCH 8/8] conf, passt.h: Rename pid_file in struct ctx to pidfile
Date: Thu, 23 May 2024 11:11:02 +0100	[thread overview]
Message-ID: <20240523101102.GX4345@redhat.com> (raw)
In-Reply-To: <20240522205911.261325-9-sbrivio@redhat.com>

On Wed, May 22, 2024 at 10:59:11PM +0200, Stefano Brivio wrote:
> We have pidfile_fd now, pid_file_fd would be quite ugly.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
>  conf.c  | 8 ++++----
>  passt.h | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/conf.c b/conf.c
> index f62a5eb..50383a3 100644
> --- a/conf.c
> +++ b/conf.c
> @@ -1123,7 +1123,7 @@ static void conf_open_files(struct ctx *c)
>  	if (c->mode == MODE_PASST && c->fd_tap == -1)
>  		c->fd_tap_listen = tap_sock_unix_open(c->sock_path);
>  
> -	c->pidfile_fd = pidfile_open(c->pid_file);
> +	c->pidfile_fd = pidfile_open(c->pidfile);
>  }
>  
>  /**
> @@ -1456,12 +1456,12 @@ void conf(struct ctx *c, int argc, char **argv)
>  
>  			break;
>  		case 'P':
> -			if (*c->pid_file)
> +			if (*c->pidfile)
>  				die("Multiple --pid options given");
>  
> -			ret = snprintf(c->pid_file, sizeof(c->pid_file), "%s",
> +			ret = snprintf(c->pidfile, sizeof(c->pidfile), "%s",
>  				       optarg);
> -			if (ret <= 0 || ret >= (int)sizeof(c->pid_file))
> +			if (ret <= 0 || ret >= (int)sizeof(c->pidfile))
>  				die("Invalid PID file: %s", optarg);
>  
>  			break;
> diff --git a/passt.h b/passt.h
> index 3e50612..46d073a 100644
> --- a/passt.h
> +++ b/passt.h
> @@ -184,7 +184,7 @@ struct ip6_ctx {
>   * @nofile:		Maximum number of open files (ulimit -n)
>   * @sock_path:		Path for UNIX domain socket
>   * @pcap:		Path for packet capture file
> - * @pid_file:		Path to PID file, empty string if not configured
> + * @pidfile:		Path to PID file, empty string if not configured
>   * @pidfile_fd:		File descriptor for PID file, -1 if none
>   * @pasta_netns_fd:	File descriptor for network namespace in pasta mode
>   * @no_netns_quit:	In pasta mode, don't exit if fs-bound namespace is gone
> @@ -236,7 +236,7 @@ struct ctx {
>  	char sock_path[UNIX_PATH_MAX];
>  	char pcap[PATH_MAX];
>  
> -	char pid_file[PATH_MAX];
> +	char pidfile[PATH_MAX];
>  	int pidfile_fd;
>  
>  	int one_off;

Looks like trivial refactor so:

Reviewed-by: Richard W.M. Jones <rjones@redhat.com>

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org



  reply	other threads:[~2024-05-23 10:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 20:59 [PATCH 0/8] Open socket and PID files as root, before switching Stefano Brivio
2024-05-22 20:59 ` [PATCH 1/8] conf: Don't lecture user about starting us as root Stefano Brivio
2024-05-23  1:45   ` David Gibson
2024-05-23  9:52   ` Richard W.M. Jones
2024-05-22 20:59 ` [PATCH 2/8] tap: Move all-ones initialisation of mac_guest to tap_sock_init() Stefano Brivio
2024-05-23  1:46   ` David Gibson
2024-05-23  9:59   ` Richard W.M. Jones
2024-05-23 10:03     ` Richard W.M. Jones
2024-05-22 20:59 ` [PATCH 3/8] passt, tap: Don't use -1 as uninitialised value for fd_tap_listen Stefano Brivio
2024-05-23  1:48   ` David Gibson
2024-05-22 20:59 ` [PATCH 4/8] tap: Split tap_sock_unix_init() into opening and listening parts Stefano Brivio
2024-05-23 10:05   ` Richard W.M. Jones
2024-05-28  7:01   ` David Gibson
2024-05-22 20:59 ` [PATCH 5/8] util: Rename write_pidfile() to pidfile_write() Stefano Brivio
2024-05-23 10:06   ` Richard W.M. Jones
2024-05-22 20:59 ` [PATCH 6/8] passt, util: Move opening of PID file to its own function Stefano Brivio
2024-05-23 10:06   ` Richard W.M. Jones
2024-05-28  7:04   ` David Gibson
2024-05-22 20:59 ` [PATCH 7/8] conf, passt, tap: Open socket and PID files before switching UID/GID Stefano Brivio
2024-05-23 10:10   ` Richard W.M. Jones
2024-05-29  2:35   ` David Gibson
2024-06-20 11:30     ` Richard W.M. Jones
2024-06-20 12:12       ` Stefano Brivio
2024-06-20 12:47         ` Richard W.M. Jones
2024-06-20 14:22           ` Stefano Brivio
2024-06-21  1:02             ` David Gibson
2024-05-22 20:59 ` [PATCH 8/8] conf, passt.h: Rename pid_file in struct ctx to pidfile Stefano Brivio
2024-05-23 10:11   ` Richard W.M. Jones [this message]
2024-05-28  7:07   ` David Gibson

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=20240523101102.GX4345@redhat.com \
    --to=rjones@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mhou@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).