diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-24 19:07:09 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-24 19:07:09 +0000 |
| commit | f7330a23d4d862d74ba6cbf0efc2f8c4050f5632 (patch) | |
| tree | 4d00f1ac9db68ad4432288e489631b4677181290 /modutils | |
| parent | 1ab8819cc50c51dc5fdd00c8fc89b7b5794fabbf (diff) | |
| download | busybox-w32-f7330a23d4d862d74ba6cbf0efc2f8c4050f5632.tar.gz busybox-w32-f7330a23d4d862d74ba6cbf0efc2f8c4050f5632.tar.bz2 busybox-w32-f7330a23d4d862d74ba6cbf0efc2f8c4050f5632.zip | |
Make insmod understand (and ignore) -L, and convert it to use getopt.
git-svn-id: svn://busybox.net/trunk/busybox@1648 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index be27a1f2b..a134fea87 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -78,7 +78,7 @@ | |||
| 78 | #ifndef MODUTILS_MODULE_H | 78 | #ifndef MODUTILS_MODULE_H |
| 79 | static const int MODUTILS_MODULE_H = 1; | 79 | static const int MODUTILS_MODULE_H = 1; |
| 80 | 80 | ||
| 81 | #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $" | 81 | #ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $" |
| 82 | 82 | ||
| 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
| 84 | We do not use the kernel headers directly because we do not wish | 84 | We do not use the kernel headers directly because we do not wish |
| @@ -284,7 +284,7 @@ int delete_module(const char *); | |||
| 284 | #ifndef MODUTILS_OBJ_H | 284 | #ifndef MODUTILS_OBJ_H |
| 285 | static const int MODUTILS_OBJ_H = 1; | 285 | static const int MODUTILS_OBJ_H = 1; |
| 286 | 286 | ||
| 287 | #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $" | 287 | #ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $" |
| 288 | 288 | ||
| 289 | /* The relocatable object is manipulated using elfin types. */ | 289 | /* The relocatable object is manipulated using elfin types. */ |
| 290 | 290 | ||
| @@ -2872,6 +2872,7 @@ static void hide_special_symbols(struct obj_file *f) | |||
| 2872 | 2872 | ||
| 2873 | extern int insmod_main( int argc, char **argv) | 2873 | extern int insmod_main( int argc, char **argv) |
| 2874 | { | 2874 | { |
| 2875 | int opt; | ||
| 2875 | int k_crcs; | 2876 | int k_crcs; |
| 2876 | int k_new_syscalls; | 2877 | int k_new_syscalls; |
| 2877 | int len; | 2878 | int len; |
| @@ -2891,15 +2892,9 @@ extern int insmod_main( int argc, char **argv) | |||
| 2891 | int m_crcs; | 2892 | int m_crcs; |
| 2892 | #endif | 2893 | #endif |
| 2893 | 2894 | ||
| 2894 | |||
| 2895 | if (argc <= 1) { | ||
| 2896 | usage(insmod_usage); | ||
| 2897 | } | ||
| 2898 | |||
| 2899 | /* Parse any options */ | 2895 | /* Parse any options */ |
| 2900 | while (--argc > 0 && **(++argv) == '-') { | 2896 | while ((opt = getopt(argc, argv, "fkvxL")) > 0) { |
| 2901 | while (*(++(*argv))) { | 2897 | switch (opt) { |
| 2902 | switch (**argv) { | ||
| 2903 | case 'f': /* force loading */ | 2898 | case 'f': /* force loading */ |
| 2904 | flag_force_load = 1; | 2899 | flag_force_load = 1; |
| 2905 | break; | 2900 | break; |
| @@ -2912,20 +2907,26 @@ extern int insmod_main( int argc, char **argv) | |||
| 2912 | case 'x': /* do not export externs */ | 2907 | case 'x': /* do not export externs */ |
| 2913 | flag_export = 0; | 2908 | flag_export = 0; |
| 2914 | break; | 2909 | break; |
| 2910 | case 'L': /* Stub warning */ | ||
| 2911 | /* This is needed for compatibility with modprobe. | ||
| 2912 | * In theory, this does locking, but we don't do | ||
| 2913 | * that. So be careful and plan your life around not | ||
| 2914 | * loading the same module 50 times concurrently. */ | ||
| 2915 | break; | ||
| 2915 | default: | 2916 | default: |
| 2916 | usage(insmod_usage); | 2917 | usage(insmod_usage); |
| 2917 | } | ||
| 2918 | } | 2918 | } |
| 2919 | } | 2919 | } |
| 2920 | 2920 | ||
| 2921 | if (argc <= 0) { | 2921 | if (argv[optind] == NULL) { |
| 2922 | usage(insmod_usage); | 2922 | usage(insmod_usage); |
| 2923 | } | 2923 | } |
| 2924 | |||
| 2924 | /* Grab the module name */ | 2925 | /* Grab the module name */ |
| 2925 | if ((tmp = strrchr(*argv, '/')) != NULL) { | 2926 | if ((tmp = strrchr(argv[optind], '/')) != NULL) { |
| 2926 | tmp++; | 2927 | tmp++; |
| 2927 | } else { | 2928 | } else { |
| 2928 | tmp = *argv; | 2929 | tmp = argv[optind]; |
| 2929 | } | 2930 | } |
| 2930 | len = strlen(tmp); | 2931 | len = strlen(tmp); |
| 2931 | 2932 | ||
| @@ -2936,7 +2937,7 @@ extern int insmod_main( int argc, char **argv) | |||
| 2936 | strcat(m_fullName, ".o"); | 2937 | strcat(m_fullName, ".o"); |
| 2937 | 2938 | ||
| 2938 | /* Get a filedesc for the module */ | 2939 | /* Get a filedesc for the module */ |
| 2939 | if ((fp = fopen(*argv, "r")) == NULL) { | 2940 | if ((fp = fopen(argv[optind], "r")) == NULL) { |
| 2940 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ | 2941 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ |
| 2941 | if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, | 2942 | if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, |
| 2942 | findNamedModule, 0, m_fullName) == FALSE) | 2943 | findNamedModule, 0, m_fullName) == FALSE) |
| @@ -2950,7 +2951,7 @@ extern int insmod_main( int argc, char **argv) | |||
| 2950 | } else | 2951 | } else |
| 2951 | error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2952 | error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); |
| 2952 | } else | 2953 | } else |
| 2953 | memcpy(m_filename, *argv, strlen(*argv)); | 2954 | memcpy(m_filename, argv[optind], strlen(argv[optind])); |
| 2954 | 2955 | ||
| 2955 | 2956 | ||
| 2956 | if ((f = obj_load(fp)) == NULL) | 2957 | if ((f = obj_load(fp)) == NULL) |
