wrapper: remove fdtable wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 16:26:59 +0000 (12:26 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 16:27:45 +0000 (12:27 -0400)
Makefile
lttng-statedump-impl.c
wrapper/fdtable.c [deleted file]
wrapper/fdtable.h [deleted file]

index 4ae26b41a9d0f9e036b97e4feb4b01c598f38a63..5358701b3e1409e50f027d652bc223bec4afcae3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -122,8 +122,7 @@ ifneq ($(KERNELRELEASE),)
   endif
 
   obj-$(CONFIG_LTTNG) += lttng-statedump.o
-  lttng-statedump-objs := lttng-statedump-impl.o \
-                          wrapper/fdtable.o
+  lttng-statedump-objs := lttng-statedump-impl.o
 
   obj-$(CONFIG_LTTNG) += probes/
   obj-$(CONFIG_LTTNG) += lib/
index ace81a3d42cff080bab7b858161e5107abaf8897..ebe7655635cee4ec2913fd7bff77fc0d1a790b39 100644 (file)
 #include <linux/wait.h>
 #include <linux/mutex.h>
 #include <linux/device.h>
+#include <linux/fdtable.h>
 
 #include <lttng-events.h>
 #include <lttng-tracer.h>
-#include <wrapper/fdtable.h>
 #include <wrapper/namespace.h>
 #include <wrapper/irq.h>
 #include <wrapper/tracepoint.h>
 #include <wrapper/genhd.h>
 #include <wrapper/file.h>
-#include <wrapper/fdtable.h>
 
 #ifdef CONFIG_LTTNG_HAS_LIST_IRQ
 #include <linux/irq.h>
@@ -236,7 +235,7 @@ int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd)
         * the lock is taken, but we are not aware whether this is
         * guaranteed or not, so play safe.
         */
-       if (fd < fdt->max_fds && lttng_close_on_exec(fd, fdt))
+       if (fd < fdt->max_fds && close_on_exec(fd, fdt))
                flags |= O_CLOEXEC;
        if (IS_ERR(s)) {
                struct dentry *dentry = file->f_path.dentry;
@@ -263,7 +262,7 @@ void lttng_enumerate_files(struct lttng_session *session,
 {
        struct lttng_fd_ctx ctx = { .page = tmp, .session = session, .files = files, };
 
-       lttng_iterate_fd(files, 0, lttng_dump_one_fd, &ctx);
+       iterate_fd(files, 0, lttng_dump_one_fd, &ctx);
 }
 
 #ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
diff --git a/wrapper/fdtable.c b/wrapper/fdtable.c
deleted file mode 100644 (file)
index 26a8367..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- * wrapper/fdtable.c
- *
- * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/version.h>
-#include <linux/spinlock.h>
-#include <wrapper/fdtable.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
-
-/*
- * Reimplementation of iterate_fd() for kernels between 2.6.32 and 3.6
- * (inclusive).
- */
-int lttng_iterate_fd(struct files_struct *files,
-               unsigned int first,
-               int (*cb)(const void *, struct file *, unsigned int),
-               const void *ctx)
-{
-       struct fdtable *fdt;
-       struct file *filp;
-       unsigned int i;
-       int res = 0;
-
-       if (!files)
-               return 0;
-       spin_lock(&files->file_lock);
-       fdt = files_fdtable(files);
-       for (i = 0; i < fdt->max_fds; i++) {
-               filp = fcheck_files(files, i);
-               if (!filp)
-                       continue;
-               res = cb(ctx, filp, i);
-               if (res)
-                       break;
-       }
-       spin_unlock(&files->file_lock);
-       return res;
-}
-
-#endif
diff --git a/wrapper/fdtable.h b/wrapper/fdtable.h
deleted file mode 100644 (file)
index 996199a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * wrapper/fdtable.h
- *
- * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_WRAPPER_FDTABLE_H
-#define _LTTNG_WRAPPER_FDTABLE_H
-
-#include <linux/version.h>
-#include <linux/fdtable.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
-
-int lttng_iterate_fd(struct files_struct *files,
-               unsigned int first,
-               int (*cb)(const void *, struct file *, unsigned int),
-               const void *ctx);
-
-#else
-
-/*
- * iterate_fd() appeared at commit
- * c3c073f808b22dfae15ef8412b6f7b998644139a in the Linux kernel (first
- * released kernel: v3.7).
- */
-#define lttng_iterate_fd       iterate_fd
-
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-
-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
-{
-       return close_on_exec(fd, fdt);
-}
-
-#else
-
-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
-{
-       return FD_ISSET(fd, fdt->close_on_exec);
-}
-
-#endif
-
-#endif /* _LTTNG_WRAPPER_FDTABLE_H */
This page took 0.029298 seconds and 4 git commands to generate.