Date: Wed, 3 Aug 2011 01:33:34 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r224619 - in user/hrs/ipv6/usr.sbin: rtadvctl rtadvd Message-ID: <201108030133.p731XY6N079716@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Wed Aug 3 01:33:34 2011 New Revision: 224619 URL: http://svn.freebsd.org/changeset/base/224619 Log: s/cmsg_/cm_/ to avoid conflict with CMSG_* symbols for struct cmsghdr. Modified: user/hrs/ipv6/usr.sbin/rtadvctl/rtadvctl.c user/hrs/ipv6/usr.sbin/rtadvd/control.c user/hrs/ipv6/usr.sbin/rtadvd/control.h user/hrs/ipv6/usr.sbin/rtadvd/control_client.c user/hrs/ipv6/usr.sbin/rtadvd/control_client.h user/hrs/ipv6/usr.sbin/rtadvd/control_server.c user/hrs/ipv6/usr.sbin/rtadvd/control_server.h user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Modified: user/hrs/ipv6/usr.sbin/rtadvctl/rtadvctl.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvctl/rtadvctl.c Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvctl/rtadvctl.c Wed Aug 3 01:33:34 2011 (r224619) @@ -260,13 +260,13 @@ action_plgeneric(int action, char *plstr *q++ = '\0'; cp.cp_val = q; } - cm->cm_len += cmsg_pl2bin(msg, &cp); + cm->cm_len += cm_pl2bin(msg, &cp); mysyslog(LOG_DEBUG, "<%s> key=%s, val_len=%d, ifname=%s", __func__,cp.cp_key, cp.cp_val_len, cp.cp_ifname); } - return (cmsg_handler_client(s->si_fd, CM_STATE_MSG_DISPATCH, buf)); + return (cm_handler_client(s->si_fd, CM_STATE_MSG_DISPATCH, buf)); } static int @@ -285,7 +285,7 @@ action_propget(char *argv, struct ctrl_m if (error || cm->cm_len <= sizeof(*cm)) return (1); - cmsg_bin2pl(msg, cp); + cm_bin2pl(msg, cp); mysyslog(LOG_DEBUG, "<%s> type=%d, len=%d", __func__, cm->cm_type, cm->cm_len); mysyslog(LOG_DEBUG, "<%s> key=%s, val_len=%d, ifname=%s", Modified: user/hrs/ipv6/usr.sbin/rtadvd/control.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control.c Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control.c Wed Aug 3 01:33:34 2011 (r224619) @@ -54,10 +54,10 @@ #include "pathnames.h" #include "control.h" -#define CMSG_RECV_TIMEOUT 30 +#define CM_RECV_TIMEOUT 30 int -cmsg_recv(int fd, char *buf) +cm_recv(int fd, char *buf) { int n; struct ctrl_msg_hdr *cm; @@ -76,7 +76,7 @@ cmsg_recv(int fd, char *buf) for (;;) { i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]), - CMSG_RECV_TIMEOUT); + CM_RECV_TIMEOUT); if (i == 0) continue; @@ -101,22 +101,22 @@ cmsg_recv(int fd, char *buf) if (n != sizeof(*cm)) { syslog(LOG_WARNING, "<%s> received a too small message.", __func__); - goto cmsg_recv_err; + goto cm_recv_err; } if (cm->cm_len > CM_MSG_MAXLEN) { syslog(LOG_WARNING, "<%s> received a too large message.", __func__); - goto cmsg_recv_err; + goto cm_recv_err; } if (cm->cm_version != CM_VERSION) { syslog(LOG_WARNING, "<%s> version mismatch", __func__); - goto cmsg_recv_err; + goto cm_recv_err; } if (cm->cm_type >= CM_TYPE_MAX) { syslog(LOG_WARNING, "<%s> invalid msg type.", __func__); - goto cmsg_recv_err; + goto cm_recv_err; } syslog(LOG_DEBUG, @@ -132,7 +132,7 @@ cmsg_recv(int fd, char *buf) for (;;) { i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]), - CMSG_RECV_TIMEOUT); + CM_RECV_TIMEOUT); if (i == 0) continue; @@ -156,20 +156,20 @@ cmsg_recv(int fd, char *buf) if (n != msglen) { syslog(LOG_WARNING, "<%s> payload size mismatch.", __func__); - goto cmsg_recv_err; + goto cm_recv_err; } buf[CM_MSG_MAXLEN - 1] = '\0'; } return (0); -cmsg_recv_err: +cm_recv_err: close(fd); return (-1); } int -cmsg_send(int fd, char *buf) +cm_send(int fd, char *buf) { struct iovec iov[2]; int iovcnt; @@ -340,7 +340,7 @@ csock_open_err: } struct ctrl_msg_pl * -cmsg_bin2pl(char *str, struct ctrl_msg_pl *cp) +cm_bin2pl(char *str, struct ctrl_msg_pl *cp) { size_t len; size_t *lenp; @@ -400,7 +400,7 @@ cmsg_bin2pl(char *str, struct ctrl_msg_p } size_t -cmsg_pl2bin(char *str, struct ctrl_msg_pl *cp) +cm_pl2bin(char *str, struct ctrl_msg_pl *cp) { size_t len; size_t *lenp; @@ -463,7 +463,7 @@ cmsg_pl2bin(char *str, struct ctrl_msg_p } size_t -cmsg_str2bin(char *bin, void *str, size_t len) +cm_str2bin(char *bin, void *str, size_t len) { struct ctrl_msg_hdr *cm; @@ -481,7 +481,7 @@ cmsg_str2bin(char *bin, void *str, size_ } void * -cmsg_bin2str(char *bin, void *str, size_t len) +cm_bin2str(char *bin, void *str, size_t len) { syslog(LOG_DEBUG, "<%s> enter", __func__); Modified: user/hrs/ipv6/usr.sbin/rtadvd/control.h ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control.h Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control.h Wed Aug 3 01:33:34 2011 (r224619) @@ -65,10 +65,10 @@ int csock_open(struct sockinfo *, mode_t int csock_close(struct sockinfo *); int csock_listen(struct sockinfo *); int csock_accept(struct sockinfo *); -int cmsg_send(int, char *); -int cmsg_recv(int, char *); +int cm_send(int, char *); +int cm_recv(int, char *); -size_t cmsg_pl2bin(char *, struct ctrl_msg_pl *); -struct ctrl_msg_pl *cmsg_bin2pl(char *, struct ctrl_msg_pl *); -size_t cmsg_str2bin(char *, void *, size_t); -void *cmsg_bin2str(char *, void *, size_t); +size_t cm_pl2bin(char *, struct ctrl_msg_pl *); +struct ctrl_msg_pl *cm_bin2pl(char *, struct ctrl_msg_pl *); +size_t cm_str2bin(char *, void *, size_t); +void *cm_bin2str(char *, void *, size_t); Modified: user/hrs/ipv6/usr.sbin/rtadvd/control_client.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control_client.c Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control_client.c Wed Aug 3 01:33:34 2011 (r224619) @@ -55,7 +55,7 @@ #include "control_client.h" int -cmsg_handler_client(int fd, int state, char *buf_orig) +cm_handler_client(int fd, int state, char *buf_orig) { char buf[CM_MSG_MAXLEN]; struct ctrl_msg_hdr *cm; @@ -91,17 +91,17 @@ cmsg_handler_client(int fd, int state, c break; case CM_STATE_MSG_DISPATCH: cm->cm_version = CM_VERSION; - error = cmsg_send(fd, buf); + error = cm_send(fd, buf); if (error) syslog(LOG_WARNING, - "<%s> cmsg_send()", __func__); + "<%s> cm_send()", __func__); state = CM_STATE_ACK_WAIT; break; case CM_STATE_ACK_WAIT: - error = cmsg_recv(fd, buf); + error = cm_recv(fd, buf); if (error) { syslog(LOG_ERR, - "<%s> cmsg_recv()", __func__); + "<%s> cm_recv()", __func__); close(fd); return (-1); } Modified: user/hrs/ipv6/usr.sbin/rtadvd/control_client.h ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control_client.h Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control_client.h Wed Aug 3 01:33:34 2011 (r224619) @@ -27,4 +27,4 @@ * */ -int cmsg_handler_client(int, int, char *); +int cm_handler_client(int, int, char *); Modified: user/hrs/ipv6/usr.sbin/rtadvd/control_server.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control_server.c Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control_server.c Wed Aug 3 01:33:34 2011 (r224619) @@ -69,28 +69,28 @@ int is_do_reload(void) { return (do_rel int is_do_shutdown(void) { return (do_shutdown); } char *reload_ifname(void) { return (do_reload_ifname); } -#define DEF_PL_HANDLER(key) { #key, cmsg_getprop_##key } +#define DEF_PL_HANDLER(key) { #key, cm_getprop_##key } -static int cmsg_getprop_echo(struct ctrl_msg_pl *); -static int cmsg_getprop_version(struct ctrl_msg_pl *); -static int cmsg_getprop_ifilist(struct ctrl_msg_pl *); -static int cmsg_getprop_ifi(struct ctrl_msg_pl *); -static int cmsg_getprop_ifi_ra_timer(struct ctrl_msg_pl *); -static int cmsg_getprop_rai(struct ctrl_msg_pl *); -static int cmsg_getprop_pfx(struct ctrl_msg_pl *); -static int cmsg_getprop_rdnss(struct ctrl_msg_pl *); -static int cmsg_getprop_dnssl(struct ctrl_msg_pl *); -static int cmsg_getprop_rti(struct ctrl_msg_pl *); - -static int cmsg_setprop_reload(struct ctrl_msg_pl *); -static int cmsg_setprop_enable(struct ctrl_msg_pl *); -static int cmsg_setprop_disable(struct ctrl_msg_pl *); +static int cm_getprop_echo(struct ctrl_msg_pl *); +static int cm_getprop_version(struct ctrl_msg_pl *); +static int cm_getprop_ifilist(struct ctrl_msg_pl *); +static int cm_getprop_ifi(struct ctrl_msg_pl *); +static int cm_getprop_ifi_ra_timer(struct ctrl_msg_pl *); +static int cm_getprop_rai(struct ctrl_msg_pl *); +static int cm_getprop_pfx(struct ctrl_msg_pl *); +static int cm_getprop_rdnss(struct ctrl_msg_pl *); +static int cm_getprop_dnssl(struct ctrl_msg_pl *); +static int cm_getprop_rti(struct ctrl_msg_pl *); + +static int cm_setprop_reload(struct ctrl_msg_pl *); +static int cm_setprop_enable(struct ctrl_msg_pl *); +static int cm_setprop_disable(struct ctrl_msg_pl *); static struct dispatch_table { const char *dt_comm; int (*dt_act)(struct ctrl_msg_pl *cp); } getprop_dtable[] = { - { "", cmsg_getprop_echo }, + { "", cm_getprop_echo }, DEF_PL_HANDLER(echo), DEF_PL_HANDLER(version), DEF_PL_HANDLER(ifilist), @@ -104,7 +104,7 @@ static struct dispatch_table { }; static int -cmsg_getprop_echo(struct ctrl_msg_pl *cp) +cm_getprop_echo(struct ctrl_msg_pl *cp) { syslog(LOG_DEBUG, "<%s> enter", __func__); @@ -115,7 +115,7 @@ cmsg_getprop_echo(struct ctrl_msg_pl *cp } static int -cmsg_getprop_version(struct ctrl_msg_pl *cp) +cm_getprop_version(struct ctrl_msg_pl *cp) { syslog(LOG_DEBUG, "<%s> enter", __func__); @@ -126,7 +126,7 @@ cmsg_getprop_version(struct ctrl_msg_pl } static int -cmsg_getprop_ifilist(struct ctrl_msg_pl *cp) +cm_getprop_ifilist(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; char *p; @@ -160,7 +160,7 @@ cmsg_getprop_ifilist(struct ctrl_msg_pl } static int -cmsg_getprop_ifi(struct ctrl_msg_pl *cp) +cm_getprop_ifi(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; char *p; @@ -181,7 +181,7 @@ cmsg_getprop_ifi(struct ctrl_msg_pl *cp) p = malloc(sizeof(*ifi)); if (p == NULL) exit(1); - len = cmsg_str2bin(p, ifi, sizeof(*ifi)); + len = cm_str2bin(p, ifi, sizeof(*ifi)); syslog(LOG_DEBUG, "<%s> len = %zu", __func__, len); @@ -195,7 +195,7 @@ cmsg_getprop_ifi(struct ctrl_msg_pl *cp) } static int -cmsg_getprop_rai(struct ctrl_msg_pl *cp) +cm_getprop_rai(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -222,7 +222,7 @@ cmsg_getprop_rai(struct ctrl_msg_pl *cp) p = malloc(sizeof(*rai)); if (p == NULL) exit(1); - len = cmsg_str2bin(p, rai, sizeof(*rai)); + len = cm_str2bin(p, rai, sizeof(*rai)); syslog(LOG_DEBUG, "<%s> len = %zu", __func__, len); @@ -236,7 +236,7 @@ cmsg_getprop_rai(struct ctrl_msg_pl *cp) } static int -cmsg_getprop_ifi_ra_timer(struct ctrl_msg_pl *cp) +cm_getprop_ifi_ra_timer(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -268,7 +268,7 @@ cmsg_getprop_ifi_ra_timer(struct ctrl_ms p = malloc(sizeof(*rtimer)); if (p == NULL) exit(1); - len = cmsg_str2bin(p, rtimer, sizeof(*rtimer)); + len = cm_str2bin(p, rtimer, sizeof(*rtimer)); syslog(LOG_DEBUG, "<%s> len = %zu", __func__, len); @@ -282,7 +282,7 @@ cmsg_getprop_ifi_ra_timer(struct ctrl_ms } static int -cmsg_getprop_rti(struct ctrl_msg_pl *cp) +cm_getprop_rti(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -331,7 +331,7 @@ cmsg_getprop_rti(struct ctrl_msg_pl *cp) } static int -cmsg_getprop_pfx(struct ctrl_msg_pl *cp) +cm_getprop_pfx(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -380,7 +380,7 @@ cmsg_getprop_pfx(struct ctrl_msg_pl *cp) } static int -cmsg_getprop_rdnss(struct ctrl_msg_pl *cp) +cm_getprop_rdnss(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -449,7 +449,7 @@ cmsg_getprop_rdnss(struct ctrl_msg_pl *c } static int -cmsg_getprop_dnssl(struct ctrl_msg_pl *cp) +cm_getprop_dnssl(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; struct rainfo *rai; @@ -517,7 +517,7 @@ cmsg_getprop_dnssl(struct ctrl_msg_pl *c } int -cmsg_getprop(struct ctrl_msg_pl *cp) +cm_getprop(struct ctrl_msg_pl *cp) { size_t i; @@ -536,7 +536,7 @@ cmsg_getprop(struct ctrl_msg_pl *cp) } int -cmsg_setprop(struct ctrl_msg_pl *cp) +cm_setprop(struct ctrl_msg_pl *cp) { syslog(LOG_DEBUG, "<%s> enter", __func__); @@ -544,13 +544,13 @@ cmsg_setprop(struct ctrl_msg_pl *cp) return (1); if (strncmp(cp->cp_key, "reload", sizeof("reload")) == 0) - cmsg_setprop_reload(cp); + cm_setprop_reload(cp); else if (strncmp(cp->cp_key, "shutdown", sizeof("shutdown")) == 0) set_do_shutdown(0); else if (strncmp(cp->cp_key, "enable", sizeof("enable")) == 0) - cmsg_setprop_enable(cp); + cm_setprop_enable(cp); else if (strncmp(cp->cp_key, "disable", sizeof("disable")) == 0) - cmsg_setprop_disable(cp); + cm_setprop_disable(cp); else if (strncmp(cp->cp_key, "echo", 8) == 0) ; /* do nothing */ else @@ -560,7 +560,7 @@ cmsg_setprop(struct ctrl_msg_pl *cp) } static int -cmsg_setprop_reload(struct ctrl_msg_pl *cp) +cm_setprop_reload(struct ctrl_msg_pl *cp) { syslog(LOG_DEBUG, "<%s> enter", __func__); @@ -572,7 +572,7 @@ cmsg_setprop_reload(struct ctrl_msg_pl * } static int -cmsg_setprop_enable(struct ctrl_msg_pl *cp) +cm_setprop_enable(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; @@ -596,7 +596,7 @@ cmsg_setprop_enable(struct ctrl_msg_pl * } static int -cmsg_setprop_disable(struct ctrl_msg_pl *cp) +cm_setprop_disable(struct ctrl_msg_pl *cp) { struct ifinfo *ifi; @@ -627,7 +627,7 @@ cmsg_setprop_disable(struct ctrl_msg_pl } int -cmsg_handler_server(int fd) +cm_handler_server(int fd) { int state; char *msg; @@ -654,17 +654,17 @@ cmsg_handler_server(int fd) break; case CM_STATE_MSG_DISPATCH: cm->cm_version = CM_VERSION; - error = cmsg_send(fd, buf); + error = cm_send(fd, buf); if (error) syslog(LOG_WARNING, - "<%s> cmsg_send()", __func__); + "<%s> cm_send()", __func__); state = CM_STATE_EOM; break; case CM_STATE_ACK_WAIT: - error = cmsg_recv(fd, buf); + error = cm_recv(fd, buf); if (error) { syslog(LOG_ERR, - "<%s> cmsg_recv()", __func__); + "<%s> cm_recv()", __func__); close(fd); return (-1); } @@ -686,11 +686,11 @@ cmsg_handler_server(int fd) state = CM_STATE_EOM; break; case CM_STATE_MSG_RECV: - error = cmsg_recv(fd, buf); + error = cm_recv(fd, buf); if (error) { syslog(LOG_ERR, - "<%s> cmsg_recv()", __func__); + "<%s> cm_recv()", __func__); close(fd); return (-1); } @@ -709,22 +709,22 @@ cmsg_handler_server(int fd) cm->cm_len = sizeof(*cm); break; case CM_TYPE_REQ_GET_PROP: - cmsg_bin2pl(msg, &cp); - error = cmsg_getprop(&cp); + cm_bin2pl(msg, &cp); + error = cm_getprop(&cp); if (error) { cm->cm_type = CM_TYPE_ERR; cm->cm_len = sizeof(*cm); } else { cm->cm_type = CM_TYPE_ACK; cm->cm_len = sizeof(*cm); - cm->cm_len += cmsg_pl2bin(msg, &cp); + cm->cm_len += cm_pl2bin(msg, &cp); } if (cp.cp_val != NULL) free(cp.cp_val); break; case CM_TYPE_REQ_SET_PROP: - cmsg_bin2pl(msg, &cp); - error = cmsg_setprop(&cp); + cm_bin2pl(msg, &cp); + error = cm_setprop(&cp); if (error) { cm->cm_type = CM_TYPE_ERR; cm->cm_len = sizeof(*cm); Modified: user/hrs/ipv6/usr.sbin/rtadvd/control_server.h ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/control_server.h Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/control_server.h Wed Aug 3 01:33:34 2011 (r224619) @@ -27,10 +27,10 @@ * */ -int cmsg_getprop(struct ctrl_msg_pl *); -int cmsg_setprop(struct ctrl_msg_pl *); +int cm_getprop(struct ctrl_msg_pl *); +int cm_setprop(struct ctrl_msg_pl *); -int cmsg_handler_server(int); +int cm_handler_server(int); void set_do_reload(int); void set_do_reload_ifname(char *); Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Tue Aug 2 23:49:23 2011 (r224618) +++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Wed Aug 3 01:33:34 2011 (r224619) @@ -353,7 +353,7 @@ main(int argc, char *argv[]) if (fd == -1) syslog(LOG_ERR, "<%s> accept", __func__); else { - cmsg_handler_server(fd); + cm_handler_server(fd); close(fd); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108030133.p731XY6N079716>