diff -urN -X dontdiff linux/arch/sparc64/kernel/traps.c linux-kmod-func/arch/sparc64/kernel/traps.c
--- linux/arch/sparc64/kernel/traps.c   Tue Dec 21 06:05:52 1999
+++ linux-kmod-func/arch/sparc64/kernel/traps.c Thu Jan 13 14:15:03 2000
@@ -10,6 +10,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/sched.h>  /* for jiffies */
#include <linux/kernel.h>
#include <linux/signal.h>
@@ -27,9 +28,6 @@
#include <asm/fpumacro.h>
#include <asm/lsu.h>
#include <asm/psrcompat.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

/* #define SYSCALL_TRACING */
/* #define VERBOSE_SYSCALL_TRACING */
diff -urN -X dontdiff linux/drivers/block/ide.c linux-kmod-func/drivers/block/ide.c
--- linux/drivers/block/ide.c   Sun Jan  9 01:41:16 2000
+++ linux-kmod-func/drivers/block/ide.c Thu Jan 13 14:15:03 2000
@@ -151,9 +151,6 @@

#include "ide_modes.h"

-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif /* CONFIG_KMOD */

#ifdef CONFIG_BLK_DEV_VIA82CXXX
extern byte fifoconfig;                /* defined in via82cxxx.c used by ide_setup() */
@@ -1795,10 +1792,8 @@
               module = module->next;
       }
       revalidate_drives();
-#ifdef CONFIG_KMOD
       if (!found && type == IDE_PROBE_MODULE)
               (void) request_module("ide-probe");
-#endif /* CONFIG_KMOD */
}

static int ide_open (struct inode * inode, struct file * filp)
@@ -1811,7 +1806,6 @@
       MOD_INC_USE_COUNT;
       if (drive->driver == NULL)
               ide_init_module(IDE_DRIVER_MODULE);
-#ifdef CONFIG_KMOD
       if (drive->driver == NULL) {
               if (drive->media == ide_disk)
                       (void) request_module("ide-disk");
@@ -1822,7 +1816,6 @@
               if (drive->media == ide_floppy)
                       (void) request_module("ide-floppy");
       }
-#endif /* CONFIG_KMOD */
       while (drive->busy)
               sleep_on(&drive->wqueue);
       drive->usage++;
diff -urN -X dontdiff linux/drivers/block/md.c linux-kmod-func/drivers/block/md.c
--- linux/drivers/block/md.c    Sun Jan  9 01:41:16 2000
+++ linux-kmod-func/drivers/block/md.c  Thu Jan 13 14:15:03 2000
@@ -46,9 +46,6 @@
#include <linux/blkdev.h>
#include <linux/genhd.h>
#include <linux/smp_lock.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#include <linux/errno.h>
#include <linux/init.h>

@@ -406,12 +403,8 @@
  }
  if (!pers[pnum])
  {
-#ifdef CONFIG_KMOD
-    char module_name[80];
-    sprintf (module_name, "md-personality-%d", pnum);
-    request_module (module_name);
+    request_module ("md-personality-%d", pnum);
    if (!pers[pnum])
-#endif
      return -EINVAL;
  }

diff -urN -X dontdiff linux/drivers/char/bttv.c linux-kmod-func/drivers/char/bttv.c
--- linux/drivers/char/bttv.c   Sat Jan  8 20:54:54 2000
+++ linux-kmod-func/drivers/char/bttv.c Thu Jan 13 14:15:03 2000
@@ -41,7 +41,6 @@
#include <linux/wrapper.h>
#include <linux/interrupt.h>
#include <linux/version.h>
-#include <linux/kmod.h>
#include <linux/vmalloc.h>

#include <linux/i2c.h>
diff -urN -X dontdiff linux/drivers/char/ftape/zftape/zftape-init.c linux-kmod-func/drivers/char/ftape/zftape/zftape-init.c
--- linux/drivers/char/ftape/zftape/zftape-init.c       Tue Nov 23 18:29:15 1999
+++ linux-kmod-func/drivers/char/ftape/zftape/zftape-init.c     Thu Jan 13 14:15:03 2000
@@ -30,9 +30,6 @@
#include <linux/signal.h>
#include <linux/major.h>
#include <linux/malloc.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#include <linux/fcntl.h>
#include <linux/wrapper.h>

@@ -382,7 +379,6 @@
int zft_cmpr_lock(int try_to_load)
{
       if (zft_cmpr_ops == NULL) {
-#ifdef CONFIG_KMOD
               if (try_to_load) {
                       request_module("zft-compressor");
                       if (zft_cmpr_ops == NULL) {
@@ -391,9 +387,6 @@
               } else {
                       return -ENOSYS;
               }
-#else
-               return -ENOSYS;
-#endif
       }
       (*zft_cmpr_ops->lock)();
       return 0;
diff -urN -X dontdiff linux/drivers/char/misc.c linux-kmod-func/drivers/char/misc.c
--- linux/drivers/char/misc.c   Tue Dec 14 00:26:27 1999
+++ linux-kmod-func/drivers/char/misc.c Thu Jan 13 14:15:03 2000
@@ -46,7 +46,6 @@

#include <linux/tty.h>
#include <linux/selection.h>
-#include <linux/kmod.h>

#include "busmouse.h"

@@ -102,9 +101,9 @@
       while ((c != &misc_list) && (c->minor != minor))
               c = c->next;
       if (c == &misc_list) {
-               char modname[20];
-               sprintf(modname, "char-major-%d-%d", MISC_MAJOR, minor);
-               request_module(modname);
+               if (request_module("char-major-%d-%d", MISC_MAJOR, minor) != 0)
+                       return -ENODEV;
+
               c = misc_list.next;
               while ((c != &misc_list) && (c->minor != minor))
                       c = c->next;
diff -urN -X dontdiff linux/drivers/char/tty_io.c linux-kmod-func/drivers/char/tty_io.c
--- linux/drivers/char/tty_io.c Thu Jan 13 14:11:18 2000
+++ linux-kmod-func/drivers/char/tty_io.c       Thu Jan 13 14:15:03 2000
@@ -57,6 +57,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/major.h>
#include <linux/errno.h>
@@ -89,8 +90,6 @@
#include <linux/vt_kern.h>
#include <linux/selection.h>

-#include <linux/kmod.h>
-
#define CONSOLE_DEV MKDEV(TTY_MAJOR,0)
#define TTY_DEV MKDEV(TTYAUX_MAJOR,0)
#define SYSCONS_DEV MKDEV(TTYAUX_MAJOR,1)
@@ -225,11 +224,8 @@
               return -EINVAL;
       /* Eduardo Blanco <[email protected]> */
       /* Cyrus Durgin <[email protected]> */
-       if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) {
-               char modname [20];
-               sprintf(modname, "tty-ldisc-%d", ldisc);
-               request_module (modname);
-       }
+       if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED))
+               request_module("tty-ldisc-%d", ldisc);
       if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED))
               return -EINVAL;

