Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2267040ybg; Fri, 5 Jun 2020 09:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys41vZ6YA1SWNaY4MqEl5vwW2zXTmGOojHP4RQ4kEDP/aOuUwAnm796K7Rg4b/58QNCqpu X-Received: by 2002:a05:6402:943:: with SMTP id h3mr10434820edz.89.1591374806234; Fri, 05 Jun 2020 09:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591374806; cv=none; d=google.com; s=arc-20160816; b=wG5Ke6FxgY9AZd0bdwEnTSkhQcC0IdkJll/VQSP4A6xlhEa3dPr7Nm+AsU49iMzy+a XrY0ZE7ZeLvb6GQ9idfWsul1nHEvz15npv2Jd/eTllXADaiSNcQlwqzo2S9mplokrkx5 mSuLFQdwLyOf6csrt7xhhXZ+1QSMQ2nrFaTI3yYtsY28ssdy1dWg64kiQqh/2hArs6TY Vr28vdPvKLvB0T0Ao60DGRtc++YyfROTvOfL9alvgHrT9wLmWKuyzbZIUziuJZW6wy/A I6kW+rBt/hzBDfybLdHYYTSoppC2TtY3dLB8ofPuZkmBjY9ZSoUCvDXQS5mCj4gDjF0i cH8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5KeJadA9027ISMttgEN7K8Lz7VH9h6QGa7xPQcosVw0=; b=hzJv+iAdHcwipSQLw14rWyLb3HqMpG+ZzfUXVCw8BNV2L7oWVXplqTNzsvlcmC6HTq v/GJRUnuGZmOl5BGNjwJVJnavRgwpo1RsNo/WiGa9v6t6QyrIH3NgxPOKY6xAdcL6oDK uYw4CPZ7EfSuvGxY9bGnBLvwDoy6ZBC5Z5QDOMVfcq944WUaXSHN1XuubkMKSfbPjknh l6xV1m2/DxH1o7WpxKqIaFko79nBorpk2VCBlOZ04vsqRwk198z/dX1HG3nyBlHKFyjB qnmtyBjcgj9ltRD7GrqUh6m6dVxnE29uPMgpH2akQYudrDf2KXJAM+v8piHkgWiHLBnq 3HQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vzuq7h4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si4158211edn.14.2020.06.05.09.33.03; Fri, 05 Jun 2020 09:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vzuq7h4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728667AbgFEQ23 (ORCPT + 99 others); Fri, 5 Jun 2020 12:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728620AbgFEQ2O (ORCPT ); Fri, 5 Jun 2020 12:28:14 -0400 Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34726C08C5C2; Fri, 5 Jun 2020 09:28:14 -0700 (PDT) Received: by mail-oo1-xc2a.google.com with SMTP id n31so2080323ooi.10; Fri, 05 Jun 2020 09:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5KeJadA9027ISMttgEN7K8Lz7VH9h6QGa7xPQcosVw0=; b=Vzuq7h4JynCAkub4hVq16vIWFPh8C7Q64F7iEdIzqr8Mp5qvUjM+xgb8OmLYY4Jtbo 7VE9sZ5iT3KeKBzFrmdpLmm3MkXv+lHeekx1y74tj0WTihXGHxMOUnxWfqEhaV9G6kg8 YHQb/yFDpkxkd5pl7KBaAPIVf77Ex8lOI5nII1hrcz2ha/lbdzuxo68XHBgDWAmHEOCk WtFSsAtEcZWNSOZzaUHtakpNOg14BdnhO/UeacYM07cdeN+7pchTFjWuXeZ5kMyXwSN4 wvGwIaLROkym70jrNSOqg3Qk4A4VDjYc48aIcsm9Iq+9fNEkD8E4Ue/tKsOSmpV3szuB 7FCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5KeJadA9027ISMttgEN7K8Lz7VH9h6QGa7xPQcosVw0=; b=J9f6pF800QC+l7VGuhmMX+6+ByKKYH+qfSouHHTv9bbmwH2YQc2ZpBun9+DcOl+Z44 um8zB8w3PFRW12jm32mtAFSVWVxBA4sawemiTtqYeClXqqVROn3ojojrUG5Nyv3K3crB CDE7FPl6sy6chqMZTc8Mxamfz4fA//CeXylHj0nu1WlHS/hbwrtBTHRH7xj7GlYdV/dp 63XYDtQBOux5LcE8r2iPUyQJX2Iu5iKTfQ5WiRmlRCKQe1TEAcGXZQ4NNRZfwQfDo6Qh 2++ihJ0EB8Kj5SoGJP+1hcsXVr/5cuhVzYD1Xl1WrrmkW1XnA8kh0jAHimuWGuCXnUzu 7nCw== X-Gm-Message-State: AOAM533J7lBTveIqiyIScjM4YJR2y51SawmsR5VRH1f1Rvk86otZ5tZM sgE90ofCTxRYMIDd83uJoLs= X-Received: by 2002:a4a:d149:: with SMTP id o9mr8445844oor.77.1591374493451; Fri, 05 Jun 2020 09:28:13 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::aaac]) by smtp.googlemail.com with ESMTPSA id z13sm813894ooa.28.2020.06.05.09.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 09:28:12 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie , Jonathan Corbet , Will Deacon , linux-doc@vger.kernel.org Subject: [PATCH 16/16] dyndbg: allow negating flag-chars in modflags Date: Fri, 5 Jun 2020 10:26:45 -0600 Message-Id: <20200605162645.289174-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200605162645.289174-1-jim.cromie@gmail.com> References: <20200605162645.289174-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend flags modifications to allow [PFMLTU] negating flags. This allows control-queries like: #> Q () { echo file inode.c $* > control } # to type less #> Q -P # same as +p #> Q +U # same as -u #> Q u-P # same as u+p This allows flags in a callsite to be simultaneously set and cleared, while still starting with the current flagstate (with +- ops). Generally, you chose -p or +p 1st, then set or clear flags accordingly. Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 10 ++++++---- lib/dynamic_debug.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 26a19f511afa..45470c9f0dad 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -252,9 +252,11 @@ only callsites with ``u`` and ``f`` cleared. Flagsets cannot contain ``pP`` etc, a flag cannot be true and false. -modflags containing upper-case flags is reserved/undefined for now. -inverted-flags are currently ignored, usage gets trickier if given -``-pXy``, it should leave x set. +modflags may contain upper-case flags also, using these lets you +invert the flag setting implied by the OP; '-pU' means disable +printing, and mark that callsite with the user-flag to create a group, +for optional further manipulation. Generally, '+p' and '-p' is your +main choice, and use of negating flags in modflags is rare. Notes:: @@ -264,7 +266,7 @@ For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only For display, the flags are preceded by ``=`` (mnemonic: what the flags are currently equal to). -Note the regexp ``^[-+=][flmptu_]+$`` matches a flags specification. +Note the regexp ``/^[-+=][flmptu_]+$/i`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-flmptu``. diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ee92e93cf23d..63ae6f77a0e4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -485,15 +485,17 @@ static int ddebug_parse_flags(const char *str, /* calculate final mods: flags, mask based upon op */ switch (op) { + unsigned int tmp; case '=': mods->mask = 0; break; case '+': - mods->mask = ~0U; + mods->mask = ~mods->mask; break; case '-': + tmp = mods->mask; mods->mask = ~mods->flags; - mods->flags = 0; + mods->flags = tmp; break; } -- 2.26.2