mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.8 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/devfsd/linux-2.6.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf
  10. #
  11. # This patch file is dual-licensed. It is available under the license the
  12. # patched project is licensed under, as long as it is an OpenSource license
  13. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  14. # of the GNU General Public License as published by the Free Software
  15. # Foundation; either version 2 of the License, or (at your option) any later
  16. # version.
  17. #
  18. # --- ROCK-COPYRIGHT-NOTE-END ---
  19. --- devfsd/check_kernel.c.kernel25 2003-06-02 22:17:21.000000000 +0400
  20. +++ devfsd/check_kernel.c 2003-06-02 22:17:43.000000000 +0400
  21. @@ -0,0 +1,30 @@
  22. +#include <sys/types.h>
  23. +#include <stdio.h>
  24. +#include <unistd.h>
  25. +#include <errno.h>
  26. +#include <asm/unistd.h>
  27. +
  28. +extern char *modules_devfs;
  29. +
  30. +/* copied over from module-init-tools backward_compat.c */
  31. +#ifndef __ia64 /* breaks ia64. */
  32. +static _syscall2(long, create_module, const char *, name, size_t, size);
  33. +#else
  34. +#define create_module(name, size) \
  35. + syscall(__NR_create_module, (name), (size))
  36. +#endif
  37. +
  38. +void check_kernel_version (int verbose)
  39. +{
  40. + int k26 = 1;
  41. +
  42. + errno = 0;
  43. + if (create_module(NULL, 0) >= 0 | errno != ENOSYS) {
  44. + modules_devfs = "/etc/modules.devfs";
  45. + k26 = 0;
  46. + }
  47. +
  48. + if (verbose)
  49. + fprintf (stderr, "devfsd: kernel %s detected, using %s for MODLOAD\n",
  50. + k26 ? "2.6" : "2.4", modules_devfs);
  51. +}
  52. --- devfsd/devfsd.c.kernel25 2003-06-02 22:17:21.000000000 +0400
  53. +++ devfsd/devfsd.c 2003-06-02 22:17:21.000000000 +0400
  54. @@ -396,10 +396,14 @@ EXTERN_FUNCTION (flag st_expr_expand,
  55. EXTERN_FUNCTION (const char *get_old_name,
  56. (const char *devname, unsigned int namelen,
  57. char *buffer, unsigned int major, unsigned int minor) );
  58. -
  59. +EXTERN_FUNCTION (void check_kernel_version,
  60. + (int) );
  61. /* Public data */
  62. flag syslog_is_open = FALSE;
  63. +/* set to new style, runtime test might override it later */
  64. +char *modules_devfs = "/etc/modprobe.devfs";
  65. +
  66. /* Public functions */
  67. @@ -508,7 +512,6 @@ static struct event_type
  68. {0xffffffff, NULL, NULL}
  69. };
  70. -
  71. /* Public functions follow */
  72. int main (int argc, char **argv)
  73. @@ -652,6 +655,7 @@ int main (int argc, char **argv)
  74. /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control
  75. over permissions */
  76. umask (0);
  77. + check_kernel_version (trace_level);
  78. read_config (CONFIG_FILE, FALSE, &event_mask);
  79. /* Do the scan before forking, so that boot scripts see the finished
  80. product */
  81. @@ -1243,7 +1247,7 @@ static void action_modload (const struct
  82. argv[0] = "/sbin/modprobe";
  83. argv[1] = "-k";
  84. argv[2] = "-C";
  85. - argv[3] = "/etc/modules.devfs";
  86. + argv[3] = modules_devfs;
  87. argv[4] = device;
  88. argv[5] = NULL;
  89. snprintf (device, sizeof (device), "/dev/%s", info->devname);
  90. --- devfsd/GNUmakefile.kernel25 2002-02-19 09:06:43.000000000 +0300
  91. +++ devfsd/GNUmakefile 2003-06-02 22:17:21.000000000 +0400
  92. @@ -18,13 +18,16 @@ endif
  93. all: devfsd rpm.spec
  94. -OBJECTS = devfsd.o expression.o compat_name.o
  95. +OBJECTS = devfsd.o expression.o compat_name.o check_kernel.o
  96. CFLAGS = -O2 -I. -I$(KERNEL_DIR)/include -Wall $(CEXTRAS) $(DEFINES)
  97. devfsd: $(OBJECTS)
  98. $(CC) -O2 -o devfsd $(OBJECTS) $(LDFLAGS) -export-dynamic -ldl
  99. +check_kernel.o: check_kernel.c
  100. + $(CC) -O2 -c $<
  101. +
  102. install: devfsd
  103. @if fgrep -q "Generic section: do not change" /etc/modules.conf ; then\
  104. echo "First remove the generic devfs entries from /etc/modules.conf"; exit 1; \