Figure 68 File operations when memory devices are opened

drivers/char/mem.c static struct file_operations null_fops = {

.llseek

.read

.write

.splice_write null_lseek, read_null, write_null, splice_write_null, drivers/char/random.c struct file_operations random_fops = { .read .write .poll .ioctl

= random_read, = random_write, = random_poll, = random ioctl,

The same approach is adopted for other device types. A specific set of file operations is first installed on the basis of the major number. These operations can then be replaced by other operations selected according to the minor number.

Continue reading here: Reading and Writing

Was this article helpful?

0 0