]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/eventpoll.c
Merge branches 'intel_pstate' and 'pm-domains'
[karo-tx-linux.git] / fs / eventpoll.c
index a6d194831ed86af3d2a9c900a3e3f7e397f019cc..e767e4389cb13da3525a1e3ec9c2b4e7501f110c 100644 (file)
@@ -960,10 +960,14 @@ static void ep_show_fdinfo(struct seq_file *m, struct file *f)
        mutex_lock(&ep->mtx);
        for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
                struct epitem *epi = rb_entry(rbp, struct epitem, rbn);
+               struct inode *inode = file_inode(epi->ffd.file);
 
-               seq_printf(m, "tfd: %8d events: %8x data: %16llx\n",
+               seq_printf(m, "tfd: %8d events: %8x data: %16llx "
+                          " pos:%lli ino:%lx sdev:%x\n",
                           epi->ffd.fd, epi->event.events,
-                          (long long)epi->event.data);
+                          (long long)epi->event.data,
+                          (long long)epi->ffd.file->f_pos,
+                          inode->i_ino, inode->i_sb->s_dev);
                if (seq_has_overflowed(m))
                        break;
        }
@@ -1073,6 +1077,50 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd)
        return epir;
 }
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+static struct epitem *ep_find_tfd(struct eventpoll *ep, int tfd, unsigned long toff)
+{
+       struct rb_node *rbp;
+       struct epitem *epi;
+
+       for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
+               epi = rb_entry(rbp, struct epitem, rbn);
+               if (epi->ffd.fd == tfd) {
+                       if (toff == 0)
+                               return epi;
+                       else
+                               toff--;
+               }
+               cond_resched();
+       }
+
+       return NULL;
+}
+
+struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd,
+                                    unsigned long toff)
+{
+       struct file *file_raw;
+       struct eventpoll *ep;
+       struct epitem *epi;
+
+       if (!is_file_epoll(file))
+               return ERR_PTR(-EINVAL);
+
+       ep = file->private_data;
+
+       mutex_lock(&ep->mtx);
+       epi = ep_find_tfd(ep, tfd, toff);
+       if (epi)
+               file_raw = epi->ffd.file;
+       else
+               file_raw = ERR_PTR(-ENOENT);
+       mutex_unlock(&ep->mtx);
+
+       return file_raw;
+}
+#endif /* CONFIG_CHECKPOINT_RESTORE */
+
 /*
  * This is the callback that is passed to the wait queue wakeup
  * mechanism. It is called by the stored file descriptors when they