inline usage in C linux kernel

Discussion in 'C Programming' started by rahul8143@gmail.com, Apr 18, 2005.

  1. Guest

    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.
    , Apr 18, 2005
    #1
    1. Advertising

  2. In article <>,
    <> 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
    Walter Roberson, Apr 18, 2005
    #2
    1. Advertising

  3. 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
    Mark F. Haigh, Apr 18, 2005
    #3
  4. Grumble Guest

    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
    Grumble, Apr 18, 2005
    #4
  5. In article <>,
    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?
    Christian Bau, Apr 18, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Don
    Replies:
    1
    Views:
    5,598
    Victor Bazarov
    Feb 8, 2004
  2. Steven T. Hatton

    FYI:C++ in the Linux Kernel

    Steven T. Hatton, May 26, 2005, in forum: C++
    Replies:
    3
    Views:
    728
    Steven T. Hatton
    May 27, 2005
  3. yogesh
    Replies:
    3
    Views:
    587
    Kenny McCormack
    Feb 12, 2006
  4. Replies:
    3
    Views:
    169
  5. Lars Gierth
    Replies:
    6
    Views:
    221
    David Masover
    Mar 20, 2010
Loading...

Share This Page