Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/tc.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/networking/tc.c

    r3232 r3621  
    3030
    3131#include "libbb.h"
     32#include "common_bufsiz.h"
    3233
    3334#include "libiproute/utils.h"
     
    6465    uint32_t filter_proto;
    6566} FIX_ALIASING;
    66 #define G (*(struct globals*)&bb_common_bufsiz1)
    67 struct BUG_G_too_big {
    68         char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
    69 };
     67#define G (*(struct globals*)bb_common_bufsiz1)
    7068#define filter_ifindex (G.filter_ifindex)
    7169#define filter_qdisc (G.filter_qdisc)
     
    7371#define filter_prio (G.filter_prio)
    7472#define filter_proto (G.filter_proto)
    75 #define INIT_G() do { } while (0)
     73#define INIT_G() do { \
     74    setup_common_bufsiz(); \
     75    BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
     76} while (0)
    7677
    7778/* Allocates a buffer containing the name of a class id.
     
    152153
    153154    if (use_iec) {
    154         if (tmp >= 1000.0*1024.0*1024.0)
    155             snprintf(buf, len, "%.0fMibit", tmp/1024.0*1024.0);
    156         else if (tmp >= 1000.0*1024)
     155        if (tmp >= 1000*1024*1024)
     156            snprintf(buf, len, "%.0fMibit", tmp/(1024*1024));
     157        else if (tmp >= 1000*1024)
    157158            snprintf(buf, len, "%.0fKibit", tmp/1024);
    158159        else
    159160            snprintf(buf, len, "%.0fbit", tmp);
    160161    } else {
    161         if (tmp >= 1000.0*1000000.0)
    162             snprintf(buf, len, "%.0fMbit", tmp/1000000.0);
    163         else if (tmp >= 1000.0 * 1000.0)
    164             snprintf(buf, len, "%.0fKbit", tmp/1000.0);
     162        if (tmp >= 1000*1000000)
     163            snprintf(buf, len, "%.0fMbit", tmp/1000000);
     164        else if (tmp >= 1000*1000)
     165            snprintf(buf, len, "%.0fKbit", tmp/1000);
    165166        else
    166167            snprintf(buf, len, "%.0fbit",  tmp);
     
    419420                        struct nlmsghdr *hdr, void *arg UNUSED_PARAM)
    420421{
    421     struct tcmsg *msg = NLMSG_DATA(hdr);
    422     int len = hdr->nlmsg_len;
    423     struct rtattr * tb[TCA_MAX+1];
    424422    return 0;
    425423}
     
    464462    obj = index_in_substrings(objects, *argv++);
    465463
    466     if (obj < OBJ_qdisc)
     464    if (obj < 0)
    467465        bb_show_usage();
    468466    if (!*argv)
     
    471469        cmd = index_in_substrings(commands, *argv);
    472470        if (cmd < 0)
    473             bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
     471            invarg_1_to_2(*argv, argv[-1]);
    474472        argv++;
    475473    }
     
    494492            /* We don't care about duparg2("qdisc handle",*argv) for now */
    495493            if (get_qdisc_handle(&filter_qdisc, *argv))
    496                 invarg(*argv, "qdisc");
     494                invarg_1_to_2(*argv, "qdisc");
    497495        } else
    498496        if (obj != OBJ_qdisc
     
    504502            /* nothing */
    505503        } else {
    506             invarg(*argv, "command");
     504            invarg_1_to_2(*argv, "command");
    507505        }
    508506        NEXT_ARG();
     
    518516                duparg(*argv, "parent");
    519517            if (get_tc_classid(&handle, *argv))
    520                 invarg(*argv, "parent");
     518                invarg_1_to_2(*argv, "parent");
    521519            msg.tcm_parent = handle;
    522520            if (obj == OBJ_filter)
     
    543541                duparg(*argv, "protocol");
    544542            if (ll_proto_a2n(&tmp, *argv))
    545                 invarg(*argv, "protocol");
     543                invarg_1_to_2(*argv, "protocol");
    546544            filter_proto = tmp;
    547545        }
Note: See TracChangeset for help on using the changeset viewer.