Character vs block device driver


















 · Block device drivers are particularly well-suited for disk drives, the most common block devices. A character device is any device that .  · Block file: A block file is a hardware file which read/write data in blocks instead of character by character. This type of files are very much useful when we want to write/read data in bulk fashion. All our disks such are HDD, USB and CDROMs are block devices. This is the reason when we are formatting we consider block size.  · Typically, a platform device driver can fit into character device driver section, as they generally involve on-chip operations, for initialization and to transfer a few bytes, whenever needed, but not in terms of blocks (KB, MB, GB) of data. Kernel Module? Now, a driver can be either compiled (to be integrated) into kernel image (zImage/bzImage/).


Character devices have a single current position, while block devices must be able to move to any position in the device to provide random access to data. To simplify work with block devices, the Linux kernel provides an entire subsystem called the block I/O (or block layer) subsystem. Block device drivers are particularly well-suited for disk drives, the most common block devices. A character device is any device that can have streams of characters read from or written to it. Rep: A block device would read/write bytes in fixed size blocks, as in disk sectors. Character devices read/write 0 or more bytes, in a stream, such as a TTY or a keyboard. The nature of the device generally dictates how the device driver is written for it, and you access the device accordingly. Mostly, when accessing devices, you treat then as if they are files: open-read-write-seek-flush-stat-close.


Sep 2, For character devices, the driver sends/receives single bytes. For block devices, communication is in entire blocks. For example, hard disk. Registering a block device driver is rather more complicated than the character as it requires some effort at kernel boot time, like characters drivers. Examples of devices using character drivers include tape drives and serial ports. Character device drivers can also.

0コメント

  • 1000 / 1000