kernel: Add TUNABLE_LONG.
authorSascha Wildner <saw@online.de>
Thu, 22 Apr 2010 09:14:47 +0000 (11:14 +0200)
committerSascha Wildner <saw@online.de>
Thu, 22 Apr 2010 09:15:29 +0000 (11:15 +0200)
sys/kern/kern_environment.c
sys/sys/kernel.h

index bd52f12..8ad7650 100644 (file)
@@ -425,6 +425,14 @@ tunable_int_init(void *data)
 }
 
 void
+tunable_long_init(void *data)
+{
+       struct tunable_long *d = (struct tunable_long *)data;
+
+       TUNABLE_LONG_FETCH(d->path, d->var);
+}
+
+void
 tunable_quad_init(void *data)
 {
        struct tunable_quad *d = (struct tunable_quad *)data;
index 950eded..269dda6 100644 (file)
@@ -309,6 +309,27 @@ struct tunable_int {
                tunable_int_init, &__tunable_int_ ## line)
 
 #define        TUNABLE_INT_FETCH(path, var)    kgetenv_int((path), (var))
+
+extern void tunable_long_init(void *);
+
+struct tunable_long {
+       const char *path;
+       long *var;
+};
+#define        TUNABLE_LONG(path, var)                                 \
+       _TUNABLE_LONG((path), (var), __LINE__)
+#define _TUNABLE_LONG(path, var, line)                         \
+       __TUNABLE_LONG((path), (var), line)
+
+#define        __TUNABLE_LONG(path, var, line)                         \
+       static struct tunable_long __tunable_long_ ## line = {  \
+               path,                                           \
+               var,                                            \
+       };                                                      \
+       SYSINIT(__Tunable_init_ ## line,                        \
+               SI_BOOT1_TUNABLES, SI_ORDER_MIDDLE,             \
+               tunable_long_init, &__tunable_long_ ## line)
+
 #define        TUNABLE_LONG_FETCH(path, var)   kgetenv_long((path), (var))
 
 /* Backwards compatibility with the old deprecated TUNABLE_INT_DECL API */