diff -urN -X dontdiff linux/drivers/char/videodev.c linux-kmod-func/drivers/char/videodev.c
--- linux/drivers/char/videodev.c       Thu Dec 30 01:13:02 1999
+++ linux-kmod-func/drivers/char/videodev.c     Thu Jan 13 14:15:03 2000
@@ -30,9 +30,6 @@
#endif
#include <asm/system.h>

-#include <linux/kmod.h>
-
-
#define VIDEO_NUM_DEVICES      256

/*
@@ -135,10 +132,7 @@

       vfl=video_device[minor];
       if(vfl==NULL) {
-               char modname[20];
-
-               sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
-               request_module(modname);
+               request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
               vfl=video_device[minor];
               if (vfl==NULL)
                       return -ENODEV;
diff -urN -X dontdiff linux/drivers/net/ppp_generic.c linux-kmod-func/drivers/net/ppp_generic.c
--- linux/drivers/net/ppp_generic.c     Tue Nov  9 19:50:49 1999
+++ linux-kmod-func/drivers/net/ppp_generic.c   Thu Jan 13 14:15:03 2000
@@ -27,7 +27,6 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/netdevice.h>
@@ -1195,9 +1194,6 @@
       struct compressor *cp;
       struct ppp_option_data data;
       unsigned char ccp_option[CCP_MAX_OPTION_LENGTH];
-#ifdef CONFIG_KMOD
-       char modname[32];
-#endif

       err = -EFAULT;
       if (copy_from_user(&data, (void *) arg, sizeof(data))
@@ -1210,13 +1206,8 @@
               goto out;

       cp = find_compressor(ccp_option[0]);
-#ifdef CONFIG_KMOD
-       if (cp == 0) {
-               sprintf(modname, "ppp-compress-%d", ccp_option[0]);
-               request_module(modname);
+       if (cp == 0 && request_module("ppp-compress-%d", ccp_option[0]) == 0)
               cp = find_compressor(ccp_option[0]);
-       }
-#endif /* CONFIG_KMOD */
       if (cp == 0)
               goto out;

diff -urN -X dontdiff linux/drivers/parport/share.c linux-kmod-func/drivers/parport/share.c
--- linux/drivers/parport/share.c       Thu Dec 30 18:11:57 1999
+++ linux-kmod-func/drivers/parport/share.c     Thu Jan 13 14:15:03 2000
@@ -24,7 +24,7 @@
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/sched.h>
-#include <linux/kmod.h>
+#include <linux/module.h>

#include <linux/spinlock.h>
#include <asm/irq.h>
diff -urN -X dontdiff linux/drivers/scsi/fcal.c linux-kmod-func/drivers/scsi/fcal.c
--- linux/drivers/scsi/fcal.c   Tue Dec 21 06:06:42 1999
+++ linux-kmod-func/drivers/scsi/fcal.c Thu Jan 13 14:15:03 2000
@@ -14,9 +14,6 @@
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/config.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

#include <asm/irq.h>

