src/mod/modpost.cpp, src/mod/module.cpp, src/mod/module.hpp:
Add correct handling for out of tree symbol lists. svn path=/dists/trunk/linux-kbuild-2.6/; revision=6814
This commit is contained in:
parent
7898c22d84
commit
71e2e62bfe
|
@ -33,7 +33,7 @@ int main (int argc, char *const argv[])
|
|||
{
|
||||
int ret = EXIT_SUCCESS;
|
||||
int opt;
|
||||
const char *dump_read = 0, *dump_write = 0;
|
||||
const char *dump_read_kernel = 0, *dump_read_module = 0, *dump_write = 0;
|
||||
bool all_versions = false, modversions = false;;
|
||||
|
||||
while ((opt = getopt (argc, argv, "ai:I:mo:")) != -1)
|
||||
|
@ -45,11 +45,10 @@ int main (int argc, char *const argv[])
|
|||
return EXIT_FAILURE;
|
||||
break;
|
||||
case 'i':
|
||||
dump_read = optarg;
|
||||
dump_read_kernel = optarg;
|
||||
break;
|
||||
case 'I':
|
||||
// Lacks special casing.
|
||||
dump_read = optarg;
|
||||
dump_read_module = optarg;
|
||||
break;
|
||||
case 'm':
|
||||
modversions = true;
|
||||
|
@ -62,8 +61,10 @@ int main (int argc, char *const argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (dump_read)
|
||||
modules.dump_read (dump_read);
|
||||
if (dump_read_kernel)
|
||||
modules.dump_read (dump_read_kernel, true);
|
||||
if (dump_read_module)
|
||||
modules.dump_read (dump_read_module, false);
|
||||
|
||||
for (int i = optind; i < argc; i++)
|
||||
{
|
||||
|
@ -82,7 +83,7 @@ int main (int argc, char *const argv[])
|
|||
modules.write (modversions);
|
||||
|
||||
if (dump_write)
|
||||
modules.dump_write (dump_write);
|
||||
modules.dump_write (dump_write, dump_read_module ? false : true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -34,21 +34,8 @@ const std::string module_real::symbol_name_init ("init_module");
|
|||
const std::string module_real::symbol_prefix_crc ("__crc_");
|
||||
const std::string module_real::symbol_prefix_ksymtab ("__ksymtab_");
|
||||
|
||||
module::module (const std::string &name) throw ()
|
||||
: name (name)
|
||||
{
|
||||
std::string::size_type t1 = name.find_last_of ('/');
|
||||
if (t1 == std::string::npos)
|
||||
t1 = 0;
|
||||
else
|
||||
t1++;
|
||||
name_short = name.substr (t1, std::string::npos);
|
||||
|
||||
if (name == "vmlinux")
|
||||
is_vmlinux = true;
|
||||
}
|
||||
|
||||
module::module (const std::string &filename, bool) throw ()
|
||||
module::module (const std::string &filename, bool kernel) throw ()
|
||||
: kernel (kernel)
|
||||
{
|
||||
std::string::size_type t1 = filename.find_last_of ('/');
|
||||
std::string::size_type t2 = filename.find_last_of ('.');
|
||||
|
@ -327,7 +314,7 @@ modulelist::~modulelist () throw ()
|
|||
delete it->second;
|
||||
}
|
||||
|
||||
void modulelist::dump_read (const std::string &filename) throw (std::runtime_error)
|
||||
void modulelist::dump_read (const std::string &filename, bool kernel) throw (std::runtime_error)
|
||||
{
|
||||
std::ifstream in (filename.c_str ());
|
||||
while (in.good ())
|
||||
|
@ -342,7 +329,7 @@ void modulelist::dump_read (const std::string &filename) throw (std::runtime_err
|
|||
module *mod;
|
||||
if (it == modules_shadow.end ())
|
||||
{
|
||||
mod = new module (module_name);
|
||||
mod = new module (module_name, kernel);
|
||||
modules_shadow.insert (_modules_shadow_pair (module_name, mod));
|
||||
}
|
||||
else
|
||||
|
@ -354,7 +341,7 @@ void modulelist::dump_read (const std::string &filename) throw (std::runtime_err
|
|||
}
|
||||
}
|
||||
|
||||
void modulelist::dump_write (const std::string &filename) const throw (std::runtime_error)
|
||||
void modulelist::dump_write (const std::string &filename, bool kernel) const throw (std::runtime_error)
|
||||
{
|
||||
char buf[128];
|
||||
std::ofstream out (filename.c_str (), std::ios::trunc);
|
||||
|
@ -363,6 +350,8 @@ void modulelist::dump_write (const std::string &filename) const throw (std::runt
|
|||
{
|
||||
const module *mod = get_module (it->second);
|
||||
const symbol_exported &sym = get_symbol (it->first);
|
||||
if (!kernel && mod->get_kernel ())
|
||||
continue;
|
||||
snprintf (buf, sizeof (buf), "0x%08x\t%s\t%s\n", sym.get_crc (), it->first.c_str (), mod->get_name ().c_str ());
|
||||
out << buf;
|
||||
}
|
||||
|
|
|
@ -41,17 +41,17 @@ namespace linuxkernel
|
|||
public:
|
||||
typedef std::map<std::string, symbol_exported> _symbols_exported;
|
||||
|
||||
module (const std::string &name) throw ();
|
||||
module (const std::string &name, bool kernel) throw ();
|
||||
|
||||
bool get_kernel () const throw () { return kernel; }
|
||||
bool get_is_vmlinux () const throw () { return is_vmlinux; }
|
||||
const std::string &get_name () const throw () { return name; }
|
||||
const std::string &get_name_short () const throw () { return name_short; }
|
||||
const _symbols_exported &get_symbols_exported () const throw () { return symbols_exported; }
|
||||
|
||||
protected:
|
||||
module (const std::string &filename, bool) throw ();
|
||||
|
||||
std::string name, name_short;
|
||||
bool kernel;
|
||||
bool is_vmlinux;
|
||||
_symbols_exported symbols_exported;
|
||||
|
||||
|
@ -117,8 +117,8 @@ namespace linuxkernel
|
|||
modulelist () throw ();
|
||||
~modulelist () throw ();
|
||||
|
||||
void dump_read (const std::string &filename) throw (std::runtime_error);
|
||||
void dump_write (const std::string &filename) const throw (std::runtime_error);
|
||||
void dump_read (const std::string &filename, bool kernel) throw (std::runtime_error);
|
||||
void dump_write (const std::string &filename, bool kernel) const throw (std::runtime_error);
|
||||
|
||||
const _modules_real &get_modules_real () const throw () { return modules_real; }
|
||||
const _modules_shadow &get_modules_shadow () const throw () { return modules_shadow; }
|
||||
|
|
Loading…
Reference in New Issue