3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

hwsim: Drop the -k/--keep switch, always keep radios

It didn't make any sense for hwsim to be called in the create mode to
have it create a radio to be destroyed immediately afterwards as hwsim
exited.
This commit is contained in:
Andrew Zaborowski 2017-03-14 00:51:20 +01:00 committed by Denis Kenzior
parent 48b90febf1
commit 0e2a7c479f
2 changed files with 4 additions and 20 deletions

View File

@ -116,7 +116,6 @@ static enum action {
ACTION_LIST, ACTION_LIST,
} action; } action;
static bool keep_radios_attr;
static bool no_vif_attr; static bool no_vif_attr;
static bool p2p_attr; static bool p2p_attr;
static const char *radio_name_attr; static const char *radio_name_attr;
@ -2076,9 +2075,6 @@ static void hwsim_ready(void *user_data)
case ACTION_CREATE: case ACTION_CREATE:
msg_size = 0; msg_size = 0;
if (!keep_radios_attr)
msg_size += 4;
if (radio_name_attr) if (radio_name_attr)
msg_size += strlen(radio_name_attr) + 8; msg_size += strlen(radio_name_attr) + 8;
@ -2090,11 +2086,6 @@ static void hwsim_ready(void *user_data)
msg = l_genl_msg_new_sized(HWSIM_CMD_NEW_RADIO, msg_size); msg = l_genl_msg_new_sized(HWSIM_CMD_NEW_RADIO, msg_size);
if (!keep_radios_attr)
l_genl_msg_append_attr(msg,
HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
0, NULL);
if (radio_name_attr) if (radio_name_attr)
l_genl_msg_append_attr(msg, HWSIM_ATTR_RADIO_NAME, l_genl_msg_append_attr(msg, HWSIM_ATTR_RADIO_NAME,
strlen(radio_name_attr) + 1, strlen(radio_name_attr) + 1,
@ -2175,8 +2166,6 @@ static void usage(void)
"\t-L, --list [id] List simulated radios\n" "\t-L, --list [id] List simulated radios\n"
"\t-C, --create Create new simulated radio\n" "\t-C, --create Create new simulated radio\n"
"\t-D, --destroy <id> Destroy existing radio\n" "\t-D, --destroy <id> Destroy existing radio\n"
"\t-k, --keep Do not destroy radios when "
"program exits\n"
"\t-n, --name <name> Name of a radio to be created\n" "\t-n, --name <name> Name of a radio to be created\n"
"\t-i, --nointerface Do not create VIF\n" "\t-i, --nointerface Do not create VIF\n"
"\t-p, --p2p Support P2P\n" "\t-p, --p2p Support P2P\n"
@ -2187,7 +2176,6 @@ static const struct option main_options[] = {
{ "list", optional_argument, NULL, 'L' }, { "list", optional_argument, NULL, 'L' },
{ "create", no_argument, NULL, 'C' }, { "create", no_argument, NULL, 'C' },
{ "destroy", required_argument, NULL, 'D' }, { "destroy", required_argument, NULL, 'D' },
{ "keep", no_argument, NULL, 'k' },
{ "name", required_argument, NULL, 'n' }, { "name", required_argument, NULL, 'n' },
{ "nointerface", no_argument, NULL, 'i' }, { "nointerface", no_argument, NULL, 'i' },
{ "p2p", no_argument, NULL, 'p' }, { "p2p", no_argument, NULL, 'p' },
@ -2235,9 +2223,6 @@ int main(int argc, char *argv[])
options = optarg; options = optarg;
actions++; actions++;
break; break;
case 'k':
keep_radios_attr = true;
break;
case 'n': case 'n':
radio_name_attr = optarg; radio_name_attr = optarg;
break; break;

View File

@ -589,11 +589,10 @@ static int create_hwsim_radio(const char *radio_name,
/*TODO add the rest of params*/ /*TODO add the rest of params*/
argv[0] = BIN_HWSIM; argv[0] = BIN_HWSIM;
argv[1] = "--create"; argv[1] = "--create";
argv[2] = "--keep"; argv[2] = "--name";
argv[3] = "--name"; argv[3] = (char *) radio_name;
argv[4] = (char *) radio_name; argv[4] = "--nointerface";
argv[5] = "--nointerface"; argv[5] = NULL;
argv[6] = NULL;
pid = execute_program(argv, true); pid = execute_program(argv, true);
if (pid < 0) if (pid < 0)