From 26cded7024aa8d08c3b972975b0e4bf9cc7f8068 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Mon, 7 Dec 2009 03:00:26 -0200 Subject: [PATCH] =?utf8?q?Revert=20"Traduzido=20para=20o=20portugu=C3=AAs.?= =?utf8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit 07e42265974da64efdb139647780b3f133590374. --- 02.a.posix/02.vfs.xml | 113 +++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/02.a.posix/02.vfs.xml b/02.a.posix/02.vfs.xml index a1085c6..8056a1f 100644 --- a/02.a.posix/02.vfs.xml +++ b/02.a.posix/02.vfs.xml @@ -9,26 +9,26 @@ -Introdução +Introduction -Dispositivos em sistemas POSIX são arquivos no diretório /dev. Como quaisquer -outros arquivos no POSIX, eles podem ser abertos, fechados, lidos, escritos, -posicionados, controlados, entre outros. +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. -Exemplos de arquivos de dispositivos: +Examples of device files: -/dev/sda - Um dispositivo de bloco SCSI +/dev/sda - A SCSI block device -/dev/ttyS0 - Um dispositivo terminal serial +/dev/ttyS0 - A Serial terminal device @@ -36,11 +36,11 @@ Exemplos de arquivos de dispositivos: -Chamandas de Entrada e Saída em POSIX +POSIX I/O calls -Sistemas POSIX possuem algumas chamadas padrões para E/S. Já que dispositivos -são arquivos, essas mesmas chamadas são utilizadas para trabalhar com -dispositivos. Vamos trabalhar com as seguintes chamadas: +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: @@ -67,19 +67,19 @@ ioctl open -A chamada de systema open abre um arquivo. Quando estivermos trabalhando com -dispositivo, é quando alguma inicialização deve ser feita. Alguns dispositivos -só podem ser abertos por um processo de cada vez. +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. int open (char * filename, int flags); -flags podem ser O\_RDONLY, O\_WRONLY, O\_RDWR e muitas outras, algumas menos -importantes para dispositivos. +flags may be O\_RDONLY, O\_WRONLY, O\_RDWR and many others, some not +important for devices. -Exemplo: +Example: fd = open ("/dev/ttyS0", O\_RDWR); @@ -89,13 +89,13 @@ fd = open ("/dev/ttyS0", O\_RDWR); close -A chamada de sistema close fecha um arquivo aberto. +The close system call closes an open file. int close (int fd); -Exemplo: +Example: close (fd); @@ -105,18 +105,18 @@ close (fd); read -A chamada de sistema read lê de um arquivo aberto para um buffer. Para -dispositivos, ela lê de um dispositivo. +The read system call reads data from an open file into a buffer. For +devices, it reads from the device. int read (int fd, char *buffer, int bsz); -read retorna o número de bytes escritos no buffer, que pode ser menor que o -número de bytes requisitados por diferentes razões. +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. -Exemplo: +Example: c = read (fd, buffer, sizeof (buffer)); @@ -126,18 +126,18 @@ c = read (fd, buffer, sizeof (buffer)); write -A chamada de sistema write escreve dados de um buffer em um arquivo aberto. Para -dispositivos, ela escreve no dispositivo. +The write system call writes data to an open file from a buffer. For +devices, it writes to the device. int write (int fd, char *buffer, int bsz); -write retorna o número de bytes escritos no arquivo, que pode ser menor que o -número de bytes requisitados por diferentes razões. +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. -Exemplo: +Example: c = write (fd, buffer, strlen (buffer)); @@ -147,20 +147,20 @@ c = write (fd, buffer, strlen (buffer)); lseek -A chamada de sistema lseek muda a posição corrente do arquivo, permitindo a -leitura ou escrita naquela posição. Posicionar em um dispositivo pode ter -diferentes significados. +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. off\_t lseek (int fd, off\_t pos, int whence); -O significado da posição depende do valor de whence, que pode ser -SEEK\_SET (a posição absoluta), SEEK\_CUR (relativa a posição corrente), -SEEK\_END (relativa ao fim do arquivo). +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). -Exemplo: +Example: lseek (fd, 0, SEEK\_END); @@ -170,20 +170,20 @@ lseek (fd, 0, SEEK\_END); ioctl -A chamada de sistema ioctl é uma operação "pega-tudo". Para aquelas operações -que não se encaixam no modelo leitura/escrita, ioctl permite ao usuário enviar -um comando com um argumento opcional ao dispositivo. Esse comando pode aceitar -entrada ou gerar saída. +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. int ioctl (int fd, int request, char *arg); -O último argumento é opcional e depende do tipo de requisição. Todo dispositivo -ou classe de dispositivo pode ter seu diferente conjunto de ioctl's. +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. -Exemplo: +Example: struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&req); @@ -191,33 +191,32 @@ struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&req); -Módulos do Linux +Linux Modules -Linux é modularizado. Drivers, sistemas de arquivos, protocolos de rede e outros -podem ser carregados em tempo de execução. Todo módulos tem uma função init e -uma função exit. +Linux is modularized. Drivers, filesystems, network protocols and others +may be loaded at runtime. Every module has an init and an exit +functions. -Módulos podem ter parâmetros. Em tempo de carga, parâmetros, que podem ser -booleanos, inteiros ou strings, são dados pelo usuário. +Modules may have parameters. In load time, parameters, which may be +boolean, integers or strings, are given by the user. -Tipos e números de dispositivos +Device types and numbers -Dispositivos no Linux podem ter diferentes tipos, incluindo dispositivos de -caractere, dispositivos de bloco e dispositivos de rede. Tanto dispositivos de -caractere quanto de bloco têm números identificadores, um número maior e um -número menor. +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. -Alocação de dispositivos de caractere +Character devices allocation -No Linux, números maior e menor devem ser requisitados ou alocados. As chamadas -para fazê-lo para os dispositivos de caractere são: +In Linux, major and minor numbers have to be requested or allocated. The +calls to do that for character devices are: int register\_chrdev\_region (dev\_t first, unsigned int count, char -- 2.20.1