@@ -99,7 +96,7 @@
                       fcalcount++;
       FCALND(("%d channels online\n", fcalcount))
       if (!fcalcount) {
-#if defined(MODULE) && defined(CONFIG_FC4_SOCAL_MODULE) && defined(CONFIG_KMOD)
+#if defined(MODULE) && defined(CONFIG_FC4_SOCAL_MODULE)
               request_module("socal");

               for_each_online_fc_channel(fc)
diff -urN -X dontdiff linux/drivers/scsi/pluto.c linux-kmod-func/drivers/scsi/pluto.c
--- linux/drivers/scsi/pluto.c  Tue Dec 21 06:06:42 1999
+++ linux-kmod-func/drivers/scsi/pluto.c        Thu Jan 13 14:15:03 2000
@@ -14,9 +14,6 @@
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/config.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

#include <asm/irq.h>

@@ -101,7 +98,7 @@
       }
       PLND(("%d channels online\n", fcscount))
       if (!fcscount) {
-#if defined(MODULE) && defined(CONFIG_FC4_SOC_MODULE) && defined(CONFIG_KMOD)
+#if defined(MODULE) && defined(CONFIG_FC4_SOC_MODULE)
               request_module("soc");

               for_each_online_fc_channel(fc) {
diff -urN -X dontdiff linux/drivers/scsi/scsi.c linux-kmod-func/drivers/scsi/scsi.c
--- linux/drivers/scsi/scsi.c   Fri Jan  7 19:55:28 2000
+++ linux-kmod-func/drivers/scsi/scsi.c Thu Jan 13 14:15:03 2000
@@ -65,10 +65,6 @@
#include "hosts.h"
#include "constants.h"

-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
#undef USE_STATIC_SCSI_MEMORY

struct proc_dir_entry *proc_scsi = NULL;
@@ -3203,10 +3199,8 @@

               /* Load upper level device handler of some kind */
       case MODULE_SCSI_DEV:
-#ifdef CONFIG_KMOD
               if (scsi_hosts == NULL)
                       request_module("scsi_hostadapter");
-#endif
               return scsi_register_device_module((struct Scsi_Device_Template *) ptr);
               /* The rest of these are not yet implemented */

diff -urN -X dontdiff linux/drivers/sound/audio.c linux-kmod-func/drivers/sound/audio.c
--- linux/drivers/sound/audio.c Wed Jun  2 07:25:48 1999
+++ linux-kmod-func/drivers/sound/audio.c       Thu Jan 13 14:15:03 2000
@@ -26,7 +26,7 @@
#include <linux/config.h>
#include <linux/stddef.h>
#include <linux/string.h>
-#include <linux/kmod.h>
+#include <linux/module.h>

#include "sound_config.h"

diff -urN -X dontdiff linux/drivers/sound/midibuf.c linux-kmod-func/drivers/sound/midibuf.c
--- linux/drivers/sound/midibuf.c       Wed May 12 07:40:50 1999
+++ linux-kmod-func/drivers/sound/midibuf.c     Thu Jan 13 14:15:03 2000
@@ -15,7 +15,7 @@
 */
#include <linux/config.h>
#include <linux/stddef.h>
-#include <linux/kmod.h>
+#include <linux/module.h>

#define MIDIBUF_C

diff -urN -X dontdiff linux/drivers/sound/sequencer.c linux-kmod-func/drivers/sound/sequencer.c
--- linux/drivers/sound/sequencer.c     Wed May 12 07:40:50 1999
+++ linux-kmod-func/drivers/sound/sequencer.c   Thu Jan 13 14:15:03 2000
@@ -15,8 +15,7 @@
 * Alan Cox       : reformatted and fixed a pair of null pointer bugs
 */
#include <linux/config.h>
-
-#include <linux/kmod.h>
+#include <linux/module.h>


#define SEQUENCER_C
diff -urN -X dontdiff linux/drivers/sound/sound_core.c linux-kmod-func/drivers/sound/sound_core.c
--- linux/drivers/sound/sound_core.c    Fri Jan  7 19:43:09 2000
+++ linux-kmod-func/drivers/sound/sound_core.c  Thu Jan 13 14:15:03 2000
@@ -42,7 +42,6 @@
#include <linux/fs.h>
#include <linux/sound.h>
#include <linux/major.h>
-#include <linux/kmod.h>


struct sound_unit
@@ -318,8 +317,6 @@
       spin_lock(&sound_loader_lock);
       s = __look_for_unit(chain, unit);
       if (s == NULL) {
-               char mod[32];
-
               spin_unlock(&sound_loader_lock);
               /*
                *  Please, don't change this order or code.
@@ -328,10 +325,8 @@
                *  ALSA toplevel modules for soundcards, thus we need
                *  load them at first.   [Jaroslav Kysela <[email protected]>]
                */
-               sprintf(mod, "sound-slot-%i", unit>>4);
-               request_module(mod);
-               sprintf(mod, "sound-service-%i-%i", unit>>4, chain);
-               request_module(mod);
+               request_module("sound-slot-%i", unit>>4);
+               request_module("sound-service-%i-%i", unit>>4, chain);
               spin_lock(&sound_loader_lock);
               s = __look_for_unit(chain, unit);
       }
diff -urN -X dontdiff linux/drivers/sound/soundcard.c linux-kmod-func/drivers/sound/soundcard.c
--- linux/drivers/sound/soundcard.c     Sun Nov 21 19:13:56 1999
+++ linux-kmod-func/drivers/sound/soundcard.c   Thu Jan 13 14:15:03 2000
@@ -20,6 +20,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>

#include "sound_config.h"
#include <linux/types.h>
@@ -28,7 +29,6 @@
#include <linux/fcntl.h>
#include <linux/ctype.h>
#include <linux/stddef.h>
-#include <linux/kmod.h>
#ifdef __KERNEL__
#include <asm/dma.h>
#include <asm/io.h>
@@ -470,11 +470,8 @@

       case SND_DEV_CTL:
               dev >>= 4;
-               if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) {
-                       char modname[20];
-                       sprintf(modname, "mixer%d", dev);
-                       request_module(modname);
-               }
+               if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL)
+                       request_module("mixer%d", dev);
               if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL))
                       return -ENXIO;
               break;
@@ -591,11 +588,8 @@
       if (mixdev < 0 || mixdev >= MAX_MIXER_DEV)
               return -ENXIO;
       /* Try to load the mixer... */
-       if (mixer_devs[mixdev] == NULL) {
-               char modname[20];
-               sprintf(modname, "mixer%d", mixdev);
-               request_module(modname);
-       }
+       if (mixer_devs[mixdev] == NULL)
+               request_module("mixer%d", mixdev);
       if (mixdev >= num_mixers || !mixer_devs[mixdev])
               return -ENXIO;
       if (cmd == SOUND_MIXER_INFO)
diff -urN -X dontdiff linux/drivers/telephony/phonedev.c linux-kmod-func/drivers/telephony/phonedev.c
--- linux/drivers/telephony/phonedev.c  Thu Dec 30 01:13:59 1999
+++ linux-kmod-func/drivers/telephony/phonedev.c        Thu Jan 13 14:15:03 2000
@@ -26,8 +26,6 @@
#include <asm/uaccess.h>
#include <asm/system.h>

-#include <linux/kmod.h>
-

#define PHONE_NUM_DEVICES      256

@@ -52,10 +50,7 @@

       p = phone_device[minor];
       if (p == NULL) {
-               char modname[32];
-
-               sprintf(modname, "char-major-%d-%d", PHONE_MAJOR, minor);
-               request_module(modname);
+               request_module("char-major-%d-%d", PHONE_MAJOR, minor);
               p = phone_device[minor];
               if (p == NULL)
                       return -ENODEV;
diff -urN -X dontdiff linux/drivers/video/fbmem.c linux-kmod-func/drivers/video/fbmem.c
--- linux/drivers/video/fbmem.c Fri Jan  7 20:59:42 2000
+++ linux-kmod-func/drivers/video/fbmem.c       Thu Jan 13 14:15:03 2000
@@ -22,9 +22,6 @@
#include <linux/console.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

#if defined(__mc68000__) || defined(CONFIG_APUS)
#include <asm/setup.h>
@@ -300,16 +297,6 @@
       return copy_size;
}

