linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 3/9] kernel-shark-qt: Add API for loading trace.dat files
Date: Thu, 28 Jun 2018 16:32:35 -0400	[thread overview]
Message-ID: <20180628163235.3a2422f7@gandalf.local.home> (raw)
In-Reply-To: <20180628163012.21477-4-y.karadz@gmail.com>

On Thu, 28 Jun 2018 19:30:06 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:


> diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
> new file mode 100644
> index 0000000..8f4059a
> --- /dev/null
> +++ b/kernel-shark-qt/src/libkshark.c
> @@ -0,0 +1,475 @@
> +// SPDX-License-Identifier: LGPL-2.1
> +

[..]
> +}
> +
> +bool kshark_instance(struct kshark_context **context)
> +{
> +	if (*context == NULL && kshark_context_handler == NULL) {
> +		/* No kshark_context exists. Create a default one. */
> +		bool status = kshark_default_context(context);
> +		if (status)
> +			return status;
> +	} else if (*context != NULL) {
> +		/* Use the context provided by the user. */
> +		if (kshark_context_handler)
> +			kshark_free(kshark_context_handler);
> +
> +		kshark_context_handler = *context;
> +	} else {
> +		/*
> +		 * No context is provided by the user, but the context handler
> +		 * is already set. Use the context handler.
> +		 */
> +		*context = kshark_context_handler;
> +	}
> +
> +	if (!seq.buffer)
> +		trace_seq_init(&seq);
> +
> +	if (!seq.buffer)
> +		return false;
> +
> +	return true;
> +}
> +
[..]

> diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h
> new file mode 100644
> index 0000000..da5359a
> 

> +
> +/**
> + * @brief Initialize a kshark session. This function must be called before
> + * calling any other kshark function. If the session has been initialized,
> + * this function can be used to obtain the session's context.
> + * @param kshark_ctx: Optional input/output location for context pointer.
> + * Only valid on return true.
> + * @returns true on success, or false on failure.
> +
> + */
> +bool kshark_instance(struct kshark_context **kshark_ctx);
> +

Keeping with the Linux styling, it is preferred to have the descriptive
comments above the C function and not the prototype.

I understand the rational for having it above the prototype, because
you would think that's where people may look if they don't have the
source (just the headers). But realistically, people who use etags and
such, when they want to see a function, the vim and emacs commands will
bring the user to the C code and not the prototype. This is why Linux
enforces the comments above the C code.

Please keep the comments above the C function (move them to the .c file)
If you are using the headers for documentation, it would probably be
easier to read about them from the output of the doxygen documentation.

-- Steve

  reply	other threads:[~2018-06-28 20:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 16:30 [PATCH v2 0/9] Introduce the basic part of the C API of KS-1.0 Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 1/9] kernel-shark-qt: Add Cmake build system for the Qt based KernelShark Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 2/9] kernel-shark-qt: Automatic generation of doxygen documentation Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 3/9] kernel-shark-qt: Add API for loading trace.dat files Yordan Karadzhov (VMware)
2018-06-28 20:32   ` Steven Rostedt [this message]
2018-06-28 20:41     ` Steven Rostedt
2018-06-28 21:55   ` Steven Rostedt
2018-06-28 21:57   ` Steven Rostedt
2018-06-28 16:30 ` [PATCH v2 4/9] kernel-shark-qt: Add an example showing how to load trace data Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 5/9] kernel-shark-qt: Add a README file to trace-cmd/kernel-shark-qt Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 6/9] kernel-shark-qt: Add filtering to the C API of KernelShark Yordan Karadzhov (VMware)
2018-06-28 23:29   ` Steven Rostedt
2018-06-28 23:44   ` Steven Rostedt
2018-06-28 16:30 ` [PATCH v2 7/9] kernel-shark-qt: Add an example showing how to filter trace data Yordan Karadzhov (VMware)
2018-06-28 16:30 ` [PATCH v2 8/9] kernel-shark-qt: Add Advanced filter to the session context Yordan Karadzhov (VMware)
2018-06-28 23:37   ` Steven Rostedt
2018-06-28 16:30 ` [PATCH v2 9/9] kernel-shark-qt: Add example of advanded filtering Yordan Karadzhov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628163235.3a2422f7@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).