summaryrefslogtreecommitdiff
path: root/udev_lib.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-13 12:36:47 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 22:27:34 -0700
commitd402af7d71be3b89eac5877a425f2c6bce5c4f3d (patch)
tree6a58878421d250fd1c2d45409f35b20d57320a36 /udev_lib.c
parent2092fbcdebf5313f29b43bdaa57a22baf0c0269f (diff)
[PATCH] don't wait for sysfs if the kernel(2.6.10-rc2) tells us what not to expect
Newer kernels will tell us if we should wait for the "device" or the "bus" link. So don't waste the time with our lists or wait for the timeout.
Diffstat (limited to 'udev_lib.c')
-rw-r--r--udev_lib.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/udev_lib.c b/udev_lib.c
index 6807f817a1..a3fab9632d 100644
--- a/udev_lib.c
+++ b/udev_lib.c
@@ -28,6 +28,7 @@
#include <dirent.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <sys/utsname.h>
#include "udev.h"
#include "logging.h"
@@ -72,6 +73,29 @@ void udev_set_values(struct udevice *udev, const char* devpath,
udev->type = get_device_type(devpath, subsystem);
}
+int kernel_release_satisfactory(int version, int patchlevel, int sublevel)
+{
+ static struct utsname uts;
+ static int kversion = 0;
+ static int kpatchlevel;
+ static int ksublevel;
+
+ if (kversion == 0) {
+ if (uname(&uts) != 0)
+ return -1;
+
+ if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) {
+ kversion = 0;
+ return -1;
+ }
+ }
+
+ if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel)
+ return 1;
+ else
+ return 0;
+}
+
int create_path(const char *path)
{
char p[NAME_SIZE];