Merge branch 'upstream' of git://lost.foo-projects.org/~ahkok/git/netdev-2.6 into...
[sfrench/cifs-2.6.git] / include / linux / dcookies.h
1 /*
2  * dcookies.h
3  *
4  * Persistent cookie-path mappings
5  *
6  * Copyright 2002 John Levon <levon@movementarian.org>
7  */
8
9 #ifndef DCOOKIES_H
10 #define DCOOKIES_H
11  
12
13 #ifdef CONFIG_PROFILING
14  
15 #include <linux/types.h>
16  
17 struct dcookie_user;
18  
19 /**
20  * dcookie_register - register a user of dcookies
21  *
22  * Register as a dcookie user. Returns %NULL on failure.
23  */
24 struct dcookie_user * dcookie_register(void);
25
26 /**
27  * dcookie_unregister - unregister a user of dcookies
28  *
29  * Unregister as a dcookie user. This may invalidate
30  * any dcookie values returned from get_dcookie().
31  */
32 void dcookie_unregister(struct dcookie_user * user);
33   
34 /**
35  * get_dcookie - acquire a dcookie
36  *
37  * Convert the given dentry/vfsmount pair into
38  * a cookie value.
39  *
40  * Returns -EINVAL if no living task has registered as a
41  * dcookie user.
42  *
43  * Returns 0 on success, with *cookie filled in
44  */
45 int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
46         unsigned long * cookie);
47
48 #else
49
50 static inline struct dcookie_user * dcookie_register(void)
51 {
52         return NULL;
53 }
54
55 static inline void dcookie_unregister(struct dcookie_user * user)
56 {
57         return;
58 }
59  
60 static inline int get_dcookie(struct dentry * dentry,
61         struct vfsmount * vfsmnt, unsigned long * cookie)
62 {
63         return -ENOSYS;
64
65  
66 #endif /* CONFIG_PROFILING */
67  
68 #endif /* DCOOKIES_H */