# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR The FreeBSD Project # This file is distributed under the same license as the FreeBSD Documentation package. # Danilo G. Baio , 2021. # Edson Brandi , 2023. # "Danilo G. Baio" , 2023. msgid "" msgstr "" "Project-Id-Version: FreeBSD Documentation VERSION\n" "POT-Creation-Date: 2022-02-01 09:21-0300\n" "PO-Revision-Date: 2023-05-04 20:00+0000\n" "Last-Translator: Edson Brandi \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.17\n" #. type: YAML Front Matter: description #: documentation/content/en/articles/geom-class/_index.adoc:1 #, no-wrap msgid "A guide to GEOM internals, and writing your own GEOM class" msgstr "" "Um guia sobre os internals do GEOM e sobre como escrever sua própria classe " "GEOM" #. type: Title = #: documentation/content/en/articles/geom-class/_index.adoc:1 #: documentation/content/en/articles/geom-class/_index.adoc:11 #, no-wrap msgid "Writing a GEOM Class" msgstr "Escrevendo uma classe GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:44 msgid "Abstract" msgstr "Resumo" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:47 msgid "" "This text documents some starting points in developing GEOM classes, and " "kernel modules in general. It is assumed that the reader is familiar with C " "userland programming." msgstr "" "Este texto documenta alguns pontos de partida no desenvolvimento de classes " "GEOM e módulos de kernel em geral. Pressupõe-se que o leitor esteja " "familiarizado com a programação de espaço de usuário em C." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:49 msgid "'''" msgstr "'''" #. type: Title == #: documentation/content/en/articles/geom-class/_index.adoc:53 #, no-wrap msgid "Introduction" msgstr "Introdução" #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:56 #, no-wrap msgid "Documentation" msgstr "Documentação" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:60 msgid "" "Documentation on kernel programming is scarce - it is one of few areas where " "there is nearly nothing in the way of friendly tutorials, and the phrase " "\"use the source!\" really holds true. However, there are some bits and " "pieces (some of them seriously outdated) floating around that should be " "studied before beginning to code:" msgstr "" "A documentação sobre programação de kernel é escassa - é uma das poucas " "áreas em que quase não há tutoriais amigáveis, e a frase \"use o código " "fonte!\" realmente é verdadeira. No entanto, existem alguns fragmentos (" "alguns deles seriamente desatualizados) circulando que devem ser estudados " "antes de começar a codificar:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:62 msgid "" "The extref:{developers-handbook}[FreeBSD Developer's Handbook] - part of the " "documentation project, it does not contain anything specific to kernel " "programming, but rather some general useful information." msgstr "" "O extref:{developers-handbook}[Handbook do Desenvolvedor do FreeBSD] - parte " "do projeto de documentação, não contém nada específico sobre programação do " "kernel, mas sim algumas informações úteis em geral." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:63 msgid "" "The extref:{arch-handbook}[FreeBSD Architecture Handbook] - also from the " "documentation project, contains descriptions of several low-level facilities " "and procedures. The most important chapter is 13, extref:{arch-handbook}" "[Writing FreeBSD device drivers, driverbasics]." msgstr "" "O extref:{arch-handbook}[Handbook de Arquitetura do FreeBSD] - também do " "projeto de documentação, contém descrições de várias instalações e " "procedimentos de baixo nível. O capítulo mais importante é o 13, extref" ":{arch-handbook}[Escrevendo drivers de dispositivos FreeBSD, driverbasics]." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:64 msgid "" "The Blueprints section of http://www.freebsddiary.org[FreeBSD Diary] web " "site - contains several interesting articles on kernel facilities." msgstr "" "A seção Blueprints do site http://www.freebsddiary.org contém vários artigos " "interessantes sobre as facilidades do kernel." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:65 msgid "" "The man pages in section 9 - for important documentation on kernel functions." msgstr "" "As páginas de manual da seção 9 - para documentação importante sobre as " "funções do kernel." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:66 msgid "" "The man:geom[4] man page and http://phk.freebsd.dk/pubs/[PHK's GEOM slides] " "- for general introduction of the GEOM subsystem." msgstr "" "A página de manual man:geom[4] e os slides sobre o GEOM do PHK em http://phk." "freebsd.dk/pubs/ - para uma introdução geral ao subsistema GEOM." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:67 msgid "" "Man pages man:g_bio[9], man:g_event[9], man:g_data[9], man:g_geom[9], man:" "g_provider[9], man:g_consumer[9], man:g_access[9] & others linked from " "those, for documentation on specific functionalities." msgstr "" "As páginas de manual man:g_bio[9], man:g_event[9], man:g_data[9], " "man:g_geom[9], man:g_provider[9], man:g_consumer[9], man:g_access[9] e " "outras vinculadas a elas, para documentação sobre funcionalidades " "específicas." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:68 msgid "" "The man:style[9] man page - for documentation on the coding-style " "conventions which must be followed for any code which is to be committed to " "the FreeBSD tree." msgstr "" "A página de manual man:style[9] - para documentação sobre as convenções de " "estilo de codificação que devem ser seguidas para qualquer código que seja " "commitado para a árvore do FreeBSD." #. type: Title == #: documentation/content/en/articles/geom-class/_index.adoc:70 #, no-wrap msgid "Preliminaries" msgstr "Preliminares" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:77 msgid "" "The best way to do kernel development is to have (at least) two separate " "computers. One of these would contain the development environment and " "sources, and the other would be used to test the newly written code by " "network-booting and network-mounting filesystems from the first one. This " "way if the new code contains bugs and crashes the machine, it will not mess " "up the sources (and other \"live\" data). The second system does not even " "require a proper display. Instead, it could be connected with a serial " "cable or KVM to the first one." msgstr "" "A melhor maneira de desenvolver para o kernel é ter (pelo menos) dois " "computadores separados. Um deles conteria o ambiente de desenvolvimento e as " "fontes, e o outro seria usado para testar o código recém-escrito por meio do " "boot e montagem de sistemas de arquivos por rede do primeiro. Dessa forma, " "se o novo código contiver erros e travar a máquina, ele não afetará as " "fontes (e outros dados \"ao vivo\"). O segundo sistema nem mesmo precisa de " "uma tela adequada. Em vez disso, ele pode ser conectado com um cabo serial " "ou KVM para o primeiro." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:80 msgid "" "But, since not everybody has two or more computers handy, there are a few " "things that can be done to prepare an otherwise \"live\" system for " "developing kernel code. This setup is also applicable for developing in a " "http://www.vmware.com/[VMWare] or http://www.qemu.org/[QEmu] virtual machine " "(the next best thing after a dedicated development machine)." msgstr "" "No entanto, como nem todo mundo tem dois ou mais computadores disponíveis, " "existem algumas coisas que podem ser feitas para preparar um sistema \"ao " "vivo\" para o desenvolvimento de código do kernel. Essa configuração também " "é aplicável para desenvolvimento em uma máquina virtual http://www.vmware." "com/[VMWare] ou http://www.qemu.org/[QEmu] (a próxima melhor opção depois de " "uma máquina de desenvolvimento dedicada)." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:82 #, no-wrap msgid "Modifying a System for Development" msgstr "Modificando um sistema para desenvolvimento" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:85 msgid "" "For any kernel programming a kernel with `INVARIANTS` enabled is a must-" "have. So enter these in your kernel configuration file:" msgstr "" "Para qualquer programação de kernel, é essencial ter um kernel com " "`INVARIANTS` ativado. Portanto, adicione as seguintes opções no arquivo de " "configuração do kernel:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:90 #, no-wrap msgid "" "options INVARIANT_SUPPORT\n" "options INVARIANTS\n" msgstr "" "options INVARIANT_SUPPORT\n" "options INVARIANTS\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:93 msgid "" "For more debugging you should also include WITNESS support, which will alert " "you of mistakes in locking:" msgstr "" "Para obter mais depuração, você também deve incluir o suporte a WITNESS, que " "alertará sobre erros de bloqueio:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:98 #, no-wrap msgid "" "options WITNESS_SUPPORT\n" "options WITNESS\n" msgstr "" "options WITNESS_SUPPORT\n" "options WITNESS\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:101 msgid "For debugging crash dumps, a kernel with debug symbols is needed:" msgstr "" "Para depurar despejos de falhas (crash dumps), é necessário um kernel com " "símbolos de depuração:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:105 #, no-wrap msgid " makeoptions DEBUG=-g\n" msgstr " makeoptions DEBUG=-g\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:110 msgid "" "With the usual way of installing the kernel (`make installkernel`) the debug " "kernel will not be automatically installed. It is called [.filename]#kernel." "debug# and located in [.filename]#/usr/obj/usr/src/sys/KERNELNAME/#. For " "convenience it should be copied to [.filename]#/boot/kernel/#." msgstr "" "Com a maneira usual de instalar o kernel (`make installkernel`), o kernel de " "depuração não será instalado automaticamente. Ele é chamado de [." "filename]#kernel.debug# e fica localizado em [.filename]#/usr/obj/usr/src/" "sys/NOME_DO_KERNEL/#. Por conveniência, ele deve ser copiado para [." "filename]#/boot/kernel/#." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:113 msgid "" "Another convenience is enabling the kernel debugger so you can examine a " "kernel panic when it happens. For this, enter the following lines in your " "kernel configuration file:" msgstr "" "Outra conveniência é habilitar o depurador do kernel para que você possa " "examinar um kernel panic quando ele ocorrer. Para isso, adicione as " "seguintes linhas no arquivo de configuração do kernel:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:119 #, no-wrap msgid "" "options KDB\n" "options DDB\n" "options KDB_TRACE\n" msgstr "" "options KDB\n" "options DDB\n" "options KDB_TRACE\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:122 msgid "" "For this to work you might need to set a sysctl (if it is not on by default):" msgstr "" "Para que isso funcione, você pode precisar definir um sysctl (se ele não " "estiver ativado por padrão):" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:126 #, no-wrap msgid " debug.debugger_on_panic=1\n" msgstr " debug.debugger_on_panic=1\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:134 msgid "" "Kernel panics will happen, so care should be taken with the filesystem " "cache. In particular, having softupdates might mean the latest file version " "could be lost if a panic occurs before it is committed to storage. " "Disabling softupdates yields a great performance hit, and still does not " "guarantee data consistency. Mounting filesystem with the \"sync\" option is " "needed for that. For a compromise, the softupdates cache delays can be " "shortened. There are three sysctl's that are useful for this (best to be " "set in [.filename]#/etc/sysctl.conf#):" msgstr "" "Panics do kernel podem acontecer, portanto, é preciso ter cuidado com o " "cache do sistema de arquivos. Em particular, ter softupdates pode significar " "que a versão mais recente de um arquivo pode ser perdida se ocorrer um panic " "antes que seja gravada no armazenamento. Desabilitar o softupdates implica " "em uma grande perda de desempenho e ainda não garante a consistência dos " "dados. É necessário montar o sistema de arquivos com a opção \"sync\" para " "garantir isso. Como um compromisso, os atrasos do cache do softupdates podem " "ser encurtados. Existem três sysctl que são úteis para isso (melhor " "configurados em [.filename]#/etc/sysctl.conf#):" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:140 #, no-wrap msgid "" "kern.filedelay=5\n" "kern.dirdelay=4\n" "kern.metadelay=3\n" msgstr "" "kern.filedelay=5\n" "kern.dirdelay=4\n" "kern.metadelay=3\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:143 msgid "The numbers represent seconds." msgstr "Os números representam segundos." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:151 msgid "" "For debugging kernel panics, kernel core dumps are required. Since a kernel " "panic might make filesystems unusable, this crash dump is first written to a " "raw partition. Usually, this is the swap partition. This partition must be " "at least as large as the physical RAM in the machine. On the next boot, the " "dump is copied to a regular file. This happens after filesystems are " "checked and mounted, and before swap is enabled. This is controlled with " "two [.filename]#/etc/rc.conf# variables:" msgstr "" "Para depurar panics do kernel, são necessários os despejos de núcleo do " "kernel. Como um kernel panic pode tornar os sistemas de arquivos " "inutilizáveis, este despejo de falhas é primeiro gravado em uma partição " "raw. Geralmente, isso é feito na partição de swap. Esta partição deve ter " "pelo menos o tamanho da RAM física da máquina. No próximo boot, o despejo é " "copiado para um arquivo regular. Isso acontece após a verificação e montagem " "dos sistemas de arquivos e antes que o swap seja ativado. Isso é controlado " "com duas variáveis do arquivo [.filename]#/etc/rc.conf#:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:156 #, no-wrap msgid "" "dumpdev=\"/dev/ad0s4b\"\n" "dumpdir=\"/usr/core\n" msgstr "" "dumpdev=\"/dev/ad0s4b\"\n" "dumpdir=\"/usr/core\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:159 msgid "" "The `dumpdev` variable specifies the swap partition and `dumpdir` tells the " "system where in the filesystem to relocate the core dump on reboot." msgstr "" "A variável `dumpdev` especifica a partição de swap e `dumpdir` informa ao " "sistema onde no sistema de arquivos realocar o core dump no reboot." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:162 msgid "" "Writing kernel core dumps is slow and takes a long time so if you have lots " "of memory (>256M) and lots of panics it could be frustrating to sit and wait " "while it is done (twice - first to write it to swap, then to relocate it to " "filesystem). It is convenient then to limit the amount of RAM the system " "will use via a [.filename]#/boot/loader.conf# tunable:" msgstr "" "Gravar o core dump do kernel é lento e leva muito tempo, portanto, se você " "tiver muita memória (>256 MB) e muitos panics, pode ser frustrante esperar " "enquanto isso é feito (duas vezes - primeiro para gravá-lo na troca, depois " "para realocá-lo no sistema de arquivos). É conveniente, portanto, limitar a " "quantidade de RAM que o sistema usará por meio de um ajuste no [.filename]#/" "boot/loader.conf#:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:166 #, no-wrap msgid " hw.physmem=\"256M\"\n" msgstr " hw.physmem=\"256M\"\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:169 msgid "" "If the panics are frequent and filesystems large (or you simply do not trust " "softupdates+background fsck) it is advisable to turn background fsck off via " "[.filename]#/etc/rc.conf# variable:" msgstr "" "Se os panics forem frequentes e os sistemas de arquivos forem grandes (ou se " "você simplesmente não confiar no softupdates + fsck em segundo plano), é " "aconselhável desativar o fsck em segundo plano por meio da seguinte variável " "no arquivo [.filename]#/etc/rc.conf#:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:173 #, no-wrap msgid " background_fsck=\"NO\"\n" msgstr " background_fsck=\"NO\"\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:178 msgid "" "This way, the filesystems will always get checked when needed. Note that " "with background fsck, a new panic could happen while it is checking the " "disks. Again, the safest way is not to have many local filesystems by using " "another computer as an NFS server." msgstr "" "Dessa forma, os sistemas de arquivos serão sempre verificados quando " "necessário. Observe que, com o fsck em segundo plano, um novo panic pode " "ocorrer enquanto os discos estão sendo verificados. Novamente, a maneira " "mais segura é não ter muitos sistemas de arquivos locais, usando outro " "computador como um servidor NFS." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:180 #, no-wrap msgid "Starting the Project" msgstr "Começando o projeto" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:184 msgid "" "For the purpose of creating a new GEOM class, an empty subdirectory has to " "be created under an arbitrary user-accessible directory. You do not have to " "create the module directory under [.filename]#/usr/src#." msgstr "" "Para criar uma nova classe GEOM, um subdiretório vazio deve ser criado em um " "diretório arbitrário acessível pelo usuário. Você não precisa criar o " "diretório do módulo em [.filename]#/usr/src#." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:186 #, no-wrap msgid "The Makefile" msgstr "O Makefile" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:189 msgid "" "It is good practice to create [.filename]#Makefiles# for every nontrivial " "coding project, which of course includes kernel modules." msgstr "" "É uma boa prática criar arquivos [.filename]#Makefile# para todos os " "projetos de codificação não triviais, o que inclui, é claro, módulos do " "kernel." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:192 msgid "" "Creating the [.filename]#Makefile# is simple thanks to an extensive set of " "helper routines provided by the system. In short, here is how a minimal [." "filename]#Makefile# looks for a kernel module:" msgstr "" "Criar o arquivo [.filename]#Makefile# é simples graças a um extenso conjunto " "de rotinas auxiliares fornecidas pelo sistema. Em resumo, aqui está como um [" ".filename]#Makefile# mínimo se parece para um módulo do kernel:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:197 #, no-wrap msgid "" "SRCS=g_journal.c\n" "KMOD=geom_journal\n" msgstr "" "SRCS=g_journal.c\n" "KMOD=geom_journal\n" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:199 #, no-wrap msgid ".include \n" msgstr ".include \n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:203 msgid "" "This [.filename]#Makefile# (with changed filenames) will do for any kernel " "module, and a GEOM class can reside in just one kernel module. If more than " "one file is required, list it in the `SRCS` variable, separated with " "whitespace from other filenames." msgstr "" "Este [.filename]#Makefile# (com nomes de arquivo alterados) serve para " "qualquer módulo do kernel e uma classe GEOM pode residir em apenas um módulo " "do kernel. Se mais de um arquivo for necessário, liste-os na variável `SRCS`" ", separados por espaço de outros nomes de arquivo." #. type: Title == #: documentation/content/en/articles/geom-class/_index.adoc:205 #, no-wrap msgid "On FreeBSD Kernel Programming" msgstr "Programação do kernel do FreeBSD" #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:208 #, no-wrap msgid "Memory Allocation" msgstr "Alocação de memória" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:213 msgid "" "See man:malloc[9]. Basic memory allocation is only slightly different than " "its userland equivalent. Most notably, `malloc`() and `free`() accept " "additional parameters as is described in the man page." msgstr "" "Consulte man:malloc[9]. A alocação básica de memória é apenas ligeiramente " "diferente da sua equivalente no espaço do usuário. Mais notavelmente, " "`malloc()` e `free()` aceitam parâmetros adicionais conforme descrito na " "página do manual." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:215 msgid "" "A \"malloc type\" must be declared in the declaration section of a source " "file, like this:" msgstr "" "Um \"malloc type\" deve ser declarado na seção de declaração de um arquivo " "de código fonte, por exemplo desta forma:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:219 #, no-wrap msgid " static MALLOC_DEFINE(M_GJOURNAL, \"gjournal data\", \"GEOM_JOURNAL Data\");\n" msgstr "" " static MALLOC_DEFINE(M_GJOURNAL, \"gjournal data\", \"GEOM_JOURNAL Data\");" "\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:222 msgid "" "To use this macro, [.filename]#sys/param.h#, [.filename]#sys/kernel.h# and [." "filename]#sys/malloc.h# headers must be included." msgstr "" "Para usar essa macro, os cabeçalhos [.filename]#sys/param.h#, [.filename]#" "sys/kernel.h# e [.filename]#sys/malloc.h# devem ser incluídos." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:225 msgid "" "There is another mechanism for allocating memory, the UMA (Universal Memory " "Allocator). See man:uma[9] for details, but it is a special type of " "allocator mainly used for speedy allocation of lists comprised of same-sized " "items (for example, dynamic arrays of structs)." msgstr "" "Existe outro mecanismo para alocar memória, o UMA (Universal Memory " "Allocator). Consulte man:uma[9] para obter detalhes, mas é um tipo especial " "de alocador usado principalmente para alocação rápida de listas compostas " "por itens do mesmo tamanho (por exemplo, matrizes dinâmicas de estruturas)." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:227 #, no-wrap msgid "Lists and Queues" msgstr "Listas e filas" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:234 msgid "" "See man:queue[3]. There are a LOT of cases when a list of things needs to " "be maintained. Fortunately, this data structure is implemented (in several " "ways) by C macros included in the system. The most used list type is TAILQ " "because it is the most flexible. It is also the one with largest memory " "requirements (its elements are doubly-linked) and also the slowest (although " "the speed variation is on the order of several CPU instructions more, so it " "should not be taken seriously)." msgstr "" "Consulte man:queue[3]. Existem MUITOS casos em que uma lista de coisas " "precisa ser mantida. Felizmente, essa estrutura de dados é implementada (de " "várias maneiras) por macros em C incluídas no sistema. O tipo de lista mais " "usado é TAILQ porque é o mais flexível. Também é o que tem os maiores " "requisitos de memória (seus elementos são duplamente vinculados) e também o " "mais lento (embora a variação de velocidade seja da ordem de algumas " "instruções de CPU a mais, então não deve ser levado a sério)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:236 msgid "" "If data retrieval speed is very important, see man:tree[3] and man:" "hashinit[9]." msgstr "" "Se a velocidade de recuperação de dados é muito importante, consulte " "man:tree[3] e man:hashinit[9]." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:238 #, no-wrap msgid "BIOs" msgstr "BIOS" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:242 msgid "" "Structure `bio` is used for any and all Input/Output operations concerning " "GEOM. It basically contains information about what device ('provider') " "should satisfy the request, request type, offset, length, pointer to a " "buffer, and a bunch of \"user-specific\" flags and fields that can help " "implement various hacks." msgstr "" "A estrutura `bio` é usada para todas e quaisquer operações de entrada/saída " "relacionadas ao GEOM. Basicamente, ela contém informações sobre qual " "dispositivo ('provider') deve satisfazer a solicitação, tipo de solicitação, " "deslocamento, comprimento, ponteiro para um buffer e um conjunto de flags e " "campos \"específicos do usuário\" que podem ajudar a implementar vários " "ajustes." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:246 msgid "" "The important thing here is that ``bio``s are handled asynchronously. That " "means that, in most parts of the code, there is no analogue to userland's " "man:read[2] and man:write[2] calls that do not return until a request is " "done. Rather, a developer-supplied function is called as a notification " "when the request gets completed (or results in error)." msgstr "" "O importante aqui é que os ``bio``s são manipulados de forma assíncrona. " "Isso significa que, na maioria das partes do código, não há um análogo das " "chamadas man:read[2] e man:write[2] do espaço do usuário que não retornam " "até que uma solicitação seja concluída. Em vez disso, uma função fornecida " "pelo desenvolvedor é chamada como uma notificação quando a solicitação é " "concluída (ou resulta em erro)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:250 msgid "" "The asynchronous programming model (also called \"event-driven\") is " "somewhat harder than the much more used imperative one used in userland (at " "least it takes a while to get used to it). In some cases the helper " "routines `g_write_data`() and `g_read_data`() can be used, but __not " "always__. In particular, they cannot be used when a mutex is held; for " "example, the GEOM topology mutex or the internal mutex held during the `." "start`() and `.stop`() functions." msgstr "" "O modelo de programação assíncrono (também chamado de \"event-driven\") é um " "pouco mais difícil do que o muito usado modelo imperativo usado no espaço do " "usuário (pelo menos leva um tempo para se acostumar). Em alguns casos, as " "rotinas auxiliares `g_write_data()` e `g_read_data()` podem ser usadas, mas " "__nem sempre__. Em particular, elas não podem ser usadas quando um mutex é " "mantido; por exemplo, o mutex de topologia GEOM ou o mutex interno mantido " "durante as funções `.start()` e `.stop()`." #. type: Title == #: documentation/content/en/articles/geom-class/_index.adoc:252 #, no-wrap msgid "On GEOM Programming" msgstr "Programação GEOM" #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:255 #, no-wrap msgid "Ggate" msgstr "Ggate" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:259 msgid "" "If maximum performance is not needed, a much simpler way of making a data " "transformation is to implement it in userland via the ggate (GEOM gate) " "facility. Unfortunately, there is no easy way to convert between, or even " "share code between the two approaches." msgstr "" "Se o desempenho máximo não for necessário, uma maneira muito mais simples de " "fazer uma transformação de dados é implementá-lo na área do usuário por meio " "do recurso ggate (GEOM gate). Infelizmente, não existe uma maneira fácil de " "converter ou até mesmo compartilhar código entre as duas abordagens." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:261 #, no-wrap msgid "GEOM Class" msgstr "Classe GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:266 msgid "" "GEOM classes are transformations on the data. These transformations can be " "combined in a tree-like fashion. Instances of GEOM classes are called " "__geoms__." msgstr "" "As classes GEOM são transformações nos dados. Essas transformações podem ser " "combinadas de maneira semelhante a uma árvore. As instâncias de classes GEOM " "são chamadas de __geoms__." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:268 msgid "" "Each GEOM class has several \"class methods\" that get called when there is " "no geom instance available (or they are simply not bound to a single " "instance):" msgstr "" "Cada classe GEOM tem vários \"métodos de classe\" que são chamados quando " "não há uma instância geom disponível (ou simplesmente não estão vinculados a " "uma única instância):" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:270 msgid "" "`.init` is called when GEOM becomes aware of a GEOM class (when the kernel " "module gets loaded.)" msgstr "" "O `.init` é chamado quando o GEOM toma conhecimento de uma classe GEOM (" "quando o módulo do kernel é carregado.)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:271 msgid "" "`.fini` gets called when GEOM abandons the class (when the module gets " "unloaded)" msgstr "" "O `.fini` é chamado quando o GEOM abandona a classe (quando o módulo é " "descarregado)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:272 msgid "" "`.taste` is called next, once for each provider the system has available. If " "applicable, this function will usually create and start a geom instance." msgstr "" "O `.taste` é chamado em seguida, uma vez para cada provider que o sistema " "tem disponível. Se aplicável, esta função geralmente criará e iniciará uma " "instância geom." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:273 msgid "`.destroy_geom` is called when the geom should be disbanded" msgstr "O `.destroy_geom` é chamado quando o geom deve ser desmontado" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:274 msgid "" "`.ctlconf` is called when user requests reconfiguration of existing geom" msgstr "" "O `.ctlconf` é chamado quando o usuário solicita a reconfiguração do geom " "existente" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:276 msgid "" "Also defined are the GEOM event functions, which will get copied to the geom " "instance." msgstr "" "Também são definidas as funções de evento GEOM, que serão copiadas para a " "instância geom." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:278 msgid "" "Field `.geom` in the `g_class` structure is a LIST of geoms instantiated " "from the class." msgstr "" "O campo `.geom` na estrutura `g_class` é uma LISTA de geoms instanciados a " "partir da classe." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:280 msgid "These functions are called from the g_event kernel thread." msgstr "Estas funções são chamadas a partir da thread g_event do kernel." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:282 #, no-wrap msgid "Softc" msgstr "Softc" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:288 msgid "" "The name \"softc\" is a legacy term for \"driver private data\". The name " "most probably comes from the archaic term \"software control block\". In " "GEOM, it is a structure (more precise: pointer to a structure) that can be " "attached to a geom instance to hold whatever data is private to the geom " "instance. Most GEOM classes have the following members:" msgstr "" "O nome \"softc\" é um termo legado para \"dados privados do driver\". O nome " "provavelmente vem do termo arcaico \"bloco de controle de software\". No " "GEOM, é uma estrutura (mais precisamente, um ponteiro para uma estrutura) " "que pode ser anexada a uma instância geom para manter quaisquer dados que " "sejam privados à instância geom. A maioria das classes GEOM tem os seguintes " "membros:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:290 msgid "`struct g_provider *provider` : The \"provider\" this geom instantiates" msgstr "" "`struct g_provider *provider`: Instância geom criada a partir do provider " "correspondente" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:291 msgid "`uint16_t n_disks` : Number of consumer this geom consumes" msgstr "" "`uint16_t n_disks`: Número de consumidores que esta instância geom consome" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:292 msgid "" "`struct g_consumer \\**disks` : Array of `struct g_consumer*`. (It is not " "possible to use just single indirection because struct g_consumer* are " "created on our behalf by GEOM)." msgstr "" "`struct g_consumer \\**disks`: Array de `struct g_consumer*`. (Não é " "possível usar apenas uma única indireção porque os `struct g_consumer*` são " "criados em nosso nome pelo GEOM)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:295 msgid "" "The `softc` structure contains all the state of geom instance. Every geom " "instance has its own softc." msgstr "" "A estrutura `softc` contém todo o estado da instância geom. Cada instância " "geom tem sua própria estrutura `softc`." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:297 #, no-wrap msgid "Metadata" msgstr "Metadados" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:300 msgid "" "Format of metadata is more-or-less class-dependent, but MUST start with:" msgstr "" "O formato dos metadados é mais ou menos dependente da classe, mas DEVE " "começar com:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:302 msgid "16 byte buffer for null-terminated signature (usually the class name)" msgstr "" "Buffer de 16 bytes para uma assinatura de terminação nula (geralmente o nome " "da classe)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:303 msgid "uint32 version ID" msgstr "ID da versão uint32" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:305 msgid "" "It is assumed that geom classes know how to handle metadata with version " "ID's lower than theirs." msgstr "" "Assume-se que as classes geom sabem como lidar com metadados com ID de " "versão menores que os deles." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:307 msgid "" "Metadata is located in the last sector of the provider (and thus must fit in " "it)." msgstr "" "Os metadados estão localizados no último setor do provedor (e, portanto, " "devem caber nele)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:309 msgid "" "(All this is implementation-dependent but all existing code works like that, " "and it is supported by libraries.)" msgstr "" "(Tudo isso depende da implementação, mas todo o código existente funciona " "assim, e é suportado por bibliotecas.)" #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:311 #, no-wrap msgid "Labeling/creating a GEOM" msgstr "Rotulando/criando um GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:314 msgid "The sequence of events is:" msgstr "A sequência de eventos é:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:316 msgid "user calls man:geom[8] utility (or one of its hardlinked friends)" msgstr "" "O usuário chama o utilitário man:geom[8] (ou um comandos alternativos para o " "mesmo utilitário)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:317 msgid "" "the utility figures out which geom class it is supposed to handle and " "searches for [.filename]#geom_CLASSNAME.so# library (usually in [.filename]#/" "lib/geom#)." msgstr "" "O utilitário determina qual classe geom ele deve manipular e procura pela " "biblioteca [.filename]#geom_CLASSNAME.so# (geralmente em [.filename]#/lib/" "geom#)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:318 msgid "" "it man:dlopen[3]-s the library, extracts the definitions of command-line " "parameters and helper functions." msgstr "" "O utilitário utiliza a função man:dlopen[3] para carregar dinamicamente a " "biblioteca, extrair as definições dos parâmetros de linha de comando e " "funções auxiliares." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:320 msgid "In the case of creating/labeling a new geom, this is what happens:" msgstr "No caso da criação/rotulação de um novo geom, isso é o que acontece:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:322 msgid "" "man:geom[8] looks in the command-line argument for the command (usually " "`label`), and calls a helper function." msgstr "" "O comando man:geom[8] procura na linha de comando pelo comando (geralmente " "`label`) e chama uma função auxiliar correspondente." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:323 msgid "" "The helper function checks parameters and gathers metadata, which it " "proceeds to write to all concerned providers." msgstr "" "A função auxiliar verifica parâmetros e reúne metadados, que são gravados em " "todos os provedores envolvidos." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:324 msgid "" "This \"spoils\" existing geoms (if any) and initializes a new round of " "\"tasting\" of the providers. The intended geom class recognizes the " "metadata and brings the geom up." msgstr "" "Isso \"anula\" os geoms existentes (se houver) e inicializa uma nova rodada " "de \"degustação\" dos providers. A classe geom pretendida reconhece os " "metadados e coloca o geom em funcionamento." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:326 msgid "" "(The above sequence of events is implementation-dependent but all existing " "code works like that, and it is supported by libraries.)" msgstr "" "(A sequência de eventos acima é dependente da implementação, mas todo o " "código existente funciona assim, e é suportado pelas bibliotecas.)" #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:328 #, no-wrap msgid "GEOM Command Structure" msgstr "Estrutura do Comando GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:332 msgid "" "The helper [.filename]#geom_CLASSNAME.so# library exports `class_commands` " "structure, which is an array of `struct g_command` elements. Commands are " "of uniform format and look like:" msgstr "" "A biblioteca auxiliar [.filename]#geom_CLASSNAME.so# exporta a estrutura " "`class_commands`, que é um array de elementos `struct g_command`. Os " "comandos têm um formato uniforme e se parecem com:" #. type: delimited block . 4 #: documentation/content/en/articles/geom-class/_index.adoc:336 #, no-wrap msgid " verb [-options] geomname [other]\n" msgstr " verb [-options] geomname [other]\n" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:339 msgid "Common verbs are:" msgstr "Verbos comuns são:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:341 msgid "" "label - to write metadata to devices so they can be recognized at tasting " "and brought up in geoms" msgstr "" "label - para escrever metadados nos dispositivos para que possam ser " "reconhecidos durante o processo de \"tasting\" e trazidos à tona em geoms" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:342 msgid "destroy - to destroy metadata, so the geoms get destroyed" msgstr "" "destroy - para destruir metadados, fazendo com que os geoms sejam destruídos" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:344 msgid "Common options are:" msgstr "Opções comuns são:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:346 msgid "`-v` : be verbose" msgstr "`-v` : ser verboso (mostrar mais informações)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:347 msgid "`-f` : force" msgstr "`-f` : forçar" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:351 msgid "" "Many actions, such as labeling and destroying metadata can be performed in " "userland. For this, `struct g_command` provides field `gc_func` that can be " "set to a function (in the same [.filename]#.so#) that will be called to " "process a verb. If `gc_func` is NULL, the command will be passed to kernel " "module, to `.ctlreq` function of the geom class." msgstr "" "Muitas ações, como rotular e destruir metadados, podem ser executadas no " "espaço de usuário. Para isso, `struct g_command` fornece o campo `gc_func`, " "que pode ser definido como uma função (no mesmo arquivo [.filename]#.so#) " "que será chamada para processar um verbo. Se `gc_func` for NULL, o comando " "será passado para o módulo do kernel, para a função `.ctlreq` da classe geom." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:353 #, no-wrap msgid "Geoms" msgstr "Geoms" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:357 msgid "" "Geoms are instances of GEOM classes. They have internal data (a softc " "structure) and some functions with which they respond to external events." msgstr "" "Os Geoms são instâncias das classes GEOM. Eles têm dados internos (uma " "estrutura softc) e algumas funções com as quais eles respondem a eventos " "externos." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:359 msgid "The event functions are:" msgstr "As funções de evento são:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:361 msgid "`.access` : calculates permissions (read/write/exclusive)" msgstr "`.access` : calcula as permissões (leitura/escrita/exclusiva)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:362 msgid "`.dumpconf` : returns XML-formatted information about the geom" msgstr "" "`.dumpconf` : uma função que retorna informações formatadas em XML sobre o " "geom" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:363 msgid "`.orphan` : called when some underlying provider gets disconnected" msgstr "`.orphan` : chamado quando algum provedor subjacente é desconectado" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:364 msgid "`.spoiled` : called when some underlying provider gets written to" msgstr "`.spoiled` : chamado quando algum provedor subjacente é escrito" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:365 msgid "`.start` : handles I/O" msgstr "`.start` : lida com operações de entrada/saída (I/O)" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:367 msgid "" "These functions are called from the `g_down` kernel thread and there can be " "no sleeping in this context, (see definition of sleeping elsewhere) which " "limits what can be done quite a bit, but forces the handling to be fast." msgstr "" "Essas funções são chamadas a partir da thread do kernel `g_down` e não é " "permitido dormir nesse contexto (consulte a definição de dormir em outro " "lugar), o que limita bastante o que pode ser feito, mas força o tratamento a " "ser rápido." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:369 msgid "" "Of these, the most important function for doing actual useful work is the `." "start`() function, which is called when a BIO request arrives for a provider " "managed by a instance of geom class." msgstr "" "A função mais importante para realizar trabalho útil é a função `.start()`, " "que é chamada quando uma solicitação BIO chega para um provider gerenciado " "por uma instância de classe geom." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:371 #, no-wrap msgid "GEOM Threads" msgstr "Threads GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:374 msgid "There are three kernel threads created and run by the GEOM framework:" msgstr "" "Existem três threads de kernel criados e executados pelo framework GEOM:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:376 msgid "" "`g_down` : Handles requests coming from high-level entities (such as a " "userland request) on the way to physical devices" msgstr "" "`g_down` : responsável por lidar com solicitações vindas de entidades de " "alto nível (como uma solicitação do espaço do usuário) a caminho de " "dispositivos físicos" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:377 msgid "" "`g_up` : Handles responses from device drivers to requests made by higher-" "level entities" msgstr "" "`g_up` : Lida com as respostas dos drivers de dispositivo às solicitações " "feitas por entidades de nível superior" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:378 msgid "" "`g_event` : Handles all other cases: creation of geom instances, access " "counting, \"spoil\" events, etc." msgstr "" "`g_event` : lida com todos os outros casos: criação de instâncias de geom, " "contagem de acesso, eventos de \"spoil\", etc." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:380 msgid "" "When a user process issues \"read data X at offset Y of a file\" request, " "this is what happens:" msgstr "" "Quando um processo do usuário emite uma solicitação para \"ler dados X no " "deslocamento Y de um arquivo\", o seguinte acontece:" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:382 msgid "" "The filesystem converts the request into a struct bio instance and passes it " "to the GEOM subsystem. It knows what geom instance should handle it because " "filesystems are hosted directly on a geom instance." msgstr "" "O sistema de arquivos converte o pedido em uma instância struct bio e o " "transmite para o subsistema GEOM. Ele sabe o que a instância geom deve " "manipular porque os sistemas de arquivos são hospedados diretamente em uma " "instância geom." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:383 msgid "" "The request ends up as a call to the `.start`() function made on the g_down " "thread and reaches the top-level geom instance." msgstr "" "A requisição termina como uma chamada para a função `.start`() feita para a " "thread g_down e atinge a instância geom de nível superior." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:384 msgid "" "This top-level geom instance (for example the partition slicer) determines " "that the request should be routed to a lower-level instance (for example the " "disk driver). It makes a copy of the bio request (bio requests _ALWAYS_ need " "to be copied between instances, with `g_clone_bio`()!), modifies the data " "offset and target provider fields and executes the copy with `g_io_request`()" msgstr "" "Esta instância geom de nível superior (por exemplo, o \"partition slicer\") " "determina que a solicitação deve ser encaminhada para uma instância de nível " "inferior (por exemplo, o driver de disco). Ela faz uma cópia da solicitação " "bio (solicitações bio PRECISAM SEMPRE ser copiadas entre instâncias, com " "`g_clone_bio`()!), modifica o deslocamento dos dados e os campos do provider " "de destino e executa a cópia com `g_io_request`()" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:385 msgid "" "The disk driver gets the bio request also as a call to `.start`() on the " "`g_down` thread. It talks to hardware, gets the data back, and calls " "`g_io_deliver`() on the bio." msgstr "" "O driver de disco também recebe a requisição bio como uma chamada para `." "start`() na thread `g_down`. Ele conversa com o hardware, recebe os dados de " "volta e chama `g_io_deliver`() na bio." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:386 msgid "" "Now, the notification of bio completion \"bubbles up\" in the `g_up` thread. " "First the partition slicer gets `.done`() called in the `g_up` thread, it " "uses information stored in the bio to free the cloned `bio` structure (with " "`g_destroy_bio`()) and calls `g_io_deliver`() on the original request." msgstr "" "Agora, a notificação da conclusão do bio \"sobe\" na thread `g_up`. " "Primeiro, o particionador recebe `.done`() chamado na thread `g_up`, usa as " "informações armazenadas no bio para liberar a estrutura de `bio` clonada (" "com `g_destroy_bio`()) e chama `g_io_deliver`() no pedido original." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:387 msgid "The filesystem gets the data and transfers it to userland." msgstr "O sistema de arquivos obtém os dados e os transfere para o usuário." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:389 msgid "" "See man:g_bio[9] man page for information how the data is passed back and " "forth in the `bio` structure (note in particular the `bio_parent` and " "`bio_children` fields and how they are handled)." msgstr "" "Consulte a página do manual man:g_bio[9] para obter informações sobre como " "os dados são passados de um lado para o outro na estrutura `bio` (observe em " "particular os campos `bio_parent` e `bio_children` e como eles são " "manipulados)." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:392 msgid "" "One important feature is: __THERE CAN BE NO SLEEPING IN G_UP AND G_DOWN " "THREADS__. This means that none of the following things can be done in " "those threads (the list is of course not complete, but only informative):" msgstr "" "Uma característica importante é que __ NÃO PODEM HAVER CHAMADAS DE FUNÇÃO " "QUE BLOQUEIEM O PROCESSO (DURMAM) NAS THREADS G_UP E G_DOWN__. Isso " "significa que nenhuma das seguintes coisas pode ser feita nesses threads (a " "lista é apenas informativa e não completa):" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:394 msgid "Calls to `msleep`() and `tsleep`(), obviously." msgstr "Chamadas para `msleep`() e `tsleep`(), obviamente." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:395 msgid "" "Calls to `g_write_data`() and `g_read_data`(), because these sleep between " "passing the data to consumers and returning." msgstr "" "Chamadas para `g_write_data`() e `g_read_data()`, pois elas dormem entre a " "passagem dos dados para os consumidores e o retorno." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:396 msgid "Waiting for I/O." msgstr "Aguardando I/O." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:397 msgid "Calls to man:malloc[9] and `uma_zalloc`() with `M_WAITOK` flag set" msgstr "" "Chamadas a man:malloc[9] e `uma_zalloc`() com a flag `M_WAITOK` definida" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:398 msgid "sx and other sleepable locks" msgstr "sx e outros tipos de bloqueios sleepable" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:402 msgid "" "This restriction is here to stop GEOM code clogging the I/O request path, " "since sleeping is usually not time-bound and there can be no guarantees on " "how long will it take (there are some other, more technical reasons also). " "It also means that there is not much that can be done in those threads; for " "example, almost any complex thing requires memory allocation. Fortunately, " "there is a way out: creating additional kernel threads." msgstr "" "Essa restrição foi imposta para evitar que o código GEOM obstrua o caminho " "de solicitação de E/S, já que a espera geralmente não está relacionada ao " "tempo e não há garantias sobre quanto tempo levará (há outras razões " "técnicas também). Isso também significa que não há muito o que se possa " "fazer nessas threads; por exemplo, quase qualquer coisa complexa requer " "alocação de memória. Felizmente, há uma saída: criar threads adicionais do " "kernel." #. type: Title === #: documentation/content/en/articles/geom-class/_index.adoc:404 #, no-wrap msgid "Kernel Threads for Use in GEOM Code" msgstr "Threads de kernel para uso no código GEOM" #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:407 msgid "" "Kernel threads are created with man:kthread_create[9] function, and they are " "sort of similar to userland threads in behavior, only they cannot return to " "caller to signify termination, but must call man:kthread_exit[9]." msgstr "" "Threads do Kernel são criados com a função man:kthread_create[9], e eles são " "parecidos com threads de espaço de usuário em termos de comportamento, " "apenas que não podem retornar ao chamador para indicar término, mas devem " "chamar man:kthread_exit[9]." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:410 msgid "" "In GEOM code, the usual use of threads is to offload processing of requests " "from `g_down` thread (the `.start`() function). These threads look like " "\"event handlers\": they have a linked list of event associated with them " "(on which events can be posted by various functions in various threads so it " "must be protected by a mutex), take the events from the list one by one and " "process them in a big `switch`() statement." msgstr "" "No código do GEOM, o uso usual de threads é para descarregar o processamento " "de solicitações da thread `g_down` (a função `.start()`). Essas threads se " "parecem com \"manipuladores de eventos\": elas têm uma lista vinculada de " "eventos associados a elas (na qual eventos podem ser postados por várias " "funções em várias threads, então ela deve ser protegida por um mutex), pegam " "os eventos da lista um por um e os processam em uma grande declaração " "`switch()`." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:415 msgid "" "The main benefit of using a thread to handle I/O requests is that it can " "sleep when needed. Now, this sounds good, but should be carefully thought " "out. Sleeping is well and very convenient but can very effectively destroy " "performance of the geom transformation. Extremely performance-sensitive " "classes probably should do all the work in `.start`() function call, taking " "great care to handle out-of-memory and similar errors." msgstr "" "O principal benefício de usar uma thread para lidar com as solicitações de E/" "S é que ela pode dormir quando necessário. Agora, isso parece bom, mas deve " "ser cuidadosamente pensado. Dormir é bem conveniente, mas pode destruir " "efetivamente o desempenho da transformação geom. As classes extremamente " "sensíveis ao desempenho provavelmente devem fazer todo o trabalho na chamada " "de função `.start()`, tendo muito cuidado para lidar com erros de falta de " "memória e similares." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:419 msgid "" "The other benefit of having a event-handler thread like that is to serialize " "all the requests and responses coming from different geom threads into one " "thread. This is also very convenient but can be slow. In most cases, " "handling of `.done`() requests can be left to the `g_up` thread." msgstr "" "O outro benefício de ter uma thread de tratamento de eventos é a " "serialização de todas as solicitações e respostas vindas de diferentes " "threads do geom em uma única thread. Isso também é muito conveniente, mas " "pode ser lento. Na maioria dos casos, o tratamento de solicitações `.done`() " "pode ser deixado para a thread `g_up`." #. type: Plain text #: documentation/content/en/articles/geom-class/_index.adoc:422 msgid "" "Mutexes in FreeBSD kernel (see man:mutex[9]) have one distinction from their " "more common userland cousins - the code cannot sleep while holding a " "mutex). If the code needs to sleep a lot, man:sx[9] locks may be more " "appropriate. On the other hand, if you do almost everything in a single " "thread, you may get away with no mutexes at all." msgstr "" "Mutexes no kernel do FreeBSD (veja man:mutex[9]) possuem uma distinção em " "relação às suas contrapartes mais comuns no userland - o código não pode " "dormir enquanto segura um mutex. Se o código precisa dormir muito, as travas " "man:sx[9] podem ser mais apropriadas. Por outro lado, se você fizer quase " "tudo em um único thread, pode se livrar completamente do uso de mutexes." #~ msgid "" #~ "include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/" #~ "{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists." #~ "adoc[] include::shared/{{% lang %}}/urls.adoc[]" #~ msgstr "" #~ "include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/" #~ "{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists." #~ "adoc[] include::shared/{{% lang %}}/urls.adoc[]"