Skip to contentSkip to conversation

Convert IP4 address class macros to inline functions

PATCH In review Joe Perches 3 participants 5 messages Nov 20, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Convert IP4 address class macros to inline functions

Change LOOPBACK MULTICAST LOCAL_MCAST BADCLASS and ZERONET macros to inline functions ipv4_is_<type>(__be32 addr)

Adds some type safety and arguably some readability

No change in compiled image size

#1 lore raw
Quoted 8 lines · Joe Perches

Change LOOPBACK MULTICAST LOCAL_MCAST BADCLASS and ZERONET macros to inline functions ipv4_is_<type>(__be32 addr)

Adds some type safety and arguably some readability

No change in compiled image size

I can understand the motivation for moving the functionality into inline functions in order to get some type safety. But what is the motivation for changing all the macro calls to function calls, when you have set up the marcos to call the appropriate functions? Surely if you want to do that you should just ditch the marcos all together. Perhaps I am missing a patch?

Also, as the function names are longer than the macro name you are creating lines that are > 80 columns wide that used not to be in that state. For my eyes that reduced readability (substantially).

Signature · 1 line
Horms
#2 lore raw
Quoted 10 lines · Simon Horman
Quoted 5 lines · Joe Perches

Change LOOPBACK MULTICAST LOCAL_MCAST BADCLASS and ZERONET macros to inline functions ipv4_is_<type>(__be32 addr) Adds some type safety and arguably some readability No change in compiled image size

I can understand the motivation for moving the functionality into inline functions in order to get some type safety. But what is the motivation for changing all the macro calls to function calls, when you have set up the marcos to call the appropriate functions?

It's just a sequence that allows the kernel to compile.

I expect to remove the macros when the other callsites, drivers/infiniband and drivers/parisc, are converted.

Quoted 2 lines

Surely if you want to do that you should just ditch the marcos all together. Perhaps I am missing a patch?

That's what I'd like to do but in sequence.

David Miller can reasonably accept the net changes, but I'm not too sure he can accept the drivers changes.

If/when this change is accepted and patches for drivers are accepted, I'll submit a patch to remove the macros.

Quoted 4 lines

Also, as the function names are longer than the macro name you are creating lines that are > 80 columns wide that used not to be in that state. For my eyes that reduced readability (substantially).

David? You want a patch for that too?

#3 lore raw
Quoted 20 lines · Joe Perches
Quoted 10 lines · Simon Horman
Quoted 5 lines · Joe Perches

Change LOOPBACK MULTICAST LOCAL_MCAST BADCLASS and ZERONET macros to inline functions ipv4_is_<type>(__be32 addr) Adds some type safety and arguably some readability No change in compiled image size

I can understand the motivation for moving the functionality into inline functions in order to get some type safety. But what is the motivation for changing all the macro calls to function calls, when you have set up the marcos to call the appropriate functions?

It's just a sequence that allows the kernel to compile.

I expect to remove the macros when the other callsites, drivers/infiniband and drivers/parisc, are converted.

Quoted 2 lines

Surely if you want to do that you should just ditch the marcos all together. Perhaps I am missing a patch?

Quoted 7 lines

That's what I'd like to do but in sequence.

David Miller can reasonably accept the net changes, but I'm not too sure he can accept the drivers changes.

If/when this change is accepted and patches for drivers are accepted, I'll submit a patch to remove the macros.

Thanks for the clarification. I realised after I sent my mail that you were probably having to cope with other callers.

Quoted 6 lines
Quoted 4 lines

Also, as the function names are longer than the macro name you are creating lines that are > 80 columns wide that used not to be in that state. For my eyes that reduced readability (substantially).

David? You want a patch for that too?

Signature · 1 line
Horms
maintainer
#4 lore raw
In reply to Joe Perches

From: Joe Perches <[email protected]>
Date: Mon, 19 Nov 2007 23:18:44 -0800

Quoted 7 lines · Simon Horman
Quoted 4 lines

Also, as the function names are longer than the macro name you are creating lines that are > 80 columns wide that used not to be in that state. For my eyes that reduced readability (substantially).

David? You want a patch for that too?

These patches are just clumsy and awkward, this much I will say.

BTW, these seemingly odd macro names come from BSD. Terefore they are quite readable for many of us :-)

I don't know what to do with these patches, they feel like just plain noise to me even though I like the type checking.

I'm going to defer for now, sorry.