Revision: 3070
          http://ipcop.svn.sourceforge.net/ipcop/?rev=3070&view=rev
Author:   gespinasse
Date:     2009-06-16 21:45:29 +0000 (Tue, 16 Jun 2009)

Log Message:
-----------
Add ash patch for busybox-1.14.1

Merge my modprobe patch (new version) with the post 1.14.1 update 

Modified Paths:
--------------
    ipcop/trunk/lfs/busybox
    ipcop/trunk/src/patches/busybox-1.14.1_modprobe.patch

Added Paths:
-----------
    ipcop/trunk/src/patches/busybox-1.14.1-ash.patch

Modified: ipcop/trunk/lfs/busybox
===================================================================
--- ipcop/trunk/lfs/busybox     2009-06-16 19:43:18 UTC (rev 3069)
+++ ipcop/trunk/lfs/busybox     2009-06-16 21:45:29 UTC (rev 3070)
@@ -80,7 +80,8 @@
 
 $(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects)) 
$(DIR_SRC)/config/busybox/* $(DIR_PATCHES)/busybox-*
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/busybox-1.14.1_modprobe.patch
+       cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/busybox-1.14.1_modprobe.patch
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/busybox-1.14.1-ash.patch
 
        cd $(DIR_APP) && cp -f $(DIR_SRC)/config/busybox/busybox.config .config
 

Added: ipcop/trunk/src/patches/busybox-1.14.1-ash.patch
===================================================================
--- ipcop/trunk/src/patches/busybox-1.14.1-ash.patch                            
(rev 0)
+++ ipcop/trunk/src/patches/busybox-1.14.1-ash.patch    2009-06-16 21:45:29 UTC 
(rev 3070)
@@ -0,0 +1,13 @@
+diff -urpN busybox-1.14.1/shell/ash.c busybox-1.14.1-ash/shell/ash.c
+--- busybox-1.14.1/shell/ash.c 2009-05-27 18:00:23.000000000 +0200
++++ busybox-1.14.1-ash/shell/ash.c     2009-06-14 19:44:24.000000000 +0200
+@@ -11909,7 +11909,8 @@ find_dot_file(char *name)
+                        */
+                       return fullname;
+               }
+-              stunalloc(fullname);
++              if (fullname != name)
++                      stunalloc(fullname);
+       }
+ 
+       /* not found in the PATH */

Modified: ipcop/trunk/src/patches/busybox-1.14.1_modprobe.patch
===================================================================
--- ipcop/trunk/src/patches/busybox-1.14.1_modprobe.patch       2009-06-16 
19:43:18 UTC (rev 3069)
+++ ipcop/trunk/src/patches/busybox-1.14.1_modprobe.patch       2009-06-16 
21:45:29 UTC (rev 3070)
@@ -1,58 +1,113 @@
-diff --git a/modutils/modprobe.c b/modutils/modprobe.c
-index 0339ebb..41b63da 100644
---- a/modutils/modprobe.c
-+++ b/modutils/modprobe.c
-@@ -52,8 +52,9 @@ struct globals {
-       llist_t *probes; /* MEs of module(s) requested on cmdline */
-       char *cmdline_mopts; /* module options from cmdline */
-       int num_unresolved_deps;
--      /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */
--      smallint need_symbols;
-+      /* 1 "Did we have 'symbol:FOO' requested on cmdline?"
-+       * 2 modprobe status */
-+      smallint modprobe_flags;
- };
- #define G (*(struct globals*)&bb_common_bufsiz1)
- #define INIT_G() do { } while (0)
-@@ -123,7 +124,7 @@ static void add_probe(const char *name)
-       if (ENABLE_FEATURE_MODUTILS_SYMBOLS
-        && strncmp(m->modname, "symbol:", 7) == 0
-       ) {
--              G.need_symbols = 1;
-+              G.modprobe_flags |= 1;
+diff -Nur busybox-1.14.1/modutils/modprobe-small.c 
busybox-1.14.2/modutils/modprobe-small.c
+--- busybox-1.14.1/modutils/modprobe-small.c   2009-05-27 18:00:23.000000000 
+0200
++++ busybox-1.14.2/modutils/modprobe-small.c   2009-06-16 23:13:53.000000000 
+0200
+@@ -656,7 +656,7 @@
+       [-b basedirectory] [forced_version]
+ depmod [-n -e -v -q -r -u] [-F kernelsyms] module1.ko module2.ko ...
+ If no arguments (except options) are given, "depmod -a" is assumed.
+-depmod will output a dependancy list suitable for the modprobe utility.
++depmod will output a dependency list suitable for the modprobe utility.
+ Options:
+     -a, --all           Probe all modules
+     -A, --quick         Only does the work if there's a new module
+diff -Nur busybox-1.14.1/modutils/modprobe.c busybox-1.14.2/modutils/modprobe.c
+--- busybox-1.14.1/modutils/modprobe.c 2009-05-27 18:01:37.000000000 +0200
++++ busybox-1.14.2/modutils/modprobe.c 2009-06-16 22:16:33.000000000 +0200
+@@ -8,12 +8,17 @@
+  * Licensed under GPLv2 or later, see file LICENSE in this tarball for 
details.
+  */
+ 
++/* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t),
++ * we expect the full dependency list to be specified in modules.dep.  Older
++ * versions would only export the direct dependency list.
++ */
++
+ #include "libbb.h"
+ #include "modutils.h"
+ #include <sys/utsname.h>
+ #include <fnmatch.h>
+ 
+-//#define DBG(...) bb_error_msg(__VA_ARGS__)
++//#define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__)
+ #define DBG(...) ((void)0)
+ 
+ #define MODULE_FLAG_LOADED            0x0001
+@@ -116,6 +121,7 @@
+               return;
        }
