From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97BACC433B4 for ; Thu, 8 Apr 2021 13:42:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6217B61107 for ; Thu, 8 Apr 2021 13:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbhDHNmL (ORCPT ); Thu, 8 Apr 2021 09:42:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:45170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbhDHNmL (ORCPT ); Thu, 8 Apr 2021 09:42: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 20BE8610FA; Thu, 8 Apr 2021 13:42:00 +0000 (UTC) Date: Thu, 8 Apr 2021 09:41:58 -0400 From: Steven Rostedt To: Tzvetomir Stoyanov Cc: Linux Trace Devel Subject: Re: [PATCH v2] libtracefs: Add new API for open trace marker file Message-ID: <20210408094158.018286c8@gandalf.local.home> In-Reply-To: References: <20210408080821.3129896-1-tz.stoyanov@gmail.com> <20210408085935.77e2fd4e@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org On Thu, 8 Apr 2021 16:21:52 +0300 Tzvetomir Stoyanov wrote: > I find "tracefs_print_" a little bit confusing, like printing > something on console. I think the name should stress that a user > string/data is written in the trace buffer. I would like to combine > string and binary APIs into one set, something like: How so? We use it in the kernel "trace_printk()" there's no confusion there. And to me, "user string written in the trace buffer" is exactly what I think when I see "tracefs_printf()". > > tracefs_user_trace_init(); /* open both trace_marker and > trace_marker_raw files, or have flags to specify what file to open, > string or data*/ > tracefs_user_trace_printf(); /* write to trace_marker */ > tracefs_user_trace_vprintf(); /* write to trace_marker */ > tracefs_user_trace_binary(); /* write to trace_marker_raw */ > tracefs_user_trace_init(); /* close both string and data fd, if open */ > I have no idea what "user_trace" is. What does that mean? There's no precedence for it. "tracefs_printf()" is short and to the point, and states exactly what you want. It does a printf() into the tracefs system. How is that confusing? We have fprintf() which does a printf into a file point. We have sprintf() which does an printf into a string. Thus, it makes sense to have "tracefs_printf()" which does a printf into the tracefs file system. Just like we have trace_seq_printf() which does a printf() into the trace_seq. "printf()" means string manipulation, and has nothing to do with consoles. I personally hate long function names, especially ones that I may use a lot of. Keeping with the other APIs trace_printf() is the only one that seems reasonable. -- Steve