Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2201245ybl; Thu, 5 Dec 2019 13:54:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzbpSK2/HGF0w45Sep0AZKZ6LmyqOiPWV/FD6Ni3v5jPFuG1F46w6qdCRcvGqEpprk6BIH7 X-Received: by 2002:a9d:1e88:: with SMTP id n8mr8886179otn.369.1575582847141; Thu, 05 Dec 2019 13:54:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575582847; cv=none; d=google.com; s=arc-20160816; b=BZ4FXp+UytnjxoaaCUQQ7+dD9hAHD8DPp60nCbqbn/eAAIDCufXbIPoZkTwHYb8OND v+uZZL1Ml8OMDz6MQnUWU1ZksoLqt43igtDfGiLSRUAwF4A9JbCcuNDMpOOrRbXSGxNN juE367d0XLLELaFEPW44KM3RFdBF9U4G/zdwFM+fWq8s2sAWZRpTu2xuQcJT9PeXakd/ HmguTilskG3AzAxWZbX98rofhykcOmqEYvtaedZfpO+y0qxaWP18ImTSZqZ3OoOzsI1X 7pHpV0HEDi4yFUJyWfvOTEqwkYtqlJEr+wukbWNjwL0eXDtTDzj8aWaq3Y2YRu8ahep0 31sw== 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=KDpmAlANE6MAMmyRNbDOgnn+c67MHiX5YoMecOWzUIoa4nQ6D7QeHj0BzbDm9sXBSv TeZuJY6XIn9ZrEujqM/1GPSKpLJ/KFsbWpisUQRzbPnljqkk76CRKNKXA+ecNT+NAiau 5qn5hmQs+NyfAg/lURGng5fp19jQWulFz/w0onUUNv6h37X4V8ce1oQE7w5Z99GINueT S80idP1t6c+fhXmva4X93Zy0AggUnvaThpvF3vs7qdN96Y+En9AuTixqfM9FAS2qLcsP SIeGtbd94cjVX9qSzkfCmEQZYT63iq4iakCF4X4uhXs//+IC8e1uhYUg8hni3Cdhf49j PAHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MOxPNe8W; 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 v25si4808621oth.136.2019.12.05.13.53.54; Thu, 05 Dec 2019 13:54:07 -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=MOxPNe8W; 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 S2387508AbfLEVwj (ORCPT + 99 others); Thu, 5 Dec 2019 16:52:39 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:44548 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387488AbfLEVwg (ORCPT ); Thu, 5 Dec 2019 16:52:36 -0500 Received: by mail-io1-f68.google.com with SMTP id z23so5191703iog.11; Thu, 05 Dec 2019 13:52:35 -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=MOxPNe8WPtSybtjHa0RjD3KJL4IhgjYoRlaEx55/rqpvYo9Ky6IkP8BxUSKa8W//Ul PBG3mLdwri+d+vIivintMAMlESZr7QBNgX+YOA+gIimPYIK7mtAPhdDh9zjI9X6cgTy8 hpkh7n7a3Mv6QLc9k+pMlahHM3SBi/a/fE0hKWOAEPaSVUcQhfKiIR4OqWXPvXm+YyhS A6XN6ru7o1ETHZLiBAbpXFeG/QwR/yS+OrF2xV4Q52E2TtUpb9MYk+Gahv/RdbWaCzCw 7OubreR8PMWUxQJo9r/xnvAmqklOf85y46yPHqKR5/Zl6ay195i+WhsPx0gbg5S7POwy OZqg== 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=Qe5A5Gt23WUNeQgU6raBeiXMvg3q1Qk6K5mquM7+rx9c1F683kHtOx6XW4ammSqQo9 ieb+sjAlgBxl9e70TBKgkfKr/TgptoWOxMeikphcpBwQUCdkcKI8KJL3iAeG1pllqCBG wZadyCU+TRgFx9LY0t+y1+RI3qbGnjKrYzZ3OeyrHoq0Ngw2EdZQSxv8OzHqI3M5yVQy FrH1JyMQLta4LQFhr5tRFMcz1++9cHsJFMUnL3WQyhrYFbDqALD6N1NTy2uwz074gQKS oTLJ2swHhQQnqMtbiJZA5SdPtNla3XXAaM8CX0X0oBe02S8/G/VyJVYxgvmkl8mysZwG JXug== X-Gm-Message-State: APjAAAWvvyRrX0576wL7KYiiQTSCqRXC1M6MCmHqtksSHELX8F7EHSMJ e55SVtZphasYdtmdTdD3tlMH3eZauis= X-Received: by 2002:a02:c4da:: with SMTP id h26mr10742177jaj.47.1575582755356; Thu, 05 Dec 2019 13:52:35 -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 n22sm740184iog.14.2019.12.05.13.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 13:52:34 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: linux@rasmusvillemoes.dk, Jim Cromie , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH 15/18] dyndbg: allow negating flag-chars in modflags Date: Thu, 5 Dec 2019 14:51:48 -0700 Message-Id: <20191205215151.421926-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191205215151.421926-1-jim.cromie@gmail.com> References: <20191205215151.421926-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