Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4331110ybg; Mon, 21 Oct 2019 07:24:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzepplpj0DPcSQyFYUt+ztnHI2rE/rihuuj9BK9XNIM9ExVZd5GD3xEZ9tgcEUJfh6G/8e2 X-Received: by 2002:a17:906:a2d1:: with SMTP id by17mr22490986ejb.206.1571667881546; Mon, 21 Oct 2019 07:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571667881; cv=none; d=google.com; s=arc-20160816; b=cHqvTlObuEyqRaOcW/1RylVSOGtcg35A6fvQmxBCrHJzM8zwbZstIEtGwFpG1BZGo+ My/I7uiDBx/QB1xHeu7w5xgbUK4KfCwwC6tprPwKQCTowL+GnnEXdn9x4PjmPFTiVrGB Ko/4ACtyCMA4pr/6aomEs+OQXK28MR3okcA8/ZFgIMpQNw5J02S6+i9/cMwpurBYs6TP AWVj1+f6N+ibR33NaHtV5Jlj8GNW3hiRJtKAWhYc93WUJ3eHz+DHGrX98Op5OwUgyP8m mBKChyHbdtdmnpr69ZVn0L4tVQ8/hv6CQ0Zp69RKR0MlcABhgAtTXVp86zdbrF9bvlBN YQxw== 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:subject:cc:to:from:date; bh=NNRlewNOQL5WE+LNYaiIDQzVEOoYlCdM2LKfsvIBAXE=; b=FZRebS8cjH51hK2m1Mosvxvv3thK6mp7yOQIZ2RyNry09uogUFx2NxKnCR08u66A4M ticwRZ4vZ2qTzyeDBcvphZ1XULhTJNTDhh9FTpf3HgENY5hzHYNaYJ59EDRWxmNshlZu LLDHIG1whHXOzf8h9OoHKyE831LAQAkQU+Mm6c1uuxGOHfJqBvRK2gtSGDMLA1t8xBUN 8paJqHG/NCGT9rLiVZjLKNDsUAgFPis5easJjfJE8v7QcrKVhwZFHY67b7YqlMR7o0ZL XZM++p+i1G6eJcNUgXq4pyzKgnLET15fOZE0ENj61XJDkf5HYna7/vx7JGKTCW4Z8+Xf QPHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si8660159ejj.70.2019.10.21.07.24.18; Mon, 21 Oct 2019 07:24:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728969AbfJUOYL convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Oct 2019 10:24:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:57376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbfJUOYL (ORCPT ); Mon, 21 Oct 2019 10:24:11 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08DFC20640; Mon, 21 Oct 2019 14:24:09 +0000 (UTC) Date: Mon, 21 Oct 2019 10:24:08 -0400 From: Steven Rostedt To: Qu Wenruo Cc: Qu Wenruo , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH v3] tools/lib/traceevent, perf tools: Handle %pU format correctly Message-ID: <20191021102408.3bb4aa8b@gandalf.local.home> In-Reply-To: <3830b0c5-5b76-36c1-5e3a-64dad62f76fb@gmx.com> References: <20191021094730.57332-1-wqu@suse.com> <20191021095625.2dfe3359@gandalf.local.home> <3830b0c5-5b76-36c1-5e3a-64dad62f76fb@gmx.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 21 Oct 2019 22:03:21 +0800 Qu Wenruo wrote: > On 2019/10/21 下午9:56, Steven Rostedt wrote: > > On Mon, 21 Oct 2019 17:47:30 +0800 > > Qu Wenruo wrote: > > > >> +static void print_uuid_arg(struct trace_seq *s, void *data, int size, > >> + struct tep_event *event, struct tep_print_arg *arg) > >> +{ > >> + unsigned char *buf; > >> + int i; > >> + > >> + if (arg->type != TEP_PRINT_FIELD) { > >> + trace_seq_printf(s, "ARG TYPE NOT FIELID but %d", arg->type); > >> + return; > >> + } > >> + > >> + if (!arg->field.field) { > >> + arg->field.field = tep_find_any_field(event, arg->field.name); > >> + if (!arg->field.field) { > >> + do_warning("%s: field %s not found", > >> + __func__, arg->field.name); > >> + return; > >> + } > >> + } > >> + if (arg->field.field->size < 16) { > >> + trace_seq_printf(s, "INVALID UUID: size have %u expect 16", > >> + arg->field.field->size); > >> + return; > >> + } > >> + buf = data + arg->field.field->offset; > >> + > >> + for (i = 0; i < 8; i++) { > >> + trace_seq_printf(s, "%02x", buf[2 * i]); > >> + trace_seq_printf(s, "%02x", buf[2 * i + 1]); > >> + if (1 <= i && i <= 4) > > > > I'm fine with this patch except for one nit. The above is hard to read > > (in my opinion), and I absolutely hate the "constant" compare to > > "variable" notation. Please change the above to: > > > > if (i >= 1 && i <= 4) > > Isn't this ( 1 <= i && i <= 4 ) easier to find out the lower and upper > boundary? only two numbers, both at the end of the expression. I don't read it like that. > > I feel that ( i >= 1 && i <= 4 ) easier to write, but takes me extra > half second to read, thus I changed to the current one. How do you read it in English? "If one is less than or equal to i and i is less than or equal to four." Or "If i is greater than or equal to one and i is less than or equal to four." ? I read it the second way, and I believe most English speakers read it that way too. It took me a minute or two to understand the original method, because my mind likes to take a variable and keep it on the same side of the comparison, and the variable should always be first. -- Steve