[kernel] r6814 - dists/trunk/linux-kbuild-2.6/src/mod

Bastian Blank waldi at costa.debian.org
Sat Jun 17 20:38:06 UTC 2006


Author: waldi
Date: Sat Jun 17 20:37:54 2006
New Revision: 6814

Modified:
   dists/trunk/linux-kbuild-2.6/src/mod/modpost.cpp
   dists/trunk/linux-kbuild-2.6/src/mod/module.cpp
   dists/trunk/linux-kbuild-2.6/src/mod/module.hpp

Log:
src/mod/modpost.cpp, src/mod/module.cpp, src/mod/module.hpp:
Add correct handling for out of tree symbol lists.


Modified: dists/trunk/linux-kbuild-2.6/src/mod/modpost.cpp
==============================================================================
--- dists/trunk/linux-kbuild-2.6/src/mod/modpost.cpp	(original)
+++ dists/trunk/linux-kbuild-2.6/src/mod/modpost.cpp	Sat Jun 17 20:37:54 2006
@@ -33,7 +33,7 @@
 {
   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 @@
         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 @@
     }
   }
 
-  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 @@
   modules.write (modversions);
 
   if (dump_write)
-    modules.dump_write (dump_write);
+    modules.dump_write (dump_write, dump_read_module ? false : true);
 
   return ret;
 }

Modified: dists/trunk/linux-kbuild-2.6/src/mod/module.cpp
==============================================================================
--- dists/trunk/linux-kbuild-2.6/src/mod/module.cpp	(original)
+++ dists/trunk/linux-kbuild-2.6/src/mod/module.cpp	Sat Jun 17 20:37:54 2006
@@ -34,21 +34,8 @@
 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 @@
     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 @@
     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_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 @@
   {
     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;
   }

Modified: dists/trunk/linux-kbuild-2.6/src/mod/module.hpp
==============================================================================
--- dists/trunk/linux-kbuild-2.6/src/mod/module.hpp	(original)
+++ dists/trunk/linux-kbuild-2.6/src/mod/module.hpp	Sat Jun 17 20:37:54 2006
@@ -41,17 +41,17 @@
     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 @@
       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; }



More information about the Kernel-svn-changes mailing list