From patchwork Tue Mar 12 22:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13590654 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D0FE142636 for ; Tue, 12 Mar 2024 22:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; cv=none; b=psv3N/IAsffbfVPUSxt0MKJ06dus403fzvLM5VrkU6A8XExbq3YyIJiqNBCQEbK0YlYwFeWqU6/eAeuF20wWZN/kxMZq3KjON3tLm7gCRh46FIwpJGc2uSuxy4TT+8UQ1SJQNQ/3S8FDlBkiFohmKnBdBXR1X7Y5phaUPXFkjBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; c=relaxed/simple; bh=kSuWr4HYXMq3u+TmXZ8PlOVjiuVo0dXv0Tw/x3SiXCo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QHFrud9oPcDdIOL/W1QwpyLOV5KmN+zJNHm1ynz6YfvNYUoIzbLkF8QjNbn7qTVXcYv5qRaXXgLPOu+8LbBMmF+umt8SsTbEMoKUe+BTi5D0jLCbrVhoC2OTpV0McIjXB6G4mGyPobtPL0h5Gnsoeamk6azlQhSCSmUulSrCdFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=qd2vVW5F; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="qd2vVW5F" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1ddbad556a8so8277355ad.3 for ; Tue, 12 Mar 2024 15:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1710281673; x=1710886473; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WupLu2/AyNsf40915UEa5w3vQstYKjAyFhm6zJPCmqc=; b=qd2vVW5F9xvk7zijz5mRlw1oEXm1rN2al7B71ZRTCt5TwzXxxvhKxjDswMfct6SgD2 ApqIOkCthYA0PpoxZuHdagR/lks8Wb4uSSGaaGt2I2MBreSyx++2VHXB0vb9GYl1u3fv 5MqHtwzXIiIX5pWpRGm7dF3Hx9MDj3/I61k1D165BlmAOy8A/NitzJPmfXtSmMFH95q2 PMhgMgx4K2fuzjmHH5Pnnf+Cq8xTWYMOTuccup7GBQMDR1LewZZYoJ7ljUpS9vW+IerJ Ab0ZW/vkJ0ryIOkX2CWxs4Ni3XV9Et2JS51EM3G6Qe/C8NaXTyQEHpLLPf8RDrXMq5YQ e8VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710281673; x=1710886473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WupLu2/AyNsf40915UEa5w3vQstYKjAyFhm6zJPCmqc=; b=D5V0f5mtBbtaeQLQZqxONgClqQmmjf4SD/TWzoyAxkX81F3HJA7DurcPykEaVck1qE vCAegYY0hxQ7+WD+OcVkobIlLdQaH7TpZMlYKxTSDRm0vsgdT8M6NrcStHgZAjb6quyK /OSXUJXOg76IopZTA6WYF/wMYDrIGF/h2ld4MnTnvF/bRf/24JoawWTCWjabQH7NbInX HsxFzY1ZeqDCJ6hlaVC8NfGfKaDUGl14Kif3z4/MNTFC+qwl+v4+jW+xSEevaVcDS+Dm P1QGA5FA4y343SrFwLXIyF3RWqYkMr2k4cZh3ycJR7JUfP1IObfjAN18AjFg8PjLDDJ9 +/jQ== X-Gm-Message-State: AOJu0YzxILABPm8DVu4jHbWkyvMFNVkfOEhhOmIFN3jwcIxMAxr6V8dc fNg4Vl8r3MNsFq9RjY06ouxUP3DKEVJeAMW+VfTbLel4dbobezvkkoeyQ3BRZlNQ2nbv2eJtt3g t X-Google-Smtp-Source: AGHT+IEzInFYI4OgdLKIDqHKoLPjDQ09QC7YaOKo0fiu9YUZ4C0GH/t3nDF1ioVGHjyEmpVgppL9Tw== X-Received: by 2002:a17:902:ea94:b0:1dc:afd1:9c37 with SMTP id x20-20020a170902ea9400b001dcafd19c37mr8625486plb.24.1710281673366; Tue, 12 Mar 2024 15:14:33 -0700 (PDT) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id o10-20020a170902e28a00b001dcfaab3457sm7240473plc.104.2024.03.12.15.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:14:32 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 1/4] tc: make qdisc_util arg const Date: Tue, 12 Mar 2024 15:12:39 -0700 Message-ID: <20240312221422.81253-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240312221422.81253-1-stephen@networkplumber.org> References: <20240312221422.81253-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The callbacks in qdisc_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger --- tc/q_cake.c | 6 +++--- tc/q_cbs.c | 4 ++-- tc/q_choke.c | 6 +++--- tc/q_clsact.c | 4 ++-- tc/q_codel.c | 6 +++--- tc/q_drr.c | 8 ++++---- tc/q_etf.c | 4 ++-- tc/q_ets.c | 8 ++++---- tc/q_fifo.c | 4 ++-- tc/q_fq.c | 6 +++--- tc/q_fq_codel.c | 6 +++--- tc/q_fq_pie.c | 6 +++--- tc/q_gred.c | 6 +++--- tc/q_hfsc.c | 10 +++++----- tc/q_hhf.c | 6 +++--- tc/q_htb.c | 8 ++++---- tc/q_ingress.c | 4 ++-- tc/q_mqprio.c | 4 ++-- tc/q_multiq.c | 4 ++-- tc/q_netem.c | 4 ++-- tc/q_pie.c | 6 +++--- tc/q_plug.c | 4 ++-- tc/q_prio.c | 4 ++-- tc/q_qfq.c | 6 +++--- tc/q_red.c | 8 ++++---- tc/q_sfb.c | 6 +++--- tc/q_sfq.c | 6 +++--- tc/q_skbprio.c | 4 ++-- tc/q_taprio.c | 6 +++--- tc/q_tbf.c | 4 ++-- tc/tc.c | 6 +++--- tc/tc_class.c | 6 +++--- tc/tc_qdisc.c | 6 +++--- tc/tc_util.h | 19 ++++++++++--------- 34 files changed, 103 insertions(+), 102 deletions(-) diff --git a/tc/q_cake.c b/tc/q_cake.c index c438b765ec56..e2b8de55e5a2 100644 --- a/tc/q_cake.c +++ b/tc/q_cake.c @@ -88,7 +88,7 @@ static void explain(void) " (* marks defaults)\n"); } -static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int cake_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct cake_preset *preset, *preset_set = NULL; @@ -415,7 +415,7 @@ static void cake_print_mode(unsigned int value, unsigned int max, } } -static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int cake_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_CAKE_MAX + 1]; unsigned int interval = 0; @@ -614,7 +614,7 @@ static void cake_print_json_tin(struct rtattr **tstat) #undef PRINT_TSTAT_JSON } -static int cake_print_xstats(struct qdisc_util *qu, FILE *f, +static int cake_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct rtattr *st[TCA_CAKE_STATS_MAX + 1]; diff --git a/tc/q_cbs.c b/tc/q_cbs.c index 788535c6a022..5adfee7f2505 100644 --- a/tc/q_cbs.c +++ b/tc/q_cbs.c @@ -29,7 +29,7 @@ static void explain1(const char *arg, const char *val) fprintf(stderr, "cbs: illegal value for \"%s\": \"%s\"\n", arg, val); } -static int cbs_parse_opt(struct qdisc_util *qu, int argc, +static int cbs_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_cbs_qopt opt = {}; @@ -103,7 +103,7 @@ static int cbs_parse_opt(struct qdisc_util *qu, int argc, return 0; } -static int cbs_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int cbs_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_CBS_MAX+1]; struct tc_cbs_qopt *qopt; diff --git a/tc/q_choke.c b/tc/q_choke.c index 7653eb7ef9c8..a16f5f680a46 100644 --- a/tc/q_choke.c +++ b/tc/q_choke.c @@ -27,7 +27,7 @@ static void explain(void) " [ min PACKETS ] [ max PACKETS ] [ burst PACKETS ]\n"); } -static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int choke_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_red_qopt opt = {}; @@ -162,7 +162,7 @@ static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int choke_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int choke_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_CHOKE_MAX+1]; const struct tc_red_qopt *qopt; @@ -203,7 +203,7 @@ static int choke_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int choke_print_xstats(struct qdisc_util *qu, FILE *f, +static int choke_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_choke_xstats *st; diff --git a/tc/q_clsact.c b/tc/q_clsact.c index 341f653f60b1..5bd9eb20ed0d 100644 --- a/tc/q_clsact.c +++ b/tc/q_clsact.c @@ -10,7 +10,7 @@ static void explain(void) fprintf(stderr, "Usage: ... clsact\n"); } -static int clsact_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int clsact_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { if (argc > 0) { @@ -22,7 +22,7 @@ static int clsact_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int clsact_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int clsact_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { return 0; } diff --git a/tc/q_codel.c b/tc/q_codel.c index 03b6f92f117c..15029b4cf5d1 100644 --- a/tc/q_codel.c +++ b/tc/q_codel.c @@ -28,7 +28,7 @@ static void explain(void) " [ ce_threshold TIME ]\n"); } -static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int codel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int limit = 0; @@ -95,7 +95,7 @@ static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int codel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_CODEL_MAX + 1]; unsigned int limit; @@ -147,7 +147,7 @@ static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int codel_print_xstats(struct qdisc_util *qu, FILE *f, +static int codel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_codel_xstats _st = {}, *st; diff --git a/tc/q_drr.c b/tc/q_drr.c index 03c4744f6f26..add684d551f8 100644 --- a/tc/q_drr.c +++ b/tc/q_drr.c @@ -28,7 +28,7 @@ static void explain2(void) } -static int drr_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int drr_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { while (argc) { @@ -44,7 +44,7 @@ static int drr_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, +static int drr_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct rtattr *tail; @@ -75,7 +75,7 @@ static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int drr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int drr_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_DRR_MAX + 1]; @@ -90,7 +90,7 @@ static int drr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int drr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +static int drr_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_drr_stats *x; diff --git a/tc/q_etf.c b/tc/q_etf.c index d16188daabbd..4e89f723428b 100644 --- a/tc/q_etf.c +++ b/tc/q_etf.c @@ -39,7 +39,7 @@ static void explain_clockid(const char *val) val); } -static int etf_parse_opt(struct qdisc_util *qu, int argc, +static int etf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_etf_qopt opt = { @@ -107,7 +107,7 @@ static int etf_parse_opt(struct qdisc_util *qu, int argc, return 0; } -static int etf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int etf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_ETF_MAX+1]; struct tc_etf_qopt *qopt; diff --git a/tc/q_ets.c b/tc/q_ets.c index 7380bb2f08b0..dea5f0446501 100644 --- a/tc/q_ets.c +++ b/tc/q_ets.c @@ -57,7 +57,7 @@ static int parse_nbands(const char *arg, __u8 *pnbands, const char *what) return 0; } -static int ets_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int ets_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { __u8 nbands = 0; @@ -182,7 +182,7 @@ parse_priomap: return 0; } -static int ets_parse_copt(struct qdisc_util *qu, int argc, char **argv, +static int ets_parse_copt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int quantum = 0; @@ -276,7 +276,7 @@ static int ets_print_opt_priomap(struct rtattr *opt) return 0; } -static int ets_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int ets_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_ETS_MAX + 1]; __u8 nbands; @@ -310,7 +310,7 @@ static int ets_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return ets_print_opt_priomap(tb[TCA_ETS_PRIOMAP]); } -static int ets_print_copt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int ets_print_copt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_ETS_MAX + 1]; __u32 quantum; diff --git a/tc/q_fifo.c b/tc/q_fifo.c index 9b2c5348d375..489208dcf74f 100644 --- a/tc/q_fifo.c +++ b/tc/q_fifo.c @@ -22,7 +22,7 @@ static void explain(void) fprintf(stderr, "Usage: ... <[p|b]fifo | pfifo_head_drop> [ limit NUMBER ]\n"); } -static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int fifo_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0; @@ -52,7 +52,7 @@ static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int fifo_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_fifo_qopt *qopt; diff --git a/tc/q_fq.c b/tc/q_fq.c index 7f8a2b80d441..f549be20f19f 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -47,7 +47,7 @@ static unsigned int ilog2(unsigned int val) return res; } -static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int fq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_prio_qopt prio2band; @@ -337,7 +337,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int fq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_FQ_MAX + 1]; unsigned int plimit, flow_plimit; @@ -490,7 +490,7 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int fq_print_xstats(struct qdisc_util *qu, FILE *f, +static int fq_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_fq_qd_stats *st, _st; diff --git a/tc/q_fq_codel.c b/tc/q_fq_codel.c index 9c9d7bc132a3..a619d2b346b1 100644 --- a/tc/q_fq_codel.c +++ b/tc/q_fq_codel.c @@ -29,7 +29,7 @@ static void explain(void) "[ drop_batch SIZE ]\n"); } -static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int fq_codel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int drop_batch = 0; @@ -157,7 +157,7 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int fq_codel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_FQ_CODEL_MAX + 1]; unsigned int limit; @@ -250,7 +250,7 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt return 0; } -static int fq_codel_print_xstats(struct qdisc_util *qu, FILE *f, +static int fq_codel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_fq_codel_xstats _st = {}, *st; diff --git a/tc/q_fq_pie.c b/tc/q_fq_pie.c index 9cbef47eef88..dc2710cdbbe6 100644 --- a/tc/q_fq_pie.c +++ b/tc/q_fq_pie.c @@ -36,7 +36,7 @@ static void explain(void) #define ALPHA_MAX 32 #define BETA_MAX 32 -static int fq_pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int fq_pie_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int limit = 0; @@ -172,7 +172,7 @@ static int fq_pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int fq_pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int fq_pie_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_FQ_PIE_MAX + 1]; unsigned int limit = 0; @@ -269,7 +269,7 @@ static int fq_pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int fq_pie_print_xstats(struct qdisc_util *qu, FILE *f, +static int fq_pie_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_fq_pie_xstats _st = {}, *st; diff --git a/tc/q_gred.c b/tc/q_gred.c index f6a3f05eb95e..84fc91244aed 100644 --- a/tc/q_gred.c +++ b/tc/q_gred.c @@ -39,7 +39,7 @@ static void explain(void) " [ probability PROBABILITY ] [ bandwidth KBPS ] [ecn] [harddrop]\n"); } -static int init_gred(struct qdisc_util *qu, int argc, char **argv, +static int init_gred(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) { @@ -115,7 +115,7 @@ static int init_gred(struct qdisc_util *qu, int argc, char **argv, /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ -static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +static int gred_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct rtattr *tail, *entry, *vqs; int ok = 0; @@ -406,7 +406,7 @@ gred_print_stats(struct tc_gred_info *info, struct tc_gred_qopt *qopt) print_size(PRINT_ANY, "bytes", "(%s) ", bytes); } -static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int gred_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_gred_info infos[MAX_DPs] = {}; struct rtattr *tb[TCA_GRED_MAX + 1]; diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c index 609d925a42e5..aed7130cc8e6 100644 --- a/tc/q_hfsc.c +++ b/tc/q_hfsc.c @@ -65,7 +65,7 @@ explain1(char *arg) } static int -hfsc_parse_opt(struct qdisc_util *qu, int argc, char **argv, +hfsc_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_hfsc_qopt qopt = {}; @@ -97,7 +97,7 @@ hfsc_parse_opt(struct qdisc_util *qu, int argc, char **argv, } static int -hfsc_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +hfsc_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_hfsc_qopt *qopt; @@ -114,7 +114,7 @@ hfsc_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) } static int -hfsc_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +hfsc_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_hfsc_stats *st; @@ -136,7 +136,7 @@ hfsc_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) } static int -hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, +hfsc_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_service_curve rsc = {}, fsc = {}, usc = {}; @@ -220,7 +220,7 @@ hfsc_print_sc(FILE *f, char *name, struct tc_service_curve *sc) } static int -hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +hfsc_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_HFSC_MAX+1]; struct tc_service_curve *rsc = NULL, *fsc = NULL, *usc = NULL; diff --git a/tc/q_hhf.c b/tc/q_hhf.c index 95e49f3dd720..939e490939e6 100644 --- a/tc/q_hhf.c +++ b/tc/q_hhf.c @@ -26,7 +26,7 @@ static void explain(void) " [ non_hh_weight NUMBER ]\n"); } -static int hhf_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int hhf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int limit = 0; @@ -117,7 +117,7 @@ static int hhf_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int hhf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int hhf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_HHF_MAX + 1]; unsigned int limit; @@ -179,7 +179,7 @@ static int hhf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int hhf_print_xstats(struct qdisc_util *qu, FILE *f, +static int hhf_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_hhf_xstats *st; diff --git a/tc/q_htb.c b/tc/q_htb.c index 9afb293d9455..545152ff2a74 100644 --- a/tc/q_htb.c +++ b/tc/q_htb.c @@ -53,7 +53,7 @@ static void explain1(char *arg) explain(); } -static int htb_parse_opt(struct qdisc_util *qu, int argc, +static int htb_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int direct_qlen = ~0U; @@ -107,7 +107,7 @@ static int htb_parse_opt(struct qdisc_util *qu, int argc, return 0; } -static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, +static int htb_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_htb_opt opt = {}; @@ -263,7 +263,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int htb_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_HTB_MAX + 1]; struct tc_htb_opt *hopt; @@ -354,7 +354,7 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +static int htb_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_htb_xstats *st; diff --git a/tc/q_ingress.c b/tc/q_ingress.c index 3df4914c7d64..294b0051225c 100644 --- a/tc/q_ingress.c +++ b/tc/q_ingress.c @@ -16,7 +16,7 @@ static void explain(void) fprintf(stderr, "Usage: ... ingress\n"); } -static int ingress_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int ingress_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { while (argc > 0) { @@ -33,7 +33,7 @@ static int ingress_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int ingress_print_opt(struct qdisc_util *qu, FILE *f, +static int ingress_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { print_string(PRINT_FP, NULL, "---------------- ", NULL); diff --git a/tc/q_mqprio.c b/tc/q_mqprio.c index 7a4417f5363b..493c6eb5d641 100644 --- a/tc/q_mqprio.c +++ b/tc/q_mqprio.c @@ -46,7 +46,7 @@ static void add_tc_entries(struct nlmsghdr *n, __u32 fp[TC_QOPT_MAX_QUEUE], } } -static int mqprio_parse_opt(struct qdisc_util *qu, int argc, +static int mqprio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int idx; @@ -314,7 +314,7 @@ static void dump_tc_entries(FILE *f, struct rtattr *opt, int len) } } -static int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int mqprio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { int i; struct tc_mqprio_qopt *qopt; diff --git a/tc/q_multiq.c b/tc/q_multiq.c index b1e6c9a83708..63fffed42cf2 100644 --- a/tc/q_multiq.c +++ b/tc/q_multiq.c @@ -28,7 +28,7 @@ static void explain(void) fprintf(stderr, "Usage: ... multiq [help]\n"); } -static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int multiq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_multiq_qopt opt = {}; @@ -48,7 +48,7 @@ static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int multiq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_multiq_qopt *qopt; diff --git a/tc/q_netem.c b/tc/q_netem.c index 4ce9ab6e529b..3954d1f3e486 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -190,7 +190,7 @@ static int get_ticks(__u32 *ticks, const char *str) return 0; } -static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int netem_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int dist_size = 0; @@ -661,7 +661,7 @@ random_loss_model: return 0; } -static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int netem_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { const struct tc_netem_corr *cor = NULL; const struct tc_netem_reorder *reorder = NULL; diff --git a/tc/q_pie.c b/tc/q_pie.c index 177cdcae0f2e..04c9aa614b2b 100644 --- a/tc/q_pie.c +++ b/tc/q_pie.c @@ -30,7 +30,7 @@ static void explain(void) #define ALPHA_MAX 32 #define BETA_MAX 32 -static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int pie_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { unsigned int limit = 0; @@ -124,7 +124,7 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int pie_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_PIE_MAX + 1]; unsigned int limit; @@ -198,7 +198,7 @@ static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int pie_print_xstats(struct qdisc_util *qu, FILE *f, +static int pie_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_pie_xstats *st; diff --git a/tc/q_plug.c b/tc/q_plug.c index 8adf9b9604e7..257735a2dd67 100644 --- a/tc/q_plug.c +++ b/tc/q_plug.c @@ -22,7 +22,7 @@ static void explain(void) fprintf(stderr, "Usage: ... plug [block | release | release_indefinite | limit NUMBER]\n"); } -static int plug_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int plug_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_plug_qopt opt = {}; @@ -62,7 +62,7 @@ static int plug_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int plug_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int plug_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { /* dummy implementation as sch_plug does not implement a dump op */ return 0; diff --git a/tc/q_prio.c b/tc/q_prio.c index a3781ffe8b2c..41bd98a58b1b 100644 --- a/tc/q_prio.c +++ b/tc/q_prio.c @@ -22,7 +22,7 @@ static void explain(void) fprintf(stderr, "Usage: ... prio bands NUMBER priomap P1 P2...[multiqueue]\n"); } -static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int prio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int pmap_mode = 0; @@ -89,7 +89,7 @@ static int prio_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +int prio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { int i; struct tc_prio_qopt *qopt; diff --git a/tc/q_qfq.c b/tc/q_qfq.c index c9955cc96a97..d4c0a5916587 100644 --- a/tc/q_qfq.c +++ b/tc/q_qfq.c @@ -30,7 +30,7 @@ static void explain_class(void) fprintf(stderr, "Usage: ... qfq weight NUMBER maxpkt BYTES\n"); } -static int qfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int qfq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { if (argc > 0) { @@ -43,7 +43,7 @@ static int qfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int qfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, +static int qfq_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct rtattr *tail; @@ -80,7 +80,7 @@ static int qfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int qfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int qfq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_QFQ_MAX + 1]; diff --git a/tc/q_red.c b/tc/q_red.c index f760253d13b2..1aa6d2b174a2 100644 --- a/tc/q_red.c +++ b/tc/q_red.c @@ -40,7 +40,7 @@ static struct qevent_util qevents[] = { {}, }; -static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int red_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct nla_bitfield32 flags_bf = { @@ -180,7 +180,7 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int red_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_RED_MAX + 1]; struct nla_bitfield32 *flags_bf; @@ -232,7 +232,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int red_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +static int red_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { #ifdef TC_RED_ECN struct tc_red_xstats *st; @@ -252,7 +252,7 @@ static int red_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstat return 0; } -static int red_has_block(struct qdisc_util *qu, struct rtattr *opt, __u32 block_idx, bool *p_has) +static int red_has_block(const struct qdisc_util *qu, struct rtattr *opt, __u32 block_idx, bool *p_has) { struct rtattr *tb[TCA_RED_MAX + 1]; diff --git a/tc/q_sfb.c b/tc/q_sfb.c index a2eef281e10f..6a26b71a83e1 100644 --- a/tc/q_sfb.c +++ b/tc/q_sfb.c @@ -40,7 +40,7 @@ static int get_prob(__u32 *val, const char *arg) return 0; } -static int sfb_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int sfb_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_sfb_qopt opt = { @@ -131,7 +131,7 @@ static int sfb_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int sfb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int sfb_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[__TCA_SFB_MAX]; struct tc_sfb_qopt *qopt; @@ -173,7 +173,7 @@ static int sfb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int sfb_print_xstats(struct qdisc_util *qu, FILE *f, +static int sfb_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_sfb_xstats *st; diff --git a/tc/q_sfq.c b/tc/q_sfq.c index 17bf8f63f105..37ebd977cb9a 100644 --- a/tc/q_sfq.c +++ b/tc/q_sfq.c @@ -30,7 +30,7 @@ static void explain(void) " [ ecn ] [ harddrop ]\n"); } -static int sfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +static int sfq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0, red = 0; struct tc_sfq_qopt_v1 opt = {}; @@ -196,7 +196,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl return 0; } -static int sfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int sfq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_sfq_qopt *qopt; struct tc_sfq_qopt_v1 *qopt_ext = NULL; @@ -255,7 +255,7 @@ static int sfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int sfq_print_xstats(struct qdisc_util *qu, FILE *f, +static int sfq_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct tc_sfq_xstats *st; diff --git a/tc/q_skbprio.c b/tc/q_skbprio.c index b0ba180ab9c4..910ea998330a 100644 --- a/tc/q_skbprio.c +++ b/tc/q_skbprio.c @@ -23,7 +23,7 @@ static void explain(void) fprintf(stderr, "Usage: ... [ limit NUMBER ]\n"); } -static int skbprio_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int skbprio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0; @@ -58,7 +58,7 @@ static int skbprio_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int skbprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int skbprio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct tc_skbprio_qopt *qopt; diff --git a/tc/q_taprio.c b/tc/q_taprio.c index c47fe244369f..416a222a8ef6 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -134,7 +134,7 @@ static void add_tc_entries(struct nlmsghdr *n, __u32 max_sdu[TC_QOPT_MAX_QUEUE], } } -static int taprio_parse_opt(struct qdisc_util *qu, int argc, +static int taprio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { __u32 max_sdu[TC_QOPT_MAX_QUEUE] = { }; @@ -545,7 +545,7 @@ static void dump_tc_entries(FILE *f, struct rtattr *opt) } } -static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int taprio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_TAPRIO_ATTR_MAX + 1]; struct tc_mqprio_qopt *qopt = 0; @@ -623,7 +623,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } -static int taprio_print_xstats(struct qdisc_util *qu, FILE *f, +static int taprio_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { struct rtattr *tb[TCA_TAPRIO_OFFLOAD_STATS_MAX + 1], *nla; diff --git a/tc/q_tbf.c b/tc/q_tbf.c index f621756d96e6..9356dfd2abcb 100644 --- a/tc/q_tbf.c +++ b/tc/q_tbf.c @@ -31,7 +31,7 @@ static void explain1(const char *arg, const char *val) } -static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, +static int tbf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { struct tc_tbf_qopt opt = {}; @@ -245,7 +245,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, return 0; } -static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int tbf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_TBF_MAX+1]; struct tc_tbf_qopt *qopt; diff --git a/tc/tc.c b/tc/tc.c index 7a746cf5115e..5191b4bd8cde 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -48,7 +48,7 @@ static void *BODY; /* cached handle dlopen(NULL) */ static struct qdisc_util *qdisc_list; static struct filter_util *filter_list; -static int print_noqopt(struct qdisc_util *qu, FILE *f, +static int print_noqopt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) { if (opt && RTA_PAYLOAD(opt)) @@ -57,7 +57,7 @@ static int print_noqopt(struct qdisc_util *qu, FILE *f, return 0; } -static int parse_noqopt(struct qdisc_util *qu, int argc, char **argv, +static int parse_noqopt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { if (argc) { @@ -102,7 +102,7 @@ static int parse_nofopt(struct filter_util *qu, char *fhandle, return 0; } -struct qdisc_util *get_qdisc_kind(const char *str) +const struct qdisc_util *get_qdisc_kind(const char *str) { void *dlh; char buf[256]; diff --git a/tc/tc_class.c b/tc/tc_class.c index f6a3d134f595..6d707d8c924f 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -61,7 +61,7 @@ static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv) .n.nlmsg_type = cmd, .t.tcm_family = AF_UNSPEC, }; - struct qdisc_util *q = NULL; + const struct qdisc_util *q = NULL; struct tc_estimator est = {}; char d[IFNAMSIZ] = {}; char k[FILTER_NAMESZ] = {}; @@ -213,7 +213,7 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, struct hlist_node *n, *tmp_cls; char cls_id_str[256] = {}; struct rtattr *tb[TCA_MAX + 1]; - struct qdisc_util *q; + const struct qdisc_util *q; char str[300] = {}; hlist_for_each_safe(n, tmp_cls, root_list) { @@ -298,7 +298,7 @@ int print_class(struct nlmsghdr *n, void *arg) struct tcmsg *t = NLMSG_DATA(n); int len = n->nlmsg_len; struct rtattr *tb[TCA_MAX + 1]; - struct qdisc_util *q; + const struct qdisc_util *q; char abuf[256]; if (n->nlmsg_type != RTM_NEWTCLASS && n->nlmsg_type != RTM_DELTCLASS) { diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index 84fd659f7d1f..7eb9a31baa31 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -42,7 +42,7 @@ static int usage(void) static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv) { - struct qdisc_util *q = NULL; + const struct qdisc_util *q = NULL; struct tc_estimator est = {}; struct { struct tc_sizespec szopts; @@ -217,7 +217,7 @@ int print_qdisc(struct nlmsghdr *n, void *arg) struct tcmsg *t = NLMSG_DATA(n); int len = n->nlmsg_len; struct rtattr *tb[TCA_MAX+1]; - struct qdisc_util *q; + const struct qdisc_util *q; char abuf[256]; if (n->nlmsg_type != RTM_NEWQDISC && n->nlmsg_type != RTM_DELQDISC) { @@ -476,7 +476,7 @@ static int tc_qdisc_block_exists_cb(struct nlmsghdr *n, void *arg) struct tcmsg *t = NLMSG_DATA(n); struct rtattr *tb[TCA_MAX+1]; int len = n->nlmsg_len; - struct qdisc_util *q; + const struct qdisc_util *q; const char *kind; int err; diff --git a/tc/tc_util.h b/tc/tc_util.h index 623d9888a5ad..bcd661ea4626 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -29,19 +29,20 @@ enum #define FILTER_NAMESZ 16 struct qdisc_util { - struct qdisc_util *next; + struct qdisc_util *next; const char *id; - int (*parse_qopt)(struct qdisc_util *qu, int argc, + int (*parse_qopt)(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev); - int (*print_qopt)(struct qdisc_util *qu, + int (*print_qopt)(const struct qdisc_util *qu, FILE *f, struct rtattr *opt); - int (*print_xstats)(struct qdisc_util *qu, + int (*print_xstats)(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats); - int (*parse_copt)(struct qdisc_util *qu, int argc, + int (*parse_copt)(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev); - int (*print_copt)(struct qdisc_util *qu, FILE *f, struct rtattr *opt); - int (*has_block)(struct qdisc_util *qu, struct rtattr *opt, __u32 block_idx, bool *p_has); + int (*print_copt)(const struct qdisc_util *qu, FILE *f, struct rtattr *opt); + int (*has_block)(const struct qdisc_util *qu, struct rtattr *opt, + __u32 block_idx, bool *p_has); }; extern __u16 f_proto; @@ -72,7 +73,7 @@ struct exec_util { const char *get_tc_lib(void); -struct qdisc_util *get_qdisc_kind(const char *str); +const struct qdisc_util *get_qdisc_kind(const char *str); struct filter_util *get_filter_kind(const char *str); int get_qdisc_handle(__u32 *h, const char *str); @@ -115,7 +116,7 @@ int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb); int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts); int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); void print_tm(FILE *f, const struct tcf_t *tm); -int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt); +int prio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt); int cls_names_init(char *path); void cls_names_uninit(void); From patchwork Tue Mar 12 22:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13590653 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E489E143C60 for ; Tue, 12 Mar 2024 22:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; cv=none; b=id7d90TqiC6/yNAfeIEfU+vNpktTOR3vqqfH6jReY0JSgdrvnmhCzy6+suQl+F+w1E/rbubXlL6OVDrLDpmXUtVltfegeIomA7VwwG15B+yZdjZ8CG2zDeoEVhSPzz7WcQPzQH8cIEfN2pKXdymn5Fi5whrefjMBWiZ8Kt8KEUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; c=relaxed/simple; bh=f8U/VB+9jEsZTOV7uq66psdP5t7+htRD3JRQNkUTtE0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZP3Okt8YqzFEn+RlyclUxT4bfGPKiPHZxjbOKl8hF7QSYfJyZHOT1eAaW7mMQmX1eIFBrg6r/rSlI5al6abZR88Q0vCMIonnIWz8IDMLggtOjMuRlncUW5RtYwZaIHUVr+RwL0Gah1UK/TIkgMxsGBdK0NlysaQRmmOotlFWJEs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=IdXw0WMc; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="IdXw0WMc" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1dd6198c4e2so43618575ad.2 for ; Tue, 12 Mar 2024 15:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1710281674; x=1710886474; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TF/QmIyd2cNWNHHDXZO/yui0ONUx5lCVQ6+6kstCr9E=; b=IdXw0WMcwDOFe3LMg95ril0x7m93WQkbcyCkDtD1loZM04q75lxd9mNPWAGNAdCWIs 80fpHNalKf+KEGMNmaTU7Tc+BJDKSUwOQXZHGH7nc89fJ9QPoCi+M0dKezFyfRdStJRz uoj+KzIXs9W1NczBi1jPH6Yn+Qh8qiRnPn6QbaQ+oz8a/g/4LpqXekkYm4PZ3Tm3hd75 tKU5NRMTmrubC7/UGNYBWi6Vk9evBWvVZqwvL3yYs68wWTfbEbQ1uCEishuJzMj/xkdT tdpvtzynhi+YV+2ZVJUpyxQ0TZLXlwuColemtcS1EWqnnYbydZ2r1lStyGkGVqY90PbD SjTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710281674; x=1710886474; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TF/QmIyd2cNWNHHDXZO/yui0ONUx5lCVQ6+6kstCr9E=; b=RYd4whO504XRpehQ+B4BHy70UYYjydrSt68ReUdpZ1KZl2DIc3Q03L3dJosShjtHTB kyoITqwGEbGIZ1D75NIcPAW9B1HGif20BfzLVSxoG3fquMRKo3531IeZ1CLAPABTEAPY GBEEV2dMC1zqHW4THnz3lb8kkOc80spTe//BsXYIlKQSjJWO5bYEs6V2cr3ZYY9n33t4 QIhFwqDr4887y3Jyb6TVDHtde9KgW8gy7CNtU2KVBQeBePksVgItR94z+yWVcEK83p6z iL2gnHf3fYkQHSsXZqYxpJW613IQ2lZ4vJ5ciD8I5V055aoRMeM5vtecHUaPhLmB9D54 8xsg== X-Gm-Message-State: AOJu0Yy1t94X8POwTvp4fNQU9Mj/EHiHy87zNn/Ox4aieEtUE4W7xWhO pbKcM05HaiAvXwBhaxiMdZLtcMQDL+gkzOckHGSd8t9+BiT6FcvoqE4cBTxD9YshiVxfwEdQjKW p X-Google-Smtp-Source: AGHT+IFi/BXpj9B16ezTDn9ms93bGGRn5RpIgm4ByXap4gTJZQpCphiHlph7WQHJMle70HaZHdqiXA== X-Received: by 2002:a17:902:f545:b0:1dd:b45f:4d02 with SMTP id h5-20020a170902f54500b001ddb45f4d02mr4437936plf.22.1710281674173; Tue, 12 Mar 2024 15:14:34 -0700 (PDT) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id o10-20020a170902e28a00b001dcfaab3457sm7240473plc.104.2024.03.12.15.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:14:33 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 2/4] tc: make filter_util args const Date: Tue, 12 Mar 2024 15:12:40 -0700 Message-ID: <20240312221422.81253-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240312221422.81253-1-stephen@networkplumber.org> References: <20240312221422.81253-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The callbacks in filter_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger --- tc/f_basic.c | 4 ++-- tc/f_bpf.c | 4 ++-- tc/f_cgroup.c | 4 ++-- tc/f_flow.c | 4 ++-- tc/f_flower.c | 4 ++-- tc/f_fw.c | 4 ++-- tc/f_matchall.c | 4 ++-- tc/f_route.c | 4 ++-- tc/f_u32.c | 4 ++-- tc/tc.c | 6 +++--- tc/tc_filter.c | 6 +++--- tc/tc_util.h | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tc/f_basic.c b/tc/f_basic.c index 1ceb15d404f3..a1db5ba5dbc0 100644 --- a/tc/f_basic.c +++ b/tc/f_basic.c @@ -32,7 +32,7 @@ static void explain(void) "NOTE: CLASSID is parsed as hexadecimal input.\n"); } -static int basic_parse_opt(struct filter_util *qu, char *handle, +static int basic_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); @@ -103,7 +103,7 @@ static int basic_parse_opt(struct filter_util *qu, char *handle, return 0; } -static int basic_print_opt(struct filter_util *qu, FILE *f, +static int basic_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_BASIC_MAX+1]; diff --git a/tc/f_bpf.c b/tc/f_bpf.c index a6d4875fc057..3e53c56ab7c3 100644 --- a/tc/f_bpf.c +++ b/tc/f_bpf.c @@ -71,7 +71,7 @@ static const struct bpf_cfg_ops bpf_cb_ops = { .ebpf_cb = bpf_ebpf_cb, }; -static int bpf_parse_opt(struct filter_util *qu, char *handle, +static int bpf_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { const char *bpf_obj = NULL, *bpf_uds_name = NULL; @@ -187,7 +187,7 @@ opt_bpf: return ret; } -static int bpf_print_opt(struct filter_util *qu, FILE *f, +static int bpf_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_BPF_MAX + 1]; diff --git a/tc/f_cgroup.c b/tc/f_cgroup.c index 291d6e7ebe33..4aba4bacaf09 100644 --- a/tc/f_cgroup.c +++ b/tc/f_cgroup.c @@ -17,7 +17,7 @@ static void explain(void) fprintf(stderr, " [ action ACTION_SPEC ]\n"); } -static int cgroup_parse_opt(struct filter_util *qu, char *handle, +static int cgroup_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); @@ -75,7 +75,7 @@ static int cgroup_parse_opt(struct filter_util *qu, char *handle, return 0; } -static int cgroup_print_opt(struct filter_util *qu, FILE *f, +static int cgroup_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_CGROUP_MAX+1]; diff --git a/tc/f_flow.c b/tc/f_flow.c index 4a29af22e99d..07ecb84cf905 100644 --- a/tc/f_flow.c +++ b/tc/f_flow.c @@ -126,7 +126,7 @@ out: return 0; } -static int flow_parse_opt(struct filter_util *fu, char *handle, +static int flow_parse_opt(const struct filter_util *fu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); @@ -273,7 +273,7 @@ static const char *flow_mode2str(__u32 mode) } } -static int flow_print_opt(struct filter_util *fu, FILE *f, struct rtattr *opt, +static int flow_print_opt(const struct filter_util *fu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_FLOW_MAX+1]; diff --git a/tc/f_flower.c b/tc/f_flower.c index 53188f1cd87a..cfcd7b2f6ddf 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -1535,7 +1535,7 @@ static int flower_parse_cfm(int *argc_p, char ***argv_p, __be16 eth_type, return 0; } -static int flower_parse_opt(struct filter_util *qu, char *handle, +static int flower_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { int ret; @@ -2882,7 +2882,7 @@ static void flower_print_cfm(struct rtattr *attr) close_json_object(); } -static int flower_print_opt(struct filter_util *qu, FILE *f, +static int flower_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_FLOWER_MAX + 1]; diff --git a/tc/f_fw.c b/tc/f_fw.c index 5e72e526b175..cf4abe122d8c 100644 --- a/tc/f_fw.c +++ b/tc/f_fw.c @@ -29,7 +29,7 @@ static void explain(void) " FWMASK is 0xffffffff by default.\n"); } -static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) +static int fw_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); struct rtattr *tail; @@ -112,7 +112,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a return 0; } -static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) +static int fw_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_FW_MAX+1]; diff --git a/tc/f_matchall.c b/tc/f_matchall.c index 38b68d7e2450..e595ac38d6f9 100644 --- a/tc/f_matchall.c +++ b/tc/f_matchall.c @@ -31,7 +31,7 @@ static void explain(void) "NOTE: CLASSID is parsed as hexadecimal input.\n"); } -static int matchall_parse_opt(struct filter_util *qu, char *handle, +static int matchall_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); @@ -107,7 +107,7 @@ static int matchall_parse_opt(struct filter_util *qu, char *handle, return 0; } -static int matchall_print_opt(struct filter_util *qu, FILE *f, +static int matchall_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_MATCHALL_MAX+1]; diff --git a/tc/f_route.c b/tc/f_route.c index ca8a8dddc2aa..87d865b7182b 100644 --- a/tc/f_route.c +++ b/tc/f_route.c @@ -30,7 +30,7 @@ static void explain(void) "NOTE: CLASSID is parsed as hexadecimal input.\n"); } -static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) +static int route_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct tcmsg *t = NLMSG_DATA(n); struct rtattr *tail; @@ -134,7 +134,7 @@ static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char return 0; } -static int route_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) +static int route_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_ROUTE4_MAX+1]; diff --git a/tc/f_u32.c b/tc/f_u32.c index 59aa4e3a2b50..a06996363b07 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -1018,7 +1018,7 @@ static __u32 u32_hash_fold(struct tc_u32_key *key) return ntohl(key->val & key->mask) >> fshift; } -static int u32_parse_opt(struct filter_util *qu, char *handle, +static int u32_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { struct { @@ -1232,7 +1232,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, return 0; } -static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, +static int u32_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle) { struct rtattr *tb[TCA_U32_MAX + 1]; diff --git a/tc/tc.c b/tc/tc.c index 5191b4bd8cde..7edff7e39166 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -69,7 +69,7 @@ static int parse_noqopt(const struct qdisc_util *qu, int argc, char **argv, return 0; } -static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle) +static int print_nofopt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle) { if (opt && RTA_PAYLOAD(opt)) fprintf(f, "fh %08x [Unknown filter, optlen=%u] ", @@ -79,7 +79,7 @@ static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u return 0; } -static int parse_nofopt(struct filter_util *qu, char *fhandle, +static int parse_nofopt(const struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n) { __u32 handle; @@ -146,7 +146,7 @@ noexist: } -struct filter_util *get_filter_kind(const char *str) +const struct filter_util *get_filter_kind(const char *str) { void *dlh; char buf[256]; diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 54790ddc6cdf..7db850bda11a 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -65,7 +65,7 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) .n.nlmsg_type = cmd, .t.tcm_family = AF_UNSPEC, }; - struct filter_util *q = NULL; + const struct filter_util *q = NULL; __u32 prio = 0; __u32 protocol = 0; int protocol_set = 0; @@ -250,7 +250,7 @@ int print_filter(struct nlmsghdr *n, void *arg) struct tcmsg *t = NLMSG_DATA(n); int len = n->nlmsg_len; struct rtattr *tb[TCA_MAX+1]; - struct filter_util *q; + const struct filter_util *q; char abuf[256]; if (n->nlmsg_type != RTM_NEWTFILTER && @@ -398,7 +398,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) .t.tcm_family = AF_UNSPEC, }; struct nlmsghdr *answer; - struct filter_util *q = NULL; + const struct filter_util *q = NULL; __u32 prio = 0; __u32 protocol = 0; int protocol_set = 0; diff --git a/tc/tc_util.h b/tc/tc_util.h index bcd661ea4626..51f9effc27b1 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -49,9 +49,9 @@ extern __u16 f_proto; struct filter_util { struct filter_util *next; char id[FILTER_NAMESZ]; - int (*parse_fopt)(struct filter_util *qu, char *fhandle, + int (*parse_fopt)(const struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n); - int (*print_fopt)(struct filter_util *qu, + int (*print_fopt)(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle); }; @@ -74,7 +74,7 @@ struct exec_util { const char *get_tc_lib(void); const struct qdisc_util *get_qdisc_kind(const char *str); -struct filter_util *get_filter_kind(const char *str); +const struct filter_util *get_filter_kind(const char *str); int get_qdisc_handle(__u32 *h, const char *str); int get_percent_rate(unsigned int *rate, const char *str, const char *dev); From patchwork Tue Mar 12 22:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13590656 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7CC3144020 for ; Tue, 12 Mar 2024 22:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; cv=none; b=egkRkZdNsBC9leSyb5TUqZFhgfvkyDTTR6hP1UtigtOZClOAmSQPk9Ry/t9lHltGwM36Ei7CXyRjYlpVAbubDBwUI6bGANr7r4kQz2YFjKcPg85tyIon2un9KTPR6KZuYQA0sNlAZ9BI2V+Go1CJEQEyk1KXfV5fC8FXeXnerZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; c=relaxed/simple; bh=qgXCGolpeqyoA7jmuGRwpDe8Z34ghJ2jbVn9Fm3RFSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MMvp4wr6pGwCKLPpYy8mHZfJ0cjYk4tZj3CphGawwpx+vYzULCXF6B8mAToyPooerKlgZ7R7pM8hnFP9kvjOQo1/5xctgmIbdDB355V52mrgtS775Jy/PPBxn3L557WDRhycyr+dyxZRdf7LaI3OIaHywzxG3NJ3A3yljNXfUNo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=hGpnyLno; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="hGpnyLno" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1dd916ad172so23158435ad.2 for ; Tue, 12 Mar 2024 15:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1710281675; x=1710886475; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9gEiCM1jx27sar3LPmESI0xMYjbB5scD0lmI2N8CVFI=; b=hGpnyLnoPZhNRSY5rz5hhQR+RFF6pBQ6gIIXBhhVy3cuhS+epb2AcbdV69KhuBKto2 e6lcfbpKPn2SvljY06rv2Pq2ZB3NgSYafM6bhF8yrMVAWk3B2phqXSUf+tKM7CeHIpxO v5AyJDEQcIH7GMB8yz7x0rM/ihwxhfGFEPYFRLNzZHW34GOHOVTZfr4JAVtTYXdNJXvr 47NmxyGaZxWPB93DeIAZIpU+i2DXpwmDkzp+iXAyvbe0NG5s8Hpn2AJGkLBBrsKyeHxU gP7o7Fdi7vmdA9tVJdYwwNYD4sckBo01sYDufZ3tYDiv1tKRzj0HvcwH02vtWC8+nwyW Y2SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710281675; x=1710886475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9gEiCM1jx27sar3LPmESI0xMYjbB5scD0lmI2N8CVFI=; b=oLV9YmXAc0YHi8qWQkUSWXSAW2/Mmuumhpiaq35yxXAJIFcWIHHTUXMoSjRk+Z/Y9s eGbNvpOQWIGPaehv8TuCxp9+XjtVlSGiDdDlKkfxocMTqKl8cryqSDcGpfM+ZV/2RE1+ wU9HXoq/o9lHShC0/DUV61Tz1WcwtKEcfUI5pVmktXYJq/7Cu6sISEy+uy1y50PUUbxD BdLSHnxvAP8BNn60bzxXL0s4bH1hA4proLz3N8lxr2Aqln2tlkczcNOUcBh1cR+jCPdw PDS18rlaVGtjP7fLpFkCG/VHrUAil8z+tSQKlt1TrUsEGtBFpJXbxGVGixBd2mo2mMPj 60EA== X-Gm-Message-State: AOJu0YwNFEsU+Ijv8M1MVYja45zehVhVFmJzyvmPtEsx/G30egH7yVrb qF+rmESj4hAEr6RKBsqOrjCNoYaVqObYbx/16mAuTvcAD4XJ/cmgK40GGLrddmbaIDHI25lEPR8 w X-Google-Smtp-Source: AGHT+IHzv4N05KGdmrRPtsocQVJeW0c6lxtYsrQGQ4GqzFBqSAsw9nK7XBoSAx2aKLbzNpGut8qJdA== X-Received: by 2002:a17:902:ec88:b0:1dd:9090:a35c with SMTP id x8-20020a170902ec8800b001dd9090a35cmr2166255plg.9.1710281674851; Tue, 12 Mar 2024 15:14:34 -0700 (PDT) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id o10-20020a170902e28a00b001dcfaab3457sm7240473plc.104.2024.03.12.15.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:14:34 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 3/4] tc: make action_util arg const Date: Tue, 12 Mar 2024 15:12:41 -0700 Message-ID: <20240312221422.81253-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240312221422.81253-1-stephen@networkplumber.org> References: <20240312221422.81253-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The callbacks in action_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger --- tc/m_action.c | 4 ++-- tc/m_bpf.c | 4 ++-- tc/m_connmark.c | 4 ++-- tc/m_csum.c | 4 ++-- tc/m_ct.c | 4 ++-- tc/m_ctinfo.c | 4 ++-- tc/m_gact.c | 4 ++-- tc/m_gate.c | 8 ++++---- tc/m_ife.c | 4 ++-- tc/m_mirred.c | 6 +++--- tc/m_mpls.c | 4 ++-- tc/m_nat.c | 4 ++-- tc/m_pedit.c | 4 ++-- tc/m_police.c | 8 ++++---- tc/m_sample.c | 4 ++-- tc/m_simple.c | 4 ++-- tc/m_skbedit.c | 4 ++-- tc/m_skbmod.c | 4 ++-- tc/m_tunnel_key.c | 4 ++-- tc/m_vlan.c | 4 ++-- tc/tc_util.h | 8 ++++---- 21 files changed, 49 insertions(+), 49 deletions(-) diff --git a/tc/m_action.c b/tc/m_action.c index e0b9ebeedf5e..36bb59edcdde 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -59,7 +59,7 @@ static void act_usage(void) exit(-1); } -static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt) +static int print_noaopt(const struct action_util *au, FILE *f, struct rtattr *opt) { if (opt && RTA_PAYLOAD(opt)) fprintf(stderr, "[Unknown action, optlen=%u] ", @@ -67,7 +67,7 @@ static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt) return 0; } -static int parse_noaopt(struct action_util *au, int *argc_p, +static int parse_noaopt(const struct action_util *au, int *argc_p, char ***argv_p, int code, struct nlmsghdr *n) { int argc = *argc_p; diff --git a/tc/m_bpf.c b/tc/m_bpf.c index da50c05e1529..9dba4be58118 100644 --- a/tc/m_bpf.c +++ b/tc/m_bpf.c @@ -69,7 +69,7 @@ static const struct bpf_cfg_ops bpf_cb_ops = { .ebpf_cb = bpf_ebpf_cb, }; -static int bpf_parse_opt(struct action_util *a, int *ptr_argc, char ***ptr_argv, +static int bpf_parse_opt(const struct action_util *a, int *ptr_argc, char ***ptr_argv, int tca_id, struct nlmsghdr *n) { const char *bpf_obj = NULL, *bpf_uds_name = NULL; @@ -151,7 +151,7 @@ opt_bpf: return ret; } -static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg) +static int bpf_print_opt(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_ACT_BPF_MAX + 1]; struct tc_act_bpf *parm; diff --git a/tc/m_connmark.c b/tc/m_connmark.c index 8506d95af5ec..8b5630f66c5e 100644 --- a/tc/m_connmark.c +++ b/tc/m_connmark.c @@ -32,7 +32,7 @@ usage(void) } static int -parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, +parse_connmark(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_connmark sel = {}; @@ -94,7 +94,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, return 0; } -static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_connmark(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_CONNMARK_MAX + 1]; struct tc_connmark *ci; diff --git a/tc/m_csum.c b/tc/m_csum.c index f5fe8f550a06..21204e5bf7b6 100644 --- a/tc/m_csum.c +++ b/tc/m_csum.c @@ -81,7 +81,7 @@ parse_csum_args(int *argc_p, char ***argv_p, struct tc_csum *sel) } static int -parse_csum(struct action_util *a, int *argc_p, +parse_csum(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_csum sel = {}; @@ -148,7 +148,7 @@ skip_args: } static int -print_csum(struct action_util *au, FILE *f, struct rtattr *arg) +print_csum(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_csum *sel; diff --git a/tc/m_ct.c b/tc/m_ct.c index 8c471489778a..4b7d322c8d4f 100644 --- a/tc/m_ct.c +++ b/tc/m_ct.c @@ -225,7 +225,7 @@ static int ct_parse_labels(char *str, struct nlmsghdr *n) } static int -parse_ct(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, +parse_ct(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_ct sel = {}; @@ -488,7 +488,7 @@ static void ct_print_helper(struct rtattr *family, struct rtattr *proto, struct print_string(PRINT_ANY, "helper", " helper %s", helper); } -static int print_ct(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_ct(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_CT_MAX + 1]; const char *commit; diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c index 996a36217dfe..dbd5c0b32c50 100644 --- a/tc/m_ctinfo.c +++ b/tc/m_ctinfo.c @@ -35,7 +35,7 @@ usage(void) } static int -parse_ctinfo(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, +parse_ctinfo(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { unsigned int cpmarkmask = 0, dscpmask = 0, dscpstatemask = 0; @@ -181,7 +181,7 @@ static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1]) rta_getattr_u64(tb[TCA_CTINFO_STATS_CPMARK_SET])); } -static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_ctinfo(const struct action_util *au, FILE *f, struct rtattr *arg) { unsigned int cpmarkmask = ~0, dscpmask = 0, dscpstatemask = 0; struct rtattr *tb[TCA_CTINFO_MAX + 1]; diff --git a/tc/m_gact.c b/tc/m_gact.c index 225ffce41412..670d59f03ee6 100644 --- a/tc/m_gact.c +++ b/tc/m_gact.c @@ -66,7 +66,7 @@ usage(void) } static int -parse_gact(struct action_util *a, int *argc_p, char ***argv_p, +parse_gact(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -157,7 +157,7 @@ skip_args: } static int -print_gact(struct action_util *au, FILE *f, struct rtattr *arg) +print_gact(const struct action_util *au, FILE *f, struct rtattr *arg) { #ifdef CONFIG_GACT_PROB struct tc_gact_p *pp = NULL; diff --git a/tc/m_gate.c b/tc/m_gate.c index 37afa426a2c8..33ee63bb316c 100644 --- a/tc/m_gate.c +++ b/tc/m_gate.c @@ -56,9 +56,9 @@ static void explain_entry_format(void) fprintf(stderr, "Usage: sched-entry [ ]\n"); } -static int parse_gate(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_gate(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); -static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg); +static int print_gate(const struct action_util *au, FILE *f, struct rtattr *arg); struct action_util gate_action_util = { .id = "gate", @@ -135,7 +135,7 @@ static void free_entries(struct list_head *gate_entries) } } -static int parse_gate(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_gate(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_gate parm = {.action = TC_ACT_PIPE}; @@ -441,7 +441,7 @@ static int print_gate_list(struct rtattr *list) return 0; } -static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_gate(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_gate *parm; struct rtattr *tb[TCA_GATE_MAX + 1]; diff --git a/tc/m_ife.c b/tc/m_ife.c index 162607ce7415..dfd85561e1c1 100644 --- a/tc/m_ife.c +++ b/tc/m_ife.c @@ -44,7 +44,7 @@ static void ife_usage(void) exit(-1); } -static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_ife(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -211,7 +211,7 @@ skip_encode: return 0; } -static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_ife(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_ife *p; struct rtattr *tb[TCA_IFE_MAX + 1]; diff --git a/tc/m_mirred.c b/tc/m_mirred.c index 60bd90452ccb..cfecd59c7551 100644 --- a/tc/m_mirred.c +++ b/tc/m_mirred.c @@ -88,7 +88,7 @@ static const char *mirred_action(int action) } static int -parse_direction(struct action_util *a, int *argc_p, char ***argv_p, +parse_direction(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { @@ -258,7 +258,7 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p, static int -parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, +parse_mirred(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { @@ -299,7 +299,7 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, } static int -print_mirred(struct action_util *au, FILE *f, struct rtattr *arg) +print_mirred(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_mirred *p; struct rtattr *tb[TCA_MIRRED_MAX + 1]; diff --git a/tc/m_mpls.c b/tc/m_mpls.c index dda4680509a9..ca3a18a9a1ef 100644 --- a/tc/m_mpls.c +++ b/tc/m_mpls.c @@ -72,7 +72,7 @@ static bool check_double_action(unsigned int action, const char *arg) return true; } -static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_mpls(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_mpls parm = {}; @@ -211,7 +211,7 @@ skip_args: return 0; } -static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_mpls(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_MPLS_MAX + 1]; struct tc_mpls *parm; diff --git a/tc/m_nat.c b/tc/m_nat.c index 95b35584a23e..a3f86e190166 100644 --- a/tc/m_nat.c +++ b/tc/m_nat.c @@ -76,7 +76,7 @@ bad_val: } static int -parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) +parse_nat(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_nat sel = {}; @@ -136,7 +136,7 @@ skip_args: } static int -print_nat(struct action_util *au, FILE * f, struct rtattr *arg) +print_nat(const struct action_util *au, FILE * f, struct rtattr *arg) { struct tc_nat *sel; struct rtattr *tb[TCA_NAT_MAX + 1]; diff --git a/tc/m_pedit.c b/tc/m_pedit.c index 32f03415d61c..83a0c42e58aa 100644 --- a/tc/m_pedit.c +++ b/tc/m_pedit.c @@ -620,7 +620,7 @@ static int pedit_keys_ex_addattr(struct m_pedit_sel *sel, struct nlmsghdr *n) return 0; } -static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_pedit(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct m_pedit_sel sel = {}; @@ -745,7 +745,7 @@ static int print_pedit_location(FILE *f, return 0; } -static int print_pedit(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_pedit(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_pedit_sel *sel; struct rtattr *tb[TCA_PEDIT_MAX + 1]; diff --git a/tc/m_police.c b/tc/m_police.c index 46c39a818761..8d6887eefc7d 100644 --- a/tc/m_police.c +++ b/tc/m_police.c @@ -17,9 +17,9 @@ #include "utils.h" #include "tc_util.h" -static int act_parse_police(struct action_util *a, int *argc_p, +static int act_parse_police(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); -static int print_police(struct action_util *a, FILE *f, struct rtattr *tb); +static int print_police(const struct action_util *a, FILE *f, struct rtattr *tb); struct action_util police_action_util = { .id = "police", @@ -42,7 +42,7 @@ static void usage(void) exit(-1); } -static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p, +static int act_parse_police(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -260,7 +260,7 @@ int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) return act_parse_police(NULL, argc_p, argv_p, tca_id, n); } -static int print_police(struct action_util *a, FILE *f, struct rtattr *arg) +static int print_police(const struct action_util *a, FILE *f, struct rtattr *arg) { SPRINT_BUF(b2); struct tc_police *p; diff --git a/tc/m_sample.c b/tc/m_sample.c index 769de144cbe0..642ec3a6ea7e 100644 --- a/tc/m_sample.c +++ b/tc/m_sample.c @@ -31,7 +31,7 @@ static void usage(void) exit(-1); } -static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_sample(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_sample p = { 0 }; @@ -133,7 +133,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p, return 0; } -static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_sample(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_SAMPLE_MAX + 1]; struct tc_sample *p; diff --git a/tc/m_simple.c b/tc/m_simple.c index fe2bca21ae46..9715955e0187 100644 --- a/tc/m_simple.c +++ b/tc/m_simple.c @@ -90,7 +90,7 @@ static void usage(void) } static int -parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, +parse_simple(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_defact sel = {}; @@ -155,7 +155,7 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, return 0; } -static int print_simple(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_simple(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_defact *sel; struct rtattr *tb[TCA_DEF_MAX + 1]; diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c index d55a6128494e..b55c3249e6fa 100644 --- a/tc/m_skbedit.c +++ b/tc/m_skbedit.c @@ -41,7 +41,7 @@ usage(void) } static int -parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, +parse_skbedit(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -177,7 +177,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, return 0; } -static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_skbedit(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_SKBEDIT_MAX + 1]; diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c index b1c8d00dfe47..c467f3f005ac 100644 --- a/tc/m_skbmod.c +++ b/tc/m_skbmod.c @@ -40,7 +40,7 @@ static void skbmod_usage(void) exit(-1); } -static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_skbmod(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -156,7 +156,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p, return 0; } -static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_skbmod(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_skbmod *p; struct rtattr *tb[TCA_SKBMOD_MAX + 1]; diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c index ff699cc8917d..2032a72194cd 100644 --- a/tc/m_tunnel_key.c +++ b/tc/m_tunnel_key.c @@ -311,7 +311,7 @@ static int tunnel_key_parse_tos_ttl(char *str, int type, struct nlmsghdr *n) return 0; } -static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_tunnel_key(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { struct tc_tunnel_key parm = {}; @@ -688,7 +688,7 @@ static void tunnel_key_print_tos_ttl(FILE *f, char *name, } } -static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_tunnel_key(const struct action_util *au, FILE *f, struct rtattr *arg) { struct rtattr *tb[TCA_TUNNEL_KEY_MAX + 1]; struct tc_tunnel_key *parm; diff --git a/tc/m_vlan.c b/tc/m_vlan.c index c1dc8b428e61..40d62fa0f282 100644 --- a/tc/m_vlan.c +++ b/tc/m_vlan.c @@ -56,7 +56,7 @@ static void unexpected(const char *arg) explain(); } -static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_vlan(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -227,7 +227,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, return 0; } -static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_vlan(const struct action_util *au, FILE *f, struct rtattr *arg) { SPRINT_BUF(b1); struct rtattr *tb[TCA_VLAN_MAX + 1]; diff --git a/tc/tc_util.h b/tc/tc_util.h index 51f9effc27b1..5ae3fafd2dd2 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -58,10 +58,10 @@ struct filter_util { struct action_util { struct action_util *next; char id[FILTER_NAMESZ]; - int (*parse_aopt)(struct action_util *a, int *argc, + int (*parse_aopt)(const struct action_util *a, int *argc, char ***argv, int code, struct nlmsghdr *n); - int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt); - int (*print_xstats)(struct action_util *au, + int (*print_aopt)(const struct action_util *au, FILE *f, struct rtattr *opt); + int (*print_xstats)(const struct action_util *au, FILE *f, struct rtattr *xstats); }; @@ -112,7 +112,7 @@ int parse_action_control_slash(int *argc_p, char ***argv_p, int *result1_p, int *result2_p, bool allow_num); void print_action_control(FILE *f, const char *prefix, int action, const char *suffix); -int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb); +int police_print_xstats(const struct action_util *a, FILE *f, struct rtattr *tb); int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts); int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); void print_tm(FILE *f, const struct tcf_t *tm); From patchwork Tue Mar 12 22:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13590655 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2600A14402F for ; Tue, 12 Mar 2024 22:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; cv=none; b=m/ltINcuyeyo+PuCLmre6AXmxSs8unX/EkbiOmk37R59YBcy/3g8pmlH8TkuuIUk7m9RvY5oCcHty0jQhJGpu1cGMfLHyjtyYfRx584niTBkf9H9M6i/ZGMXZFJCD5jeKWT5zZzkNiRO4lYewdIgoxsqfLGNjSqtgCWDT4257H8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710281677; c=relaxed/simple; bh=5ZwCF+rs7lCtGdo8KOoL+qGcDQAW7t/YnIkrC77Nd2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CMFCZRzyLq5Ea/d8ftidPb72X6dknr8C34nPeruKbO6OpxiYkHHYCB88+fLaRPm98dHsm1Bl4WfeoiqrkERIv0emrFdvoVAZtiFgJrvzMiWY6aUZ3qZyb6Jk4A3/BNfnqh2YJlbE9wfb/HZGVDY+4A6rlnaqAAjPUcPk6bmQsAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=0HvPLUWe; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="0HvPLUWe" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1dd68d4cff1so34127565ad.2 for ; Tue, 12 Mar 2024 15:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1710281675; x=1710886475; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YqUagkvWJXywn2IxPi0bRayOpXinOg94l8rLXSzDkU8=; b=0HvPLUWeqdEdeckTab8pRqvjJmUSZWX6zPeeJXllo+Di5AjPrm02lFCjvqKHQQhCm0 IEAhwtu2HzWLnFLm15x2dDz5ZgbFsQKFyR8p1YRGtfANRSKrPUyaDgLy58WU0udp7EBC inneIbRk18sB8DtktGDaGIOwW5TV7qVQ2mbYNSKtmfQ1iy2bIF48dsQporlK1iMg0Vtr 2/8n5Rrp0EgTXqBG/7dHf6LJDUUD4rslYDH4VTHa602m8bMM24Um1qRCcYDsbmfLAcMt pZyeJ9v+Quq5QqW3MOf7QEYgns95+CJykG7wYAN+OcAiuQ6OmvoRex8R1xrt38UxoACq uhbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710281675; x=1710886475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YqUagkvWJXywn2IxPi0bRayOpXinOg94l8rLXSzDkU8=; b=iSQHyVMe2EiNpGd9P/M4HKduu6sKXmlC4YxexgCUVu/74A5ZXUQ6EW0217QQHG1Sle tf+AKW2XCXBC8BTIOurL/EjZDIiErAMBBsyO1vMxjfvfM3AT79Fe84gpFk3zHOyUxWH8 GnvZBA5QTK/8++B6rBDfdsZe0x8FDTXy+uhhmlI7HuiQ2z0OhxGDAYtACO3xkdDldsWk BlJYwhndFEhQOdSzGJ3gJM/qx7ShiGN/m/a6SaHpUq04HTbMuzfh0Fab7oWhJyUroWx1 HYXCJmt8NHqsZbVrA6507eSEi0SO7mkrvZtLxMPEDzX8u09eswMDFnNBVzvbxYIMwXKG vRAg== X-Gm-Message-State: AOJu0YwCiWZFApqwQXI2RbYR8i89qUf5sifdmmZEkQHfPfvOnb80xF6x RQGIIgUa3gaI/O2uCzdbOdaOFumabV+2gtgjYefkNAYNM4XPilimCwj1DDyfTiF0FyZW4z2WQxs M X-Google-Smtp-Source: AGHT+IGXa0W0ae6kEQwbD/BZzW3iwdkIex3PIj7J3cpTFfgch0OV4AnuHwwrnaAs06mURTnhyPyARA== X-Received: by 2002:a17:902:d486:b0:1dd:7d20:63ef with SMTP id c6-20020a170902d48600b001dd7d2063efmr12248619plg.11.1710281675452; Tue, 12 Mar 2024 15:14:35 -0700 (PDT) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id o10-20020a170902e28a00b001dcfaab3457sm7240473plc.104.2024.03.12.15.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:14:35 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 4/4] tc: make exec_util arg const Date: Tue, 12 Mar 2024 15:12:42 -0700 Message-ID: <20240312221422.81253-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240312221422.81253-1-stephen@networkplumber.org> References: <20240312221422.81253-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com The callbacks in exec_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger --- tc/e_bpf.c | 2 +- tc/tc_exec.c | 2 +- tc/tc_util.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tc/e_bpf.c b/tc/e_bpf.c index 79cddace96a4..cca853f95299 100644 --- a/tc/e_bpf.c +++ b/tc/e_bpf.c @@ -49,7 +49,7 @@ static int bpf_num_env_entries(void) return num; } -static int parse_bpf(struct exec_util *eu, int argc, char **argv) +static int parse_bpf(const struct exec_util *eu, int argc, char **argv) { char **argv_run = argv_default, **envp_run, *tmp; int ret, i, env_old, env_num, env_map; diff --git a/tc/tc_exec.c b/tc/tc_exec.c index 182fbb4c35c9..fe9fdb1b5aa6 100644 --- a/tc/tc_exec.c +++ b/tc/tc_exec.c @@ -26,7 +26,7 @@ static void usage(void) "OPTIONS := ... try tc exec help\n"); } -static int parse_noeopt(struct exec_util *eu, int argc, char **argv) +static int parse_noeopt(const struct exec_util *eu, int argc, char **argv) { if (argc) { fprintf(stderr, "Unknown exec \"%s\", hence option \"%s\" is unparsable\n", diff --git a/tc/tc_util.h b/tc/tc_util.h index 5ae3fafd2dd2..bbb2961dfe93 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -68,7 +68,7 @@ struct action_util { struct exec_util { struct exec_util *next; char id[FILTER_NAMESZ]; - int (*parse_eopt)(struct exec_util *eu, int argc, char **argv); + int (*parse_eopt)(const struct exec_util *eu, int argc, char **argv); }; const char *get_tc_lib(void);