While writing kernel modules/drivers, most of the time some structures are initialized to point to some specific functions. As a beginner in this could someone explain the importance of this.
I saw the struct file_operations while writing the character device driver
Also I found that eventhough the functions are declared they are not implemented always. Could anyone help on that too. For example, in the kernel source: kernel/dma.c, eventhough
static const struct file_operations proc_dma_operations = {
.open = proc_dma_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
are defined, only proc_dma_open is implemented.
The functions
seq_read,seq_lseekandsingle_releaseare declared in the kernel source filelinux-3.1.6/include/linux/seq_file.hand defined in the kernel source filelinux-3.1.6/fs/seq_file.c. They are probably common to many file operations.