内核宏函数查找
今天在内核源码里查找一个函数set_buffer_bit, 但是一直没有找到。
后来发现原来这是一个宏函数,难怪找不到完全匹配的函数。定义如下:
#define BUFFER_FNS(bit, name) \
static __always_inline void set_buffer_##name(struct buffer_head *bh) \
{ \
set_bit(BH_##bit, &(bh)->b_state); \
} \
static __always_inline void clear_buffer_##name(struct buffer_head *bh) \
{ \
clear_bit(BH_##bit, &(bh)->b_state); \
} \
static __always_inline int buffer_##name(const struct buffer_head *bh) \
{ \
return test_bit(BH_##bit, &(bh)->b_state); \
}
如果内核源码里面找不到函数,可以去头文件里面看看是不是宏定义函数,如set_buffer_bit,就可以去buffer_head.h看看