mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
8b264f8823
drgn was originally my side project, but for awhile now it's also been my work project. Update the copyright headers to reflect this, and add a copyright header to various files that were missing it.
33 lines
714 B
Python
Executable File
33 lines
714 B
Python
Executable File
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# SPDX-License-Identifier: GPL-3.0+
|
|
|
|
"""List the paths of all inodes cached in a given filesystem"""
|
|
|
|
from drgn.helpers.linux.fs import for_each_mount, inode_path
|
|
from drgn.helpers.linux.list import list_for_each_entry
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
|
|
if len(sys.argv) == 1:
|
|
path = "/"
|
|
else:
|
|
path = sys.argv[1]
|
|
|
|
mnt = None
|
|
for mnt in for_each_mount(prog, dst=path):
|
|
pass
|
|
if mnt is None:
|
|
sys.exit(f"No filesystem mounted at {path}")
|
|
|
|
sb = mnt.mnt.mnt_sb
|
|
|
|
for inode in list_for_each_entry(
|
|
"struct inode", sb.s_inodes.address_of_(), "i_sb_list"
|
|
):
|
|
try:
|
|
print(os.fsdecode(inode_path(inode)))
|
|
except ValueError:
|
|
continue
|