我正在研究内核架构及其编程以了解有关内核的概念。 我知道 C 编程,但内核代码中提到的结构和指针让我难以理解。如下图
int irq = regs.orig_eax & 0xff;
asmlinkage int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
struct irqaction *action)
{
struct super_operations {
struct inode *(*alloc_inode) (struct super_block *sb);
void (*destroy_inode) (struct inode *);
void (*read_inode) (struct inode *);
void (*dirty_inode) (struct inode *);
void (*write_inode) (struct inode *, int);
void (*put_inode) (struct inode *);
void (*drop_inode) (struct inode *);
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
int (*sync_fs) (struct super_block *, int);
void (*write_super_lockfs) (struct super_block *);
void (*unlockfs) (struct super_block *);
int (*statfs) (struct super_block *, struct statfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
int (*show_options) (struct seq_file *, struct vfsmount *);
};
我怎样才能更好地理解代码。任何教授内核代码中的指针和结构的书
最佳答案
除此之外,这是标准的 C 语法,您必须自己在内核代码中查找结构的定义。这并不难,只是一开始很乏味。
这就是说,Linux Kernel Newbies对您来说可能是一个很好的起点。
关于c - 我怎样才能更好地理解内核 C 编程代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3175954/