source: MondoRescue/branches/2.2.9/mindi-busybox/modutils/insmod.c@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 1.8 KB
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini insmod implementation for busybox
4 *
5 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */
9
10//applet:IF_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_DROP))
11
12#include "libbb.h"
13#include "modutils.h"
14
15/* 2.6 style insmod has no options and required filename
16 * (not module name - .ko can't be omitted) */
17
18//usage:#if !ENABLE_MODPROBE_SMALL
19//usage:#define insmod_trivial_usage
20//usage: IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE ")
21//usage: IF_NOT_FEATURE_2_4_MODULES("FILE ")
22//usage: "[SYMBOL=VALUE]..."
23//usage:#define insmod_full_usage "\n\n"
24//usage: "Load the specified kernel modules into the kernel"
25//usage: IF_FEATURE_2_4_MODULES( "\n"
26//usage: "\nOptions:"
27//usage: "\n -f Force module to load into the wrong kernel version"
28//usage: "\n -k Make module autoclean-able"
29//usage: "\n -v Verbose"
30//usage: "\n -q Quiet"
31//usage: "\n -L Lock: prevent simultaneous loads"
32//usage: IF_FEATURE_INSMOD_LOAD_MAP(
33//usage: "\n -m Output load map to stdout"
34//usage: )
35//usage: "\n -x Don't export externs"
36//usage: )
37//usage:#endif
38
39int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
40int insmod_main(int argc UNUSED_PARAM, char **argv)
41{
42 char *filename;
43 int rc;
44
45 /* Compat note:
46 * 2.6 style insmod has no options and required filename
47 * (not module name - .ko can't be omitted).
48 * 2.4 style insmod can take module name without .o
49 * and performs module search in default directories
50 * or in $MODPATH.
51 */
52
53 IF_FEATURE_2_4_MODULES(
54 getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
55 argv += optind - 1;
56 );
57
58 filename = *++argv;
59 if (!filename)
60 bb_show_usage();
61
62 rc = bb_init_module(filename, parse_cmdline_module_options(argv));
63 if (rc)
64 bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
65
66 return rc;
67}
Note: See TracBrowser for help on using the repository browser.