/* Function used by an Ethernet Switch driver to set the functions that must be called by the parser when an ethsw command is given  */
int ethsw_define_functions(const struct ethsw_command_func *cmd_func)
/* Function used by an Ethernet Switch driver to set the functions that must be called by the parser when an ethsw command is given  */
int ethsw_define_functions(const struct ethsw_command_func *cmd_func)
{
	int i;
	void **aux_p;
	int (*cmd_func_aux)(struct ethsw_command_def *);
	if (!cmd_func->ethsw_name)
		return -EINVAL;
	ethsw_name = cmd_func->ethsw_name;
	for (i = 0; i < ARRAY_SIZE(ethsw_cmd_def); i++) {
		if (ethsw_cmd_def[i].keyword_function)
			continue;
		aux_p = (void *)cmd_func + ethsw_cmd_def[i].cmd_func_offset;
		cmd_func_aux = (int (*)(struct ethsw_command_def *)) *aux_p;
		ethsw_cmd_def[i].keyword_function = cmd_func_aux;
	}
	return 0;
}