bootlin / elixir

The Elixir Cross Referencer
GNU Affero General Public License v3.0
977 stars 144 forks source link

Confusion between variable definition and declaration #211

Open sk-buff opened 3 years ago

sk-buff commented 3 years ago

When I searched the identifier pfifo_fast_ops in the newest kernel v5.12-rc5, I found the result confused the definition and the declaration of the identifier. The result showed pfifo_fast_ops is defined at include/net/sch_generic.h, line 574 (as a externvar). However, it's a declaration of a extern variable instead of a definition, which is like the following:

extern struct Qdisc_ops pfifo_fast_ops;

The definition of pfifo_fast_ops actually locates in net/sched/sch_generic.c, line 782 and is showed in the Referenced part in the result.The definition is:

struct Qdisc_ops pfifo_fast_ops __read_mostly = {
    .id     =   "pfifo_fast",
    .priv_size  =   sizeof(struct pfifo_fast_priv),
    .enqueue    =   pfifo_fast_enqueue,
    .dequeue    =   pfifo_fast_dequeue,
    .peek       =   pfifo_fast_peek,
    .init       =   pfifo_fast_init,
    .destroy    =   pfifo_fast_destroy,
    .reset      =   pfifo_fast_reset,
    .dump       =   pfifo_fast_dump,
    .change_tx_queue_len =  pfifo_fast_change_tx_queue_len,
    .owner      =   THIS_MODULE,
    .static_flags   =   TCQ_F_NOLOCK | TCQ_F_CPUSTATS,
};

I don't know whether it's a mistake, plz check it :)

CS-cwhite commented 2 years ago

What ctags output do you get for that symbol in sch_generic.h and sch_generic.c? Elixir relies on ctags to make those distinctions.