]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/fs_struct.h
net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()
[mirror_ubuntu-bionic-kernel.git] / include / linux / fs_struct.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _LINUX_FS_STRUCT_H
3#define _LINUX_FS_STRUCT_H
4
6ac08c39 5#include <linux/path.h>
c28cc364
NP
6#include <linux/spinlock.h>
7#include <linux/seqlock.h>
1da177e4
LT
8
9struct fs_struct {
498052bb 10 int users;
2a4419b5 11 spinlock_t lock;
c28cc364 12 seqcount_t seq;
1da177e4 13 int umask;
498052bb 14 int in_exec;
7f2da1e7 15 struct path root, pwd;
3859a271 16} __randomize_layout;
1da177e4 17
aa362a83
CL
18extern struct kmem_cache *fs_cachep;
19
1da177e4 20extern void exit_fs(struct task_struct *);
dcf787f3
AV
21extern void set_fs_root(struct fs_struct *, const struct path *);
22extern void set_fs_pwd(struct fs_struct *, const struct path *);
1da177e4 23extern struct fs_struct *copy_fs_struct(struct fs_struct *);
498052bb 24extern void free_fs_struct(struct fs_struct *);
3e93cd67 25extern int unshare_fs_struct(void);
1da177e4 26
f7ad3c6b
MS
27static inline void get_fs_root(struct fs_struct *fs, struct path *root)
28{
2a4419b5 29 spin_lock(&fs->lock);
f7ad3c6b
MS
30 *root = fs->root;
31 path_get(root);
2a4419b5 32 spin_unlock(&fs->lock);
f7ad3c6b
MS
33}
34
35static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
36{
2a4419b5 37 spin_lock(&fs->lock);
f7ad3c6b
MS
38 *pwd = fs->pwd;
39 path_get(pwd);
2a4419b5 40 spin_unlock(&fs->lock);
f7ad3c6b
MS
41}
42
3151527e
EB
43extern bool current_chrooted(void);
44
1da177e4 45#endif /* _LINUX_FS_STRUCT_H */