Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp432704ybt; Sat, 13 Jun 2020 09:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy++IAEw98FemQTjxJW6/FDXn9l/qjhRfi8I2hH5AzMJcD8xDVAkLlL+wsByi0PxxclmvIg X-Received: by 2002:a17:906:370a:: with SMTP id d10mr18128046ejc.433.1592064061635; Sat, 13 Jun 2020 09:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592064061; cv=none; d=google.com; s=arc-20160816; b=G8/lQ7o/qDTAayhHdxthCtlXujgTp6cEijuxfNuHYUvU9KvBCAlSiVjlAM7/UlNG/M qfA5VeBpkMBr7nLaFGkC0bSvGbnr0pjFi4NxHfnJqAN8mYcwGYn0BTWpj1LDb4H3hPZz N8z7Q7yzziKSnIbgsdiFSLFJ9LXt9RpX6U2E2MxNBeiJO+PlKcLiKDsi8J+VgWvTovpW b02uCiI+PVOAY3JsyKUKjrTPR5gtlSChZn+UXvMPWwloJopd+TXeberysDZUa4UtjUlM PmIkMAb/Mx2Dp32F1BlWyp53f/FPEOoJzRP+JR6ksJq24XrMn6S1FtHGJ3+axrcSewyJ 5Elg== 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=fxzelwdDz29Q+H/iQtV1kYP71GBSr15ktvkIuRajfug=; b=r1U68JQIiEaPq6AaqZ8unB/XmkR+q3RrGQs9AdG6BMqRmuqzuRXhRKnqeEcwdAkeZd BtzPurw6iMD0UExi6wQnGOAfDNrLCY2T5iACOu2QCg9epwvd7cCHn303thiVAC/pW0r5 tB6F6lGOT6MphCo23lQHKxu3T3WiOkL+uPtQx0EFMLWN5h+tJKrzbhSCcQGASZQsB+Ki ZN7tqt2mFAlrzG1/Wl8R4cQEvItJBPSv6kVNhhGRumUw1I1g/ioEqGoQHT33gc1VLhib cjAJrKjnIlbiaJm3IQOM3lGED69wXp8TzVR2QdY4OUjWezGt9LnaUs/s0J3QFjbCDMO2 6P+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W0woNcU1; 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 y30si5988125edi.11.2020.06.13.09.00.39; Sat, 13 Jun 2020 09:01:01 -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=W0woNcU1; 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 S1726664AbgFMP6f (ORCPT + 99 others); Sat, 13 Jun 2020 11:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbgFMP6a (ORCPT ); Sat, 13 Jun 2020 11:58:30 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F869C03E96F; Sat, 13 Jun 2020 08:58:30 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id b18so9740019oti.1; Sat, 13 Jun 2020 08:58:30 -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=fxzelwdDz29Q+H/iQtV1kYP71GBSr15ktvkIuRajfug=; b=W0woNcU1YHp+9kUoS8+uxvC82NYj26uFyyVl0/0Pm5H5ClLy+nXaOQ7dYBjqex2T6k 3586wIOzpkkyR+S5fzBmy4XsnfXJ6JjAx/sZheFZyp3No25Ri1NOE/Oz8SkTh6vFs/Wo D4oweemBCkx1yDoMsXLcnQR4FCrNrsHqoV/yS8uDEcjztqIUvGaqzjiFofSx5cQuBPuP 65X9orl8Vb9vMLY7h85tDC7mhAXl8MlFlS5H+Fb5T/FywmLIAEqWs3KFqUZ0IcSmUCSg Gs1NTCiY0tJuA8EFHusaWEQLj1nIj3B3bMwZPD2+iIVoZcxNCRPuZj0dZWzl1JZVcMmH wcvg== 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=fxzelwdDz29Q+H/iQtV1kYP71GBSr15ktvkIuRajfug=; b=CGt4o5mv7YUpw8jP8w5pwTur+emZo6emuD/u2SDag7UtSZxnlc2EqSCM/z8EkQe095 EFEJTeyGwYm6ip0aZNP1T7KR64W7Z7EDOgXpNMfYZNV/WVH2ObPTY8h78AVoEzw2vQYO bicuUVYeQfVTlSs48KtDZER6+iUSIBBWzIHuliTHUS/r7a1HRrhob5CFnTBCMxyb/6Q/ lVyLJCyUp2TsHS97tzcuJzuOQ3gleh0f8chYz+4NpRj76GGy+JkVstbZsNEua7Tc889v u2tNbfl7cklLZ6BXchC12zsj8M8yjx20a8UQzopIc6AbaZa1XAX4raGQ0kaa2BoxsrBx CsoQ== X-Gm-Message-State: AOAM533paWgyfhXaAR9tczlx+26u53vK3KsQJlBtdwxgy8QCNHat4exZ 4GRV536795rPf3CG5kjJQDk= X-Received: by 2002:a9d:6e96:: with SMTP id a22mr15165265otr.58.1592063909921; Sat, 13 Jun 2020 08:58:29 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::aaac]) by smtp.googlemail.com with ESMTPSA id 53sm2105565otv.22.2020.06.13.08.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 08:58:29 -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 , Orson Zhai , Andrew Morton , Will Deacon , Petr Mladek , linux-doc@vger.kernel.org Subject: [PATCH v2 18/24] dyndbg: allow negating flag-chars in modflags Date: Sat, 13 Jun 2020 09:57:32 -0600 Message-Id: <20200613155738.2249399-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200613155738.2249399-1-jim.cromie@gmail.com> References: <20200613155738.2249399-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). Using filter-flags with negating-flags, you can select exactly the flagstates you want, both required and prohibited. Then with negating-flags in modflags, you can set and clear every flag #> Q umfLT-Pmf # select sites with u,m,f only. enable print, turn off m,f leave u Its not an important feature, but it does fill out the logic. and the patch is tiny, and feels more symmetrical. --- 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 45d3adf889ba..10e514237e83 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -257,9 +257,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:: @@ -269,7 +271,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 b02cde1cfc2f..d67fbbc5317f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -486,15 +486,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