Skip to content

Commit

Permalink
[nozzle] start cleaning internal function names
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Apr 19, 2018
1 parent 84898db commit abf88b5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
10 changes: 5 additions & 5 deletions libnozzle/internals.c
Expand Up @@ -22,7 +22,7 @@
#include "libnozzle.h"
#include "internals.h"

static int _read_pipe(int fd, char **file, size_t *length)
static int read_pipe(int fd, char **file, size_t *length)
{
char buf[4096];
int n;
Expand Down Expand Up @@ -71,7 +71,7 @@ static int _read_pipe(int fd, char **file, size_t *length)
return 0;
}

int _execute_shell(const char *command, char **error_string)
int execute_shell_command(const char *command, char **error_string)
{
pid_t pid;
int status, err = 0;
Expand All @@ -98,7 +98,7 @@ int _execute_shell(const char *command, char **error_string)
if (pid) { /* parent */

close(fd[1]);
err = _read_pipe(fd[0], error_string, &size);
err = read_pipe(fd[0], error_string, &size);
if (err)
goto out_clean0;

Expand Down Expand Up @@ -134,7 +134,7 @@ int _execute_shell(const char *command, char **error_string)
return err;
}

int _exec_updown(const nozzle_t nozzle, const char *action, char **error_string)
int run_updown(const nozzle_t nozzle, const char *action, char **error_string)
{
char command[PATH_MAX];
struct stat sb;
Expand All @@ -151,7 +151,7 @@ int _exec_updown(const nozzle_t nozzle, const char *action, char **error_string)
if ((err < 0) && (errno == ENOENT))
return 0;

err = _execute_shell(command, error_string);
err = execute_shell_command(command, error_string);
if ((!err) && (*error_string)) {
free(*error_string);
*error_string = NULL;
Expand Down
4 changes: 2 additions & 2 deletions libnozzle/internals.h
Expand Up @@ -60,7 +60,7 @@ struct nozzle_iface {

#define ifname ifr.ifr_name

int _execute_shell(const char *command, char **error_string);
int _exec_updown(const nozzle_t nozzle, const char *action, char **error_string);
int execute_shell_command(const char *command, char **error_string);
int run_updown(const nozzle_t nozzle, const char *action, char **error_string);

#endif
10 changes: 5 additions & 5 deletions libnozzle/libnozzle.c
Expand Up @@ -691,7 +691,7 @@ int nozzle_set_up(nozzle_t nozzle, char **error_preup, char **error_up)
goto out_clean;
}

_exec_updown(nozzle, "pre-up.d", error_preup);
run_updown(nozzle, "pre-up.d", error_preup);

ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
err = ioctl(lib_cfg.ioctlfd, SIOCSIFFLAGS, &ifr);
Expand All @@ -700,7 +700,7 @@ int nozzle_set_up(nozzle_t nozzle, char **error_preup, char **error_up)
goto out_clean;
}

_exec_updown(nozzle, "up.d", error_up);
run_updown(nozzle, "up.d", error_up);

nozzle->up = 1;

Expand Down Expand Up @@ -728,7 +728,7 @@ static int _set_down(nozzle_t nozzle, char **error_down, char **error_postdown)
goto out_clean;
}

_exec_updown(nozzle, "down.d", error_down);
run_updown(nozzle, "down.d", error_down);

ifr.ifr_flags &= ~IFF_UP;

Expand All @@ -738,7 +738,7 @@ static int _set_down(nozzle_t nozzle, char **error_down, char **error_postdown)
goto out_clean;
}

_exec_updown(nozzle, "post-down.d", error_postdown);
run_updown(nozzle, "post-down.d", error_postdown);

nozzle->up = 0;

Expand Down Expand Up @@ -872,7 +872,7 @@ static int _set_ip(nozzle_t nozzle, const char *command,
if (broadcast) {
free(broadcast);
}
return _execute_shell(cmdline, error_string);
return execute_shell_command(cmdline, error_string);
}

static int _find_ip(nozzle_t nozzle,
Expand Down
40 changes: 20 additions & 20 deletions libnozzle/tests/nozzle_test.c
Expand Up @@ -448,7 +448,7 @@ static int check_knet_mtu_ipv6(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -471,7 +471,7 @@ static int check_knet_mtu_ipv6(void)
goto out_clean;
}

err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -509,7 +509,7 @@ static int check_knet_mtu_ipv6(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_2);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -540,7 +540,7 @@ static int check_knet_mtu_ipv6(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -560,7 +560,7 @@ static int check_knet_mtu_ipv6(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_2);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -705,19 +705,19 @@ static int check_knet_mac(void)
return err;
}

static int check_nozzle_execute_shell(void)
static int check_nozzle_execute_shell_command(void)
{
int err = 0;
char command[4096];
char *error_string = NULL;

memset(command, 0, sizeof(command));

printf("Testing _execute_shell\n");
printf("Testing execute_shell_command\n");

printf("command true\n");

err = _execute_shell("true", &error_string);
err = execute_shell_command("true", &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -732,7 +732,7 @@ static int check_nozzle_execute_shell(void)

printf("command false\n");

err = _execute_shell("false", &error_string);
err = execute_shell_command("false", &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -746,7 +746,7 @@ static int check_nozzle_execute_shell(void)

printf("command that outputs to stdout (enforcing redirect)\n");

err = _execute_shell("grep -h 2>&1", &error_string);
err = execute_shell_command("grep -h 2>&1", &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -759,7 +759,7 @@ static int check_nozzle_execute_shell(void)
}

printf("command that outputs to stderr\n");
err = _execute_shell("grep -h", &error_string);
err = execute_shell_command("grep -h", &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -772,7 +772,7 @@ static int check_nozzle_execute_shell(void)
}

printf("empty command\n");
err = _execute_shell(NULL, &error_string);
err = execute_shell_command(NULL, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand All @@ -785,7 +785,7 @@ static int check_nozzle_execute_shell(void)
}

printf("empty error\n");
err = _execute_shell("true", NULL);
err = execute_shell_command("true", NULL);
if (!err) {
printf("Check EINVAL filter for no error_string!\n");
err = -1;
Expand Down Expand Up @@ -846,7 +846,7 @@ static int check_knet_up_down(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q UP", nozzle->name);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -885,7 +885,7 @@ static int check_knet_up_down(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q UP", nozzle->name);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -1231,7 +1231,7 @@ static int check_knet_set_del_ip(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv4_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -1315,7 +1315,7 @@ static int check_knet_set_del_ip(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv4_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -1349,7 +1349,7 @@ static int check_knet_set_del_ip(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -1383,7 +1383,7 @@ static int check_knet_set_del_ip(void)
#ifdef KNET_BSD
"ifconfig %s | grep -q %s", nozzle->name, testipv6_1);
#endif
err = _execute_shell(verifycmd, &error_string);
err = execute_shell_command(verifycmd, &error_string);
if (error_string) {
printf("Error string: %s\n", error_string);
free(error_string);
Expand Down Expand Up @@ -1491,7 +1491,7 @@ int main(void)
if (check_knet_mac() < 0)
return -1;

if (check_nozzle_execute_shell() < 0)
if (check_nozzle_execute_shell_command() < 0)
return -1;

if (check_knet_up_down() < 0)
Expand Down

0 comments on commit abf88b5

Please sign in to comment.