LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1000|回复: 5

内核结构真好,不过有的语句看不懂

[复制链接]
发表于 2004-5-31 22:57:47 | 显示全部楼层 |阅读模式
在fs.h里
struct file_system_type {
        const char *name;
        int fs_flags;
        struct super_block *(*read_super) (struct super_block *, void *, int);
        struct module *owner;
        struct file_system_type * next;
        struct list_head fs_supers;
};

不知道那句
        struct super_block *(*read_super) (struct super_block *, void *, int);
是什么意思.

C语言学的有点差....
发表于 2004-6-1 09:48:25 | 显示全部楼层
函数指针read_super
 楼主| 发表于 2004-6-1 14:09:45 | 显示全部楼层

明白了,谢谢

很像C++的成员函数呢.
 楼主| 发表于 2004-6-1 14:21:42 | 显示全部楼层

还有一点不明白的.

还是include/fs.h中
在struct inode的定义中,有一个成员变量
__u32 i_generation;
请问这种有两个下划线打头的东西是什么类型??
发表于 2004-6-6 08:03:51 | 显示全部楼层
一般情况下下划线是为了产生不会与用户定义冲突的变量,类型等,这只是为了防止冲突而加入的
发表于 2004-6-18 13:36:44 | 显示全部楼层

回复: 内核结构真好,不过有的语句看不懂

最初由 KMnO4 发表
在fs.h里
struct file_system_type {
        const char *name;
        int fs_flags;
        struct super_block *(*read_super) (struct super_block *, void *, int);
        struct module *owner;
        struct file_system_type * next;
        struct list_head fs_supers;
};

不知道那句
        struct super_block *(*read_super) (struct super_block *, void *, int);
是什么意思.

C语言学的有点差....


read_super为一个函数指针,返回类型为一个指向super_block结构的指针.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表