Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp454519lqo; Thu, 16 May 2024 10:48:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV54eWwc3CMK6NhHAuRsNNAGRuKB8K9FKctQeJigvbAgfEEy4MY0llBUDcAVDW3TJspk64j7XX3VRhCvtWbVAredEYdmmFXSVIXk999NQ== X-Google-Smtp-Source: AGHT+IEFZnot8YuTRc8BmrsbQxi6CamtIWYJIR7jnszXVZL9CPK47p8IxyWaentXmpIee7QMAlA1 X-Received: by 2002:a05:6a21:6d9e:b0:1af:952f:f6fb with SMTP id adf61e73a8af0-1afde0a8e00mr21744906637.3.1715881708177; Thu, 16 May 2024 10:48:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715881708; cv=pass; d=google.com; s=arc-20160816; b=muUOTXOY//NQs3k1gbiE+NBoVnFw1ajfwvVdTFisIdqdTR9Ewz+CDco9R8FAb9lFQ/ Ddrn6xbkYW5CHldbmv8psDwGZaOpA89N3RmVIOH45CcvYcwk278rAI8SyufwO9FxX7Oe Vuys/NCdwegp9QruksF+9LO6iGLJTYa34jljYuFT3PxXZ1V8fb+1SH8y5w/r8h99Ydw1 8NeAjbJe/FQfRUNVk46Bf4rB7S7zvKd2DaF+S/KjW7v4QfsMSIbES/mFcXAOxYNcq0m9 bqfegPKQoxmXiTRZP5G+AdhBCuuaXHxPjbvkcKsGWEi2lMlecSlnnWl3fR6E3yDBIPb0 9TeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PKt9z1FjU1g7BjHL+/GNBbUF+urWK9jMB07KelneGxw=; fh=mKFvgSk/lSxooE8LGeP+9T+0spysmcwngdxnZ9bphe4=; b=zZH9F79DEfJsuJ6faK993wv+FgR+AZNwPOS1bx4oDYI/KIiQJgUSq5dZ5h5mCAp57G 9G1b9Ve3FU+vurZVzoIMJAGCxJR9hP+HNZVbcHYOiHJ3I6p/ZIToNUK1H/6RaTz7jUqK 5KzCUcPhQ5BT+HokQ+IxyO8AKHubpPtEKpsEGKYOEmUABgnLWQzPrD1d/KbTZMrgd0eI FG8PP8CjI0BpVco8Xa3o3Lh943VGno7KjH9sIQkf6LGt51Ci6HewF9xncz8BTCDMTz6S yOYMeDImx3vGWXaCeexOClPcmJxsUUBkwM4GJd1Cg0DVZekpHMZ9NopCi/nCOo5nc6C5 Wqbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CByamTHe; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181401-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c157d73si163525865ad.506.2024.05.16.10.48.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:48:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CByamTHe; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181401-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2FEFE281CD6 for ; Thu, 16 May 2024 17:48:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5B5D158DD2; Thu, 16 May 2024 17:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CByamTHe" Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6310515747D for ; Thu, 16 May 2024 17:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881504; cv=none; b=M6yFSeg1Fanq3OY9m90ZOgzZWyw+DAW1NhhiKczsxQ6606y9/alkyVnL/pR5gQ9FYJdk5DwJLSx4Rp1xGr4B7/igbc8ThztgOreYtN0T4M+W1TlGUURL2Ykoagd/eDnHq+eK1dj3vtC+U34uIC7VHUksTYdEetPLBTm8nFcS3xQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881504; c=relaxed/simple; bh=itcV+24asaVC3KYa/U3kpaJGYMkp9GjyLqWBirFU8Us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WpY34MrgqsfNGs58tUrRie0kqpxfbAKwrg0MS59YKAWgiaXblv0MeIA0DRY4rP2BhwaHfsu6O4RKz82YZBFNvn+QtH7VyZyDgBX/hJKK9xd3hi/JENstikzbyoEBe0zR9y4mK44fT1Eyi6RWXtqPjZg78hZN0KEARKnKh6aUlDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CByamTHe; arc=none smtp.client-ip=209.85.166.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7e1cd52db2eso60617039f.0 for ; Thu, 16 May 2024 10:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881501; x=1716486301; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PKt9z1FjU1g7BjHL+/GNBbUF+urWK9jMB07KelneGxw=; b=CByamTHeXl4xlO0U9qbWizxCAtiBj5Brpj130fd2oPdXCMa4MQx8fwPncC7CkZLRtz 8Dp9upuZLwirmS5u2HpTSKpuh1xeBtn8d6bfDOeNSNQ6Ad5k0NTiICtuuFZVzx/afI6i ur+4qK5Ycs8hhVBfjSwiocZnnkdlmHTM9G+FAKJz0iSWSMVfo4I4i3Hs72LTsY7RSD1c ZKMDtjSzr8S0lLIdYtMAOxBwRqRuo+mkOS/vpos4GlC3VsMNaU5fzQ2dJUOy2+MsyKLu rDpNzKXJLj2iI55B3LvbHrljwJK71cpjgamO5MLhu7X5rvEDHIyDzAZfEUPQx5h3ecpw jDCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881501; x=1716486301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PKt9z1FjU1g7BjHL+/GNBbUF+urWK9jMB07KelneGxw=; b=W3W9Hf/LFuRI9oWT9gGbIUZg+vXEIMx+z7Navp2yRly23JPl3LqfC5gTKDoeINWrh/ 6WcfGROPd+Mt8Jx9+GXoNy/u666yslCafOucPLHA6/u16LmXdvN+gkcYhhDw22zr867v durOJyiOoQiOeujqLX6iEqCvz2CfLxUetghNWh6T0ooh2apT0KGD/tdhC4lPOiIEiwIh fjMCI4G4S2VvOjeSc/a6uFS5LBv53C5oRITssJNfCFssBWgKnN9xHEEv1zIMTD4wLj5B On7E1WlY2oqYniS8pMWAQtic3vXDVJkDAObueG7g0sxypwlupC9XY2MPB8qY+Rn2o6l4 G/3A== X-Forwarded-Encrypted: i=1; AJvYcCVO0uHEYgKLF5k89L9i5WC5O6h1J6Va7SA0HbEBgiLgZkUSiLws+QS3/UvmkUJUEioLobABJVtXzZdpdpOYZWVUNiwvXzC/qoNBxMD7 X-Gm-Message-State: AOJu0YyG9bNrSWbXe+Fox/8AsN4kO9iLoimd4x0LlB33Zl5J2x6xT4XF wU+veuZRzLDVgcfu1Bf/kyNNjat7wHeXfELiQogeMuqqbDu0DbW+vU3AaQB+ X-Received: by 2002:a5d:88c7:0:b0:7e2:1e0:3350 with SMTP id ca18e2360f4ac-7e201e033d5mr837924039f.12.1715881501632; Thu, 16 May 2024 10:45:01 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:01 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 20/33] dyndbg: treat comma as a token separator Date: Thu, 16 May 2024 11:43:44 -0600 Message-ID: <20240516174357.26755-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Treat comma as a token terminator, just like a space. This allows a user to avoid quoting hassles when spaces are otherwise needed: :#> modprobe drm dyndbg=class,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=class,DRM_UT_CORE,+p # todo: support multi-query here Given the many ways a boot-line +args can be assembled and then passed in/down/around shell based tools, this may allow side-stepping all sorts of quoting hassles thru those layers. existing query format: modprobe test_dynamic_debug dyndbg="class D2_CORE +p" new format: modprobe test_dynamic_debug dyndbg=class,D2_CORE,+p Signed-off-by: Jim Cromie Co-developed-by: Łukasz Bartosik Signed-off-by: Łukasz Bartosik --- lib/dynamic_debug.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 31fd67597928..c1bc728cb050 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -290,6 +290,14 @@ static int ddebug_change(const struct ddebug_query *query, return nfound; } +static char *skip_spaces_and_commas(const char *str) +{ + str = skip_spaces(str); + while (*str == ',') + str = skip_spaces(++str); + return (char *)str; +} + /* * Split the buffer `buf' into space-separated words. * Handles simple " and ' quoting, i.e. without nested, @@ -303,8 +311,8 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) while (*buf) { char *end; - /* Skip leading whitespace */ - buf = skip_spaces(buf); + /* Skip leading whitespace and comma */ + buf = skip_spaces_and_commas(buf); if (!*buf) break; /* oh, it was trailing whitespace */ if (*buf == '#') @@ -320,7 +328,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) return -EINVAL; /* unclosed quote */ } } else { - for (end = buf; *end && !isspace(*end); end++) + for (end = buf; *end && !isspace(*end) && *end != ','; end++) ; if (end == buf) { pr_err("parse err after word:%d=%s\n", nwords, @@ -592,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) if (split) *split++ = '\0'; - query = skip_spaces(query); + query = skip_spaces_and_commas(query); + if (!query || !*query || *query == '#') continue; -- 2.45.0