inline usage in C linux kernel

R

rahul8143

hello,
I have some inline declaration questions.
1)why new kernel 2.4.30 has intermediate function of __ instead of
direct calling it?
int ip_finish_output(struct sk_buff *skb)
{
return __ip_finish_output(skb);
}

and also __ip_finish_output is written as
static __inline__ int __ip_finish_output(struct sk_buff *skb)
what are these changes in kernel? Does they are for optimization?

2)Also ip_output is calling __ip_finish_output instead ip_finish_output
why?
3) what is difference between declaring following 2 inline functions
static inline int ip_finish_output2(struct sk_buff *skb)
and
static __inline__ int __ip_finish_output(struct sk_buff *skb)
please correct me.
regards,
rahul.
 
W

Walter Roberson

I have some inline declaration questions.
1)why new kernel 2.4.30 has intermediate function of __ instead of
direct calling it?
int ip_finish_output(struct sk_buff *skb)
{
return __ip_finish_output(skb);
}

You should ask that in a Linux developer's newsgroup, as it
is not a point that has to do with C itself.

3) what is difference between declaring following 2 inline functions
static inline int ip_finish_output2(struct sk_buff *skb)
and
static __inline__ int __ip_finish_output(struct sk_buff *skb)

'inline' is not part of C89 (I don't know about C99),
so the two could be there for reasons having to do with
two different implimentations of 'inline'.
 
M

Mark F. Haigh

hello,
I have some inline declaration questions.
1)why new kernel 2.4.30 has intermediate function of __ instead of
direct calling it?
int ip_finish_output(struct sk_buff *skb)
{
return __ip_finish_output(skb);
}

and also __ip_finish_output is written as
static __inline__ int __ip_finish_output(struct sk_buff *skb)
what are these changes in kernel? Does they are for optimization?


7.1.3 Reserved identifiers

[...]
-- All identifiers that begin with an underscore and
either an uppercase letter or another underscore are
always reserved for any use.

__ip_finish_output is reserved for the implementation. In this case,
the implementors (the Linux kernel coders) have decided that this
roughly means "do not use for general kernel code; use it only if you
really know what you're doing." This is getting off-topic; see your
friendly Linux newsgroup for details (comp.os.linux.development*)

If you're not writing kernel or other very special purpose code, do not
ever infringe upon anything reserved for the implementation.

3) what is difference between declaring following 2 inline functions
static inline int ip_finish_output2(struct sk_buff *skb)
and
static __inline__ int __ip_finish_output(struct sk_buff *skb)

Once again, by its double underscore prefix, __inline__ is reserved for
the implementation. In this case it's for the compiler, and offtopic
here, so go consult your version of gcc's manual for the details.


Mark F. Haigh
(e-mail address removed)
 
G

Grumble

rahul8143 said:
hello,
I have some inline declaration questions.
1)why new kernel 2.4.30 has intermediate function of __ instead of
direct calling it?
int ip_finish_output(struct sk_buff *skb)
{
return __ip_finish_output(skb);
}

Wrong newsgroup. Try comp.os.linux.development.system
 
C

Christian Bau

hello,
I have some inline declaration questions.
1)why new kernel 2.4.30 has intermediate function of __ instead of
direct calling it?
int ip_finish_output(struct sk_buff *skb)
{
return __ip_finish_output(skb);
}

and also __ip_finish_output is written as
static __inline__ int __ip_finish_output(struct sk_buff *skb)
what are these changes in kernel? Does they are for optimization?

2)Also ip_output is calling __ip_finish_output instead ip_finish_output
why?
3) what is difference between declaring following 2 inline functions
static inline int ip_finish_output2(struct sk_buff *skb)
and
static __inline__ int __ip_finish_output(struct sk_buff *skb)
please correct me.
regards,

I looked through my copy of the C Standard, and I just couldn't find
this "new kernel 2.4.30" thing anywhere mentioned in it. Are you sure
you are posting to the right newsgroup here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top