3 Devices in POSIX Systems are files in /dev directory. As with any files
4 in POSIX, they may be opened, closed, read from, written to, seeked,
7 Examples of device files:
9 * /dev/sda - A SCSI block device
10 * /dev/ttyS0 - A Serial terminal device
14 POSIX systems have some standard calls for I/O. Since devices are files,
15 these same system calls are used to work with devices. We are gonna work
16 with the following calls:
25 # Device types and numbers
27 Linux devices may be of different types, including character devices,
28 block devices or network devices. Both character and block devices have
29 identifying numbers, a major and a minor number.
31 # Character devices allocation
33 In Linux, major and minor numbers have to be requested or allocated. The
34 calls to do that for character devices are:
37 * int register\\_chrdev\\_region (dev\\_t first, unsigned int count, char
39 * int alloc\\_chrdev\\_region (dev\\_t *dev, unsigned int firstminor,
40 unsigned int count, char *name);
41 * void unregister\\_chrdev\\_region (dev\\_t dev, unsigned int count);