virtio-net: split out clean affinity function
[cascardo/linux.git] / fs / eventfd.c
index d81b9f6..35470d9 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/export.h>
 #include <linux/kref.h>
 #include <linux/eventfd.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 
 struct eventfd_ctx {
        struct kref kref;
@@ -284,7 +286,25 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
        return res;
 }
 
+#ifdef CONFIG_PROC_FS
+static int eventfd_show_fdinfo(struct seq_file *m, struct file *f)
+{
+       struct eventfd_ctx *ctx = f->private_data;
+       int ret;
+
+       spin_lock_irq(&ctx->wqh.lock);
+       ret = seq_printf(m, "eventfd-count: %16llx\n",
+                        (unsigned long long)ctx->count);
+       spin_unlock_irq(&ctx->wqh.lock);
+
+       return ret;
+}
+#endif
+
 static const struct file_operations eventfd_fops = {
+#ifdef CONFIG_PROC_FS
+       .show_fdinfo    = eventfd_show_fdinfo,
+#endif
        .release        = eventfd_release,
        .poll           = eventfd_poll,
        .read           = eventfd_read,