device - What kernel module function gets called, when I say "cat myfile > /dev/sda" -
i've skimmed through linux kernel module programming guide, can't figure out:
when cat image.iso > /dev/sda, cause write function of file_operations structure executed sda device driver? or file interface not applied block device nodes?
where find function's implementation? (the respective driver within linux code tree)?
fs/block-dev.c defines file operations , address space operations applicable block devices.
static const struct address_space_operations def_blk_aops = { .readpage = blkdev_readpage, .writepage = blkdev_writepage, .write_begin = blkdev_write_begin, .write_end = blkdev_write_end, .writepages = generic_writepages, .releasepage = blkdev_releasepage, .direct_io = blkdev_direct_io, .is_dirty_writeback = buffer_check_dirty_writeback, }; const struct file_operations def_blk_fops = { .open = blkdev_open, .release = blkdev_close, .llseek = block_llseek, .read = do_sync_read, .write = do_sync_write, .aio_read = blkdev_aio_read, .aio_write = blkdev_aio_write, .mmap = generic_file_mmap, .fsync = blkdev_fsync, .unlocked_ioctl = block_ioctl, #ifdef config_compat .compat_ioctl = compat_blkdev_ioctl, #endif .splice_read = generic_file_splice_read, .splice_write = generic_file_splice_write, };
Comments
Post a Comment