Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Adrian Bunk | 0072b13 | 2005-08-01 21:11:39 -0700 | [diff] [blame] | 50 | static inline struct dcookie_user * dcookie_register(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | { |
| 52 | return NULL; |
| 53 | } |
| 54 | |
Adrian Bunk | 0072b13 | 2005-08-01 21:11:39 -0700 | [diff] [blame] | 55 | static inline void dcookie_unregister(struct dcookie_user * user) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |