Skip to content

Commit

Permalink
helpers.linux.fs: update for_each_mount() for changes in Linux 6.8
Browse files Browse the repository at this point in the history
Starting with kernel v6.8 the mnt_list int struct mnt_namespace git
converted to a rb-tree.

Reflect this change in drgn's for_each_mount() helper.

Signed-off-by: Johannes Thumshirn <[email protected]>
  • Loading branch information
morbidrsa committed Feb 23, 2024
1 parent 145ac79 commit 661f3ce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drgn/helpers/linux/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
list_for_each_entry,
list_for_each_entry_reverse,
)
from drgn.helpers.linux.rbtree import rbtree_inorder_for_each_entry

__all__ = (
"path_lookup",
Expand Down Expand Up @@ -301,7 +302,15 @@ def for_each_mount(
dst = os.fsencode(dst)
if fstype:
fstype = os.fsencode(fstype)
for mnt in list_for_each_entry("struct mount", ns.list.address_of_(), "mnt_list"):
try:
mounts = rbtree_inorder_for_each_entry(
"struct mount", ns.mounts, "mnt_node"
)
except AttributeError:
mounts = list_for_each_entry(
"struct mount", ns.list.address_of_(), "mnt_list"
)
for mnt in mounts:
if (
(src is None or mount_src(mnt) == src)
and (dst is None or mount_dst(mnt) == dst)
Expand Down

0 comments on commit 661f3ce

Please sign in to comment.