Use a proper namespace for control

This commit is contained in:
Roy Marples 2012-11-13 10:17:19 +00:00
parent b7fdc6ed45
commit e749a9ee95
3 changed files with 21 additions and 21 deletions

View File

@ -64,7 +64,7 @@ cleanup(void)
#endif #endif
static void static void
remove_control_data(void *arg) control_remove(void *arg)
{ {
struct fd_list *l, *n, *last = NULL; struct fd_list *l, *n, *last = NULL;
@ -87,7 +87,7 @@ remove_control_data(void *arg)
} }
static void static void
handle_control_data(void *arg) control_handle_data(void *arg)
{ {
struct fd_list *l = arg; struct fd_list *l = arg;
ssize_t bytes; ssize_t bytes;
@ -97,7 +97,7 @@ handle_control_data(void *arg)
bytes = read(l->fd, buffer, sizeof(buffer) - 1); bytes = read(l->fd, buffer, sizeof(buffer) - 1);
if (bytes == -1 || bytes == 0) { if (bytes == -1 || bytes == 0) {
remove_control_data(l); control_remove(l);
return; return;
} }
buffer[bytes] = '\0'; buffer[bytes] = '\0';
@ -115,7 +115,7 @@ handle_control_data(void *arg)
/* ARGSUSED */ /* ARGSUSED */
static void static void
handle_control(_unused void *arg) control_handle(_unused void *arg)
{ {
struct sockaddr_un run; struct sockaddr_un run;
socklen_t len; socklen_t len;
@ -132,7 +132,7 @@ handle_control(_unused void *arg)
l->listener = 0; l->listener = 0;
l->next = control_fds; l->next = control_fds;
control_fds = l; control_fds = l;
add_event(l->fd, handle_control_data, l); add_event(l->fd, control_handle_data, l);
} }
} }
@ -148,7 +148,7 @@ make_sock(void)
} }
int int
start_control(void) control_start(void)
{ {
int len; int len;
@ -165,12 +165,12 @@ start_control(void)
close(fd); close(fd);
return -1; return -1;
} }
add_event(fd, handle_control, NULL); add_event(fd, control_handle, NULL);
return fd; return fd;
} }
int int
stop_control(void) control_stop(void)
{ {
int retval = 0; int retval = 0;
struct fd_list *l; struct fd_list *l;
@ -195,7 +195,7 @@ stop_control(void)
} }
int int
open_control(void) control_open(void)
{ {
int len; int len;
@ -208,7 +208,7 @@ open_control(void)
} }
int int
send_control(int argc, char * const *argv) control_send(int argc, char * const *argv)
{ {
char *p = buffer; char *p = buffer;
int i; int i;

View File

@ -37,9 +37,9 @@ struct fd_list {
}; };
extern struct fd_list *control_fds; extern struct fd_list *control_fds;
int start_control(void); int control_start(void);
int stop_control(void); int control_stop(void);
int open_control(void); int control_open(void);
int send_control(int, char * const *); int control_send(int, char * const *);
#endif #endif

View File

@ -201,8 +201,8 @@ cleanup(void)
close(linkfd); close(linkfd);
if (pidfd > -1) { if (pidfd > -1) {
if (options & DHCPCD_MASTER) { if (options & DHCPCD_MASTER) {
if (stop_control() == -1) if (control_stop() == -1)
syslog(LOG_ERR, "stop_control: %m"); syslog(LOG_ERR, "control_stop: %m");
} }
close(pidfd); close(pidfd);
unlink(pidfile); unlink(pidfile);
@ -1966,11 +1966,11 @@ main(int argc, char **argv)
} }
if (!(options & (DHCPCD_MASTER | DHCPCD_TEST))) { if (!(options & (DHCPCD_MASTER | DHCPCD_TEST))) {
control_fd = open_control(); control_fd = control_open();
if (control_fd != -1) { if (control_fd != -1) {
syslog(LOG_INFO, syslog(LOG_INFO,
"sending commands to master dhcpcd process"); "sending commands to master dhcpcd process");
i = send_control(argc, argv); i = control_send(argc, argv);
if (i > 0) { if (i > 0) {
syslog(LOG_DEBUG, "send OK"); syslog(LOG_DEBUG, "send OK");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -1980,7 +1980,7 @@ main(int argc, char **argv)
} }
} else { } else {
if (errno != ENOENT) if (errno != ENOENT)
syslog(LOG_ERR, "open_control: %m"); syslog(LOG_ERR, "control_open: %m");
} }
} }
@ -2070,8 +2070,8 @@ main(int argc, char **argv)
} }
if (options & DHCPCD_MASTER) { if (options & DHCPCD_MASTER) {
if (start_control() == -1) if (control_start() == -1)
syslog(LOG_ERR, "start_control: %m"); syslog(LOG_ERR, "control_start: %m");
} }
if (init_sockets() == -1) { if (init_sockets() == -1) {