Device types and char device registering.
[cascardo/kernel/old_slides/.git] / _ldd.xml
index f5a8bff..4930ffc 100644 (file)
--- a/_ldd.xml
+++ b/_ldd.xml
@@ -167,4 +167,60 @@ lseek (fd, 0, SEEK\_END);
 </para>
 </foil>
 
+<foil>
+<title>ioctl</title>
+<para>
+The ioctl system call is a catch-all operation. For those operations
+which doesn't fit in the read/write model, the ioctl allows the user to
+send a command with an optional argument to the device. This command may
+accept input or generate output.
+</para>
+<para>
+int ioctl (int fd, int request, char *arg);
+</para>
+<para>
+The last argument is optional and depends on the type of request. Every
+device or device class may have its different set of ioctl's.
+</para>
+<para>
+Example:
+</para>
+<para>
+struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&#38;req);
+</para>
+</foil>
+
+<foil>
+<title>Linux Modules</title>
+<para>
+Linux is modularized. Drivers, filesystems, network protocols and others
+may be loaded at runtime. Every module has an init and an exit
+functions.
+</para>
+<para>
+Modules may have parameters. In load time, parameters, which may be
+boolean, integers or strings, are given by the user.
+</para>
+</foil>
+
+<foil>
+<title>Device types and numbers</title>
+<para>
+Linux devices may be of different types, including character devices,
+block devices or network devices. Both character and block devices have
+identifying numbers, a major and a minor number.
+</para>
+<para>
+In Linux, major and minor numbers have to be requested or allocated. The
+calls to do that are:
+</para>
+<para>
+int register\_chrdev\_region (dev\_t first, unsigned int count, char
+*name);
+int alloc\_chrdev\_region (dev\_t *dev, unsigned int firstminor,
+unsigned int count, char *name);
+void unregister\_chrdev\_region (dev\_t dev, unsigned int count);
+</para>
+</foil>
+
 </slides>