Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / dcookies.h
blobddfdac20cad03ca774c87be11b0dd4350eb0a0c1
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * dcookies.h
5 * Persistent cookie-path mappings
7 * Copyright 2002 John Levon <levon@movementarian.org>
8 */
10 #ifndef DCOOKIES_H
11 #define DCOOKIES_H
14 #ifdef CONFIG_PROFILING
16 #include <linux/dcache.h>
17 #include <linux/types.h>
19 struct dcookie_user;
20 struct path;
22 /**
23 * dcookie_register - register a user of dcookies
25 * Register as a dcookie user. Returns %NULL on failure.
27 struct dcookie_user * dcookie_register(void);
29 /**
30 * dcookie_unregister - unregister a user of dcookies
32 * Unregister as a dcookie user. This may invalidate
33 * any dcookie values returned from get_dcookie().
35 void dcookie_unregister(struct dcookie_user * user);
37 /**
38 * get_dcookie - acquire a dcookie
40 * Convert the given dentry/vfsmount pair into
41 * a cookie value.
43 * Returns -EINVAL if no living task has registered as a
44 * dcookie user.
46 * Returns 0 on success, with *cookie filled in
48 int get_dcookie(const struct path *path, unsigned long *cookie);
50 #else
52 static inline struct dcookie_user * dcookie_register(void)
54 return NULL;
57 static inline void dcookie_unregister(struct dcookie_user * user)
59 return;
62 static inline int get_dcookie(const struct path *path, unsigned long *cookie)
64 return -ENOSYS;
67 #endif /* CONFIG_PROFILING */
69 #endif /* DCOOKIES_H */