summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJohn Levon <levon@movementarian.org>2002-10-15 04:30:32 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-15 04:30:32 -0700
commit7e1aee05c99cfbb7e5cf33bae11ab9fa8df6c57c (patch)
tree51704e67bd9dc8d0da94f9285488e551ac834717 /include/linux
parent19bb2ab92d37ae85fc6d4cb6ae1fea6a8de027b1 (diff)
[PATCH] oprofile - dcookies
This implements the persistent path-to-dcookies mapping, and adds a system call for the user-space profiler to look up the profile data, so it can tag profiles to specific binaries.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dcookies.h69
2 files changed, 72 insertions, 0 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 71708edafce9..76a5085043e1 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -66,6 +66,8 @@ static __inline__ unsigned int full_name_hash(const unsigned char * name, unsign
#define DNAME_INLINE_LEN 16
+struct dcookie_struct;
+
struct dentry {
atomic_t d_count;
unsigned int d_flags;
@@ -84,6 +86,7 @@ struct dentry {
unsigned long d_vfs_flags;
void * d_fsdata; /* fs-specific data */
unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
+ struct dcookie_struct * d_cookie; /* cookie, if any */
};
struct dentry_operations {
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
new file mode 100644
index 000000000000..b2ae9692dc05
--- /dev/null
+++ b/include/linux/dcookies.h
@@ -0,0 +1,69 @@
+/*
+ * dcookies.h
+ *
+ * Persistent cookie-path mappings
+ *
+ * Copyright 2002 John Levon <levon@movementarian.org>
+ */
+
+#ifndef DCOOKIES_H
+#define DCOOKIES_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_PROFILING
+
+#include <linux/types.h>
+
+struct dcookie_user;
+
+/**
+ * dcookie_register - register a user of dcookies
+ *
+ * Register as a dcookie user. Returns %NULL on failure.
+ */
+struct dcookie_user * dcookie_register(void);
+
+/**
+ * dcookie_unregister - unregister a user of dcookies
+ *
+ * Unregister as a dcookie user. This may invalidate
+ * any dcookie values returned from get_dcookie().
+ */
+void dcookie_unregister(struct dcookie_user * user);
+
+/**
+ * get_dcookie - acquire a dcookie
+ *
+ * Convert the given dentry/vfsmount pair into
+ * a cookie value.
+ *
+ * Returns -EINVAL if no living task has registered as a
+ * dcookie user.
+ *
+ * Returns 0 on success, with *cookie filled in
+ */
+int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
+ unsigned long * cookie);
+
+#else
+
+struct dcookie_user * dcookie_register(void)
+{
+ return 0;
+}
+
+void dcookie_unregister(struct dcookie_user * user)
+{
+ return;
+}
+
+static inline int get_dcookie(struct dentry * dentry,
+ struct vfsmount * vfsmnt, unsigned long * cookie)
+{
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_PROFILING */
+
+#endif /* DCOOKIES_H */