Constify and other misc fixes to make this build with WARNS=4.
This commit is contained in:
parent
8a3759e671
commit
7097d2c139
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: libaltq2.c,v 1.5 2002/03/05 04:11:51 itojun Exp $ */
|
||||
/* $NetBSD: libaltq2.c,v 1.6 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: libaltq2.c,v 1.6 2002/02/20 10:43:35 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1997-2000
|
||||
@ -44,7 +44,7 @@
|
||||
#include "altq_qop.h"
|
||||
|
||||
/* from rsvp_main.c */
|
||||
char *altqconfigfile = "/etc/altq.conf";
|
||||
const char *altqconfigfile = "/etc/altq.conf";
|
||||
|
||||
/* from rsvp_global.h */
|
||||
int if_num; /* number of phyints */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qdisc_cdnr.c,v 1.5 2006/10/28 11:43:02 peter Exp $ */
|
||||
/* $NetBSD: qdisc_cdnr.c,v 1.6 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: qdisc_cdnr.c,v 1.6 2002/11/08 06:36:18 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
@ -49,10 +49,10 @@
|
||||
#define NELEMENTS 64
|
||||
#define MAX_PROB (128*1024)
|
||||
|
||||
static char *element_names[] = { "none", "top", "element", "tbmeter", "trtcm",
|
||||
static const char *element_names[] = { "none", "top", "element", "tbmeter", "trtcm",
|
||||
"tswtcm" };
|
||||
static char *tbmprof_names[] = { "in: ", "out: " };
|
||||
static char *tcmprof_names[] = { "green: ", "yellow:", "red: " };
|
||||
static const char *tbmprof_names[] = { "in: ", "out: " };
|
||||
static const char *tcmprof_names[] = { "green: ", "yellow:", "red: " };
|
||||
|
||||
void
|
||||
cdnr_stat_loop(int fd, const char *ifname, int count, int interval)
|
||||
@ -63,7 +63,8 @@ cdnr_stat_loop(int fd, const char *ifname, int count, int interval)
|
||||
struct tce_stats *sp, *lp, *new, *last, *tmp;
|
||||
struct timeval cur_time, last_time;
|
||||
double sec;
|
||||
char **profile_names, _ifname[32];
|
||||
const char **profile_names;
|
||||
char _ifname[32];
|
||||
int i, j, nprofile;
|
||||
int cnt = count;
|
||||
sigset_t omask;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qdisc_conf.c,v 1.4 2006/10/12 19:59:13 peter Exp $ */
|
||||
/* $NetBSD: qdisc_conf.c,v 1.5 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: qdisc_conf.c,v 1.5 2002/10/26 06:59:54 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
@ -63,11 +63,11 @@ struct qdisc_conf qdisc_table[] = {
|
||||
stat_loop_t *
|
||||
qdisc2stat_loop(const char *qdisc_name)
|
||||
{
|
||||
struct qdisc_conf *stat;
|
||||
struct qdisc_conf *st;
|
||||
|
||||
for (stat = qdisc_table; stat->qdisc_name != NULL; stat++)
|
||||
if (strcmp(stat->qdisc_name, qdisc_name) == 0)
|
||||
return (stat->stat_loop);
|
||||
for (st = qdisc_table; st->qdisc_name != NULL; st++)
|
||||
if (strcmp(st->qdisc_name, qdisc_name) == 0)
|
||||
return (st->stat_loop);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -96,12 +96,12 @@ ifname2qdisc(const char *ifname, char *qname)
|
||||
close(fd);
|
||||
|
||||
if (qname != NULL) {
|
||||
struct qdisc_conf *stat;
|
||||
struct qdisc_conf *st;
|
||||
|
||||
qtype = qtypereq.arg;
|
||||
for (stat = qdisc_table; stat->qdisc_name != NULL; stat++)
|
||||
if (stat->altqtype == qtype)
|
||||
strlcpy(qname, stat->qdisc_name, 64);
|
||||
for (st = qdisc_table; st->qdisc_name != NULL; st++)
|
||||
if (st->altqtype == qtype)
|
||||
strlcpy(qname, st->qdisc_name, 64);
|
||||
}
|
||||
|
||||
return (qtype);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: altq_qop.h,v 1.4 2006/11/26 11:38:07 peter Exp $ */
|
||||
/* $NetBSD: altq_qop.h,v 1.5 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: altq_qop.h,v 1.5 2002/02/12 10:14:01 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
@ -38,7 +38,7 @@ struct fltrinfo;
|
||||
|
||||
/* queueing discipline specific command parsers */
|
||||
struct qdisc_parser {
|
||||
char *qname;
|
||||
const char *qname;
|
||||
int (*interface_parser)(const char *ifname, int argc, char **argv);
|
||||
int (*class_parser)(const char *ifname, const char *clname,
|
||||
const char *parent, int argc, char **argv);
|
||||
@ -46,8 +46,8 @@ struct qdisc_parser {
|
||||
|
||||
/* queueing discipline specific operations */
|
||||
struct qdisc_ops {
|
||||
int qdisc_type; /* discipline type (e.g., ALTQT_CBQ) */
|
||||
char *qname; /* discipline name (e.g., cbq) */
|
||||
int qdisc_type; /* discipline type (e.g., ALTQT_CBQ) */
|
||||
const char *qname; /* discipline name (e.g., cbq) */
|
||||
|
||||
/* interface operations */
|
||||
int (*attach)(struct ifinfo *);
|
||||
@ -217,7 +217,7 @@ int client_input(FILE *fp);
|
||||
#define QOPERR_MAX 18
|
||||
|
||||
extern int filter_dontwarn;/* supress warning for the current filter */
|
||||
extern char *altqconfigfile; /* config file name */
|
||||
extern const char *altqconfigfile; /* config file name */
|
||||
extern const char *qop_errlist[]; /* error string list */
|
||||
extern struct qdisc_ops nop_qdisc;
|
||||
extern char *cur_ifname(void);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qop.c,v 1.8 2006/11/26 11:38:07 peter Exp $ */
|
||||
/* $NetBSD: qop.c,v 1.9 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: qop.c,v 1.11 2001/10/26 04:57:59 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
@ -172,12 +172,12 @@ int
|
||||
qcmd_disableall()
|
||||
{
|
||||
struct ifinfo *ifinfo;
|
||||
int err, error = 0;
|
||||
int lerr, error = 0;
|
||||
|
||||
LIST_FOREACH(ifinfo, &qop_iflist, next)
|
||||
if ((err = qop_disable(ifinfo)) != 0)
|
||||
if ((lerr = qop_disable(ifinfo)) != 0)
|
||||
if (error == 0)
|
||||
error = err;
|
||||
error = lerr;
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1404,7 +1404,7 @@ qop_rio_set_defaults(struct redparams *params)
|
||||
* (also check the altq device file)
|
||||
*/
|
||||
int
|
||||
open_module(const char *devname, int flags)
|
||||
open_module(const char *dvname, int flags)
|
||||
{
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version > 300000)
|
||||
char modname[64], filename[MAXPATHLEN], *cp;
|
||||
@ -1413,8 +1413,8 @@ open_module(const char *devname, int flags)
|
||||
struct stat sbuf;
|
||||
|
||||
/* check if the altq device exists */
|
||||
if (stat(devname, &sbuf) < 0) {
|
||||
LOG(LOG_ERR, errno, "can't access %s!", devname);
|
||||
if (stat(dvname, &sbuf) < 0) {
|
||||
LOG(LOG_ERR, errno, "can't access %s!", dvname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qop_cbq.c,v 1.6 2002/05/31 06:53:48 itojun Exp $ */
|
||||
/* $NetBSD: qop_cbq.c,v 1.7 2008/05/02 19:07:44 xtraeme Exp $ */
|
||||
/* $KAME: qop_cbq.c,v 1.7 2002/05/31 06:03:35 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
|
||||
@ -755,7 +755,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
{
|
||||
struct cbq_ifinfo *cbq_ifinfo = ifinfo->private;
|
||||
double maxq, maxidle_s, maxidle, minidle,
|
||||
offtime, nsPerByte, ptime, cptime;
|
||||
lofftime, nsPerByte, ptime, cptime;
|
||||
double z = (double)(1 << RM_FILTER_GAIN);
|
||||
double g = (1.0 - 1.0 / z);
|
||||
double f;
|
||||
@ -836,22 +836,22 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
if (IsDebug(DEBUG_ALTQ))
|
||||
LOG(LOG_DEBUG, 0, " maxidle=%.2f us", maxidle/1000.0);
|
||||
if (minburst)
|
||||
offtime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom);
|
||||
lofftime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom);
|
||||
else
|
||||
offtime = cptime;
|
||||
lofftime = cptime;
|
||||
minidle = -((double)max_pkt_size * (double)nsPerByte);
|
||||
if (IsDebug(DEBUG_ALTQ))
|
||||
LOG(LOG_DEBUG, 0, " offtime=%.2f us minidle=%.2f us",
|
||||
offtime/1000.0, minidle/1000.0);
|
||||
LOG(LOG_DEBUG, 0, " lofftime=%.2f us minidle=%.2f us",
|
||||
lofftime/1000.0, minidle/1000.0);
|
||||
|
||||
maxidle = ((maxidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN);
|
||||
#if 1 /* ALTQ */
|
||||
/* also scale offtime and minidle */
|
||||
offtime = (offtime * 8.0) / nsPerByte * pow(2, RM_FILTER_GAIN);
|
||||
/* also scale lofftime and minidle */
|
||||
lofftime = (lofftime * 8.0) / nsPerByte * pow(2, RM_FILTER_GAIN);
|
||||
minidle = ((minidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN);
|
||||
#endif
|
||||
maxidle = maxidle / 1000.0;
|
||||
offtime = offtime / 1000.0;
|
||||
lofftime = lofftime / 1000.0;
|
||||
minidle = minidle / 1000.0;
|
||||
/* adjust queue size when maxdelay is specified.
|
||||
queue size should be relative to its share */
|
||||
@ -898,7 +898,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
cl_spec->maxq = (u_int) maxq;
|
||||
cl_spec->maxidle = (u_int) fabs(maxidle);
|
||||
cl_spec->minidle = (int)minidle;
|
||||
cl_spec->offtime = (u_int) fabs(offtime);
|
||||
cl_spec->offtime = (u_int) fabs(lofftime);
|
||||
|
||||
cl_spec->parent_class_handle = parent_class;
|
||||
cl_spec->borrow_class_handle = borrow_class;
|
||||
|
Loading…
Reference in New Issue
Block a user