-#ifdef CONFIG_KMOD
-static void try_to_load(int fb)
-{
-       char modname[16];
-
-       sprintf(modname, "fb%d", fb);
-       request_module(modname);
-}
-#endif /* CONFIG_KMOD */
-
static int
fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        unsigned long arg)
@@ -378,10 +365,8 @@
                   return -EINVAL;
               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
                   return -EINVAL;
-#ifdef CONFIG_KMOD
               if (!registered_fb[con2fb.framebuffer])
-                   try_to_load(con2fb.framebuffer);
-#endif /* CONFIG_KMOD */
+                   request_module("fb%d", con2fb.framebuffer);
               if (!registered_fb[con2fb.framebuffer])
                   return -EINVAL;
               if (con2fb.console != 0)
@@ -532,10 +517,8 @@
       int fbidx = GET_FB_IDX(inode->i_rdev);
       struct fb_info *info;

-#ifdef CONFIG_KMOD
       if (!(info = registered_fb[fbidx]))
-               try_to_load(fbidx);
-#endif /* CONFIG_KMOD */
+               request_module("fb%d", fbidx);
       if (!(info = registered_fb[fbidx]))
               return -ENODEV;
       return info->fbops->fb_open(info,1);
diff -urN -X dontdiff linux/fs/block_dev.c linux-kmod-func/fs/block_dev.c
--- linux/fs/block_dev.c        Mon Jan 10 00:51:37 2000
+++ linux-kmod-func/fs/block_dev.c      Thu Jan 13 14:15:03 2000
@@ -5,11 +5,11 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/mm.h>
#include <linux/locks.h>
#include <linux/fcntl.h>
#include <linux/malloc.h>
-#include <linux/kmod.h>

#include <asm/uaccess.h>

@@ -446,13 +446,8 @@

       /* major 0 is used for non-device mounts */
       if (major && major < MAX_BLKDEV) {
-#ifdef CONFIG_KMOD
-               if (!blkdevs[major].bdops) {
-                       char name[20];
-                       sprintf(name, "block-major-%d", major);
-                       request_module(name);
-               }
-#endif
+               if (!blkdevs[major].bdops)
+                       request_module("block-major-%d", major);
               ret = blkdevs[major].bdops;
       }
       return ret;
diff -urN -X dontdiff linux/fs/devices.c linux-kmod-func/fs/devices.c
--- linux/fs/devices.c  Thu Jan  6 18:14:36 2000
+++ linux-kmod-func/fs/devices.c        Thu Jan 13 14:15:03 2000
@@ -10,6 +10,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/string.h>
@@ -17,16 +18,12 @@
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/errno.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-
#include <linux/tty.h>

/* serial module kmod load support */
struct tty_driver *get_tty_driver(kdev_t device);
#define isa_tty_dev(ma)        (ma == TTY_MAJOR || ma == TTYAUX_MAJOR)
#define need_serial(ma,mi) (get_tty_driver(MKDEV(ma,mi)) == NULL)
-#endif

struct device_struct {
       const char * name;
@@ -68,7 +65,6 @@
       struct file_operations *ret = NULL;

       if (major < maxdev){
-#ifdef CONFIG_KMOD
               /*
                * I do get request for device 0. I have no idea why. It happen
                * at shutdown time for one. Without the following test, the
@@ -85,12 +81,8 @@
                *  as there is no other loadable dev on these majors
                */
               if ((isa_tty_dev(major) && need_serial(major,minor)) ||
-                   (major != 0 && !tb[major].fops)) {
-                       char name[20];
-                       sprintf(name, mangle, major);
-                       request_module(name);
-               }
-#endif
+                   (major != 0 && !tb[major].fops))
+                       request_module(mangle, major);
               ret = tb[major].fops;
       }
       return ret;
diff -urN -X dontdiff linux/fs/exec.c linux-kmod-func/fs/exec.c
--- linux/fs/exec.c     Wed Dec 29 19:42:07 1999
+++ linux-kmod-func/fs/exec.c   Thu Jan 13 14:15:03 2000
@@ -23,6 +23,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/mman.h>
@@ -38,9 +39,6 @@
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>

-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

static struct linux_binfmt *formats = (struct linux_binfmt *) NULL;

@@ -779,18 +777,14 @@
               }
               if (retval != -ENOEXEC) {
                       break;
-#ifdef CONFIG_KMOD
               }else{
#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
-                       char modname[20];
                       if (printable(bprm->buf[0]) &&
                           printable(bprm->buf[1]) &&
                           printable(bprm->buf[2]) &&
                           printable(bprm->buf[3]))
                               break; /* -ENOEXEC */
-                       sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
-                       request_module(modname);
-#endif
+                       request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
               }
       }
       return retval;
diff -urN -X dontdiff linux/fs/fat/cvf.c linux-kmod-func/fs/fat/cvf.c
--- linux/fs/fat/cvf.c  Mon Aug  9 19:43:49 1999
+++ linux-kmod-func/fs/fat/cvf.c        Thu Jan 13 14:15:03 2000
@@ -8,16 +8,14 @@
 *
 */

-#include<linux/sched.h>
-#include<linux/fs.h>
-#include<linux/msdos_fs.h>
-#include<linux/msdos_fs_sb.h>
-#include<linux/string.h>
-#include<linux/fat_cvf.h>
-#include<linux/config.h>
-#ifdef CONFIG_KMOD
-#include<linux/kmod.h>
-#endif
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/msdos_fs.h>
+#include <linux/msdos_fs_sb.h>
+#include <linux/string.h>
+#include <linux/fat_cvf.h>
+#include <linux/config.h>

#define MAX_CVF_FORMATS 3

@@ -181,20 +179,17 @@
  if(force)
    if(strcmp(force,"autoload")==0)
    {
-#ifdef CONFIG_KMOD
-      request_module("cvf_autoload");
-      force=NULL;
-#else
-      printk("cannot autoload CVF modules: kmod support is not compiled into kernel\n");
-      return -1;
-#endif
+      if (request_module("cvf_autoload") == 0)
+       force=NULL;
+      else {
+        printk("cannot autoload CVF modules: kmod support is not compiled into kernel\n");
+        return -1;
+      }
    }

