DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Shahaf Shuler <shahafs@mellanox.com>,
	Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
	dev@dpdk.org, Marcelo Ricardo Leitner <mleitner@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v1 1/4] net/mlx4: move rdma-core calls to separate file
Date: Thu, 25 Jan 2018 12:31:41 +0100	[thread overview]
Message-ID: <20180125113141.GO4256@6wind.com> (raw)
In-Reply-To: <20180124155857.52457b9d@xeon-e3>

On Wed, Jan 24, 2018 at 03:58:57PM -0800, Stephen Hemminger wrote:
> On Thu, 25 Jan 2018 00:25:00 +0100
> Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> 
> > +const struct mlx4_glue *mlx4_glue = &(const struct mlx4_glue){
> > +	.fork_init = mlx4_glue_fork_init,
> > +	.get_async_event = mlx4_glue_get_async_event,
> 
> The cast should not be necessary here.

It's not a mere cast but a compound literal. The mlx4_glue symbol represents
a pointer to this structure, not the structure itself. This syntax is
equivalent to:

 static const struct mlx4_glue mlx4_glue_internal = {
    ...
 };

 const struct mlx4_glue *mlx4_glue = &mlx4_glue_internal;

The reason I chose to expose a pointer instead of that structure directly is
seamless transition to dlsym() in the next patch, otherwise all
mlx4_glue->foo() need to be first written mlx4_glue.foo() and then modified
as mlx4_glue->foo().

-- 
Adrien Mazarguil
6WIND

  reply	other threads:[~2018-01-25 11:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 23:24 [dpdk-dev] [PATCH v1 0/4] net/mlx: make rdma-core optional at run-time Adrien Mazarguil
2018-01-24 23:25 ` [dpdk-dev] [PATCH v1 1/4] net/mlx4: move rdma-core calls to separate file Adrien Mazarguil
2018-01-24 23:58   ` Stephen Hemminger
2018-01-25 11:31     ` Adrien Mazarguil [this message]
2018-01-24 23:25 ` [dpdk-dev] [PATCH v1 2/4] net/mlx4: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-26 10:06   ` Thomas Monjalon
2018-01-24 23:25 ` [dpdk-dev] [PATCH v1 3/4] net/mlx5: move rdma-core calls to separate file Adrien Mazarguil
2018-01-24 23:25 ` [dpdk-dev] [PATCH v1 4/4] net/mlx5: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-26 14:18 ` [dpdk-dev] [PATCH v2 0/4] net/mlx: make rdma-core optional at run-time Adrien Mazarguil
2018-01-26 14:18   ` [dpdk-dev] [PATCH v2 1/4] net/mlx4: move rdma-core calls to separate file Adrien Mazarguil
2018-01-26 14:19   ` [dpdk-dev] [PATCH v2 2/4] net/mlx4: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-27 15:03     ` Marcelo Ricardo Leitner
2018-01-28  9:04       ` Shahaf Shuler
2018-01-28 11:17         ` Marcelo Ricardo Leitner
2018-01-28 11:46           ` Shahaf Shuler
2018-01-26 14:19   ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: move rdma-core calls to separate file Adrien Mazarguil
2018-01-26 14:19   ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-26 15:58   ` [dpdk-dev] [PATCH v2 0/4] net/mlx: make rdma-core optional at run-time Nélio Laranjeiro
2018-01-29 17:19   ` [dpdk-dev] [PATCH v3 " Adrien Mazarguil
2018-01-29 17:19     ` [dpdk-dev] [PATCH v3 1/4] net/mlx4: move rdma-core calls to separate file Adrien Mazarguil
2018-01-29 17:19     ` [dpdk-dev] [PATCH v3 2/4] net/mlx4: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-29 17:19     ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: move rdma-core calls to separate file Adrien Mazarguil
2018-01-29 17:19     ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-30 15:34     ` [dpdk-dev] [PATCH v4 0/4] net/mlx: make rdma-core optional at run-time Adrien Mazarguil
2018-01-30 15:34       ` [dpdk-dev] [PATCH v4 1/4] net/mlx4: move rdma-core calls to separate file Adrien Mazarguil
2018-01-30 15:34       ` [dpdk-dev] [PATCH v4 2/4] net/mlx4: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-30 17:54         ` Marcelo Ricardo Leitner
2018-01-30 18:32           ` Adrien Mazarguil
2018-01-30 15:34       ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: move rdma-core calls to separate file Adrien Mazarguil
2018-01-30 15:34       ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: spawn rdma-core dependency plug-in Adrien Mazarguil
2018-01-31 10:13       ` [dpdk-dev] [PATCH v4 0/4] net/mlx: make rdma-core optional at run-time Shahaf Shuler

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=20180125113141.GO4256@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=mleitner@redhat.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=shahafs@mellanox.com \
    --cc=stephen@networkplumber.org \
    /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).