#endif /* CONFIG_TRACER_SNAPSHOT */
 
+/*
+ * trace_min_max_write - Write a u64 value to a trace_min_max_param struct
+ * @filp: The active open file structure
+ * @ubuf: The userspace provided buffer to read value into
+ * @cnt: The maximum number of bytes to read
+ * @ppos: The current "file" position
+ *
+ * This function implements the write interface for a struct trace_min_max_param.
+ * The filp->private_data must point to a trace_min_max_param structure that
+ * defines where to write the value, the min and the max acceptable values,
+ * and a lock to protect the write.
+ */
+static ssize_t
+trace_min_max_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos)
+{
+       struct trace_min_max_param *param = filp->private_data;
+       u64 val;
+       int err;
+
+       if (!param)
+               return -EFAULT;
+
+       err = kstrtoull_from_user(ubuf, cnt, 10, &val);
+       if (err)
+               return err;
+
+       if (param->lock)
+               mutex_lock(param->lock);
+
+       if (param->min && val < *param->min)
+               err = -EINVAL;
+
+       if (param->max && val > *param->max)
+               err = -EINVAL;
+
+       if (!err)
+               *param->val = val;
+
+       if (param->lock)
+               mutex_unlock(param->lock);
+
+       if (err)
+               return err;
+
+       return cnt;
+}
+
+/*
+ * trace_min_max_read - Read a u64 value from a trace_min_max_param struct
+ * @filp: The active open file structure
+ * @ubuf: The userspace provided buffer to read value into
+ * @cnt: The maximum number of bytes to read
+ * @ppos: The current "file" position
+ *
+ * This function implements the read interface for a struct trace_min_max_param.
+ * The filp->private_data must point to a trace_min_max_param struct with valid
+ * data.
+ */
+static ssize_t
+trace_min_max_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
+{
+       struct trace_min_max_param *param = filp->private_data;
+       char buf[U64_STR_SIZE];
+       int len;
+       u64 val;
+
+       if (!param)
+               return -EFAULT;
+
+       val = *param->val;
+
+       if (cnt > sizeof(buf))
+               cnt = sizeof(buf);
+
+       len = snprintf(buf, sizeof(buf), "%llu\n", val);
+
+       return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
+}
+
+const struct file_operations trace_min_max_fops = {
+       .open           = tracing_open_generic,
+       .read           = trace_min_max_read,
+       .write          = trace_min_max_write,
+};
+
 #define TRACING_LOG_ERRS_MAX   8
 #define TRACING_LOG_LOC_MAX    128