From ad30b684748061ca0c68e4a5ca21b45c240c52c5 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 4 Jun 2007 00:40:32 +0000 Subject: [PATCH] Replace the remaining NG_*LEN constants with NG_*SIZ constants for real. Submitted-by: Nuno Antunes --- libexec/pppoed/pppoed.c | 4 ++-- share/examples/netgraph/ngctl | 6 +++--- share/man/man4/netgraph.4 | 10 +++++----- share/man/man4/ng_bpf.4 | 8 ++++---- share/man/man4/ng_etf.4 | 4 ++-- share/man/man4/ng_pppoe.4 | 8 ++++---- sys/dev/misc/musycc/musycc.c | 4 ++-- sys/net/i4b/driver/i4b_ing.c | 4 ++-- usr.sbin/ngctl/list.c | 4 ++-- usr.sbin/ngctl/main.c | 6 +++--- usr.sbin/ngctl/msg.c | 4 ++-- usr.sbin/ppp/netgraph.c | 20 ++++++++++---------- usr.sbin/ppp/tty.c | 6 +++--- 13 files changed, 44 insertions(+), 44 deletions(-) diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c index b3bf86ab4f..c8c18aa11b 100644 --- a/libexec/pppoed/pppoed.c +++ b/libexec/pppoed/pppoed.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/libexec/pppoed/pppoed.c,v 1.2.6.8 2002/06/17 02:21:25 brian Exp $ - * $DragonFly: src/libexec/pppoed/pppoed.c,v 1.3 2003/08/08 04:18:36 dillon Exp $ + * $DragonFly: src/libexec/pppoed/pppoed.c,v 1.4 2007/06/04 00:40:31 swildner Exp $ */ #include @@ -498,7 +498,7 @@ nglogx(const char *fmt, ...) int main(int argc, char *argv[]) { - char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1]; + char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKSIZ]; unsigned char response[1024]; const char *label, *prog, *provider, *acname; struct ngm_connect ngc; diff --git a/share/examples/netgraph/ngctl b/share/examples/netgraph/ngctl index 01eeb265e9..789eaa5098 100644 --- a/share/examples/netgraph/ngctl +++ b/share/examples/netgraph/ngctl @@ -1,5 +1,5 @@ # $FreeBSD: src/share/examples/netgraph/ngctl,v 1.1 1999/11/30 02:45:08 archie Exp $ -# $DragonFly: src/share/examples/netgraph/ngctl,v 1.2 2003/06/17 04:36:57 dillon Exp $ +# $DragonFly: src/share/examples/netgraph/ngctl,v 1.3 2007/06/04 00:40:31 swildner Exp $ # # This is an example that shows how to send ASCII formatted control @@ -151,8 +151,8 @@ # # /* Structure used for NGM_LISTHOOKS */ # struct linkinfo { -# char ourhook[NG_HOOKLEN + 1]; /* hook name */ -# char peerhook[NG_HOOKLEN + 1]; /* peer hook */ +# char ourhook[NG_HOOKSIZ]; /* hook name */ +# char peerhook[NG_HOOSIZ]; /* peer hook */ # struct nodeinfo nodeinfo; # }; # diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4 index 97e49fecb7..3b050918c5 100644 --- a/share/man/man4/netgraph.4 +++ b/share/man/man4/netgraph.4 @@ -34,7 +34,7 @@ .\" Archie Cobbs .\" .\" $FreeBSD: src/share/man/man4/netgraph.4,v 1.39.2.1 2001/12/21 09:00:50 ru Exp $ -.\" $DragonFly: src/share/man/man4/netgraph.4,v 1.9 2007/05/17 08:19:01 swildner Exp $ +.\" $DragonFly: src/share/man/man4/netgraph.4,v 1.10 2007/06/04 00:40:31 swildner Exp $ .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $ .\" .Dd January 19, 1999 @@ -103,7 +103,7 @@ The name must not contain the characters or .Dq \&: and is limited to -.Dv "NG_NODELEN + 1" +.Dv "NG_NODESIZ" characters (including NUL byte). .Pp Each node instance has a unique @@ -133,7 +133,7 @@ or a .Dq \&: and is limited to -.Dv "NG_HOOKLEN + 1" +.Dv "NG_HOOKSIZ" characters (including NUL byte). .It A hook is always connected to another hook. That is, hooks are @@ -541,7 +541,7 @@ struct ng_type { .Pp Control messages have the following structure: .Bd -literal -#define NG_CMDSTRLEN 15 /* Max command string (16 with null) */ +#define NG_CMDSTRSIZ 16 /* Max command string (including null) */ struct ng_mesg { struct ng_msghdr { @@ -552,7 +552,7 @@ struct ng_mesg { u_long token; /* Reply should have the same token */ u_long typecookie; /* Node type understanding this message */ u_long cmd; /* Command identifier */ - u_char cmdstr[NG_CMDSTRLEN+1]; /* Cmd string (for debug) */ + u_char cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */ } header; char data[0]; /* Start of cmd/resp data */ }; diff --git a/share/man/man4/ng_bpf.4 b/share/man/man4/ng_bpf.4 index baeb4de37e..b313ac0234 100644 --- a/share/man/man4/ng_bpf.4 +++ b/share/man/man4/ng_bpf.4 @@ -33,7 +33,7 @@ .\" Author: Archie Cobbs .\" .\" $FreeBSD: src/share/man/man4/ng_bpf.4,v 1.17.2.1 2001/12/21 09:00:51 ru Exp $ -.\" $DragonFly: src/share/man/man4/ng_bpf.4,v 1.4 2006/05/26 19:39:39 swildner Exp $ +.\" $DragonFly: src/share/man/man4/ng_bpf.4,v 1.5 2007/06/04 00:40:31 swildner Exp $ .\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $ .\" .Dd December 2, 1999 @@ -83,9 +83,9 @@ This command sets the filter program that will be applied to incoming data on a hook. The following structure must be supplied as an argument: .Bd -literal -offset 4n struct ng_bpf_hookprog { - char thisHook[NG_HOOKLEN+1]; /* name of hook */ - char ifMatch[NG_HOOKLEN+1]; /* match dest hook */ - char ifNotMatch[NG_HOOKLEN+1]; /* !match dest hook */ + char thisHook[NG_HOOKSIZ]; /* name of hook */ + char ifMatch[NG_HOOKSIZ]; /* match dest hook */ + char ifNotMatch[NG_HOOKSIZ]; /* !match dest hook */ int32_t bpf_prog_len; /* #isns in program */ struct bpf_insn bpf_prog[0]; /* bpf program */ }; diff --git a/share/man/man4/ng_etf.4 b/share/man/man4/ng_etf.4 index 54cafea913..ab2c4453d8 100644 --- a/share/man/man4/ng_etf.4 +++ b/share/man/man4/ng_etf.4 @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/share/man/man4/ng_etf.4,v 1.3.2.1 2002/04/09 20:17:17 julian Exp $ -.\" $DragonFly: src/share/man/man4/ng_etf.4,v 1.3 2006/05/26 19:39:39 swildner Exp $ +.\" $DragonFly: src/share/man/man4/ng_etf.4,v 1.4 2007/06/04 00:40:31 swildner Exp $ .\" .Dd February 28, 2001 .Dt NG_ETF 4 @@ -101,7 +101,7 @@ are specified in a structure of type .Vt "struct ng_etffilter" : .Bd -literal -offset 4n struct ng_etffilter { - char matchhook[NG_HOOKLEN + 1]; /* hook name */ + char matchhook[NG_HOOKSIZ]; /* hook name */ u_int16_t ethertype; /* catch these */ }; .Ed diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4 index 8038c1e72a..815a464c89 100644 --- a/share/man/man4/ng_pppoe.4 +++ b/share/man/man4/ng_pppoe.4 @@ -33,7 +33,7 @@ .\" Author: Archie Cobbs .\" .\" $FreeBSD: src/share/man/man4/ng_pppoe.4,v 1.18.2.1 2001/12/21 09:00:51 ru Exp $ -.\" $DragonFly: src/share/man/man4/ng_pppoe.4,v 1.3 2006/05/26 19:39:39 swildner Exp $ +.\" $DragonFly: src/share/man/man4/ng_pppoe.4,v 1.4 2007/06/04 00:40:31 swildner Exp $ .\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $ .\" .Dd October 28, 1999 @@ -127,7 +127,7 @@ structure shown below. The three commands above use a common data structure: .Bd -literal -offset 4n struct ngpppoe_init_data { - char hook[NG_HOOKLEN + 1]; /* hook to monitor on */ + char hook[NG_HOOKSIZ]; /* hook to monitor on */ u_int16_t data_len; /* service name length */ char data[0]; /* init data goes here */ }; @@ -155,7 +155,7 @@ will be received at closure instead. The three commands above use a common data structure: .Bd -literal -offset 4n struct ngpppoe_sts { - char hook[NG_HOOKLEN + 1]; /* hook associated with event session */ + char hook[NG_HOOKSIZ]; /* hook associated with event session */ }; .Ed .El @@ -226,7 +226,7 @@ setup(char *ethername, char *service, char *sessname, } message; /********tracking our little graph ********/ char path[100]; - char source_ID[NG_NODELEN + 1]; + char source_ID[NG_NODESIZ]; char pppoe_node_name[100]; int k; diff --git a/sys/dev/misc/musycc/musycc.c b/sys/dev/misc/musycc/musycc.c index b1e1e04593..f8e8ce8418 100644 --- a/sys/dev/misc/musycc/musycc.c +++ b/sys/dev/misc/musycc/musycc.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/dev/musycc/musycc.c,v 1.17.2.3 2001/03/13 22:05:36 phk Exp $ - * $DragonFly: src/sys/dev/misc/musycc/musycc.c,v 1.10 2006/12/22 23:26:17 swildner Exp $ + * $DragonFly: src/sys/dev/misc/musycc/musycc.c,v 1.11 2007/06/04 00:40:31 swildner Exp $ * * * @@ -223,7 +223,7 @@ struct softc { struct mdesc *mdt[NHDLC]; struct mdesc *mdr[NHDLC]; node_p node; /* NG node */ - char nodename[NG_NODELEN + 1]; /* NG nodename */ + char nodename[NG_NODESIZ]; /* NG nodename */ struct schan *chan[NHDLC]; u_long cnt_ferr; u_long cnt_cerr; diff --git a/sys/net/i4b/driver/i4b_ing.c b/sys/net/i4b/driver/i4b_ing.c index 78d74a0862..beac90a45c 100644 --- a/sys/net/i4b/driver/i4b_ing.c +++ b/sys/net/i4b/driver/i4b_ing.c @@ -28,7 +28,7 @@ * ------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_ing.c,v 1.10.2.4 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.10 2006/12/22 23:44:55 swildner Exp $ + * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.11 2007/06/04 00:40:31 swildner Exp $ * * last edit-date: [Tue Jan 1 10:43:58 2002] * @@ -103,7 +103,7 @@ struct ing_softc { struct ifqueue xmitq; /* transmit queue */ node_p node; /* back pointer to node */ - char nodename[NG_NODELEN + 1]; /* store our node name */ + char nodename[NG_NODESIZ]; /* store our node name */ hook_p debughook; hook_p hook; diff --git a/usr.sbin/ngctl/list.c b/usr.sbin/ngctl/list.c index 854fc0866d..3c5275ad21 100644 --- a/usr.sbin/ngctl/list.c +++ b/usr.sbin/ngctl/list.c @@ -34,7 +34,7 @@ * OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ngctl/list.c,v 1.2 1999/11/30 02:45:30 archie Exp $ - * $DragonFly: src/usr.sbin/ngctl/list.c,v 1.4 2005/03/16 05:19:11 joerg Exp $ + * $DragonFly: src/usr.sbin/ngctl/list.c,v 1.5 2007/06/04 00:40:31 swildner Exp $ */ #include "ngctl.h" @@ -100,7 +100,7 @@ ListCmd(int ac, const char **av) printf("There are %d total %snodes:\n", nlist->numnames, named_only ? "named " : ""); for (k = 0; k < nlist->numnames; k++) { - char path[NG_PATHLEN+1]; + char path[NG_PATHSIZ]; const char *new_av[3] = { "list", "-n", path }; snprintf(path, sizeof(path), diff --git a/usr.sbin/ngctl/main.c b/usr.sbin/ngctl/main.c index ae3938f2d3..232f01fe40 100644 --- a/usr.sbin/ngctl/main.c +++ b/usr.sbin/ngctl/main.c @@ -34,7 +34,7 @@ * OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ngctl/main.c,v 1.4.2.4 2002/02/01 18:17:43 archie Exp $ - * $DragonFly: src/usr.sbin/ngctl/main.c,v 1.4 2005/03/16 05:19:11 joerg Exp $ + * $DragonFly: src/usr.sbin/ngctl/main.c,v 1.5 2007/06/04 00:40:31 swildner Exp $ * $Whistle: main.c,v 1.12 1999/11/29 19:17:46 archie Exp $ */ @@ -110,7 +110,7 @@ int csock, dsock; int main(int ac, char *av[]) { - char name[NG_NODELEN + 1]; + char name[NG_NODESIZ]; int interactive = isatty(0) && isatty(1); FILE *fp = NULL; int ch, rtn = 0; @@ -236,7 +236,7 @@ DoInteractive(void) /* Display any incoming data packet */ if (FD_ISSET(dsock, &rfds)) { u_char buf[8192]; - char hook[NG_HOOKLEN + 1]; + char hook[NG_HOOKSIZ]; int rl; /* Read packet from socket */ diff --git a/usr.sbin/ngctl/msg.c b/usr.sbin/ngctl/msg.c index f1f8851a71..8c30f93915 100644 --- a/usr.sbin/ngctl/msg.c +++ b/usr.sbin/ngctl/msg.c @@ -35,7 +35,7 @@ * * $Whistle: msg.c,v 1.2 1999/11/29 23:38:35 archie Exp $ * $FreeBSD: src/usr.sbin/ngctl/msg.c,v 1.1.4.1 2000/07/27 22:05:36 archie Exp $ - * $DragonFly: src/usr.sbin/ngctl/msg.c,v 1.4 2005/12/05 02:40:27 swildner Exp $ + * $DragonFly: src/usr.sbin/ngctl/msg.c,v 1.5 2007/06/04 00:40:31 swildner Exp $ */ #include "ngctl.h" @@ -112,7 +112,7 @@ MsgRead(void) u_char buf[2 * sizeof(struct ng_mesg) + BUF_SIZE]; struct ng_mesg *const m = (struct ng_mesg *)buf; struct ng_mesg *const ascii = (struct ng_mesg *)m->data; - char path[NG_PATHLEN+1]; + char path[NG_PATHSIZ]; /* Get incoming message (in binary form) */ if (NgRecvMsg(csock, m, sizeof(buf), path) < 0) { diff --git a/usr.sbin/ppp/netgraph.c b/usr.sbin/ppp/netgraph.c index 4c56d4f78d..887e13fe55 100644 --- a/usr.sbin/ppp/netgraph.c +++ b/usr.sbin/ppp/netgraph.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ppp/netgraph.c,v 1.4.2.1 2002/09/01 02:12:29 brian Exp $ - * $DragonFly: src/usr.sbin/ppp/netgraph.c,v 1.2 2003/06/17 04:30:00 dillon Exp $ + * $DragonFly: src/usr.sbin/ppp/netgraph.c,v 1.3 2007/06/04 00:40:32 swildner Exp $ */ #include @@ -92,7 +92,7 @@ struct ngdevice { struct device dev; /* What struct physical knows about */ int cs; /* Control socket */ - char hook[NG_HOOKLEN + 1]; /* Our socket node hook */ + char hook[NG_HOOKSIZ]; /* Our socket node hook */ }; #define device2ng(d) ((d)->type == NG_DEVICE ? (struct ngdevice *)d : NULL) @@ -108,7 +108,7 @@ ng_DeviceSize(void) static int ng_MessageOut(struct ngdevice *dev, struct physical *p, const char *data) { - char path[NG_PATHLEN + 1]; + char path[NG_PATHSIZ]; int len, pos, dpos; char *fmt; @@ -169,7 +169,7 @@ ng_MessageIn(struct physical *p, char *buf, size_t sz) char msgbuf[sizeof(struct ng_mesg) * 2 + NG_MSGBUFSZ]; struct ngdevice *dev = device2ng(p->handler); struct ng_mesg *rep = (struct ng_mesg *)msgbuf; - char path[NG_PATHLEN + 1]; + char path[NG_PATHSIZ]; int len; #ifdef BROKEN_SELECT @@ -233,7 +233,7 @@ ng_Write(struct physical *p, const void *v, size_t n) static ssize_t ng_Read(struct physical *p, void *v, size_t n) { - char hook[NG_HOOKLEN + 1]; + char hook[NG_HOOKSIZ]; log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { @@ -463,11 +463,11 @@ ng_Create(struct physical *p) struct ngm_mkpeer mkp; struct ngm_connect ngc; const char *devp, *endp; - char lasthook[NG_HOOKLEN + 1]; - char hook[NG_HOOKLEN + 1]; - char nodetype[NG_TYPELEN + NG_NODELEN + 2]; - char modname[NG_TYPELEN + 4]; - char path[NG_PATHLEN + 1]; + char lasthook[NG_HOOKSIZ]; + char hook[NG_HOOKSIZ]; + char nodetype[NG_TYPESIZ + NG_NODESIZ]; + char modname[NG_TYPESIZ + 3]; + char path[NG_PATHSIZ]; char *nodename; int len, sz, done, f; diff --git a/usr.sbin/ppp/tty.c b/usr.sbin/ppp/tty.c index 968930e8c9..4c90f5521f 100644 --- a/usr.sbin/ppp/tty.c +++ b/usr.sbin/ppp/tty.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ppp/tty.c,v 1.21.2.3 2002/09/01 02:12:32 brian Exp $ - * $DragonFly: src/usr.sbin/ppp/tty.c,v 1.3 2003/08/08 04:18:47 dillon Exp $ + * $DragonFly: src/usr.sbin/ppp/tty.c,v 1.4 2007/06/04 00:40:32 swildner Exp $ */ #include @@ -228,7 +228,7 @@ static void tty_SetAsyncParams(struct physical *p, u_int32_t mymap, u_int32_t hismap) { struct ttydevice *dev = device2tty(p->handler); - char asyncpath[NG_PATHLEN + 1]; + char asyncpath[NG_PATHSIZ]; struct ng_async_cfg cfg; if (isngtty(dev)) { @@ -257,7 +257,7 @@ LoadLineDiscipline(struct physical *p) u_char rbuf[sizeof(struct ng_mesg) + sizeof(struct nodeinfo)]; struct ng_mesg *reply; struct nodeinfo *info; - char ttypath[NG_NODELEN + 1]; + char ttypath[NG_NODESIZ]; struct ngm_mkpeer ngm; struct ngm_connect ngc; int ldisc, cs, ds, hot, speed; -- 2.41.0