blob: 0fe7cdf326f735c0722ffc08443cbcf993991fca [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -070012
13#ifdef CONFIG_PROFILING
14
15#include <linux/types.h>
16
17struct dcookie_user;
18
19/**
20 * dcookie_register - register a user of dcookies
21 *
22 * Register as a dcookie user. Returns %NULL on failure.
23 */
24struct 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 */
32void 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 */
45int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
46 unsigned long * cookie);
47
48#else
49
Adrian Bunk0072b132005-08-01 21:11:39 -070050static inline struct dcookie_user * dcookie_register(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070051{
52 return NULL;
53}
54
Adrian Bunk0072b132005-08-01 21:11:39 -070055static inline void dcookie_unregister(struct dcookie_user * user)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056{
57 return;
58}
59
60static 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 */