-#ifdef CONFIG_KMOD
  if(force)
    if(*force)
      request_module(force);
-#endif

  if(force)
  { if(*force)
diff -urN -X dontdiff linux/fs/filesystems.c linux-kmod-func/fs/filesystems.c
--- linux/fs/filesystems.c      Mon Jan  3 20:01:31 2000
+++ linux-kmod-func/fs/filesystems.c    Thu Jan 13 14:15:03 2000
@@ -7,6 +7,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/fs.h>

#include <linux/minix_fs.h>
@@ -36,9 +37,6 @@
#include <linux/major.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#include <linux/lockd/bind.h>
#include <linux/lockd/xdr.h>
#include <linux/init.h>
@@ -188,12 +186,10 @@
               ret = do_nfsservctl(cmd, argp, resp);
               goto out;
       }
-#ifdef CONFIG_KMOD
       if (request_module ("nfsd") == 0) {
               if (do_nfsservctl)
                       ret = do_nfsservctl(cmd, argp, resp);
       }
-#endif /* CONFIG_KMOD */
out:
       unlock_kernel();
       return ret;
diff -urN -X dontdiff linux/fs/nls/nls_base.c linux-kmod-func/fs/nls/nls_base.c
--- linux/fs/nls/nls_base.c     Tue Dec  7 18:21:10 1999
+++ linux-kmod-func/fs/nls/nls_base.c   Thu Jan 13 14:15:36 2000
@@ -14,9 +14,6 @@
#include <linux/config.h>
#include <linux/nls.h>
#include <linux/malloc.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#include <asm/byteorder.h>

static struct nls_table *tables = (struct nls_table *) NULL;
@@ -204,37 +201,23 @@
struct nls_table *load_nls(char *charset)
{
       struct nls_table *nls;
-#ifdef CONFIG_KMOD
-       char buf[40];
-       int ret;
-#endif

       nls = find_nls(charset);
       if (nls) {
               nls->inc_use_count();
               return nls;
       }
-
-#ifndef CONFIG_KMOD
-       return NULL;
-#else
-       if (strlen(charset) > sizeof(buf) - sizeof("nls_")) {
-               printk("Unable to load NLS charset %s: name too long\n", charset);
-               return NULL;
-       }

-       sprintf(buf, "nls_%s", charset);
-       ret = request_module(buf);
-       if (ret != 0) {
+       if (request_module("nls_%s", charset) != 0) {
               printk("Unable to load NLS charset %s\n", charset);
               return NULL;
       }
+
       nls = find_nls(charset);
-       if (nls) {
+       if (nls)
               nls->inc_use_count();
-       }
+
       return nls;
-#endif
}

void unload_nls(struct nls_table *nls)
diff -urN -X dontdiff linux/fs/super.c linux-kmod-func/fs/super.c
--- linux/fs/super.c    Thu Jan  6 18:14:36 2000
+++ linux-kmod-func/fs/super.c  Thu Jan 13 14:15:03 2000
@@ -18,6 +18,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/malloc.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
@@ -32,9 +33,6 @@
#include <linux/nfs_fs_sb.h>
#include <linux/nfs_mount.h>

-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

/*
 * We use a semaphore to synchronize all mount/umount
@@ -394,12 +392,10 @@
               return fs;
       for (fs = file_systems; fs && strcmp(fs->name, name); fs = fs->next)
               ;
-#ifdef CONFIG_KMOD
       if (!fs && (request_module(name) == 0)) {
               for (fs = file_systems; fs && strcmp(fs->name, name); fs = fs->next)
                       ;
       }
-#endif

       return fs;
}
diff -urN -X dontdiff linux/include/asm-arm/unistd.h linux-kmod-func/include/asm-arm/unistd.h
--- linux/include/asm-arm/unistd.h      Tue Jan 11 02:15:58 2000
+++ linux-kmod-func/include/asm-arm/unistd.h    Tue Jan 11 02:15:58 2000
@@ -290,5 +290,137 @@
  "mov\t%0,r0"                                                         \
        : "=r" (__res)                                                 \
        : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3))     \
-        : "r0","r1","r2","lrZ� .���..[�     Config.in\�Makefile]� joy-amiga.c^� joy-analog.c_� joy-analog.h`�joy-assassin.ca� joy-console.cb� joy-db9.cc� joy-gravis.cd�joy-lightning.ce�joy-logitech.cf�joy-sidewinder.cg�joy-thrustmaster.ch�joy-turbografx.ci�
-joystick.cj�joy-creative.ck�joy-magellan.cl�    joy-pci.cm�joy-spaceball.cn�joy-spaceorb.co� joy-warrior.cU�.depend
\ No newline at end of file
+        : "r0","r1","r2","lr");                                                \
+  __syscall_return(type,__res);                                                \
+}
+
+
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)               \
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {                            \
+  long __res;                                                                          \
+  __asm__ __volatile__ (                                                               \
+  "mov\tr0,%1\n\t"                                                                     \
+  "mov\tr1,%2\n\t"                                                                     \
+  "mov\tr2,%3\n\t"                                                                     \
+  "mov\tr3,%4\n\t"                                                                     \
+  __syscall(name)                                                                      \
+  "mov\t%0,r0"                                                                         \
+       : "=r" (__res)                                                                  \
+       : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4))   \
+       : "r0","r1","r2","r3","lr");                                                    \
+  __syscall_return(type,__res);                                                                \
+}
+
+
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5)    \
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {                        \
+  long __res;                                                                          \
+  __asm__ __volatile__ (                                                               \
+  "mov\tr0,%1\n\t"                                                                     \
+  "mov\tr1,%2\n\t"                                                                     \
+  "mov\tr2,%3\n\t"                                                                     \
+  "mov\tr3,%4\n\t"                                                                     \
+  "mov\tr4,%5\n\t"                                                                     \
+  __syscall(name)                                                                      \
+  "mov\t%0,r0"                                                                         \
+       : "=r" (__res)                                                                  \
+       : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)),  \
+         "r" ((long)(arg5))                                                            \
+       : "r0","r1","r2","r3","r4","lr");                                               \
+  __syscall_return(type,__res);                                                                \
+}
+
+#ifdef __KERNEL_SYSCALLS__
+
+static inline long idle(void)
+{
+       extern long sys_idle(void);
+       return sys_idle();
+}
+
+static inline long pause(void)
+{
+       extern long sys_pause(void);
+       return sys_pause();
+}
+
+static inline long sync(void)
+{
+       extern long sys_sync(void);
+       return sys_sync();
+}
+
+static inline pid_t setsid(void)
+{
+       extern long sys_setsid(void);
+       return sys_setsid();
+}
+
+static inline long write(int fd, const char *buf, off_t count)
+{
+       extern long sys_write(int, const char *, int);
+       return sys_write(fd, buf, count);
+}
+
+static inline long read(int fd, char *buf, off_t count)
+{
+       extern long sys_read(int, char *, int);
+       return sys_read(fd, buf, count);
+}
+
+static inline off_t lseek(int fd, off_t offset, int count)
+{
+       extern off_t sys_lseek(int, off_t, int);
+       return sys_lseek(fd, offset, count);
+}
+
+static inline long dup(int fd)
+{
+       extern long sys_dup(int);
+       return sys_dup(fd);
+}
+
+static inline long open(const char *file, int flag, int mode)
+{
+       extern long sys_open(const char *, int, int);
+       return sys_open(file, flag, mode);
+}
+
+static inline long close(int fd)
+{
+       extern long sys_close(unsigned int);
+       return sys_close(fd);
+}
+
+static inline long _exit(int exitcode)
+{
+       extern long sys_exit(int) __attribute__((noreturn));
+       return sys_exit(exitcode);
+}
+
+static inline pid_t waitpid(pid_t pid, int *wait_stat, int options)
+{
+       extern long sys_wait4(int, int *, int, struct rusage *);
+       return sys_wait4((int)pid, wait_stat, options, NULL);
+}
+
+static inline long delete_module(const char *name)
+{
+       extern long sys_delete_module(const char *name);
+       return sys_delete_module(name);
+}
+
+static inline pid_t wait(int * wait_stat)
+{
+       extern long sys_wait4(int, int *, int, struct rusage *);
+       return sys_wait4(-1, wait_stat, 0, NULL);
+}
+
+/*
+ * The following two can't be eliminated yet - they rely on
+ * specific conditions.
+ */
+static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp);
+
+#endif
+#endif /* __ASM_ARM_UNISTD_H */
diff -urN -X dontdiff linux/include/linux/kmod.h linux-kmod-func/include/linux/kmod.h
--- linux/include/linux/kmod.h  Tue Jan 11 02:29:09 2000
+++ linux-kmod-func/include/linux/kmod.h        Thu Jan  1 01:00:00 1970
@@ -1,12 +0,0 @@
-/*
-       kmod header
-*/
-
-#include <linux/config.h>
-
-#ifdef CONFIG_KMOD
-extern int request_module(const char * name);
-#else
-#define request_module(x) do {} while(0)
-#endif
-
diff -urN -X dontdiff linux/include/linux/module.h linux-kmod-func/include/linux/module.h
--- linux/include/linux/module.h        Thu Jan 13 14:11:19 2000
+++ linux-kmod-func/include/linux/module.h      Thu Jan 13 14:16:10 2000
@@ -9,6 +9,7 @@

