Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Jan Blunck | c5e725f | 2008-02-14 19:34:31 -0800 | [diff] [blame] | 2 | #ifndef _LINUX_PATH_H |
| 3 | #define _LINUX_PATH_H |
| 4 | |
| 5 | struct dentry; |
| 6 | struct vfsmount; |
| 7 | |
| 8 | struct path { |
| 9 | struct vfsmount *mnt; |
| 10 | struct dentry *dentry; |
Kees Cook | 3859a27 | 2016-10-28 01:22:25 -0700 | [diff] [blame] | 11 | } __randomize_layout; |
Jan Blunck | c5e725f | 2008-02-14 19:34:31 -0800 | [diff] [blame] | 12 | |
Al Viro | dcf787f | 2013-03-01 23:51:07 -0500 | [diff] [blame] | 13 | extern void path_get(const struct path *); |
| 14 | extern void path_put(const struct path *); |
Jan Blunck | 1d957f9 | 2008-02-14 19:34:35 -0800 | [diff] [blame] | 15 | |
Miklos Szeredi | 8df9d1a | 2010-08-10 11:41:41 +0200 | [diff] [blame] | 16 | static inline int path_equal(const struct path *path1, const struct path *path2) |
| 17 | { |
| 18 | return path1->mnt == path2->mnt && path1->dentry == path2->dentry; |
| 19 | } |
| 20 | |
Miklos Szeredi | f121aad | 2017-11-09 10:23:28 +0100 | [diff] [blame] | 21 | static inline void path_put_init(struct path *path) |
| 22 | { |
| 23 | path_put(path); |
| 24 | *path = (struct path) { }; |
| 25 | } |
| 26 | |
Jan Blunck | c5e725f | 2008-02-14 19:34:31 -0800 | [diff] [blame] | 27 | #endif /* _LINUX_PATH_H */ |