From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 6/6] device: command: remove default device concept
Date: Thu, 11 Aug 2022 10:59:00 -0700 [thread overview]
Message-ID: <20220811175900.443310-6-prestwoj@gmail.com> (raw)
In-Reply-To: <20220811175900.443310-1-prestwoj@gmail.com>
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
---
client/command.c | 18 ----------------
client/command.h | 3 ---
client/dbus-proxy.c | 2 --
client/device.c | 50 ---------------------------------------------
4 files changed, 73 deletions(-)
diff --git a/client/command.c b/client/command.c
index 46752c72..dbd97703 100644
--- a/client/command.c
+++ b/client/command.c
@@ -329,9 +329,6 @@ static char **cmd_completion_match_family_cmd(const char *cmd_family,
break;
}
- if (family->set_default_entity)
- family->set_default_entity(arg1);
-
matches = cmd_completion_match_entity_cmd(arg2, text,
family->command_list);
@@ -663,21 +660,6 @@ int command_get_exit_status(void)
return exit_status;
}
-void command_reset_default_entities(void)
-{
- const struct l_queue_entry *entry;
-
- for (entry = l_queue_get_entries(command_families); entry;
- entry = entry->next) {
- struct command_family *family = entry->data;
-
- if (!family->reset_default_entity)
- continue;
-
- family->reset_default_entity();
- }
-}
-
void command_family_register(const struct command_family *family)
{
l_queue_push_tail(command_families, (void *) family);
diff --git a/client/command.h b/client/command.h
index 1f841689..96eefdec 100644
--- a/client/command.h
+++ b/client/command.h
@@ -56,8 +56,6 @@ struct command_family {
const struct command *command_list;
command_rl_completion_func_t family_arg_completion;
command_rl_completion_func_t entity_arg_completion;
- void (*set_default_entity)(const char *entity);
- void (*reset_default_entity)(void);
};
bool command_option_get(const char *name, const char **value_out);
@@ -74,7 +72,6 @@ void command_noninteractive_trigger(void);
bool command_is_interactive_mode(void);
int command_get_exit_status(void);
void command_set_exit_status(int status);
-void command_reset_default_entities(void);
void command_family_register(const struct command_family *family);
void command_family_unregister(const struct command_family *family);
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 1534488e..42b8427f 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -806,8 +806,6 @@ static void service_disappeared_callback(struct l_dbus *dbus,
l_queue_clear(proxy_interfaces, proxy_interface_destroy);
- command_reset_default_entities();
-
display_disable_cmd_prompt();
}
diff --git a/client/device.c b/client/device.c
index 8b27ddd2..ce2afc81 100644
--- a/client/device.c
+++ b/client/device.c
@@ -42,8 +42,6 @@ struct device {
const struct proxy_interface *adapter;
};
-static struct proxy_interface *default_device;
-
static void display_device(const struct proxy_interface *proxy)
{
const struct device *device = proxy_interface_get_data(proxy);
@@ -260,52 +258,6 @@ static bool match_by_partial_name(const void *a, const void *b)
return !strncmp(device->name, text, strlen(text));
}
-static bool match_all(const void *a, const void *b)
-{
- return true;
-}
-
-static void device_set_default(const char *device_name)
-{
- struct l_queue *match;
-
- if (!device_name)
- return;
-
- match = proxy_interface_find_all(device_interface_type.interface,
- match_by_name, device_name);
-
- if (!match)
- return;
-
- default_device = l_queue_pop_head(match);
- l_queue_destroy(match, NULL);
-}
-
-static void device_reset_default(void)
-{
- default_device = NULL;
-}
-
-const struct proxy_interface *device_get_default(void)
-{
- struct l_queue *match;
-
- if (default_device)
- return default_device;
-
- match = proxy_interface_find_all(device_interface_type.interface,
- match_all, NULL);
-
- if (!match)
- return NULL;
-
- default_device = l_queue_pop_head(match);
- l_queue_destroy(match, NULL);
-
- return default_device;
-}
-
const struct proxy_interface *device_proxy_find_by_name(const char *name)
{
struct l_queue *match;
@@ -464,8 +416,6 @@ static struct command_family device_command_family = {
.command_list = device_commands,
.family_arg_completion = family_arg_completion,
.entity_arg_completion = entity_arg_completion,
- .set_default_entity = device_set_default,
- .reset_default_entity = device_reset_default,
};
static int device_command_family_init(void)
--
2.34.3
prev parent reply other threads:[~2022-08-11 17:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 17:58 [PATCH v2 1/6] doc: add documentation for StationDebug James Prestwood
2022-08-11 17:58 ` [PATCH v2 2/6] station: add debug method GetNetworks James Prestwood
2022-08-11 17:58 ` [PATCH v2 3/6] client: allow entity name to be passed to completion James Prestwood
2022-08-11 17:58 ` [PATCH v2 4/6] client: add station-debug command interface James Prestwood
2022-08-11 17:58 ` [PATCH v2 5/6] client: fix station autocomplete with multiple phys James Prestwood
2022-08-11 17:59 ` James Prestwood [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=20220811175900.443310-6-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.