Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp434813ybt; Sat, 13 Jun 2020 09:04:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/2MW8rwQzIaema/Tr+r3BnOGMjhjnIlEEilL2xJ17e4CBXiepvim/Oj2QIMtiXYDTrZ8X X-Received: by 2002:a17:906:6b8a:: with SMTP id l10mr17198532ejr.465.1592064240559; Sat, 13 Jun 2020 09:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592064240; cv=none; d=google.com; s=arc-20160816; b=kId7N1uYJZPp11rqUFPO3cnhcaFtc7+e2IqFIcCSkJU7QFUgv7LD/YjW5JjRtpPXsL 0GtXsjz4iWgE2Gn41tIntgSu7CLLlJcvcBbh+4YW1ewrFAJvpjyEW4ChHoaIcfa6DVw1 ftf9PJYNqEqxBH+tsIh2ehyWn8kT/uxKAUumf4fepB9aWYBrTUWFDh5p7FsdVOvRpvnM mVSV9StCM7KR0kiXoWqP7It1HweXlxXcX+4osCbxubDXq0nfZuvBAaJd3ub85RahLwxU Q0wyfnAiRwSidfsCGCpFZcYVmBPHRvy/qqRW+6wPoOIJG6a26pOkVC+26iCdYKnuQaHY ETbw== 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=bMX4OzWsojlD8s6xTuD1Ig+vMeRlYxFlVf1O2bU8rdo=; b=vUb7TcBPrC+T/b4JTooKYitmZljZbdbAnK7cELImDxRrPVYoCALTFLZFhEZAgqQ1yO aDPa3YhRHpdWsrWPrEWefxM739h8ntdZM5eBti5T/XQeYAVowKFijYrhxr7uIqGyoQoO acloOuPlMyYaQy1Yw5c9ddo+EnPLLrTMlsBI/toQy80FK6XEoLxBRXqQAf+u0qBckG1t dgDBKOx2DTgRof1WNyVuXvugZugZ0Ci2NSwweffy0/3343fMnV+5BCi/KZOzOx79QqLX uibW4sytYyf1U6aCOuGU9Ea6IuFS1015mkbQOG/ZCO3iWuEVYWUj6FtFlWAiX+o9lVgW wZsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kyn4QDu7; 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 l22si5890737ejg.740.2020.06.13.09.03.38; Sat, 13 Jun 2020 09:04:00 -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=kyn4QDu7; 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 S1726766AbgFMP7L (ORCPT + 99 others); Sat, 13 Jun 2020 11:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726606AbgFMP6W (ORCPT ); Sat, 13 Jun 2020 11:58:22 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B7DC03E96F; Sat, 13 Jun 2020 08:58:21 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id n6so9789278otl.0; Sat, 13 Jun 2020 08:58:21 -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=bMX4OzWsojlD8s6xTuD1Ig+vMeRlYxFlVf1O2bU8rdo=; b=kyn4QDu7hT/mqd4FV3we/LI0R3CAzwL/hWz/PJ61g13FMMjO+1/QEXH2dt9czUI+XI PHj5mPHV9IXzGQKIzSqF0vAfIBOb8fui8eC7HYzbkHlRmn56i1i9koMFu4fp/sK6YR+1 6qhN5Im26ZhWnM1JCcWW9S2w3YBWiCuepk8D6+kQFLUNy//uI/cK0UEfF5dwJ74FjP3u E1Yz0J/n1Jys/K/YD8kHGXwPE5CTkdekbfXyuuGgnbvrsYIIz18w+82xUadqaweTe2/4 Vws+TTop/Ya2pWLAztfEfxj2X5QTaRkbppTBTTPwSyg7jbdmPCnh+VQntaGWNgtDvG7F HreA== 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=bMX4OzWsojlD8s6xTuD1Ig+vMeRlYxFlVf1O2bU8rdo=; b=CGiKzAXqkVo/VKCIGABF8z+EYbIgHcw4XZ5YLRb/eDPjvhQ36HGpVihgXuA35FRkyC TUpewtD8y6fx6tTKeNDkYGQC4Q55Scof8Lrd3yGB3A76+mQ9jg3Kq5uHDSZNQcnVDIwX Mj2Gy3KnpseMqRi14NE/uVDAiUBzLlWYC/oLZ3FxmtLgUT/3JYTYIZG8bSawwIpoGStP pQl4BuR0TpSH8ZMaQPEchPjFzxo/dbVyv0rKJxNKn23Qdy2CHzfcozcGGknOJO9YByMM Ks/0Y7XMfc6yM3ALqECTw8j3i74P7JN/F59vma3oxGQlxViAlCkIjKE8Esc6pdV+jELa CCPg== X-Gm-Message-State: AOAM532S7erMnQ714VeWY1xoqSNB/xNreNvn8Wt6G1lAUJtp0mtUktC5 O//67oVwnEMeGawxzKmRx4w= X-Received: by 2002:a9d:c29:: with SMTP id 38mr14236212otr.107.1592063901002; Sat, 13 Jun 2020 08:58:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 08:58:20 -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 , Andrew Morton , Will Deacon , Petr Mladek , Orson Zhai , linux-doc@vger.kernel.org Subject: [PATCH v2 15/24] dyndbg: extend ddebug_parse_flags to accept optional leading filter-flags Date: Sat, 13 Jun 2020 09:57:29 -0600 Message-Id: <20200613155738.2249399-16-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 change ddebug_parse_flags to accept optional filterflags before OP. this now sets the parameter added in ~1 --- .../admin-guide/dynamic-debug-howto.rst | 18 +++++++---- lib/dynamic_debug.c | 30 ++++++++++--------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 6c04aea8f4cd..4f343e6036f5 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -217,13 +217,19 @@ line line -1605 // the 1605 lines from line 1 to line 1605 line 1600- // all lines from line 1600 to the end of the file -The flags specification comprises a change operation followed -by one or more flag characters. The change operation is one -of the characters:: +Flags Specification:: - - remove the given flags - + add the given flags - = set the flags to the given flags + flagspec ::= filterflags? OP modflags + filterflags ::= flagset + modflags ::= flagset + flagset ::= ([pfmltu_] | [PFMLTU_])+ # also cant have pP etc + OP ::= [-+=] + +OP: modify callsites per following flagset:: + + - remove the following flags + + add the following flags + = set the flags to the following flags The flags are:: diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0f393a930fdc..40436270d38a 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -441,34 +441,36 @@ static int ddebug_read_flags(const char *str, struct flagsettings *f) } /* - * Parse `str' as a flags specification, format [-+=][p]+. - * Sets up *maskp and *flagsp to be used when changing the - * flags fields of matched _ddebug's. Returns 0 on success - * or <0 on error. + * Parse `str' as a flags-spec, ie: [pfmlt_]*[-+=][pfmlt_]+ + * Fills flagsettings provided. Returns 0 on success or <0 on error. */ - static int ddebug_parse_flags(const char *str, struct flagsettings *mods, struct flagsettings *filter) { int op; + char *opp = strpbrk(str, "-+="); - switch (*str) { - case '+': - case '-': - case '=': - op = *str++; - break; - default: - pr_err("bad flag-op %c, at start of %s\n", *str, str); + if (!opp) { + pr_err("no OP given in %s\n", str); return -EINVAL; } + op = *opp; vpr_info("op='%c'\n", op); + if (opp != str) { + /* filterflags precedes OP, grab it */ + *opp++ = '\0'; + if (ddebug_read_flags(str, filter)) + return -EINVAL; + str = opp; + } else + str++; + if (ddebug_read_flags(str, mods)) return -EINVAL; - /* calculate final flags, mask based upon op */ + /* calculate final mods: flags, mask based upon op */ switch (op) { case '=': mods->mask = 0; -- 2.26.2