watchfrr: indent to Linux CodingStyle

before this patch, watchfrr was using an inconsistent style that matched
neither GNU nor Linux kernel nor BSD style.  Reindent to Linux kernel
style, which should be pretty close to pimd & ldpd.

indent (2.2.11) options used:
 -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
 -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2017-01-13 14:10:00 +01:00
parent 903c7f556e
commit a6810074aa
3 changed files with 1073 additions and 1123 deletions

File diff suppressed because it is too large Load Diff

View File

@ -26,4 +26,4 @@ extern void watchfrr_vty_init(void);
extern pid_t integrated_write_pid; extern pid_t integrated_write_pid;
extern void integrated_write_sigchld(int status); extern void integrated_write_sigchld(int status);
#endif /* FRR_WATCHFRR_H */ #endif /* FRR_WATCHFRR_H */

View File

@ -31,18 +31,18 @@
pid_t integrated_write_pid; pid_t integrated_write_pid;
static int integrated_result_fd; static int integrated_result_fd;
DEFUN (config_write_integrated, DEFUN(config_write_integrated,
config_write_integrated_cmd, config_write_integrated_cmd,
"write integrated", "write integrated",
"Write running configuration to memory, network, or terminal\n" "Write running configuration to memory, network, or terminal\n"
"Write integrated all-daemon Frr.conf file\n") "Write integrated all-daemon Frr.conf file\n")
{ {
pid_t child; pid_t child;
sigset_t oldmask, sigmask; sigset_t oldmask, sigmask;
if (integrated_write_pid != -1) { if (integrated_write_pid != -1) {
vty_out(vty, "%% configuration write already in progress.%s", vty_out(vty, "%% configuration write already in progress.%s",
VTY_NEWLINE); VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
@ -61,20 +61,20 @@ DEFUN (config_write_integrated,
child = fork(); child = fork();
if (child == -1) { if (child == -1) {
vty_out(vty, "%% configuration write fork() failed: %s.%s", vty_out(vty, "%% configuration write fork() failed: %s.%s",
safe_strerror(errno), VTY_NEWLINE); safe_strerror(errno), VTY_NEWLINE);
sigprocmask(SIG_SETMASK, &oldmask, NULL); sigprocmask(SIG_SETMASK, &oldmask, NULL);
return CMD_WARNING; return CMD_WARNING;
} }
if (child != 0) { if (child != 0) {
/* note: the VTY won't write a command return value to vtysh; the /* note: the VTY won't write a command return value to vtysh; the
* session temporarily enters an intentional "hang" state. This is * session temporarily enters an intentional "hang" state. This is
* to make sure latency in vtysh doing the config write (several * to make sure latency in vtysh doing the config write (several
* seconds is not rare to see) does not interfere with watchfrr's * seconds is not rare to see) does not interfere with watchfrr's
* supervisor job. * supervisor job.
* *
* The fd is duplicated here so we don't need to hold a vty pointer * The fd is duplicated here so we don't need to hold a vty pointer
* (which could become invalid in the meantime). * (which could become invalid in the meantime).
*/ */
integrated_write_pid = child; integrated_write_pid = child;
integrated_result_fd = dup(vty->wfd); integrated_result_fd = dup(vty->wfd);
sigprocmask(SIG_SETMASK, &oldmask, NULL); sigprocmask(SIG_SETMASK, &oldmask, NULL);
@ -93,7 +93,7 @@ DEFUN (config_write_integrated,
/* unbuffered write; we just messed with stdout... */ /* unbuffered write; we just messed with stdout... */
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "error executing %s: %s\n", snprintf(msg, sizeof(msg), "error executing %s: %s\n",
VTYSH_BIN_PATH, safe_strerror(errno)); VTYSH_BIN_PATH, safe_strerror(errno));
write(1, msg, strlen(msg)); write(1, msg, strlen(msg));
exit(1); exit(1);
} }
@ -104,11 +104,11 @@ void integrated_write_sigchld(int status)
if (WIFEXITED(status)) { if (WIFEXITED(status)) {
zlog_info("configuration write completed with exit code %d", zlog_info("configuration write completed with exit code %d",
WEXITSTATUS(status)); WEXITSTATUS(status));
reply[3] = WEXITSTATUS(status); reply[3] = WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) { } else if (WIFSIGNALED(status)) {
zlog_warn("configuration write terminated by signal %d", zlog_warn("configuration write terminated by signal %d",
WTERMSIG(status)); WTERMSIG(status));
} else { } else {
zlog_warn("configuration write terminated"); zlog_warn("configuration write terminated");
} }