Skip to content

RFC debugfs: Allow debugfs_create_dir() to take data from caller

Hiroshi Doyu linux-iommu linux-tegra lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 2 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 2 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/2] debugfs: Allow debugfs_create_dir() to take data from caller

Added missing Subject:
[RFC][PATCH 0/2] debugfs: Allow debugfs_create_dir() to take data from caller

Quoted 49 lines · On Wed, 8 Aug 2012 08:24:31 +0200 Hiroshi Doyu <[email protected]> wrote:

The commit c3b1a35 "debugfs: make sure that debugfs_create_file() gets used only for regulars" doesn't allow to use debugfs_create_file() for creating directory, and the current debugfs_create_dir() cannot take the private data from caller. There are some cases that we want to pass some client data to dir, especially when dir is nested deeply. We can work around to pass all necessary data with some invented data structure to the end files, but if directory itself had private data, we could avoid to introduce new structures just to pass data to end files.

For example, tegra iommu(smmu) case, debugfs structure could be as below.

sys/

└── kernel
    └── debug
        ├── smmu.0
        │   ├── mc
        │   │   ├── ptc
        │   │   └── tlb
        │   └── mc0
        │       ├── ptc
        │       └── tlb
        └── smmu.1
            ├── mc
            │   ├── ptc
            │   └── tlb
            ├── mc0
            │   ├── ptc
            │   └── tlb
            └── mc1
                ├── ptc
                └── tlb

The end files, {ptc,tlb} depend on which mc? to belong to, and which smmu.? to belong to. The parent data can be accessed from those end files if necessary.

  dent = d_find_alias(s->private);
  cache = (int)dent->d_inode->i_private;
  mc = (int)dent->d_parent->d_inode->i_private;
  smmu = dent->d_parent->d_parent->d_inode->i_private;

The original tegra smmu debugfs patch is:
http://lists.linuxfoundation.org/pipermail/iommu/2012-August/004507.html

Hiroshi Doyu (2):
debugfs: Allow debugfs_create_dir() to take data iommu/tegra: smmu: Use __debugfs_create_dir

Quoted 8 lines
 drivers/iommu/tegra-smmu.c |    4 +---
 fs/debugfs/inode.c         |    7 ++++---
 include/linux/debugfs.h    |    9 ++++++++-
 3 files changed, 13 insertions(+), 7 deletions(-)

--
1.7.5.4

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu