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.
 
 
 
 
 
 

111 lines
3.6 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../devfsd/linux-2.6.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
--- devfsd/check_kernel.c.kernel25 2003-06-02 22:17:21.000000000 +0400
+++ devfsd/check_kernel.c 2003-06-02 22:17:43.000000000 +0400
@@ -0,0 +1,30 @@
+#include <sys/types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <asm/unistd.h>
+
+extern char *modules_devfs;
+
+/* copied over from module-init-tools backward_compat.c */
+#ifndef __ia64 /* breaks ia64. */
+static _syscall2(long, create_module, const char *, name, size_t, size);
+#else
+#define create_module(name, size) \
+ syscall(__NR_create_module, (name), (size))
+#endif
+
+void check_kernel_version (int verbose)
+{
+ int k26 = 1;
+
+ errno = 0;
+ if (create_module(NULL, 0) >= 0 | errno != ENOSYS) {
+ modules_devfs = "/etc/modules.devfs";
+ k26 = 0;
+ }
+
+ if (verbose)
+ fprintf (stderr, "devfsd: kernel %s detected, using %s for MODLOAD\n",
+ k26 ? "2.6" : "2.4", modules_devfs);
+}
--- devfsd/devfsd.c.kernel25 2003-06-02 22:17:21.000000000 +0400
+++ devfsd/devfsd.c 2003-06-02 22:17:21.000000000 +0400
@@ -396,10 +396,14 @@ EXTERN_FUNCTION (flag st_expr_expand,
EXTERN_FUNCTION (const char *get_old_name,
(const char *devname, unsigned int namelen,
char *buffer, unsigned int major, unsigned int minor) );
-
+EXTERN_FUNCTION (void check_kernel_version,
+ (int) );
/* Public data */
flag syslog_is_open = FALSE;
+/* set to new style, runtime test might override it later */
+char *modules_devfs = "/etc/modprobe.devfs";
+
/* Public functions */
@@ -508,7 +512,6 @@ static struct event_type
{0xffffffff, NULL, NULL}
};
-
/* Public functions follow */
int main (int argc, char **argv)
@@ -652,6 +655,7 @@ int main (int argc, char **argv)
/* Set umask so that mknod(2), open(2) and mkdir(2) have complete control
over permissions */
umask (0);
+ check_kernel_version (trace_level);
read_config (CONFIG_FILE, FALSE, &event_mask);
/* Do the scan before forking, so that boot scripts see the finished
product */
@@ -1243,7 +1247,7 @@ static void action_modload (const struct
argv[0] = "/sbin/modprobe";
argv[1] = "-k";
argv[2] = "-C";
- argv[3] = "/etc/modules.devfs";
+ argv[3] = modules_devfs;
argv[4] = device;
argv[5] = NULL;
snprintf (device, sizeof (device), "/dev/%s", info->devname);
--- devfsd/GNUmakefile.kernel25 2002-02-19 09:06:43.000000000 +0300
+++ devfsd/GNUmakefile 2003-06-02 22:17:21.000000000 +0400
@@ -18,13 +18,16 @@ endif
all: devfsd rpm.spec
-OBJECTS = devfsd.o expression.o compat_name.o
+OBJECTS = devfsd.o expression.o compat_name.o check_kernel.o
CFLAGS = -O2 -I. -I$(KERNEL_DIR)/include -Wall $(CEXTRAS) $(DEFINES)
devfsd: $(OBJECTS)
$(CC) -O2 -o devfsd $(OBJECTS) $(LDFLAGS) -export-dynamic -ldl
+check_kernel.o: check_kernel.c
+ $(CC) -O2 -c $<
+
install: devfsd
@if fgrep -q "Generic section: do not change" /etc/modules.conf ; then\
echo "First remove the generic devfs entries from /etc/modules.conf"; exit 1; \