source: MondoRescue/branches/3.2/mindi-busybox/modutils/insmod.c@ 3232

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