diff options
Diffstat (limited to 'usr.sbin/altq/libaltq/qop_hfsc.c')
-rw-r--r-- | usr.sbin/altq/libaltq/qop_hfsc.c | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/usr.sbin/altq/libaltq/qop_hfsc.c b/usr.sbin/altq/libaltq/qop_hfsc.c index b9e9d40a532..b83e3d376d5 100644 --- a/usr.sbin/altq/libaltq/qop_hfsc.c +++ b/usr.sbin/altq/libaltq/qop_hfsc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: qop_hfsc.c,v 1.1 2001/06/27 18:23:33 kjc Exp $ */ -/* $KAME: qop_hfsc.c,v 1.4 2000/10/18 09:15:19 kjc Exp $ */ +/* $OpenBSD: qop_hfsc.c,v 1.2 2001/08/16 12:59:43 kjc Exp $ */ +/* $KAME: qop_hfsc.c,v 1.6 2001/08/16 10:39:14 kjc Exp $ */ /* * Copyright (C) 1999-2000 * Sony Computer Science Laboratories, Inc. All rights reserved. @@ -50,34 +50,31 @@ #include "altq_qop.h" #include "qop_hfsc.h" -static int read_sc(int *argcp, char ***argvp, - int *type, u_int *m1, u_int *d, u_int *m2); -static int qop_hfsc_enable_hook(struct ifinfo *ifinfo); -static int qop_hfsc_delete_class_hook(struct classinfo *clinfo); -static int validate_sc(struct service_curve *sc); - -static void gsc_add_sc(struct gen_sc *gsc, struct service_curve *sc); -static void gsc_sub_sc(struct gen_sc *gsc, struct service_curve *sc); -static int is_gsc_under_sc(struct gen_sc *gsc, struct service_curve *sc); -static void gsc_destroy(struct gen_sc *gsc); -static struct segment *gsc_getentry(struct gen_sc *gsc, double x); -static int gsc_add_seg(struct gen_sc *gsc, - double x, double y, double d, double m); -static int gsc_sub_seg(struct gen_sc *gsc, - double x, double y, double d, double m); -static void gsc_compress(struct gen_sc *gsc); -static double sc_x2y(struct service_curve *sc, double x); - -static int hfsc_attach(struct ifinfo *ifinfo); -static int hfsc_detach(struct ifinfo *ifinfo); -static int hfsc_clear(struct ifinfo *ifinfo); -static int hfsc_enable(struct ifinfo *ifinfo); -static int hfsc_disable(struct ifinfo *ifinfo); -static int hfsc_add_class(struct classinfo *clinfo); -static int hfsc_modify_class(struct classinfo *clinfo, void *arg); -static int hfsc_delete_class(struct classinfo *clinfo); -static int hfsc_add_filter(struct fltrinfo *fltrinfo); -static int hfsc_delete_filter(struct fltrinfo *fltrinfo); +static int read_sc(int *, char ***, int *, u_int *, u_int *, u_int *); +static int qop_hfsc_enable_hook(struct ifinfo *); +static int qop_hfsc_delete_class_hook(struct classinfo *); +static int validate_sc(struct service_curve *); + +static void gsc_add_sc(struct gen_sc *, struct service_curve *); +static void gsc_sub_sc(struct gen_sc *, struct service_curve *); +static int is_gsc_under_sc(struct gen_sc *, struct service_curve *); +static void gsc_destroy(struct gen_sc *); +static struct segment *gsc_getentry(struct gen_sc *, double); +static int gsc_add_seg(struct gen_sc *, double, double, double, double); +static int gsc_sub_seg(struct gen_sc *, double, double, double, double); +static void gsc_compress(struct gen_sc *); +static double sc_x2y(struct service_curve *, double); + +static int hfsc_attach(struct ifinfo *); +static int hfsc_detach(struct ifinfo *); +static int hfsc_clear(struct ifinfo *); +static int hfsc_enable(struct ifinfo *); +static int hfsc_disable(struct ifinfo *); +static int hfsc_add_class(struct classinfo *); +static int hfsc_modify_class(struct classinfo *, void *); +static int hfsc_delete_class(struct classinfo *); +static int hfsc_add_filter(struct fltrinfo *); +static int hfsc_delete_filter(struct fltrinfo *); #define HFSC_DEVICE "/dev/altq/hfsc" @@ -126,7 +123,7 @@ hfsc_interface_parser(const char *ifname, int argc, char **argv) } else if (EQUAL(*argv, "hfsc")) { /* just skip */ } else { - LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv); + LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv); return (0); } argc--; argv++; @@ -154,7 +151,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, if (*argv[0] == '[') { if (read_sc(&argc, &argv, &type, &m1, &d, &m2) != 0) { LOG(LOG_ERR, 0, - "Bad service curve in %s, line %d\n", + "Bad service curve in %s, line %d", altqconfigfile, line_no); return (0); } @@ -198,7 +195,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, /* nothing */ } else { LOG(LOG_ERR, 0, - "unknown admission type - %s, line %d\n", + "unknown admission type - %s, line %d", *argv, line_no); return (0); } @@ -213,7 +210,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, flags |= HFCF_CLEARDSCP; } else { LOG(LOG_ERR, 0, - "Unknown keyword '%s' in %s, line %d\n", + "Unknown keyword '%s' in %s, line %d", *argv, altqconfigfile, line_no); return (0); } @@ -223,7 +220,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, if (type == 0) { LOG(LOG_ERR, 0, - "hfsc: service curve not specified in %s, line %d\n", + "hfsc: service curve not specified in %s, line %d", altqconfigfile, line_no); return (0); } @@ -261,7 +258,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, if (ifinfo->resv_class != NULL) { LOG(LOG_ERR, 0, - "more than one admission class specified: %s\n", + "more than one admission class specified: %s", class_name); return (0); } @@ -269,7 +266,7 @@ hfsc_class_parser(const char *ifname, const char *class_name, } if (error) { - LOG(LOG_ERR, errno, "hfsc_class_parser: %s\n", + LOG(LOG_ERR, errno, "hfsc_class_parser: %s", qoperror(error)); return (0); } @@ -328,7 +325,7 @@ qcmd_hfsc_add_if(const char *ifname, u_int bandwidth, int flags) error = qop_hfsc_add_if(NULL, ifname, bandwidth, flags); if (error != 0) - LOG(LOG_ERR, errno, "%s: can't add hfsc on interface '%s'\n", + LOG(LOG_ERR, errno, "%s: can't add hfsc on interface '%s'", qoperror(error), ifname); return (error); } @@ -359,7 +356,7 @@ qcmd_hfsc_add_class(const char *ifname, const char *class_name, &sc, qlimit, flags); if (error != 0) LOG(LOG_ERR, errno, - "hfsc: %s: can't add class '%s' on interface '%s'\n", + "hfsc: %s: can't add class '%s' on interface '%s'", qoperror(error), class_name, ifname); return (error); } @@ -415,7 +412,7 @@ qop_hfsc_add_if(struct ifinfo **rp, const char *ifname, if ((error = qop_hfsc_add_class(&hfsc_ifinfo->root_class, "root", ifinfo, NULL, &sc, 0, 0)) != 0) { LOG(LOG_ERR, errno, - "hfsc: %s: can't create dummy root class on %s!\n", + "hfsc: %s: can't create dummy root class on %s!", qoperror(error), ifname); (void)qop_delete_if(ifinfo); return (QOPERR_CLASS); @@ -636,18 +633,19 @@ qop_hfsc_enable_hook(struct ifinfo *ifinfo) hfsc_ifinfo = ifinfo->private; if (hfsc_ifinfo->default_class == NULL) { - LOG(LOG_ERR, 0, "hfsc: no default class on interface %s!\n", + LOG(LOG_ERR, 0, "hfsc: no default class on interface %s!", ifinfo->ifname); return (QOPERR_CLASS); } else if (hfsc_ifinfo->default_class->child != NULL) { - LOG(LOG_ERR, 0, "hfsc: default class on %s must be a leaf!\n", + LOG(LOG_ERR, 0, "hfsc: default class on %s must be a leaf!", ifinfo->ifname); return (QOPERR_CLASS); } LIST_FOREACH(clinfo, &ifinfo->cllist, next) { if (clinfo->child != NULL && !LIST_EMPTY(&clinfo->fltrlist)) { - LOG(LOG_ERR, 0, "hfsc: internal class \"%s\" should not have a filter!\n", + LOG(LOG_ERR, 0, + "hfsc: internal class \"%s\" should not have a filter!", clinfo->clname); return (QOPERR_CLASS); } @@ -661,7 +659,7 @@ validate_sc(struct service_curve *sc) { /* the 1st segment of a concave curve must be zero */ if (sc->m1 < sc->m2 && sc->m1 != 0) { - LOG(LOG_ERR, 0, "m1 must be 0 for convex!\n"); + LOG(LOG_ERR, 0, "m1 must be 0 for convex!"); return (-1); } return (0); @@ -913,7 +911,7 @@ hfsc_attach(struct ifinfo *ifinfo) if (hfsc_fd < 0 && (hfsc_fd = open(HFSC_DEVICE, O_RDWR)) < 0 && (hfsc_fd = open_module(HFSC_DEVICE, O_RDWR)) < 0) { - LOG(LOG_ERR, errno, "HFSC open\n"); + LOG(LOG_ERR, errno, "HFSC open"); return (QOPERR_SYSCALL); } |