#include <linux/config.h>
#include <linux/spinlock.h>
+#include <stdarg.h>

#ifdef __GENKSYMS__
#  define _set_ver(sym) sym
@@ -295,5 +296,8 @@
#else
#define EXPORT_NO_SYMBOLS
#endif /* MODULE */
+
+extern int request_module(const char * fmt, ...)
+       __attribute__ ((format(printf, 1, 2)));

#endif /* _LINUX_MODULE_H */
diff -urN -X dontdiff linux/kernel/Makefile linux-kmod-func/kernel/Makefile
--- linux/kernel/Makefile       Tue Jan 11 02:15:58 2000
+++ linux-kmod-func/kernel/Makefile     Thu Jan 13 14:15:03 2000
@@ -13,13 +13,9 @@
O_TARGET := kernel.o
O_OBJS    = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
           module.o exit.o itimer.o info.o time.o softirq.o resource.o \
-           sysctl.o acct.o capability.o ptrace.o timer.o uid16.o
+           sysctl.o acct.o capability.o ptrace.o timer.o uid16.o kmod.o

OX_OBJS  += signal.o
-
-ifeq ($(CONFIG_KMOD),y)
-O_OBJS += kmod.o
-endif

ifeq ($(CONFIG_MODULES),y)
OX_OBJS  += ksyms.o
diff -urN -X dontdiff linux/kernel/kmod.c linux-kmod-func/kernel/kmod.c
--- linux/kernel/kmod.c Fri Jan  7 00:17:18 2000
+++ linux-kmod-func/kernel/kmod.c       Thu Jan 13 14:15:03 2000
@@ -11,16 +11,31 @@
       Limit the concurrent number of kmod modprobes to catch loops from
       "modprobe needs a service that is in a module".
       Keith Owens <[email protected]> December 1999
+
+       Changed request_module() to take variable number of arguments
+       Tigran Aivazian <[email protected]>, Jan 2000.
*/

#define __KERNEL_SYSCALLS__

+#include <linux/config.h>
+#include <linux/module.h>
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>

+/* very big ifdef for those who don't want kmod support */
+#ifndef CONFIG_KMOD
+
+int request_module(const char * fmt, ...)
+{
+       return -EINVAL;
+}
+
+#else
+
/*
       modprobe_path is set via /proc/sys.
*/
@@ -114,8 +129,9 @@
       request_module: the function that everyone calls when they need
       a module.
