[kernel] r6311 - people/waldi/linux-kbuild-2.6/src/mod
Bastian Blank
waldi at costa.debian.org
Tue Mar 28 14:25:57 UTC 2006
Author: waldi
Date: Tue Mar 28 14:25:57 2006
New Revision: 6311
Modified:
people/waldi/linux-kbuild-2.6/src/mod/module.cpp
people/waldi/linux-kbuild-2.6/src/mod/module.hpp
people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.cpp
people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.hpp
people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.tpp
Log:
* src/mod/module.cpp, src/mod/module.hpp:
Use list of device tables.
* src/mod/module_devicetable.cpp, src/mod/module_devicetable.hpp,
src/mod/module_devicetable.tpp:
Read all known device tables.
Modified: people/waldi/linux-kbuild-2.6/src/mod/module.cpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module.cpp (original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module.cpp Tue Mar 28 14:25:57 2006
@@ -273,18 +273,8 @@
void module_real::write_moddevtable (std::ostream &out)
{
- if (devicetable_ccw)
- devicetable_ccw->write (out);
- if (devicetable_ieee1394)
- devicetable_ieee1394->write (out);
- if (devicetable_pci)
- devicetable_pci->write (out);
- if (devicetable_pnp)
- devicetable_pnp->write (out);
- if (devicetable_pnp_card)
- devicetable_pnp_card->write (out);
- if (devicetable_usb)
- devicetable_usb->write (out);
+ for (std::list<module_devicetable::table_base *>::iterator it = devicetables.begin (); it != devicetables.end (); ++it)
+ (*it)->write (out);
}
void module_real::write_versions (std::ostream &out, const modulelist &list)
@@ -318,12 +308,7 @@
module_data<Elf_class, Elf_data>::module_data (const std::string &filename, Elf::file *file) throw (std::runtime_error)
: module_real (filename, file)
{
- devicetable_ccw = module_devicetable::table<module_devicetable::device_ccw, Elf_class, Elf_data>::create (this, file);
- devicetable_ieee1394 = module_devicetable::table<module_devicetable::device_ieee1394, Elf_class, Elf_data>::create (this, file);
- devicetable_pci = module_devicetable::table<module_devicetable::device_pci, Elf_class, Elf_data>::create (this, file);
- devicetable_pnp = module_devicetable::table<module_devicetable::device_pnp, Elf_class, Elf_data>::create (this, file);
- devicetable_pnp_card = module_devicetable::table<module_devicetable::device_pnp_card, Elf_class, Elf_data>::create (this, file);
- devicetable_usb = module_devicetable::table<module_devicetable::device_usb, Elf_class, Elf_data>::create (this, file);
+ module_devicetable::table_create<Elf_class, Elf_data> (devicetables, this, file);
}
modulelist::modulelist () throw ()
Modified: people/waldi/linux-kbuild-2.6/src/mod/module.hpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module.hpp (original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module.hpp Tue Mar 28 14:25:57 2006
@@ -25,6 +25,7 @@
#include "elf.hpp"
#include "module_devicetable.hpp"
+#include <list>
#include <map>
#include <ostream>
@@ -92,12 +93,7 @@
bool has_init;
bool has_cleanup;
Elf::section_type<Elf::section_type_SYMTAB> *symtab;
- module_devicetable::table_base<module_devicetable::device_ccw> *devicetable_ccw;
- module_devicetable::table_base<module_devicetable::device_ieee1394> *devicetable_ieee1394;
- module_devicetable::table_base<module_devicetable::device_pci> *devicetable_pci;
- module_devicetable::table_base<module_devicetable::device_pnp> *devicetable_pnp;
- module_devicetable::table_base<module_devicetable::device_pnp_card> *devicetable_pnp_card;
- module_devicetable::table_base<module_devicetable::device_usb> *devicetable_usb;
+ std::list<module_devicetable::table_base *> devicetables;
Elf::file *file;
};
Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.cpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.cpp (original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.cpp Tue Mar 28 14:25:57 2006
@@ -34,5 +34,15 @@
const std::string def<device_pnp_card>::symbol = "__mod_pnp_card_device_table";
const std::string def<device_usb>::symbol = "__mod_usb_device_table";
}
+
+ void table_base::write (std::ostream &out) const throw (std::runtime_error)
+ {
+ for (std::vector<table_entry *>::const_iterator it = entries.begin (); it != entries.end (); ++it)
+ {
+ out << "MODULE_ALIAS(\"";
+ (*it)->write (out);
+ out << "\");\n";
+ }
+ }
}
}
Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.hpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.hpp (original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.hpp Tue Mar 28 14:25:57 2006
@@ -23,6 +23,7 @@
#include "elf.hpp"
+#include <list>
#include <ostream>
#include <stdexcept>
#include <vector>
@@ -52,61 +53,18 @@
{
template<typename device>
struct def {};
- template<>
- struct def<device_ccw>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_i2c>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_ieee1394>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_input>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_of>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_pci>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_pnp>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_pnp_card>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_serio>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_usb>
- {
- static const std::string symbol;
- };
- template<>
- struct def<device_vio>
- {
- static const std::string symbol;
- };
+ template<> struct def<device_ccw> { static const std::string symbol; };
+ template<> struct def<device_i2c> { static const std::string symbol; };
+ template<> struct def<device_ieee1394> { static const std::string symbol; };
+ template<> struct def<device_input> { static const std::string symbol; };
+ template<> struct def<device_of> { static const std::string symbol; };
+ template<> struct def<device_pci> { static const std::string symbol; };
+ template<> struct def<device_pcmcia> { static const std::string symbol; };
+ template<> struct def<device_pnp> { static const std::string symbol; };
+ template<> struct def<device_pnp_card> { static const std::string symbol; };
+ template<> struct def<device_serio> { static const std::string symbol; };
+ template<> struct def<device_usb> { static const std::string symbol; };
+ template<> struct def<device_vio> { static const std::string symbol; };
}
class table_entry
@@ -126,25 +84,28 @@
{
};
- template<typename device>
- class table_base
- {
- public:
- virtual ~table_base () throw () {};
+ class table_base
+ {
+ public:
+ virtual ~table_base () throw () {};
- void write (std::ostream &out) const throw (std::runtime_error);
+ void write (std::ostream &out) const throw (std::runtime_error);
- protected:
- table_base () throw () {};
- std::vector<table_entry *> entries;
- };
+ protected:
+ table_base () throw () {};
+
+ std::vector<table_entry *> entries;
+ };
+
+ template<typename Elf_class, typename Elf_data>
+ void table_create (std::list<table_base *> &, const module_real *m, const Elf::file *f) throw (std::runtime_error);
template<typename device, typename Elf_class, typename Elf_data>
- class table : public table_base<device>
+ class table : public table_base
{
public:
- static table_base<device> *create (const module_real *m, const Elf::file *f) throw (std::runtime_error);
+ static table_base *create (const module_real *m, const Elf::file *f) throw (std::runtime_error);
protected:
table () {};
Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.tpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.tpp (original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable.tpp Tue Mar 28 14:25:57 2006
@@ -27,19 +27,25 @@
{
namespace module_devicetable
{
- template<typename device>
- void table_base<device>::write (std::ostream &out) const throw (std::runtime_error)
+ template<typename Elf_class, typename Elf_data>
+ void table_create (std::list<table_base *> &list, const module_real *m, const Elf::file *file) throw (std::runtime_error)
{
- for (std::vector<table_entry *>::const_iterator it = entries.begin (); it != entries.end (); ++it)
- {
- out << "MODULE_ALIAS(\"";
- (*it)->write (out);
- out << "\");\n";
- }
+ list.push_back (table<module_devicetable::device_ccw, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_i2c, Elf_class, Elf_data>::create (m, file));
+ list.push_back (table<module_devicetable::device_ieee1394, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_input, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_of, Elf_class, Elf_data>::create (m, file));
+ list.push_back (table<module_devicetable::device_pci, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_pcmcia, Elf_class, Elf_data>::create (m, file));
+ list.push_back (table<module_devicetable::device_pnp, Elf_class, Elf_data>::create (m, file));
+ list.push_back (table<module_devicetable::device_pnp_card, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_serio, Elf_class, Elf_data>::create (m, file));
+ list.push_back (table<module_devicetable::device_usb, Elf_class, Elf_data>::create (m, file));
+// list.push_back (table<module_devicetable::device_vio, Elf_class, Elf_data>::create (m, file));
}
template<typename device, typename Elf_class, typename Elf_data>
- table_base<device> *table<device, Elf_class, Elf_data>::create (const module_real *m, const Elf::file *f) throw (std::runtime_error)
+ table_base *table<device, Elf_class, Elf_data>::create (const module_real *m, const Elf::file *f) throw (std::runtime_error)
{
const Elf::symbol *sym = m->_get_symbol (internal::def<device>::symbol);
if (!sym)
More information about the Kernel-svn-changes
mailing list