All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: Can the empty struct rte_eth_txmode be enhanced?
Date: Wed, 12 Jun 2013 11:17:15 +0200	[thread overview]
Message-ID: <51B83C9B.4060807@6wind.com> (raw)
In-Reply-To: <tencent_30A6C31C56B0DBD36771F80E-9uewiaClKEY@public.gmane.org>

Hello,

> Can we change the struct rte_eth_txmode ?
>
> Such as :
>
> struct rte_eth_txmode { int reserve[]; };   /* sizeof(struct rte_eth_txmode) == 0 in gcc and g++ */

I agree with your solution. Do you approve the following patch ?

From: lxu <lxu4net-9uewiaClKEY@public.gmane.org>
Date: Wed, 12 Jun 2013 09:32:30 +0200
Subject: [PATCH] ethdev: force the size of struct rte_eth_txmode to be 0

The size of an empty structure is 0 when compiling with gcc, and 1 when
compiling with g++. Adding an empty table forces the size fo be 0, in C
or C++.

Acked-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Signed-off-by: lxu <lxu4net-9uewiaClKEY@public.gmane.org>
---
  lib/librte_ether/rte_ethdev.h |    1 +
  1 file changed, 1 insertion(+)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5985496..e0a1ccf 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -320,6 +320,7 @@ struct rte_eth_vmdq_dcb_conf {
   * For future extensions.
   */
  struct rte_eth_txmode {
+       int reserved[]; /* force the size of struct to be 0 */
  };

  /**
-- 
1.7.10.4

  parent reply	other threads:[~2013-06-12  9:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12  4:54 Can the empty struct rte_eth_txmode be enhanced? lxu
     [not found] ` <tencent_30A6C31C56B0DBD36771F80E-9uewiaClKEY@public.gmane.org>
2013-06-12  9:17   ` Olivier MATZ [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-06-12 12:23 lxu
     [not found] ` <tencent_32A472FE12E181E41F4C6C1C-9uewiaClKEY@public.gmane.org>
2013-06-12 13:39   ` Thomas Monjalon

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=51B83C9B.4060807@6wind.com \
    --to=olivier.matz-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.