*/
-int request_module(const char * module_name)
+int request_module(const char * fmt, ...)
{
+       va_list args;
       int pid;
       int waitpid_result;
       sigset_t tmpsig;
@@ -123,6 +139,14 @@
       static atomic_t kmod_concurrent = ATOMIC_INIT(0);
#define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */
       static int kmod_loop_msg;
+       char module_name[64];
+
+       module_name[63] = '\0';
+       va_start(args, fmt);
+       vsprintf(module_name, fmt, args);
+       va_end(args);
+       if (module_name[63]!=0)
+               BUG(); /* Buffer overflow!! */

       /* Don't allow request_module() before the root fs is mounted!  */
       if ( ! current->fs->root ) {
@@ -181,3 +205,5 @@
       }
       return 0;
}
+
+#endif /* CONFIG_KMOD */
diff -urN -X dontdiff linux/kernel/ksyms.c linux-kmod-func/kernel/ksyms.c
--- linux/kernel/ksyms.c        Sun Jan  9 01:41:17 2000
+++ linux-kmod-func/kernel/ksyms.c      Thu Jan 13 14:15:03 2000
@@ -46,9 +46,6 @@
#if defined(CONFIG_PROC_FS)
#include <linux/proc_fs.h>
#endif
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

extern int console_loglevel;
extern void set_device_ro(kdev_t dev,int flag);
@@ -70,10 +67,7 @@
};
#endif

-
-#ifdef CONFIG_KMOD
EXPORT_SYMBOL(request_module);
-#endif

#ifdef CONFIG_MODULES
EXPORT_SYMBOL(get_module_symbol);
diff -urN -X dontdiff linux/net/core/dev.c linux-kmod-func/net/core/dev.c
--- linux/net/core/dev.c        Thu Dec 23 08:08:44 1999
+++ linux-kmod-func/net/core/dev.c      Thu Jan 13 14:15:03 2000
@@ -62,6 +62,7 @@
#include <asm/system.h>
#include <asm/bitops.h>
#include <linux/config.h>
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -86,7 +87,6 @@
#include <net/pkt_sched.h>
#include <net/profile.h>
#include <linux/init.h>
-#include <linux/kmod.h>
#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
#include <linux/wireless.h>            /* Note : will define WIRELESS_EXT */
#endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
@@ -400,19 +400,11 @@
 *     Find and possibly load an interface.
 */

-#ifdef CONFIG_KMOD
-
void dev_load(const char *name)
{
       if(!__dev_get_by_name(name) && capable(CAP_SYS_MODULE))
               request_module(name);
}
-
-#else
-
-extern inline void dev_load(const char *unused){;}
-
-#endif

