[PATCH 3/3] virtfs-proxy-helper: Make the helper_opts[] array const

Philippe Mathieu-Daudé posted 3 patches 5 years, 8 months ago
Maintainers: Greg Kurz <groug@kaod.org>, Jason Wang <jasowang@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Christian Schoenebeck <qemu_oss@crudebyte.com>
There is a newer version of this series
[PATCH 3/3] virtfs-proxy-helper: Make the helper_opts[] array const
Posted by Philippe Mathieu-Daudé 5 years, 8 months ago
Reduce a bit the memory footprint by making the helper_opts[]
array const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 fsdev/virtfs-proxy-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index aa1ab2590d..de061a8a0e 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -43,7 +43,7 @@
 #define BTRFS_SUPER_MAGIC 0x9123683E
 #endif
 
-static struct option helper_opts[] = {
+static const struct option helper_opts[] = {
     {"fd", required_argument, NULL, 'f'},
     {"path", required_argument, NULL, 'p'},
     {"nodaemon", no_argument, NULL, 'n'},
-- 
2.21.1


Re: [PATCH 3/3] virtfs-proxy-helper: Make the helper_opts[] array const
Posted by Greg Kurz 5 years, 8 months ago
On Thu,  5 Mar 2020 02:04:46 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Reduce a bit the memory footprint by making the helper_opts[]
> array const.
> 

... and, maybe most importantly, make it clear helper_opts[] is
not supposed to be modified at runtime.

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---

Assuming this goes to the trivial tree:

Acked-by: Greg Kurz <groug@kaod.org>

>  fsdev/virtfs-proxy-helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index aa1ab2590d..de061a8a0e 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -43,7 +43,7 @@
>  #define BTRFS_SUPER_MAGIC 0x9123683E
>  #endif
>  
> -static struct option helper_opts[] = {
> +static const struct option helper_opts[] = {
>      {"fd", required_argument, NULL, 'f'},
>      {"path", required_argument, NULL, 'p'},
>      {"nodaemon", no_argument, NULL, 'n'},