Hello community,

here is the log from the commit of package linuxrc for openSUSE:Factory checked 
in at 2019-09-27 14:44:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/linuxrc (Old)
 and      /work/SRC/openSUSE:Factory/.linuxrc.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "linuxrc"

Fri Sep 27 14:44:12 2019 rev:273 rq:732951 version:6.0.15

Changes:
--------
--- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes  2019-08-19 
20:49:13.705074812 +0200
+++ /work/SRC/openSUSE:Factory/.linuxrc.new.2352/linuxrc.changes        
2019-09-27 14:44:19.821407266 +0200
@@ -1,0 +2,7 @@
+Tue Sep 24 13:39:06 UTC 2019 - wfe...@opensuse.org
+
+- merge gh#openSUSE/linuxrc#195
+- add support for compressed modules
+- 6.0.15
+
+--------------------------------------------------------------------

Old:
----
  linuxrc-6.0.14.tar.xz

New:
----
  linuxrc-6.0.15.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ linuxrc.spec ++++++
--- /var/tmp/diff_new_pack.EoFPHA/_old  2019-09-27 14:44:20.513405466 +0200
+++ /var/tmp/diff_new_pack.EoFPHA/_new  2019-09-27 14:44:20.513405466 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           linuxrc
-Version:        6.0.14
+Version:        6.0.15
 Release:        0
 Summary:        SUSE Installation Program
 License:        GPL-3.0+

