summaryrefslogtreecommitdiff
path: root/include
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
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')
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dcookies.h69
3 files changed, 74 insertions, 0 deletions
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 8765a0f82aff..159dfa7fefe1 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -257,6 +257,8 @@
#define __NR_alloc_hugepages 250
#define __NR_free_hugepages 251
#define __NR_exit_group 252
+#define __NR_lookup_dcookie 253
+
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
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 */