Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4002811pxf; Mon, 22 Mar 2021 23:20:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7AOTBIGGRymNMoNcNudxtFuTmJdo4eeypRXVQj9VFtBYIsxFqeZju7zuGBERdt1erqVT0 X-Received: by 2002:a17:906:379b:: with SMTP id n27mr3447567ejc.182.1616480412775; Mon, 22 Mar 2021 23:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616480412; cv=none; d=google.com; s=arc-20160816; b=sFFe/AVu0AhlFvtjfQj7QP7lmR+wQdAuue1ZgJn/MrlLfdaY6jxsqohfutkIVp3QP0 +8j9y4ousie+b8nWNxwdcbcXHb6u905kOYedXPBmRU8kLBKBn2hEtryf11jP/3ZpP/Rk p14Ddop5ImC8WjgiANE5ZfPIyiiYoMAwCxBiL9Cj+CzZmwbbikMZKfH4WZqTzuH9aDLA SCdf0GjbYMa0XWoAXxR4xQ7Lr0LsdHHPHc9JSoKA0M8flHse9RU5Pf26Jv8nSsGGxnK2 lZvCgreOHFeWZDgLTuPC0sEDZ6cFKO0GRtkN7KpfUCoPvb0UGnPYNCxe56oQ9jvdmhWm adWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9a7WpLfMa2pUk8U0O+U4UQy55bOLwjMqp9wpg8sCwwc=; b=pqT7NdpZedZJPN32KwgnFLy20daYafYFa/mc8yDKfGnQFXg2OJa3ROM3lZKOP4pik2 FsZdHHZYsx4Rc/6hQwk+NycEaqcv5PQBXvTWkylj+J5XoJ+xjms0ubaund5LFghnkoJU VXRVlsN9plRMkM6dWGZvbaYOywIwuHyP+qe81pdfL8E7QMFUvFMNrmJVcy5iJvSg7VUU TAwMYSTYZzfHtcMvuQjJ4iiznftxww9E06nAymA3kTXT83tYf6JM2p0HTkBv/40u0fUZ +OQbU/D3oWEJSucAgBu7/DV5W9MthnXArmGC5/JSdTHIjUiQNRRFui9mm8NKN8gO1ULR ShJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZUYjQ8HZ; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c18si12400825ejr.332.2021.03.22.23.19.49; Mon, 22 Mar 2021 23:20:12 -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=@linaro.org header.s=google header.b=ZUYjQ8HZ; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbhCWGOR (ORCPT + 99 others); Tue, 23 Mar 2021 02:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbhCWGOD (ORCPT ); Tue, 23 Mar 2021 02:14:03 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AEBCC061574 for ; Mon, 22 Mar 2021 23:14:03 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id a1so24135129ljp.2 for ; Mon, 22 Mar 2021 23:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9a7WpLfMa2pUk8U0O+U4UQy55bOLwjMqp9wpg8sCwwc=; b=ZUYjQ8HZYqvnzkDWkihzrDTJwFuJ2Yq41wGZeU7bkQuIAbTD3ggAZ7ELOJAeSC9M2g gu7ugP59zJupCQBu87rJq/beWbCd//MqrJgoncooJYkAK3Lv2xfUZ3DNIFjMK+XXwbva T0iXKjHVKlnCIQ/sYD8fYTLnWen549ARRW5N4kYuf6VVRnQIXVS8ECCiCy3TqRLsdbUo MS1vh9Ed8UEAv24wE66n+slCG8zsAi5wg73NImVr3P9wAbA7V/9qTt8OxJVRrE2SDd2F t+ytIPEhxZ+zfyN7VySbYjsODZSmDjoe3dXRYALuAZCAUsVYAkccGvGBfFgM78yTo1OV isdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9a7WpLfMa2pUk8U0O+U4UQy55bOLwjMqp9wpg8sCwwc=; b=Okih+LOSK4GeUrUAHuaU5UuOyWBogM32azdxxz/2XBhdcxm518Y79ueNirAucK26iR Q/tRKGmf0Q+3D4n3rXTkQLoV4pqz9NzFIalC8n0xdJnRoU8QxGMLodwQ4l+pzs9i0FX4 Nd/3u/pnHCdiInWwXlsqlBXZsRFQQECET/f452C1KM9PJ2Zlmq3QKybGH8GgaAjLGTpj SVi4+5TRIQF4K+MaIDI8UdXY1SpFB1e/+3aKAoGBCNfOXMnQELnDKxo5BsxcekFUuG/B CTZRwUzSyqy/cRKrLpMKAkfQCHMpiU3Qv7+P3Q8hKzDWFlVeNzCnrcDdWlmaxX9wBaXg s4Jg== X-Gm-Message-State: AOAM5339xudFo8V81aEt0cKiMnXuLFd5akwFpX/T3gKRjQkVJ5cqNxH9 vVyqHlaEBnAGDsdCASLD2EDa3DDJN1W+6GD2yqILtg== X-Received: by 2002:a2e:5c47:: with SMTP id q68mr2104505ljb.314.1616480041484; Mon, 22 Mar 2021 23:14:01 -0700 (PDT) MIME-Version: 1.0 References: <20210309121747.859823-1-sumit.garg@linaro.org> <20210319171712.vlkgnmp7cbnayxdn@maple.lan> In-Reply-To: <20210319171712.vlkgnmp7cbnayxdn@maple.lan> From: Sumit Garg Date: Tue, 23 Mar 2021 11:43:50 +0530 Message-ID: Subject: Re: [PATCH] kdb: Refactor kdb_defcmd implementation To: Daniel Thompson Cc: kgdb-bugreport@lists.sourceforge.net, Jason Wessel , Douglas Anderson , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Mar 2021 at 22:47, Daniel Thompson wrote: > > On Tue, Mar 09, 2021 at 05:47:47PM +0530, Sumit Garg wrote: > > Switch to use kdbtab_t instead of separate struct defcmd_set since > > now we have kdb_register_table() to register pre-allocated kdb commands. > > This needs rewriting. I've been struggling for some time to figure out > what it actually means means and how it related to the patch. I'm > starting to conclude that this might not be my fault! > Okay. > > > Also, switch to use a linked list for sub-commands instead of dynamic > > array which makes traversing the sub-commands list simpler. > > We can't call these things sub-commands! These days a sub-commands > implies something like `git subcommand` and kdb doesn't have anything > like that. > To me, defcmd_set implied that we are defining a kdb command which will run a list of other kdb commands which I termed as sub-commands here. But yes I agree with you that these don't resemble `git subcommand`. > > > +struct kdb_subcmd { > > + char *scmd_name; /* Sub-command name */ > > + struct list_head list_node; /* Sub-command node */ > > +}; > > + > > /* The KDB shell command table */ > > typedef struct _kdbtab { > > char *cmd_name; /* Command name */ > > @@ -175,6 +181,7 @@ typedef struct _kdbtab { > > kdb_cmdflags_t cmd_flags; /* Command behaviour flags */ > > struct list_head list_node; /* Command list */ > > bool is_dynamic; /* Command table allocation type */ > > + struct list_head kdb_scmds_head; /* Sub-commands list */ > > } kdbtab_t; > > Perhaps this should be more like: > > struct defcmd_set { > kdbtab_t cmd; > struct list_head commands; > > }; > > This still gets registers using kdb_register_table() but it keeps the > macro code all in once place: > > kdb_register_table(¯o->cmd, 1); > > I think that is what I *meant* to suggest ;-) . It also avoids having to > talk about sub-commands! Okay, I will use this struct instead. > BTW I'm open to giving defcmd_set a better name > (kdb_macro?) > kdb_macro sounds more appropriate. > but I don't see why we want to give all commands a macro > list. I am not sure if I follow you here but I think it's better to distinguish between a normal kdb command and a kdb command which is a super-set (or macro) representing a list of other kdb commands. -Sumit > > Daniel.