mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-25 18:23:07 +00:00
helpers: handle inodes with no aliases in inode_path()
This commit is contained in:
parent
7282c40a75
commit
8c229b794b
@ -13,7 +13,11 @@ import os
|
||||
|
||||
from drgn import Program, container_of
|
||||
from drgn.helpers import escape_string
|
||||
from drgn.helpers.linux.list import hlist_for_each_entry, list_for_each_entry
|
||||
from drgn.helpers.linux.list import (
|
||||
hlist_empty,
|
||||
hlist_for_each_entry,
|
||||
list_for_each_entry,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
'd_path',
|
||||
@ -94,6 +98,8 @@ def inode_path(inode):
|
||||
|
||||
Return any path of an inode from the root of its filesystem.
|
||||
"""
|
||||
if hlist_empty(inode.i_dentry):
|
||||
return None
|
||||
return dentry_path(container_of(inode.i_dentry.first, 'struct dentry',
|
||||
'd_u.d_alias'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user