Einzelnen Beitrag anzeigen

Benutzerbild von Valle
Valle

Registriert seit: 26. Dez 2005
Ort: Karlsruhe
1.223 Beiträge
 
#9

Re: Kconfig-Syntax: Wir parse ich sowas?

  Alt 26. Okt 2008, 15:42
Hi alzaimer!

Wie ich oben geschrieben habe, habe ich bereits angefangen. Allerdings denke ich, ist dieser Ansatz eigentlich so gut wie nichts wert. Da das ganze doch etwas viel Code wäre, bei dem sowieso keiner durchblickt (mich einschließlich ) schreibe ich hier mal, was das Ding bisher tut.

Also es handelt sich um eine einfache Klasse. Bei der Initialisierung lädt diese Klasse eine angegebene Datei in den Speicher. Diese Datei wird dann erstmal in einzelne Zeilen zerlegt (Nach \n in ein Array aufgeteilt). Bei der "parse()"-Methode geht das Programm dann jede einzelne Zeile durch. Es schaut, um welches Keyword es sich in dieser Zeile handelt und (sollte zumindest) dann je nach Keyword entsprechend weitermachen.

Im ersten Post habe ich zwei Links geschrieben, in denen die Struktur solcher Programme beschrieben ist. Ich poste jetzt hier einfach mal ein paar Zeilen, damit man eine Vorstellung davon hat.

Code:
menuconfig NETDEV_1000
   bool "Ethernet (1000 Mbit)"
   depends on !UML
   default y
   ---help---
     Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common
     type of Local Area Network (LAN) in universities and companies.

     Say Y here to get to see options for Gigabit Ethernet drivers.
     This option alone does not add any kernel code.
     Note that drivers supporting both 100 and 1000 MBit may be listed
     under "Ethernet (10 or 100MBit)" instead.

     If you say N, all options in this submenu will be skipped and disabled.

if NETDEV_1000

config ACENIC
   tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support"
   depends on PCI
   ---help---
     Say Y here if you have an Alteon AceNIC, 3Com 3C985(B), NetGear
     GA620, SGI Gigabit or Farallon PN9000-SX PCI Gigabit Ethernet
     adapter. The driver allows for using the Jumbo Frame option (9000
     bytes/frame) however it requires that your switches can handle this
     as well. To enable Jumbo Frames, add `mtu 9000' to your ifconfig
     line.

     To compile this driver as a module, choose M here: the
     module will be called acenic.

config ACENIC_OMIT_TIGON_I
   bool "Omit support for old Tigon I based AceNICs"
   depends on ACENIC
   help
     Say Y here if you only have Tigon II based AceNICs and want to leave
     out support for the older Tigon I based cards which are no longer
     being sold (ie. the original Alteon AceNIC and 3Com 3C985 (non B
     version)). This will reduce the size of the driver object by
     app. 100KB. If you are not sure whether your card is a Tigon I or a
     Tigon II, say N here.

     The safe and default value for this is N.
Auszug aus linux-2.6.26.2/drivers/net/Kconfig

Ich bin jetzt eben der Meinung, dass es in dieser Weise keinen Sinn hat. Da muss was anderes her. Ich habe ja (wie bereits geschrieben) mal was von diesen Tokenizern / Lexern und wie sie alle heißen gelesen, aber irgendwie fehlen mit da gute Dokumentationen und Beispiele für. Und außerdem weiß ich selbst noch nicht recht, ob das überhaupt das richtige ist.

Eigentlich will ich jetzt gar keine konkrete Hilfe. Ich hoffe vielmehr darauf, einige allgemeinen Tipps zu bekommen. Bestimmte Ansätze / Bibliotheken etc. Gegen was konkretes bzgl. Kconfig-Syntax habe ich natürlich auch nichts einzuwenden. Aber ich denke meinen momentanen Code kann man so nicht benutzen...

Mit freundlichen Grüßen,

Valle
Valentin Voigt
BOFH excuse #423: „It's not RFC-822 compliant.“
Mein total langweiliger Blog
  Mit Zitat antworten Zitat