kernel/fork.c: fix typos
[linux-2.6-microblaze.git] / kernel / sysctl.c
index 62fbd09..14edf84 100644 (file)
@@ -148,6 +148,9 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
 #ifdef CONFIG_INOTIFY_USER
 #include <linux/inotify.h>
 #endif
+#ifdef CONFIG_FANOTIFY
+#include <linux/fanotify.h>
+#endif
 
 #ifdef CONFIG_PROC_SYSCTL
 
@@ -184,17 +187,6 @@ static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
 int sysctl_legacy_va_layout;
 #endif
 
-#ifdef CONFIG_SCHED_DEBUG
-static int min_sched_granularity_ns = 100000;          /* 100 usecs */
-static int max_sched_granularity_ns = NSEC_PER_SEC;    /* 1 second */
-static int min_wakeup_granularity_ns;                  /* 0 usecs */
-static int max_wakeup_granularity_ns = NSEC_PER_SEC;   /* 1 second */
-#ifdef CONFIG_SMP
-static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
-static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
-#endif /* CONFIG_SMP */
-#endif /* CONFIG_SCHED_DEBUG */
-
 #ifdef CONFIG_COMPACTION
 static int min_extfrag_threshold;
 static int max_extfrag_threshold = 1000;
@@ -1034,6 +1026,65 @@ int proc_douintvec_minmax(struct ctl_table *table, int write,
                                 do_proc_douintvec_minmax_conv, &param);
 }
 
+/**
+ * proc_dou8vec_minmax - read a vector of unsigned chars with min/max values
+ * @table: the sysctl table
+ * @write: %TRUE if this is a write to the sysctl file
+ * @buffer: the user buffer
+ * @lenp: the size of the user buffer
+ * @ppos: file position
+ *
+ * Reads/writes up to table->maxlen/sizeof(u8) unsigned chars
+ * values from/to the user buffer, treated as an ASCII string. Negative
+ * strings are not allowed.
+ *
+ * This routine will ensure the values are within the range specified by
+ * table->extra1 (min) and table->extra2 (max).
+ *
+ * Returns 0 on success or an error on write when the range check fails.
+ */
+int proc_dou8vec_minmax(struct ctl_table *table, int write,
+                       void *buffer, size_t *lenp, loff_t *ppos)
+{
+       struct ctl_table tmp;
+       unsigned int min = 0, max = 255U, val;
+       u8 *data = table->data;
+       struct do_proc_douintvec_minmax_conv_param param = {
+               .min = &min,
+               .max = &max,
+       };
+       int res;
+
+       /* Do not support arrays yet. */
+       if (table->maxlen != sizeof(u8))
+               return -EINVAL;
+
+       if (table->extra1) {
+               min = *(unsigned int *) table->extra1;
+               if (min > 255U)
+                       return -EINVAL;
+       }
+       if (table->extra2) {
+               max = *(unsigned int *) table->extra2;
+               if (max > 255U)
+                       return -EINVAL;
+       }
+
+       tmp = *table;
+
+       tmp.maxlen = sizeof(val);
+       tmp.data = &val;
+       val = *data;
+       res = do_proc_douintvec(&tmp, write, buffer, lenp, ppos,
+                               do_proc_douintvec_minmax_conv, &param);
+       if (res)
+               return res;
+       if (write)
+               *data = val;
+       return 0;
+}
+EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
+
 static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,
                                        unsigned int *valp,
                                        int write, void *data)
@@ -1582,6 +1633,12 @@ int proc_douintvec_minmax(struct ctl_table *table, int write,
        return -ENOSYS;
 }
 
+int proc_dou8vec_minmax(struct ctl_table *table, int write,
+                       void *buffer, size_t *lenp, loff_t *ppos)
+{
+       return -ENOSYS;
+}
+
 int proc_dointvec_jiffies(struct ctl_table *table, int write,
                    void *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -1659,58 +1716,6 @@ static struct ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
        },
