All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] iproute2: add libgenl files
Date: Mon, 10 Sep 2012 15:42:43 -0700	[thread overview]
Message-ID: <20120910154243.215fbcab@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <alpine.LFD.2.00.1209110021150.2010@ja.ssi.bg>

On Tue, 11 Sep 2012 00:54:00 +0300 (EEST)
Julian Anastasov <ja@ssi.bg> wrote:

> > Why not an inline function, macro code is error prone.  
> 
> 	The problem is that we define every request with
> its own structure in GENL_DEFINE_REQUEST. We can use init
> func instead of macro only if we define some base structure,
> for example:
> 
> struct genl_header_base {
> 	struct nlmsghdr		n;
> 	struct genlmsghdr	g;
> };

Ok, that makes sense. I prefer C99 style initializers
in general. Maybe:

#define GENL_INIT_REQUEST(family, hdrsize, ver, cmd_, flags) {	\
	.req = { \
          .n = { \
             .nlmsg_type = (family), \
             .nlmsg_flags = (flags), \
             .nlmsg_len   = NLMSG_LENGTH(GENL_HDRLEN + (hdrsize)), \
           } \
          .g = { \
              .cmd = (cmd), \
              .version = (ver), \
           } \
          }
		

Or merge GENL_DEFINE_REQUEST and GENL_INIT_REQUEST.

These are all nits, and not that important, just want to make it as simple
as possible. So if you like it okay as it was, we can just use that.

  reply	other threads:[~2012-09-10 22:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08  9:48 [PATCH 0/2] iproute2: add GENL helpers Julian Anastasov
2012-09-08  9:48 ` [PATCH 1/2] iproute2: add libgenl files Julian Anastasov
2012-09-10 16:55   ` Stephen Hemminger
2012-09-10 21:54     ` Julian Anastasov
2012-09-10 22:42       ` Stephen Hemminger [this message]
2012-09-10 16:56   ` Stephen Hemminger
2012-09-08  9:48 ` [PATCH 2/2] iproute2: use libgenl in ipl2tp Julian Anastasov

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=20120910154243.215fbcab@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.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.