- 论坛徽章:
- 0
|
- struct attribute {
- const char *name;
- mode_t mode;
- };
- struct mlog_attribute {
- struct attribute attr;
- u64 mask;
- };
- #define define_mask(_name) { \
- .attr = { \
- .name = #_name, \
- .mode = S_IRUGO | S_IWUSR, \
- }, \
- .mask = ML_##_name, \
- }
- static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
- define_mask(TCP),
- define_mask(MSG),
- define_mask(SOCKET),
- define_mask(HEARTBEAT),
- define_mask(HB_BIO),
- define_mask(DLMFS),
- define_mask(DLM),
- define_mask(DLM_DOMAIN),
- define_mask(DLM_THREAD),
- define_mask(DLM_MASTER),
- define_mask(DLM_RECOVERY),
- define_mask(DLM_GLUE),
- define_mask(VOTE),
- define_mask(CONN),
- define_mask(QUORUM),
- define_mask(BASTS),
- define_mask(CLUSTER),
- define_mask(ERROR),
- define_mask(NOTICE),
- define_mask(KTHREAD),
- };
复制代码 小弟最近看linux-3.2.7内核中,Masklog.c中,这部分内容,意思呢我懂,就是在创建一个变量数组时候同时将其赋值,但是这种赋值我有点想不明白。。{:3_196:}
还请各位高手先知们解答,小弟拜上 |
|