static int default_rebuild_header(struct sk_buff *skb)
{
diff -urN -X dontdiff linux/net/decnet/dn_dev.c linux-kmod-func/net/decnet/dn_dev.c
--- linux/net/decnet/dn_dev.c   Sun Jan  9 05:36:20 2000
+++ linux-kmod-func/net/decnet/dn_dev.c Thu Jan 13 14:15:03 2000
@@ -459,9 +459,7 @@
               return -EFAULT;
       ifr->ifr_name[IFNAMSIZ-1] = 0;

-#ifdef CONFIG_KMOD
       dev_load(ifr->ifr_name);
-#endif

       switch(cmd) {
               case SIOCGIFADDR:
diff -urN -X dontdiff linux/net/ipv4/af_inet.c linux-kmod-func/net/ipv4/af_inet.c
--- linux/net/ipv4/af_inet.c    Sun Jan  9 05:36:20 2000
+++ linux-kmod-func/net/ipv4/af_inet.c  Thu Jan 13 14:15:03 2000
@@ -62,6 +62,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -106,9 +107,6 @@
#ifdef CONFIG_BRIDGE
#include <net/br.h>
#endif
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
#include <linux/wireless.h>            /* Note : will define WIRELESS_EXT */
#endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
@@ -868,10 +866,8 @@

#ifdef CONFIG_DLCI_MODULE

-#ifdef CONFIG_KMOD
                       if (dlci_ioctl_hook == NULL)
                               request_module("dlci");
-#endif

                       if (dlci_ioctl_hook) {
                               lock_kernel();
diff -urN -X dontdiff linux/net/ipv4/devinet.c linux-kmod-func/net/ipv4/devinet.c
--- linux/net/ipv4/devinet.c    Sun Jan  9 05:36:20 2000
+++ linux-kmod-func/net/ipv4/devinet.c  Thu Jan 13 14:15:03 2000
@@ -23,6 +23,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>

#include <asm/uaccess.h>
#include <asm/system.h>
@@ -50,9 +51,6 @@
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif

#include <net/ip.h>
#include <net/route.h>
@@ -489,9 +487,7 @@
               *colon = 0;
#endif

-#ifdef CONFIG_KMOD
       dev_load(ifr.ifr_name);
-#endif

       switch(cmd) {
       case SIOCGIFADDR:       /* Get interface address */
diff -urN -X dontdiff linux/net/irda/irda_device.c linux-kmod-func/net/irda/irda_device.c
--- linux/net/irda/irda_device.c        Thu Jan  6 22:46:18 2000
+++ linux-kmod-func/net/irda/irda_device.c      Thu Jan 13 14:15:04 2000
@@ -29,6 +29,7 @@
 ********************************************************************/

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/string.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
@@ -38,7 +39,6 @@
#include <linux/netdevice.h>
#include <linux/init.h>
#include <linux/tty.h>
-#include <linux/kmod.h>
#include <linux/wireless.h>
#include <linux/spinlock.h>

@@ -460,16 +460,12 @@
dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
{
       struct dongle_reg *reg;
-       char modname[32];
       dongle_t *dongle;

       ASSERT(dev != NULL, return NULL;);

-#ifdef CONFIG_KMOD
       /* Try to load the module needed */
-       sprintf(modname, "irda-dongle-%d", type);
-       request_module(modname);
-#endif /* CONFIG_KMOD */
+       request_module("irda-dongle-%d", type);

       if (!(reg = hashbin_find(dongles, type, NULL))) {
               ERROR("IrDA: Unable to find requested dongle\n");
diff -urN -X dontdiff linux/net/irda/irlmp.c linux-kmod-func/net/irda/irlmp.c
--- linux/net/irda/irlmp.c      Thu Jan  6 22:46:18 2000
+++ linux-kmod-func/net/irda/irlmp.c    Thu Jan 13 14:15:04 2000
@@ -30,7 +30,6 @@
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
-#include <linux/kmod.h>
#include <linux/random.h>

#include <net/irda/irda.h>
diff -urN -X dontdiff linux/net/netsyms.c linux-kmod-func/net/netsyms.c
--- linux/net/netsyms.c Sun Jan  9 05:36:21 2000
+++ linux-kmod-func/net/netsyms.c       Thu Jan 13 14:15:04 2000
@@ -500,9 +500,7 @@
EXPORT_SYMBOL(dev_get);
EXPORT_SYMBOL(dev_alloc);
EXPORT_SYMBOL(dev_alloc_name);
-#ifdef CONFIG_KMOD
EXPORT_SYMBOL(dev_load);
-#endif
EXPORT_SYMBOL(dev_ioctl);
EXPORT_SYMBOL(dev_queue_xmit);
EXPORT_SYMBOL(netdev_dropping);
diff -urN -X dontdiff linux/net/packet/af_packet.c linux-kmod-func/net/packet/af_packet.c
--- linux/net/packet/af_packet.c        Thu Dec 23 03:55:38 1999
+++ linux-kmod-func/net/packet/af_packet.c      Thu Jan 13 14:15:04 2000
@@ -52,7 +52,6 @@
#include <linux/netdevice.h>
#include <linux/if_packet.h>
#include <linux/wireless.h>
-#include <linux/kmod.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
diff -urN -X dontdiff linux/net/sched/cls_api.c linux-kmod-func/net/sched/cls_api.c
--- linux/net/sched/cls_api.c   Sat Jan  8 00:57:13 2000
+++ linux-kmod-func/net/sched/cls_api.c Thu Jan 13 14:15:04 2000
@@ -17,6 +17,7 @@
#include <asm/system.h>
#include <asm/bitops.h>
#include <linux/config.h>
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -31,7 +32,6 @@
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/init.h>
-#include <linux/kmod.h>
#include <net/sock.h>
#include <net/pkt_sched.h>

@@ -201,18 +201,13 @@
               if ((tp = kmalloc(sizeof(*tp), GFP_KERNEL)) == NULL)
                       goto errout;
               tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND-1]);
-#ifdef CONFIG_KMOD
               if (tp_ops==NULL && tca[TCA_KIND-1] != NULL) {
                       struct rtattr *kind = tca[TCA_KIND-1];
-                       char module_name[4 + IFNAMSIZ + 1];

-                       if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
-                               sprintf(module_name, "cls_%s", (char*)RTA_DATA(kind));
-                               request_module (module_name);
-                               tp_ops = tcf_proto_lookup_ops(kind);
-                       }
+                       if (RTA_PAYLOAD(kind) <= IFNAMSIZ)
+                               if (request_module("cls_%s", (char*)RTA_DATA(kind)) == 0)
+                                       tp_ops = tcf_proto_lookup_ops(kind);
               }
-#endif
               if (tp_ops == NULL) {
                       err = -EINVAL;
                       kfree(tp);
diff -urN -X dontdiff linux/net/sched/sch_api.c linux-kmod-func/net/sched/sch_api.c
--- linux/net/sched/sch_api.c   Sat Jan  8 00:57:13 2000
+++ linux-kmod-func/net/sched/sch_api.c Thu Jan 13 14:15:04 2000
@@ -16,6 +16,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -31,7 +32,6 @@
#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
-#include <linux/kmod.h>

#include <net/sock.h>
#include <net/pkt_sched.h>
@@ -397,17 +397,11 @@
       int size;

       ops = qdisc_lookup_ops(kind);
-#ifdef CONFIG_KMOD
       if (ops==NULL && tca[TCA_KIND-1] != NULL) {
-               char module_name[4 + IFNAMSIZ + 1];
-
-               if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
-                       sprintf(module_name, "sch_%s", (char*)RTA_DATA(kind));
-                       request_module (module_name);
-                       ops = qdisc_lookup_ops(kind);
-               }
+               if (RTA_PAYLOAD(kind) <= IFNAMSIZ)
+                       if (request_module("sch_%s", (char*)RTA_DATA(kind)) == 0)
+                               ops = qdisc_lookup_ops(kind);
       }
-#endif

       err = -EINVAL;
       if (ops == NULL)
diff -urN -X dontdiff linux/net/sched/sch_ingress.c linux-kmod-func/net/sched/sch_ingress.c
--- linux/net/sched/sch_ingress.c       Sat Jan  8 00:57:13 2000
+++ linux-kmod-func/net/sched/sch_ingress.c     Thu Jan 13 14:15:04 2000
@@ -19,7 +19,6 @@
#include <asm/byteorder.h>
#include <asm/uaccess.h>
#include <asm/smp.h>
-#include <linux/kmod.h>
#include <linux/stat.h>
#include <linux/interrupt.h>
#include <linux/list.h>
diff -urN -X dontdiff linux/net/socket.c linux-kmod-func/net/socket.c
--- linux/net/socket.c  Thu Jan 13 14:11:19 2000
+++ linux-kmod-func/net/socket.c        Thu Jan 13 14:15:04 2000
@@ -58,6 +58,7 @@
 */

#include <linux/config.h>
+#include <linux/module.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/socket.h>
@@ -70,10 +71,6 @@
#include <linux/init.h>
#include <linux/poll.h>

-#if defined(CONFIG_KMOD) && defined(CONFIG_NET)
-#include <linux/kmod.h>
-#endif
-
#include <asm/uaccess.h>

#include <linux/inet.h>
@@ -715,7 +712,7 @@
               family = PF_PACKET;
       }

-#if defined(CONFIG_KMOD) && defined(CONFIG_NET)
+#if defined(CONFIG_NET)
       /* Attempt to load a protocol module if the find failed.
        *
        * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
@@ -723,11 +720,7 @@
        * Otherwise module support will break!
        */
       if (net_families[family]==NULL)
-       {
-               char module_name[30];
-               sprintf(module_name,"net-pf-%d",family);
-               request_module(module_name);
-       }
+               request_module("net-pf-%d",family);
#endif

       net_family_read_lock();