fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
[lttng-modules.git] / lttng-statedump-impl.c
index 37a4542e253ed35157746a84e2c776e80a278443..54a309d15b879d92ca251dacb916c250dc6ba745 100644 (file)
@@ -1,4 +1,5 @@
-/*
+/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
+ *
  * lttng-statedump.c
  *
  * Linux Trace Toolkit Next Generation Kernel State Dump
@@ -6,20 +7,6 @@
  * Copyright 2005 Jean-Hugues Deschenes <jean-hugues.deschenes@polymtl.ca>
  * Copyright 2006-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * Changes:
  *     Eric Clement:                   Add listing of network IP interface
  *     2006, 2007 Mathieu Desnoyers    Fix kernel threads
@@ -41,7 +28,6 @@
 #include <linux/inetdevice.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
-#include <linux/fdtable.h>
 #include <linux/swap.h>
 #include <linux/wait.h>
 #include <linux/mutex.h>
@@ -56,7 +42,7 @@
 #include <wrapper/tracepoint.h>
 #include <wrapper/genhd.h>
 #include <wrapper/file.h>
-#include <wrapper/time.h>
+#include <wrapper/fdtable.h>
 
 #ifdef CONFIG_LTTNG_HAS_LIST_IRQ
 #include <linux/irq.h>
@@ -152,10 +138,19 @@ int lttng_enumerate_block_devices(struct lttng_session *session)
 
                disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
                while ((part = disk_part_iter_next(&piter))) {
+                       struct block_device bdev;
                        char name_buf[BDEVNAME_SIZE];
-                       char *p;
+                       const char *p;
+
+                       /*
+                        * Create a partial 'struct blockdevice' to use
+                        * 'bdevname()' which is a simple wrapper over
+                        * 'disk_name()' but has the honor to be EXPORT_SYMBOL.
+                        */
+                       bdev.bd_disk = disk;
+                       bdev.bd_part = part;
 
-                       p = wrapper_disk_name(disk, part->partno, name_buf);
+                       p = bdevname(&bdev, name_buf);
                        if (!p) {
                                disk_part_iter_exit(&piter);
                                class_dev_iter_exit(&iter);
@@ -397,7 +392,7 @@ void lttng_statedump_process_ns(struct lttng_session *session,
        do {
                trace_lttng_statedump_process_state(session,
                        p, type, mode, submode, status, pid_ns);
-               pid_ns = pid_ns->parent;
+               pid_ns = pid_ns ? pid_ns->parent : NULL;
        } while (pid_ns);
 }
 
This page took 0.023752 seconds and 4 git commands to generate.