-#ifdef CONFIG_SCHED_DEBUG
-       {
-               .procname       = "sched_min_granularity_ns",
-               .data           = &sysctl_sched_min_granularity,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = sched_proc_update_handler,
-               .extra1         = &min_sched_granularity_ns,
-               .extra2         = &max_sched_granularity_ns,
-       },
-       {
-               .procname       = "sched_latency_ns",
-               .data           = &sysctl_sched_latency,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = sched_proc_update_handler,
-               .extra1         = &min_sched_granularity_ns,
-               .extra2         = &max_sched_granularity_ns,
-       },
-       {
-               .procname       = "sched_wakeup_granularity_ns",
-               .data           = &sysctl_sched_wakeup_granularity,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = sched_proc_update_handler,
-               .extra1         = &min_wakeup_granularity_ns,
-               .extra2         = &max_wakeup_granularity_ns,
-       },
-#ifdef CONFIG_SMP
-       {
-               .procname       = "sched_tunable_scaling",
-               .data           = &sysctl_sched_tunable_scaling,
-               .maxlen         = sizeof(enum sched_tunable_scaling),
-               .mode           = 0644,
-               .proc_handler   = sched_proc_update_handler,
-               .extra1         = &min_sched_tunable_scaling,
-               .extra2         = &max_sched_tunable_scaling,
-       },
-       {
-               .procname       = "sched_migration_cost_ns",
-               .data           = &sysctl_sched_migration_cost,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-       {
-               .procname       = "sched_nr_migrate",
-               .data           = &sysctl_sched_nr_migrate,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
 #ifdef CONFIG_SCHEDSTATS
        {
                .procname       = "sched_schedstats",
@@ -1722,37 +1727,7 @@ static struct ctl_table kern_table[] = {
                .extra2         = SYSCTL_ONE,
        },
 #endif /* CONFIG_SCHEDSTATS */
-#endif /* CONFIG_SMP */
 #ifdef CONFIG_NUMA_BALANCING
-       {
-               .procname       = "numa_balancing_scan_delay_ms",
-               .data           = &sysctl_numa_balancing_scan_delay,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-       {
-               .procname       = "numa_balancing_scan_period_min_ms",
-               .data           = &sysctl_numa_balancing_scan_period_min,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-       {
-               .procname       = "numa_balancing_scan_period_max_ms",
-               .data           = &sysctl_numa_balancing_scan_period_max,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-       {
-               .procname       = "numa_balancing_scan_size_mb",
-               .data           = &sysctl_numa_balancing_scan_size,
-               .maxlen         = sizeof(unsigned int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec_minmax,
-               .extra1         = SYSCTL_ONE,
-       },
        {
                .procname       = "numa_balancing",
                .data           = NULL, /* filled in by handler */
@@ -1763,7 +1738,6 @@ static struct ctl_table kern_table[] = {
                .extra2         = SYSCTL_ONE,
        },
 #endif /* CONFIG_NUMA_BALANCING */
-#endif /* CONFIG_SCHED_DEBUG */
        {
                .procname       = "sched_rt_period_us",
                .data           = &sysctl_sched_rt_period,
@@ -2856,7 +2830,7 @@ static struct ctl_table vm_table[] = {
 #ifdef CONFIG_COMPACTION
        {
                .procname       = "compact_memory",
-               .data           = &sysctl_compact_memory,
+               .data           = NULL,
                .maxlen         = sizeof(int),
                .mode           = 0200,
                .proc_handler   = sysctl_compaction_handler,
@@ -3258,7 +3232,14 @@ static struct ctl_table fs_table[] = {
                .mode           = 0555,
                .child          = inotify_table,
        },
-#endif 
+#endif
+#ifdef CONFIG_FANOTIFY
+       {
+               .procname       = "fanotify",
+               .mode           = 0555,
+               .child          = fanotify_table,
+       },
+#endif
 #ifdef CONFIG_EPOLL
        {
                .procname       = "epoll",