modutils.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Common modutils related functions for busybox
  3. *
  4. * Copyright (C) 2008 by Timo Teras <timo.teras@iki.fi>
  5. *
  6. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  7. */
  8. #ifndef MODUTILS_H
  9. #define MODUTILS_H 1
  10. #include "libbb.h"
  11. PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  12. /* linux/include/linux/module.h has 64, but this is also used
  13. * internally for the maximum alias name length, which can be quite long */
  14. #define MODULE_NAME_LEN 256
  15. const char *moderror(int err) FAST_FUNC;
  16. void replace(char *s, char what, char with) FAST_FUNC;
  17. char *replace_underscores(char *s) FAST_FUNC;
  18. int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC;
  19. char *filename2modname(const char *filename, char *modname) FAST_FUNC;
  20. char *parse_cmdline_module_options(char **argv) FAST_FUNC;
  21. #define INSMOD_OPTS \
  22. "vq" \
  23. USE_FEATURE_2_4_MODULES("sLo:fkx") \
  24. USE_FEATURE_INSMOD_LOAD_MAP("m")
  25. #define INSMOD_ARGS USE_FEATURE_2_4_MODULES(, NULL)
  26. enum {
  27. INSMOD_OPT_VERBOSE = 0x0001,
  28. INSMOD_OPT_SILENT = 0x0002,
  29. INSMOD_OPT_SYSLOG = 0x0004 * ENABLE_FEATURE_2_4_MODULES,
  30. INSMOD_OPT_LOCK = 0x0008 * ENABLE_FEATURE_2_4_MODULES,
  31. INSMOD_OPT_OUTPUTNAME = 0x0010 * ENABLE_FEATURE_2_4_MODULES,
  32. INSMOD_OPT_FORCE = 0x0020 * ENABLE_FEATURE_2_4_MODULES,
  33. INSMOD_OPT_KERNELD = 0x0040 * ENABLE_FEATURE_2_4_MODULES,
  34. INSMOD_OPT_NO_EXPORT = 0x0080 * ENABLE_FEATURE_2_4_MODULES,
  35. INSMOD_OPT_PRINT_MAP = 0x0100 * ENABLE_FEATURE_INSMOD_LOAD_MAP,
  36. #if ENABLE_FEATURE_2_4_MODULES
  37. # if ENABLE_FEATURE_INSMOD_LOAD_MAP
  38. INSMOD_OPT_UNUSED = 0x0200,
  39. # else
  40. INSMOD_OPT_UNUSED = 0x0100,
  41. # endif
  42. #else
  43. INSMOD_OPT_UNUSED = 0x0004,
  44. #endif
  45. };
  46. int FAST_FUNC bb_init_module(const char *module, const char *options);
  47. int FAST_FUNC bb_delete_module(const char *module, unsigned int flags);
  48. #if ENABLE_FEATURE_2_4_MODULES
  49. int FAST_FUNC bb_init_module_24(const char *module, const char *options);
  50. #endif
  51. POP_SAVED_FUNCTION_VISIBILITY
  52. #endif