Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Align option names with functionality
@ 2020-09-03 20:00 Inga Stotland
  2020-09-03 21:28 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2020-09-03 20:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

Change option "config" ('c') to "storage" ('s) to specify
a custom storage directory for node configuration.

Change option 'f' (long name was missing) to "config" ('c')
to specify a custom mesh configuration file to override the
default mesh-main.conf
---
 mesh/main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/mesh/main.c b/mesh/main.c
index 1a4e6ba76..5a3cbf290 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -39,14 +39,15 @@
 #include "mesh/mesh-io.h"
 #include "mesh/util.h"
 
-static const char *config_dir;
+static const char *storage_dir;
 static const char *mesh_conf_fname;
 static enum mesh_io_type io_type;
 static void *io_opts;
 
 static const struct option main_options[] = {
 	{ "io",		required_argument,	NULL, 'i' },
-	{ "config",	optional_argument,	NULL, 'c' },
+	{ "storage",	required_argument,	NULL, 's' },
+	{ "config",	required_argument,	NULL, 'c' },
 	{ "nodetach",	no_argument,		NULL, 'n' },
 	{ "debug",	no_argument,		NULL, 'd' },
 	{ "dbus-debug",	no_argument,		NULL, 'b' },
@@ -108,7 +109,7 @@ static void request_name_callback(struct l_dbus *dbus, bool success,
 		return;
 	}
 
-	if (!mesh_init(config_dir, mesh_conf_fname, io_type, io_opts,
+	if (!mesh_init(storage_dir, mesh_conf_fname, io_type, io_opts,
 					mesh_ready_callback, dbus)) {
 		l_error("Failed to initialize mesh");
 		l_main_quit();
@@ -195,7 +196,7 @@ int main(int argc, char *argv[])
 	for (;;) {
 		int opt;
 
-		opt = getopt_long(argc, argv, "i:c:f:ndbh", main_options, NULL);
+		opt = getopt_long(argc, argv, "i:s:c:ndbh", main_options, NULL);
 		if (opt < 0)
 			break;
 
@@ -213,10 +214,10 @@ int main(int argc, char *argv[])
 		case 'd':
 			enable_debug();
 			break;
-		case 'c':
-			config_dir = optarg;
+		case 's':
+			storage_dir = optarg;
 			break;
-		case 'f':
+		case 'c':
 			mesh_conf_fname = optarg;
 			break;
 		case 'b':
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh: Align option names with functionality
  2020-09-03 20:00 [PATCH BlueZ] mesh: Align option names with functionality Inga Stotland
@ 2020-09-03 21:28 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2020-09-03 21:28 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org, Stotland, Inga

Applied

On Thu, 2020-09-03 at 13:00 -0700, Inga Stotland wrote:
> Change option "config" ('c') to "storage" ('s) to specify
> a custom storage directory for node configuration.
> 
> Change option 'f' (long name was missing) to "config" ('c')
> to specify a custom mesh configuration file to override the
> default mesh-main.conf
> ---
>  mesh/main.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/mesh/main.c b/mesh/main.c
> index 1a4e6ba76..5a3cbf290 100644
> --- a/mesh/main.c
> +++ b/mesh/main.c
> @@ -39,14 +39,15 @@
>  #include "mesh/mesh-io.h"
>  #include "mesh/util.h"
>  
> -static const char *config_dir;
> +static const char *storage_dir;
>  static const char *mesh_conf_fname;
>  static enum mesh_io_type io_type;
>  static void *io_opts;
>  
>  static const struct option main_options[] = {
>  	{ "io",		required_argument,	NULL, 'i' },
> -	{ "config",	optional_argument,	NULL, 'c' },
> +	{ "storage",	required_argument,	NULL, 's' },
> +	{ "config",	required_argument,	NULL, 'c' },
>  	{ "nodetach",	no_argument,		NULL, 'n' },
>  	{ "debug",	no_argument,		NULL, 'd' },
>  	{ "dbus-debug",	no_argument,		NULL, 'b' },
> @@ -108,7 +109,7 @@ static void request_name_callback(struct l_dbus *dbus, bool success,
>  		return;
>  	}
>  
> -	if (!mesh_init(config_dir, mesh_conf_fname, io_type, io_opts,
> +	if (!mesh_init(storage_dir, mesh_conf_fname, io_type, io_opts,
>  					mesh_ready_callback, dbus)) {
>  		l_error("Failed to initialize mesh");
>  		l_main_quit();
> @@ -195,7 +196,7 @@ int main(int argc, char *argv[])
>  	for (;;) {
>  		int opt;
>  
> -		opt = getopt_long(argc, argv, "i:c:f:ndbh", main_options, NULL);
> +		opt = getopt_long(argc, argv, "i:s:c:ndbh", main_options, NULL);
>  		if (opt < 0)
>  			break;
>  
> @@ -213,10 +214,10 @@ int main(int argc, char *argv[])
>  		case 'd':
>  			enable_debug();
>  			break;
> -		case 'c':
> -			config_dir = optarg;
> +		case 's':
> +			storage_dir = optarg;
>  			break;
> -		case 'f':
> +		case 'c':
>  			mesh_conf_fname = optarg;
>  			break;
>  		case 'b':

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-03 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-03 20:00 [PATCH BlueZ] mesh: Align option names with functionality Inga Stotland
2020-09-03 21:28 ` Gix, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox