Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4860978ybl; Mon, 9 Dec 2019 18:29:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzBB9GEU/ftVAhjefBsAAIhJerk0a7NH0BGmpy65etbgkDq4MfJNFMnwQpoPT+9UFvQShg3 X-Received: by 2002:a9d:5552:: with SMTP id h18mr23019732oti.122.1575944964407; Mon, 09 Dec 2019 18:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575944964; cv=none; d=google.com; s=arc-20160816; b=LmYtGRvx/pd3Ce9TBPs6FygkmzFYhwwtuYyxnKTd2eKSngHiOIC1Iwva/1d9v/l4gs 55B320c8CVDuFBDg3vXVoLe9aj9B7aXLAsRvvLlP/xB6+MvB7j+shm0liE3aG7RjvoZo 0YKYRyYWOX1CiVPLvreLdMlw9U3DS4PjdRKZqgOZ8XQ3OcwDHjmzU/LmvsAXp4WiPFUE Hn2tum7uCKIWi4fbAlCuV+dbMKUrzHmiuWnt03gpfJWwQF6Xj2XI0kCwLghcTxmzJMiG Ko39Vy4TZNXR7grgTT1ZetJ5vTSPXQjM+zZVcO6m13ZMo7O/RKwD48p6jMpSOuSf1dbv iMQQ== 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=2hpIeNO/rrHxqmmLp7RAfiIu08DiGGroLpGDwIlCW7M=; b=THPfUPzZDz5Xj0YejD19tNbMRn4lDa8wIH1xX94QN+cwoYlGzqjF74nY6Pkqp/n7i0 NOOoAkGPPxFAE68PIVhra3LFtByKpFxFUz4/ZWR7W7ykq8/yt1yhHQJS+Tc4zDT0tMvY EWBHo8KHGPoO4wIo1SmBlCyaPLiPEB4VD/1JdkwNjiaChEbeje0DQ/FfieFJZ9uW6RGj yKiAArxdjv9lB+yRr0QV4UZFIwDiCD6IC1DBvX83ECDvHxdnFkR7hRaFq4N26OlF8pDS LdmmPZdfI0D7uV2dNWxT/R++VWMgvdvih9IWCcWaeOP/BfcW9xRZEw5A3PibvW+bU33c JNKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YxfVe940; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id b133si1205398oii.155.2019.12.09.18.29.12; Mon, 09 Dec 2019 18:29:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YxfVe940; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727225AbfLJC23 (ORCPT + 99 others); Mon, 9 Dec 2019 21:28:29 -0500 Received: from mail-il1-f181.google.com ([209.85.166.181]:39471 "EHLO mail-il1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727219AbfLJC22 (ORCPT ); Mon, 9 Dec 2019 21:28:28 -0500 Received: by mail-il1-f181.google.com with SMTP id n1so185739ilm.6; Mon, 09 Dec 2019 18:28:28 -0800 (PST) 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=2hpIeNO/rrHxqmmLp7RAfiIu08DiGGroLpGDwIlCW7M=; b=YxfVe9409xO7A5aYrBrGlRbGsh3ogIpVMwfBvOJbUU1hOJuGCoXs6DuorJkBBeaV0n QqzdqSNv6ChBrX37YFBPycflHz7YtU389hoxCMOgre83Hbei1HFeFm9XtEfVRENaoVUd CpDYGjtTkLhsgi+8iY8JJP+xHWNgLZRDyuU0M6KOyG2SmcpO4Hz/rhFht1m4vPpk9Haw sdU3lBV5+Rfg/N30nqla35JFGaHQb0/ca+3klW0B9InhJKJe3sM1eeFSFwm6Un8M2V0C ktYaRgqIV7HVGfc+SkzvWHYKCz0vc7Xhja+Fwn33a6ebdU4k+2NKJJdYEpb7GcAaUtJW Dtug== 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=2hpIeNO/rrHxqmmLp7RAfiIu08DiGGroLpGDwIlCW7M=; b=CxLwwigdv5ousu1pgKV2ve+06rq09KaXHbs47USj0Oa9TfgSw7fvvMGSZpjJn8E27H C6HrKpIRW6aL13fJml4fQaNDesbezNsg+ImzpHAzz2OLuhuTscJl0u2qdzmWHxIX0PGY za9t0BflPy/YaaFA6XgC1mF23/jm/ohk1Qb4jw8k3zMqVDkBzmOHe3W3+pnQKxuRAHE6 M+C1kDvjJP7U0kn81w0q0L8WnsnYKlPMQ3GhkV9EGQNwWH+jiKkDbK+tYWd34UX+7Z7p eT+AwbVlqK/ix8ch7n1ne1A5Pq2WIPQ7Vwlcosu7PgwJzXA4hYwbQct03ZWn43VIpErP dYNQ== X-Gm-Message-State: APjAAAUHP2w2IlX3QtAUj+CissPRS4E//dWpSrIjWP8M2PnYWWzN34YW 0Ck41K6mvymknUzzPU4L3UU= X-Received: by 2002:a92:7e90:: with SMTP id q16mr5399043ill.1.1575944907615; Mon, 09 Dec 2019 18:28:27 -0800 (PST) Received: from localhost.localdomain (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id l9sm334052ioh.77.2019.12.09.18.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 18:28:27 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org Cc: gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk, Jim Cromie , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v4 15/16] dyndbg: allow negating flag-chars in modflags Date: Mon, 9 Dec 2019 19:27:41 -0700 Message-Id: <20191210022742.822686-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191210022742.822686-1-jim.cromie@gmail.com> References: <20191210022742.822686-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] inverted 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 9f68062ba316..5c170e49121d 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -249,9 +249,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:: @@ -261,7 +263,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 736895efe17d..15bb9939df97 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.23.0