• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

strange struct declaration

I recently found the following declaration in a program I'm studying:

static struct symbol_table my_symtab = {
         #include <linux/symtab_begin.h>
         X(printk),
        X(vmalloc),
        X(vfree),
        X(kerneld_send),
        X(current_set),
        X(sys_call_table),
        X(register_symtab_from),
        #include <linux/symtab_end.h>
};



I know the symbol_table struct is defined in module.h; but its contents seem to bear no resemblance to the above. Why does the declaration begin and end with the preprocessor instructions, and what exactly do symtab_begin.h and symtab_end.h do? (They're not on my system - Linux 2.0.0 slakware - at all.) Also, what does the X refer to? Is it some obscure preprocessor instruction? (It's not mentioned in Kernighan and Ritchie's book.)

Thanks for any help,

David
0
sevrin
Asked:
sevrin
  • 3
1 Solution
 
ozoCommented:
Is X defined in linux/symtab_begin.h?
0
 
rbrCommented:
Serach for a define X in your header files. The X must be a macro which is replaced by compile time with the structure component.
0
 
rbrCommented:
I found the define X in the
symtab_begin.h
#define X(sym) { _basic_version(sym) }

0
 
sevrinAuthor Commented:
Ah, a macro. As I say, I don't have symtab_begin.h or symtab_end.h, so it was impossible for me to find out.

Thanks,

David
0
 
rbrCommented:
To ozo: Sorry I answered the question at the same time so I didn't see your comment.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now