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 | |
Bob Nelson | 1474855 | 2007-07-20 21:39:53 +0200 | [diff] [blame] | 15 | #include <linux/dcache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/types.h> |
| 17 | |
| 18 | struct dcookie_user; |
Alexey Dobriyan | 37721e1 | 2011-01-10 08:17:10 +0200 | [diff] [blame^] | 19 | struct path; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * dcookie_register - register a user of dcookies |
| 23 | * |
| 24 | * Register as a dcookie user. Returns %NULL on failure. |
| 25 | */ |
| 26 | struct dcookie_user * dcookie_register(void); |
| 27 | |
| 28 | /** |
| 29 | * dcookie_unregister - unregister a user of dcookies |
| 30 | * |
| 31 | * Unregister as a dcookie user. This may invalidate |
| 32 | * any dcookie values returned from get_dcookie(). |
| 33 | */ |
| 34 | void dcookie_unregister(struct dcookie_user * user); |
| 35 | |
| 36 | /** |
| 37 | * get_dcookie - acquire a dcookie |
| 38 | * |
| 39 | * Convert the given dentry/vfsmount pair into |
| 40 | * a cookie value. |
| 41 | * |
| 42 | * Returns -EINVAL if no living task has registered as a |
| 43 | * dcookie user. |
| 44 | * |
| 45 | * Returns 0 on success, with *cookie filled in |
| 46 | */ |
Jan Blunck | 448678a | 2008-02-14 19:38:36 -0800 | [diff] [blame] | 47 | int get_dcookie(struct path *path, unsigned long *cookie); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | #else |
| 50 | |
Adrian Bunk | 0072b13 | 2005-08-01 21:11:39 -0700 | [diff] [blame] | 51 | static inline struct dcookie_user * dcookie_register(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | { |
| 53 | return NULL; |
| 54 | } |
| 55 | |
Adrian Bunk | 0072b13 | 2005-08-01 21:11:39 -0700 | [diff] [blame] | 56 | static inline void dcookie_unregister(struct dcookie_user * user) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | { |
| 58 | return; |
| 59 | } |
Jan Blunck | 448678a | 2008-02-14 19:38:36 -0800 | [diff] [blame] | 60 | |
| 61 | static inline int get_dcookie(struct path *path, unsigned long *cookie) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | { |
| 63 | return -ENOSYS; |
Jan Blunck | 448678a | 2008-02-14 19:38:36 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | #endif /* CONFIG_PROFILING */ |
Jan Blunck | 448678a | 2008-02-14 19:38:36 -0800 | [diff] [blame] | 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | #endif /* DCOOKIES_H */ |