++++++ linuxrc-6.0.14.tar.xz -> linuxrc-6.0.15.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/VERSION new/linuxrc-6.0.15/VERSION
--- old/linuxrc-6.0.14/VERSION  2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/VERSION  2019-09-24 15:39:06.000000000 +0200
@@ -1 +1 @@
-6.0.14
+6.0.15
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/changelog new/linuxrc-6.0.15/changelog
--- old/linuxrc-6.0.14/changelog        2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/changelog        2019-09-24 15:39:06.000000000 +0200
@@ -1,3 +1,7 @@
+2019-09-24:    6.0.15
+       - merge gh#openSUSE/linuxrc#195
+       - add support for compressed modules
+
 2019-08-15:    6.0.14
        - merge gh#openSUSE/linuxrc#193
        - choose correct kernel image on aarch64 (bsc#1145625)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/global.h new/linuxrc-6.0.15/global.h
--- old/linuxrc-6.0.14/global.h 2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/global.h 2019-09-24 15:39:06.000000000 +0200
@@ -131,8 +131,6 @@
 
 #define MAX_FILENAME     300
 
-#define MODULE_SUFFIX  ".ko"
-
 typedef struct {
                int c;
                char attr;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/linuxrc.c new/linuxrc-6.0.15/linuxrc.c
--- old/linuxrc-6.0.14/linuxrc.c        2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/linuxrc.c        2019-09-24 15:39:06.000000000 +0200
@@ -1577,6 +1577,33 @@
   return cmp_entry(*sl0, *sl1);
 }
 
+static void insmod_basics(void)
+{
+  static const struct {
+    char *name;
+    char *param;
+    int mandatory;
+  } *i, basics[] = {
+    { "loop", "max_loop=64", 1 },
+    { "lz4_decompress" },
+    { "xxhash" },
+    { "zstd_decompress" },
+    { }
+  };
+  char file[MAX_FILENAME], insmod[MAX_FILENAME + 200];
+
+  for (i = basics; i->name; i++) {
+    if(!mod_find_module("/modules", i->name, file)) {
+      if(i->mandatory)
+       log_show("Cannot find module %s!\n", i->name);
+      continue;
+    }
+
+    sprintf(insmod, "/sbin/insmod %s%s%s", file, i->param ? " " : "",
+       i->param ? : "");
+    lxrc_run(insmod);
+  }
+}
 
 void lxrc_add_parts()
 {
@@ -1603,16 +1630,7 @@
     if(!config.test) {
       if(!insmod_done) {
         insmod_done = 1;
-        lxrc_run("/sbin/insmod /modules/loop.ko max_loop=64");
-        if(util_check_exist("/modules/lz4_decompress.ko")) {
-          lxrc_run("/sbin/insmod /modules/lz4_decompress.ko");
-        }
-        if(util_check_exist("/modules/xxhash.ko")) {
-          lxrc_run("/sbin/insmod /modules/xxhash.ko");
-        }
-        if(util_check_exist("/modules/zstd_decompress.ko")) {
-          lxrc_run("/sbin/insmod /modules/zstd_decompress.ko");
-        }
+        insmod_basics();
       }
       strprintf(&mp, "/parts/mp_%04u", config.mountpoint.initrd_parts++);
       mkdir(mp, 0755);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/module.c new/linuxrc-6.0.15/module.c
--- old/linuxrc-6.0.14/module.c 2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/module.c 2019-09-24 15:39:06.000000000 +0200
@@ -39,6 +39,21 @@
 #define MODULE_CONFIG          "module.config"
 #define CARDMGR_PIDFILE                "/run/cardmgr.pid"
 
+#define MODULE_SUFFIX  ".ko"
+#define MODULE_COMP1   ".xz"
+#define MOD_EXT(mod)   { .ext = (mod), .len = sizeof(mod) - 1 }
+
+typedef struct {
+       char *ext;
+       size_t len;
+} mod_extensions_t;
+
+static const mod_extensions_t mod_extensions[] = {
+  MOD_EXT(MODULE_SUFFIX MODULE_COMP1),
+  MOD_EXT(MODULE_SUFFIX),
+  { }
+};
+
 static int mod_types = 0;
 static int mod_type[MAX_MODULE_TYPES] = {};
 static int mod_menu_last = 0;
@@ -96,6 +111,40 @@
   return !i || (i == 1 && !*mod_items) ? 0 : 1;
 }
 
+static inline int mod_cmp_ext(const char *file, const size_t len,
+    const char *ext, const size_t ext_len)
+{
+  return len >= ext_len && !strcmp(file + len - ext_len, ext);
+}
+
+int mod_has_module_ext(const char *file, const size_t len, size_t *ext_pos)
+{
+  const mod_extensions_t *mod_ext;
+
+  for (mod_ext = mod_extensions; mod_ext->ext; mod_ext++)
+    if (mod_cmp_ext(file, len, mod_ext->ext, mod_ext->len)) {
+      if (ext_pos)
+       *ext_pos = len - mod_ext->len;
+      return 1;
+    }
+
+  return 0;
+}
+
+int mod_find_module(const char *prefix, const char *module, char *file)
+{
+  const mod_extensions_t *mod_ext;
+  int file_len;
+
+  file_len = sprintf(file, "%s/%s", prefix, module);
+  for (mod_ext = mod_extensions; mod_ext->ext; mod_ext++) {
+    strcpy(file + file_len, mod_ext->ext);
+    if(util_check_exist(file))
+      return 1;
+  }
+
+  return 0;
+}
 
 int mod_copy_modules(char *src_dir, int doit)
 {
@@ -119,12 +168,8 @@
 
   while((de = readdir(d))) {
     i = strlen(de->d_name);
-    if(
-      i >= sizeof MODULE_SUFFIX &&
-      (
-        !strcmp(de->d_name + i + 1 - sizeof MODULE_SUFFIX, MODULE_SUFFIX) ||
+    if(mod_has_module_ext(de->d_name, i, NULL) ||
         !strcmp(de->d_name, MODULE_CONFIG)
-      )
     ) {
       ok = 0;
       if(doit == 2) {
@@ -213,6 +258,7 @@
   DIR *d;
   char buf[32];
   int i, found;
+  size_t ext_pos;
 
   for(ml1 = &config.module.list; *ml1; ml1 = &(*ml1)->next) (*ml1)->exists = 0;
 
@@ -221,12 +267,11 @@
   while((de = readdir(d))) {
     i = strlen(de->d_name);
     if(
-      i >= sizeof MODULE_SUFFIX &&
       i < (int) sizeof buf &&
-      !strcmp(de->d_name + i + 1 - sizeof MODULE_SUFFIX, MODULE_SUFFIX)
+      mod_has_module_ext(de->d_name, i, &ext_pos)
     ) {
       strcpy(buf, de->d_name);
-      buf[i + 1 - sizeof MODULE_SUFFIX] = 0;
+      buf[ext_pos] = 0;
 
       for(found = 0, ml = config.module.list; ml; ml = ml->next) {
         /* Don't stop if it is an 'autoload' entry! */
@@ -632,8 +677,8 @@
 int mod_insmod(char *module, char *param)
 {
   char buf[512];
+  size_t buf_len;
   int err, cnt;
-  char *force = config.forceinsmod ? "-f " : "";
   slist_t *sl;
   driver_t *drv;
 
@@ -647,11 +692,14 @@
 
   if(mod_is_loaded(module)) return 0;
 
-  if(!config.forceinsmod) {
-    if(!util_check_exist(module)) {
-      sprintf(buf, "%s/%s" MODULE_SUFFIX, config.module.dir, module);
-      if(!util_check_exist(buf)) return -1;
-    }
+  buf_len = sprintf(buf, "insmod %s", config.forceinsmod ? "-f " : "");
+
+  if (util_check_exist(module)) {
+    /* wow, user provided a _path_ */
+    strcpy(buf + buf_len, module);
+  } else {
+    if(!mod_find_module(config.module.dir, module, buf + buf_len))
+      return -1;
   }
 
   if(slist_getentry(config.module.broken, module)) {
@@ -659,8 +707,6 @@
     return -1;
   }
 
-  sprintf(buf, "insmod %s%s/%s" MODULE_SUFFIX, force, config.module.dir, 
module);
-
   if(param && *param) sprintf(buf + strlen(buf), " '%s'", param);
 
   if(config.run_as_linuxrc) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/module.h new/linuxrc-6.0.15/module.h
--- old/linuxrc-6.0.14/module.h 2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/module.h 2019-09-24 15:39:06.000000000 +0200
@@ -21,3 +21,6 @@
 void       mod_disk_text(char *buf, int type);
 int        mod_copy_modules(char *src_dir, int doit);
 int        mod_cmp(char *str1, char *str2);
+int        mod_has_module_ext(const char *file, const size_t len,
+               size_t *ext_pos);
+int        mod_find_module(const char *prefix, const char *module, char *file);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-6.0.14/util.c new/linuxrc-6.0.15/util.c
--- old/linuxrc-6.0.14/util.c   2019-08-15 10:49:34.000000000 +0200
+++ new/linuxrc-6.0.15/util.c   2019-09-24 15:39:06.000000000 +0200
@@ -730,7 +730,6 @@
 void add_driver_update(char *dir, char *loc)
 {
   unsigned u;
-  size_t len;
   char *copy_dir[] = { "install", "modules", "y2update", "inst-sys" };
   char *src = NULL, *dst = NULL, *buf1 = NULL, *buf2 = NULL;
   char *argv[3];
@@ -844,10 +843,7 @@
       strprintf(&buf2, "%s/modules/module.order", dst);
       if(!util_check_exist(buf2) && (f = fopen(buf2, "w"))) {
         while((de = readdir(d))) {
-          if(
-            (len = strlen(de->d_name)) > sizeof MODULE_SUFFIX - 1 &&
-            !strcmp(de->d_name + len - (sizeof MODULE_SUFFIX - 1), 
MODULE_SUFFIX)
-          ) {
+          if(mod_has_module_ext(de->d_name, strlen(de->d_name), NULL)) {
             fprintf(f, "%s\n", de->d_name);
           }
         }


Reply via email to