~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/gdb/linux/vfs.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #
  2 # gdb helper commands and functions for Linux kernel debugging
  3 #
  4 #  VFS tools
  5 #
  6 # Copyright (c) 2023 Glenn Washburn
  7 # Copyright (c) 2016 Linaro Ltd
  8 #
  9 # Authors:
 10 #  Glenn Washburn <development@efficientek.com>
 11 #  Kieran Bingham <kieran.bingham@linaro.org>
 12 #
 13 # This work is licensed under the terms of the GNU GPL version 2.
 14 #
 15 
 16 import gdb
 17 from linux import utils
 18 
 19 
 20 def dentry_name(d):
 21     parent = d['d_parent']
 22     if parent == d or parent == 0:
 23         return ""
 24     p = dentry_name(d['d_parent']) + "/"
 25     return p + d['d_iname'].string()
 26 
 27 class DentryName(gdb.Function):
 28     """Return string of the full path of a dentry.
 29 
 30 $lx_dentry_name(PTR): Given PTR to a dentry struct, return a string
 31 of the full path of the dentry."""
 32 
 33     def __init__(self):
 34         super(DentryName, self).__init__("lx_dentry_name")
 35 
 36     def invoke(self, dentry_ptr):
 37         return dentry_name(dentry_ptr)
 38 
 39 DentryName()
 40 
 41 
 42 dentry_type = utils.CachedType("struct dentry")
 43 
 44 class InodeDentry(gdb.Function):
 45     """Return dentry pointer for inode.
 46 
 47 $lx_i_dentry(PTR): Given PTR to an inode struct, return a pointer to
 48 the associated dentry struct, if there is one."""
 49 
 50     def __init__(self):
 51         super(InodeDentry, self).__init__("lx_i_dentry")
 52 
 53     def invoke(self, inode_ptr):
 54         d_u = inode_ptr["i_dentry"]["first"]
 55         if d_u == 0:
 56             return ""
 57         return utils.container_of(d_u, dentry_type.get_type().pointer(), "d_u")
 58 
 59 InodeDentry()

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php