File: mount.py

package info (click to toggle)
drgn 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,852 kB
  • sloc: python: 74,992; ansic: 54,589; awk: 423; makefile: 351; sh: 99
file content (16 lines) | stat: -rwxr-xr-x 529 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env drgn
# Copyright (c) SUSE Linux.
# SPDX-License-Identifier: LGPL-2.1-or-later

"""A simplified implementation of mount(1) using drgn"""

from drgn.helpers.linux.fs import for_each_mount, mount_dst, mount_fstype, mount_src

print("Mount            Type         Devname      Dirname")
for mount in for_each_mount(prog):
    maddr = mount.value_()
    src = mount_src(mount).decode()
    dst = mount_dst(mount).decode()
    type_ = mount_fstype(mount).decode()

    print(f"{maddr:<16x} {type_:<12} {src:<12} {dst}")