By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

inline usage in C linux kernel

P: n/a
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.

Nov 14 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <11*********************@z14g2000cwz.googlegroups. com>,
<ra*******@gmail.com> wrote:
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'.
--
'ignorandus (Latin): "deserving not to be known"'
-- Journal of Self-Referentialism
Nov 14 '05 #2

P: n/a
ra*******@gmail.com wrote:
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.

<snip> 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
mf*****@sbcglobal.net

Nov 14 '05 #3

P: n/a
rahul8143 wrote:
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
Nov 14 '05 #4

P: n/a
In article <11*********************@z14g2000cwz.googlegroups. com>,
ra*******@gmail.com wrote:
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?
Nov 14 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.