mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 08:38:45 +02:00 
			
		
		
		
	 79300ac805
			
		
	
	
		79300ac805
		
	
	
	
	
		
			
			The "d_iname" member was replaced with "d_shortname.string" in the commit
referenced in the Fixes tag.  This prevented the GDB script "lx-mount"
command to properly function:
(gdb) lx-mounts
      mount          super_block     devname pathname fstype options
0xff11000002d21180 0xff11000002d24800 rootfs / rootfs rw 0 0
0xff11000002e18a80 0xff11000003713000 /dev/root / ext4 rw,relatime 0 0
Python Exception <class 'gdb.error'>: There is no member named d_iname.
Error occurred in Python: There is no member named d_iname.
Link: https://lkml.kernel.org/r/20250619225105.320729-1-florian.fainelli@broadcom.com
Fixes: 58cf9c383c ("dcache: back inline names with a struct-wrapped array of unsigned long")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jan Kara <jack@suse.cz>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
		
	
			
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| #
 | |
| # gdb helper commands and functions for Linux kernel debugging
 | |
| #
 | |
| #  VFS tools
 | |
| #
 | |
| # Copyright (c) 2023 Glenn Washburn
 | |
| # Copyright (c) 2016 Linaro Ltd
 | |
| #
 | |
| # Authors:
 | |
| #  Glenn Washburn <development@efficientek.com>
 | |
| #  Kieran Bingham <kieran.bingham@linaro.org>
 | |
| #
 | |
| # This work is licensed under the terms of the GNU GPL version 2.
 | |
| #
 | |
| 
 | |
| import gdb
 | |
| from linux import utils
 | |
| 
 | |
| 
 | |
| def dentry_name(d):
 | |
|     parent = d['d_parent']
 | |
|     if parent == d or parent == 0:
 | |
|         return ""
 | |
|     p = dentry_name(d['d_parent']) + "/"
 | |
|     return p + d['d_shortname']['string'].string()
 | |
| 
 | |
| class DentryName(gdb.Function):
 | |
|     """Return string of the full path of a dentry.
 | |
| 
 | |
| $lx_dentry_name(PTR): Given PTR to a dentry struct, return a string
 | |
| of the full path of the dentry."""
 | |
| 
 | |
|     def __init__(self):
 | |
|         super(DentryName, self).__init__("lx_dentry_name")
 | |
| 
 | |
|     def invoke(self, dentry_ptr):
 | |
|         return dentry_name(dentry_ptr)
 | |
| 
 | |
| DentryName()
 | |
| 
 | |
| 
 | |
| dentry_type = utils.CachedType("struct dentry")
 | |
| 
 | |
| class InodeDentry(gdb.Function):
 | |
|     """Return dentry pointer for inode.
 | |
| 
 | |
| $lx_i_dentry(PTR): Given PTR to an inode struct, return a pointer to
 | |
| the associated dentry struct, if there is one."""
 | |
| 
 | |
|     def __init__(self):
 | |
|         super(InodeDentry, self).__init__("lx_i_dentry")
 | |
| 
 | |
|     def invoke(self, inode_ptr):
 | |
|         d_u = inode_ptr["i_dentry"]["first"]
 | |
|         if d_u == 0:
 | |
|             return ""
 | |
|         return utils.container_of(d_u, dentry_type.get_type().pointer(), "d_u")
 | |
| 
 | |
| InodeDentry()
 |