b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 3/4] batman-adv: Introduce packet type independent TVLV handler API
Date: Sun, 22 Jan 2017 13:51:14 +0100	[thread overview]
Message-ID: <3122041.oyWN8MZ83e@sven-edge> (raw)
In-Reply-To: <20161220115550.GN6323@otheros>

[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]

On Dienstag, 20. Dezember 2016 12:55:50 CET Linus Lüssing wrote:
> On Mon, Dec 19, 2016 at 12:43:49PM +0100, Sven Eckelmann wrote:
> > On Montag, 19. Dezember 2016 12:37:43 CET Sven Eckelmann wrote:
> > > I was not talking about the packing functions.
> > 
> > Just read my initial mails. Looks like I've copied the wrong function name 
> > "batadv_tvlv_ogm_pack_ctx". But I was talking about the parameter in of 
> > "batadv_tvlv_containers_process2". So I am the reason for the confusion :)
> 
> Just to check, you suggest removing this line:
> https://git.open-mesh.org/batman-adv.git/blob/1ddd189528fc332bf286ffd56b629da26a6b149c:/net/batman-adv/tvlv.c#l662

Yes

> And to replace the passing of "ctx" with an "orig_node" here:
> https://git.open-mesh.org/batman-adv.git/blob/1ddd189528fc332bf286ffd56b629da26a6b149c:/net/batman-adv/tvlv.c#l682

Yes

> (which works as a "void *" parameter accepts any type, without the
> need of casting explicitly)

Yes

> If that's what you mean, hm, not sure. Feels dangerous, such
> automatic casting, doesn't it?

It is not perfect but it is the way it is already done for many things in the
kernel and also in userspace. Think for example about "the argument" when you
generate (k)threads and which you can then then retrieve again inside this
thread.

Your current extra functions also don't prevent that there is a wrong argument
added to this perticular function. They just introduce some weird extra
functions. (At least this is how feel about it - their might be different
opinions about that)

> 
> I'm really wondering whether I should go for the approach of
> hiding the "void *" in a new type. And only having the "void *"
> fiddeling inside _pack()/_unpack() functions.

Hm, I personally don't see a reason for a new type at the moment. But when you
find a good one... at least their could be plenty of reasons which might make
everything a little bit cleaner.

Just keep in mind that there are already many other things in the kernel like
container_of and similar things. So don't try to overengineer it :)

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-01-22 12:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06  6:41 [B.A.T.M.A.N.] [PATCH v2 0/4] Broadcast Avoidances, Neighborhood Hash Linus Lüssing
2016-10-06  6:41 ` [B.A.T.M.A.N.] [PATCH v2 1/4] batman-adv: Keep hard interface neighbor list sorted Linus Lüssing
2016-12-14 18:48   ` Sven Eckelmann
2016-12-14 19:23     ` Sven Eckelmann
2017-01-28  3:13       ` Linus Lüssing
2017-01-28  3:40         ` Linus Lüssing
2017-01-28  9:07           ` Sven Eckelmann
2016-10-06  6:41 ` [B.A.T.M.A.N.] [PATCH v2 2/4] batman-adv: Store and transmit own neighborhood hash Linus Lüssing
2016-12-14 20:28   ` Sven Eckelmann
2016-12-19 13:32     ` Linus Lüssing
2016-12-14 20:49   ` Sven Eckelmann
2016-12-14 20:57   ` Sven Eckelmann
2016-10-06  6:41 ` [B.A.T.M.A.N.] [PATCH v2 3/4] batman-adv: Introduce packet type independent TVLV handler API Linus Lüssing
2016-12-14 14:50   ` Sven Eckelmann
2016-12-19 10:29     ` Linus Lüssing
2017-01-22 12:40       ` Sven Eckelmann
2016-12-14 20:03   ` Sven Eckelmann
2016-12-14 20:12     ` Sven Eckelmann
2016-12-19 10:50       ` Linus Lüssing
2016-12-19 11:37         ` Sven Eckelmann
2016-12-19 11:43           ` Sven Eckelmann
2016-12-20 11:55             ` Linus Lüssing
2017-01-22 12:51               ` Sven Eckelmann [this message]
2016-10-06  6:41 ` [B.A.T.M.A.N.] [PATCH v2 4/4] batman-adv: Evaluate and use neighborhood hash TVLV Linus Lüssing
2016-12-14 14:49 ` [B.A.T.M.A.N.] [PATCH v2 0/4] Broadcast Avoidances, Neighborhood Hash Sven Eckelmann

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=3122041.oyWN8MZ83e@sven-edge \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.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).