summaryrefslogtreecommitdiff
path: root/udev_lib.c
diff options
context:
space:
mode:
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];