Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2025 16:03:26 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2ee1311820be - main - lindebugfs: Add `debugfs_lookup()`
Message-ID:  <202501311603.50VG3QEJ039018@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ee1311820be0ffbe76a0226049910ade470ed1e

commit 2ee1311820be0ffbe76a0226049910ade470ed1e
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-01-13 18:55:00 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2025-01-31 16:00:50 +0000

    lindebugfs: Add `debugfs_lookup()`
    
    [Why]
    This function is used by hhe DRM generic code starting with Linux 6.7.
    
    Reviewed by:    manu
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48761
---
 sys/compat/lindebugfs/lindebugfs.c                 | 17 +++++++++++++++++
 sys/compat/linuxkpi/common/include/linux/debugfs.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
index d32de5d0657e..5449dabede66 100644
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -328,6 +328,23 @@ debugfs_create_symlink(const char *name, struct dentry *parent,
 	return (NULL);
 }
 
+struct dentry *
+debugfs_lookup(const char *name, struct dentry *parent)
+{
+	struct dentry_meta *dm;
+	struct dentry *dnode;
+	struct pfs_node *pnode;
+
+	pnode = pfs_find_node(parent->d_pfs_node, name);
+	if (pnode == NULL)
+		return (NULL);
+
+	dm = (struct dentry_meta *)pnode->pn_data;
+	dnode = &dm->dm_dnode;
+
+	return (dnode);
+}
+
 void
 debugfs_remove(struct dentry *dnode)
 {
diff --git a/sys/compat/linuxkpi/common/include/linux/debugfs.h b/sys/compat/linuxkpi/common/include/linux/debugfs.h
index 13186334d75c..54145b61503e 100644
--- a/sys/compat/linuxkpi/common/include/linux/debugfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/debugfs.h
@@ -82,6 +82,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
 struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
     const char *dest);
 
+struct dentry *debugfs_lookup(const char *name, struct dentry *parent);
+
 void debugfs_remove(struct dentry *dentry);
 
 void debugfs_remove_recursive(struct dentry *dentry);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501311603.50VG3QEJ039018>