Não, isso é determinado pelo sistema operacional.
FreeBSD Architecture Handbook dated 2018-09-23 11:38:04.
9.4 Block Devices (Are Gone)
Other UNIX® systems may support a second type of disk device known as block devices. Block devices are disk devices for which the kernel provides caching [...] FreeBSD dropped support for cached disk devices as part of the modernization of the disk I/O infrastructure.
O FreeBSD ainda tem dispositivos "brutos", que são dispositivos de caracteres que permitem ler e gravar blocos de disco.
Não se confunda com os nomes. Dispositivos de bloco fornecem armazenamento em buffer - o que permite ler e gravar em unidades de bytes. Dispositivos brutos são um tipo de dispositivo de caractere - mas eles exigem que você leia e escreva em unidades de blocos. O tamanho do bloco depende do hardware específico do disco.
"Dispositivos de caracteres" provavelmente foram originalmente nomeados após os terminais teletipo , que trabalham fisicamente um caractere de cada vez. Os dispositivos de bloco eram um caso específico em que read()
e write()
interagiam com o cache de buffer, em vez de diretamente com o driver de dispositivo. Os dispositivos de caracteres tornaram-se o caso geral, usado para todos os outros arquivos de dispositivos. A interface é flexível, pois, além de read()
e write()
específicas do dispositivo, ela pode suportar comandos arbitrários com ioctl()
.
https://en.wikipedia.org/wiki/Device_file#Block_devices
Most systems create both block and character devices to represent hardware like hard disks. FreeBSD and Linux notably do not; the former has removed support for block devices,[6] while the latter creates only block devices. In Linux, to get a character device for a disk one must use the "raw" driver, though one can get the same effect as opening a character device by opening the block device with the Linux-specific
O_DIRECT
flag.Block special files or block devices provide buffered access to hardware devices, and provide some abstraction from their specifics.[5] Unlike character devices, block devices will always allow the programmer to read or write a block of any size (including single characters/bytes) and any alignment. The downside is that because block devices are buffered, the programmer does not know how long it will take before written data is passed from the kernel's buffers to the actual device, or indeed in what order two separate writes will arrive at the physical device. Additionally, if the same hardware exposes both character and block devices, there is a risk of data corruption due to clients using the character device being unaware of changes made in the buffers of the block device.