- }
  
-@@ -203,6 +204,7 @@ static int read_config(const char *path)
++      DBG("queuing %s", name);
+       m->probed_name = name;
+       m->flags |= MODULE_FLAG_NEED_DEPS;
+       llist_add_to_end(&G.probes, m);
+@@ -134,7 +140,7 @@
+ {
+       char *tokens[3];
+       parser_t *p;
+-        struct module_entry *m;
++      struct module_entry *m;
+       int rc = TRUE;
+ 
+       if (bb_basename(filename)[0] == '.')
+@@ -203,11 +209,13 @@
                                config_file_action, NULL, NULL, 1);
  }
  
 +/* Return a value >=0 or -ENOENT if module not found in modules.dep */
  static int do_modprobe(struct module_entry *m)
  {
-       struct module_entry *m2;
-@@ -224,7 +226,9 @@ static int do_modprobe(struct module_entry *m)
+-      struct module_entry *m2;
++      struct module_entry *m2 = m2; /* for compiler */
+       char *fn, *options;
+-      int rc = -1;
++      int rc, first;
++      llist_t *l;
+ 
+       if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
+               DBG("skipping %s, not found in modules.dep", m->modname);
+@@ -218,13 +226,25 @@
+       if (!(option_mask32 & MODPROBE_OPT_REMOVE))
+               m->deps = llist_rev(m->deps);
+ 
++      for (l = m->deps; l != NULL; l = l->link)
++              DBG("dep: %s", l->data);
++
++      first = 1;
+       rc = 0;
+       while (m->deps && rc == 0) {
+               fn = llist_pop(&m->deps);
                m2 = get_or_add_modentry(fn);
                if (option_mask32 & MODPROBE_OPT_REMOVE) {
-                       if (bb_delete_module(m->modname, O_EXCL) != 0)
+-                      if (bb_delete_module(m->modname, O_EXCL) != 0)
 -                              rc = errno;
-+                              /* silence with module already unloaded */
-+                              if (errno != ENOENT)
-+                                      rc = errno;
++                      if (m2->flags & MODULE_FLAG_LOADED) {
++                              if (bb_delete_module(m2->modname, O_EXCL) != 0) 
{
++                                      if (first)
++                                              rc = errno;
++                              } else {
++                                      m2->flags &= ~MODULE_FLAG_LOADED;
++                              }
++                      }
++                      /* do not error out if *deps* fail to unload */
++                      first = 0;
                } else if (!(m2->flags & MODULE_FLAG_LOADED)) {
                        options = m2->options;
                        m2->options = NULL;
-@@ -242,7 +246,8 @@ static int do_modprobe(struct module_entry *m)
+@@ -242,11 +262,10 @@
                free(fn);
        }
  
 -//FIXME: what if rc < 0?
-+      /* On 2.6 kernel, rc is alway >=0 (0 or errno).
-+       * On 2.4 kernel, that's EXIT_SUCCESS or EXIT_ERROR */
-       if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT)) {
+-      if (rc > 0 && !(option_mask32 & INSMOD_OPT_SILENT)) {
++      if (rc && !(option_mask32 & INSMOD_OPT_SILENT)) {
                bb_error_msg("failed to %sload module %s: %s",
                        (option_mask32 & MODPROBE_OPT_REMOVE) ? "un" : "",
-@@ -260,7 +265,7 @@ static void load_modules_dep(void)
+-                      m->probed_name ? m->probed_name : m->modname,
++                      m2->probed_name ? m2->probed_name : m2->modname,
+                       moderror(rc)
+               );
+       }
+@@ -260,7 +279,7 @@
        char *colon, *tokens[2];
        parser_t *p;
  
@@ -61,16 +116,47 @@
         * even if the full module name is given. Returning error here
         * was making us later confuse user with this message:
         * "module /full/path/to/existing/file/module.ko not found".
-@@ -358,7 +363,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -294,7 +313,8 @@
+                       llist_add_to(&m->deps, xstrdup(tokens[0]));
+                       if (tokens[1])
+                               string_to_llist(tokens[1], &m->deps, " ");
+-              }
++              } else
++                      DBG("skipping dep line");
+       }
+       config_close(p);
+ }
+@@ -303,7 +323,7 @@
+ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+ {
+       struct utsname uts;
+-      int rc;
++      int rc = 0;
+       unsigned opt;
+       struct module_entry *me;
  
-       read_config("/etc/modprobe.conf");
-       read_config("/etc/modprobe.d");
--      if (ENABLE_FEATURE_MODUTILS_SYMBOLS && G.need_symbols)
-+      if (ENABLE_FEATURE_MODUTILS_SYMBOLS && G.modprobe_flags & 1)
-               read_config("modules.symbols");
-       load_modules_dep();
-       if (ENABLE_FEATURE_MODUTILS_ALIAS && G.num_unresolved_deps) {
-@@ -375,10 +380,12 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -344,10 +364,12 @@
+       if (opt & (MODPROBE_OPT_INSERT_ALL | MODPROBE_OPT_REMOVE)) {
+               /* Each argument is a module name */
+               do {
++                      DBG("adding module %s", *argv);
+                       add_probe(*argv++);
+               } while (*argv);
+       } else {
+               /* First argument is module name, rest are parameters */
++              DBG("probing just module %s", *argv);
+               add_probe(argv[0]);
+               G.cmdline_mopts = parse_cmdline_module_options(argv);
+       }
+@@ -368,6 +390,7 @@
+ 
+       while ((me = llist_pop(&G.probes)) != NULL) {
+               if (me->realnames == NULL) {
++                      DBG("probing by module name");
+                       /* This is not an alias. Literal names are blacklisted
+                        * only if '-b' is given.
+                        */
+@@ -375,7 +398,7 @@
                         || !(me->flags & MODULE_FLAG_BLACKLISTED)
                        ) {
                                rc = do_modprobe(me);
@@ -79,12 +165,7 @@
                                if (rc < 0 && !(opt & INSMOD_OPT_SILENT))
                                        bb_error_msg("module %s not found",
                                                     me->probed_name);
-+                              if (rc != 0)
-+                                      G.modprobe_flags |= 2;
-                       }
-               } else {
-                       /* Probe all realnames */
-@@ -388,13 +395,17 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+@@ -388,13 +411,19 @@
  
                                DBG("probing %s by realname %s", me->modname, 
realname);
                                m2 = get_or_add_modentry(realname);
@@ -95,8 +176,10 @@
 +                               && (!(m2->flags & MODULE_FLAG_LOADED)
 +                                      || opt & MODPROBE_OPT_REMOVE )
 +                              ) {
-+                                      if (do_modprobe(m2))
-+                                              G.modprobe_flags |= 2;
++                                      rc=do_modprobe(m2);
++                                      if (rc < 0 && !(opt & 
INSMOD_OPT_SILENT))
++                                              bb_error_msg("module %s alias 
error",
++                                                           me->modname);
 +                              }
                                free(realname);
                        } while (me->realnames != NULL);
@@ -104,5 +187,17 @@
        }
  
 -      return EXIT_SUCCESS;
-+      return (G.modprobe_flags & 2) == 2;
++      return (rc != 0);
  }
+diff -Nur busybox-1.14.1/modutils/modutils.c busybox-1.14.2/modutils/modutils.c
+--- busybox-1.14.1/modutils/modutils.c 2009-05-27 18:00:23.000000000 +0200
++++ busybox-1.14.2/modutils/modutils.c 2009-06-16 23:13:53.000000000 +0200
+@@ -57,7 +57,7 @@
+       from = bb_get_last_path_component_nostrip(filename);
+       for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != 
'.'; i++)
+               modname[i] = (from[i] == '-') ? '_' : from[i];
+-      modname[i] = 0;
++      modname[i] = '\0';
+ 
+       return modname;
+ }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to