summaryrefslogtreecommitdiff
path: root/include/linux/ref_tracker.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2025-06-18 17:24:22 +0300
committerJakub Kicinski <kuba@kernel.org>2025-06-20 03:02:04 +0300
commit707bd05be75f65749c3f1695f4e362a89b3fcc7b (patch)
tree17eef3415153efe93237fdf0941a9597274b7b14 /include/linux/ref_tracker.h
parent8f2079f8da5b6d4373d125a05cb076b0d6dc646b (diff)
downloadlinux-707bd05be75f65749c3f1695f4e362a89b3fcc7b.tar.xz
ref_tracker: eliminate the ref_tracker_dir name field
Now that we have dentries and the ability to create meaningful symlinks to them, don't keep a name string in each tracker. Switch the output format to print "class@address", and drop the name field. Also, add a kerneldoc header for ref_tracker_dir_init(). Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20250618-reftrack-dbgfs-v15-9-24fc37ead144@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/ref_tracker.h')
-rw-r--r--include/linux/ref_tracker.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/linux/ref_tracker.h b/include/linux/ref_tracker.h
index e1323de93bf6..d10563afd91c 100644
--- a/include/linux/ref_tracker.h
+++ b/include/linux/ref_tracker.h
@@ -20,7 +20,6 @@ struct ref_tracker_dir {
struct list_head list; /* List of active trackers */
struct list_head quarantine; /* List of dead trackers */
const char *class; /* object classname */
- char name[32];
#endif
};
@@ -44,10 +43,21 @@ void ref_tracker_dir_symlink(struct ref_tracker_dir *dir, const char *fmt, ...)
#endif /* CONFIG_DEBUG_FS */
+/**
+ * ref_tracker_dir_init - initialize a ref_tracker dir
+ * @dir: ref_tracker_dir to be initialized
+ * @quarantine_count: max number of entries to be tracked
+ * @class: pointer to static string that describes object type
+ *
+ * Initialize a ref_tracker_dir. If debugfs is configured, then a file
+ * will also be created for it under the top-level ref_tracker debugfs
+ * directory.
+ *
+ * Note that @class must point to a static string.
+ */
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
unsigned int quarantine_count,
- const char *class,
- const char *name)
+ const char *class)
{
INIT_LIST_HEAD(&dir->list);
INIT_LIST_HEAD(&dir->quarantine);
@@ -57,7 +67,6 @@ static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
refcount_set(&dir->untracked, 1);
refcount_set(&dir->no_tracker, 1);
dir->class = class;
- strscpy(dir->name, name, sizeof(dir->name));
ref_tracker_dir_debugfs(dir);
stack_depot_init();
}
@@ -82,8 +91,7 @@ int ref_tracker_free(struct ref_tracker_dir *dir,
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
unsigned int quarantine_count,
- const char *class,
- const char *name)
+ const char *class)
{
}