Rename posix presentation again.
[cascardo/kernel/old_slides/.git] / 02.a.posix / 02.vfs.xml
diff --git a/02.a.posix/02.vfs.xml b/02.a.posix/02.vfs.xml
deleted file mode 100644 (file)
index 8056a1f..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE slides SYSTEM "/usr/share/xml/docbook/custom/slides/3.3.1/schema/dtd/slides-full.dtd">
-
-<slides>
-
-<slidesinfo>
-<title>Linux Device Drivers</title>
-<author><firstname>Thadeu</firstname><surname>Cascardo</surname></author>
-</slidesinfo>
-
-<foil>
-<title>Introduction</title>
-<para>
-Devices in POSIX Systems are files in /dev directory. As with any files
-in POSIX, they may be opened, closed, read from, written to, seeked,
-ioctl'd, and others.
-</para>
-
-<para>
-Examples of device files:
-</para>
-
-<itemizedlist>
-<listitem>
-<para>
-/dev/sda - A SCSI block device
-</para>
-</listitem>
-<listitem>
-<para>
-/dev/ttyS0 - A Serial terminal device
-</para>
-</listitem>
-</itemizedlist>
-
-</foil>
-
-<foil>
-<title>POSIX I/O calls</title>
-<para>
-POSIX systems have some standard calls for I/O. Since devices are files,
-these same system calls are used to work with devices. We are gonna work
-with the following calls:
-</para>
-<itemizedlist>
-<listitem><para>
-open
-</para></listitem>
-<listitem><para>
-read
-</para></listitem>
-<listitem><para>
-write
-</para></listitem>
-<listitem><para>
-close
-</para></listitem>
-<listitem><para>
-lseek
-</para></listitem>
-<listitem><para>
-ioctl
-</para></listitem>
-</itemizedlist>
-</foil>
-
-<foil>
-<title>open</title>
-<para>
-The open system call opens a file. When working with devices, that's
-when some initialization should be done. Some devices may be opened only
-once at a time.
-</para>
-<para>
-int open (char * filename, int flags);
-</para>
-<para>
-flags may be O\_RDONLY, O\_WRONLY, O\_RDWR and many others, some not
-important for devices.
-</para>
-<para>
-Example:
-</para>
-<para>
-fd = open ("/dev/ttyS0", O\_RDWR);
-</para>
-</foil>
-
-<foil>
-<title>close</title>
-<para>
-The close system call closes an open file.
-</para>
-<para>
-int close (int fd);
-</para>
-<para>
-Example:
-</para>
-<para>
-close (fd);
-</para>
-</foil>
-
-<foil>
-<title>read</title>
-<para>
-The read system call reads data from an open file into a buffer. For
-devices, it reads from the device.
-</para>
-<para>
-int read (int fd, char *buffer, int bsz);
-</para>
-<para>
-Read returns the number of bytes written into the buffer, which may be
-less than the number of bytes requested for any number of reasons.
-</para>
-<para>
-Example:
-</para>
-<para>
-c = read (fd, buffer, sizeof (buffer));
-</para>
-</foil>
-
-<foil>
-<title>write</title>
-<para>
-The write system call writes data to an open file from a buffer. For
-devices, it writes to the device.
-</para>
-<para>
-int write (int fd, char *buffer, int bsz);
-</para>
-<para>
-Write returns the number of bytes written to the file, which may be
-less than the number of bytes requested for any number of reasons.
-</para>
-<para>
-Example:
-</para>
-<para>
-c = write (fd, buffer, strlen (buffer));
-</para>
-</foil>
-
-<foil>
-<title>lseek</title>
-<para>
-The lseek system call changes the current position of the file, allowing
-to read or write in that position. Seeking on a device may have many
-different meanings.
-</para>
-<para>
-off\_t lseek (int fd, off\_t pos, int whence);
-</para>
-<para>
-The meaning of the position depends on the value of whence, which can be
-SEEK\_SET (the absolute position), SEEK\_CUR (relative to the current
-position), SEEK\_END (relative to the end of the file).
-</para>
-<para>
-Example:
-</para>
-<para>
-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>
-</foil>
-
-<foil>
-<title>Character devices allocation</title>
-<para>
-In Linux, major and minor numbers have to be requested or allocated. The
-calls to do that for character devices 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>