]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/linux/posix_acl_xattr.h
UBUNTU: SAUCE: (namespace) posix_acl: Export posix_acl_fix_xattr_userns() to modules
[mirror_ubuntu-zesty-kernel.git] / include / linux / posix_acl_xattr.h
CommitLineData
1da177e4
LT
1/*
2 File: linux/posix_acl_xattr.h
3
4 Extended attribute system call representation of Access Control Lists.
5
6 Copyright (C) 2000 by Andreas Gruenbacher <a.gruenbacher@computer.org>
7 Copyright (C) 2002 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>
8 */
9#ifndef _POSIX_ACL_XATTR_H
10#define _POSIX_ACL_XATTR_H
11
97d79299 12#include <uapi/linux/xattr.h>
bc8bcf3b 13#include <uapi/linux/posix_acl_xattr.h>
1da177e4
LT
14#include <linux/posix_acl.h>
15
1da177e4
LT
16static inline size_t
17posix_acl_xattr_size(int count)
18{
2211d5ba
AG
19 return (sizeof(struct posix_acl_xattr_header) +
20 (count * sizeof(struct posix_acl_xattr_entry)));
1da177e4
LT
21}
22
23static inline int
24posix_acl_xattr_count(size_t size)
25{
2211d5ba 26 if (size < sizeof(struct posix_acl_xattr_header))
1da177e4 27 return -1;
2211d5ba
AG
28 size -= sizeof(struct posix_acl_xattr_header);
29 if (size % sizeof(struct posix_acl_xattr_entry))
1da177e4 30 return -1;
2211d5ba 31 return size / sizeof(struct posix_acl_xattr_entry);
1da177e4
LT
32}
33
2f6f0654 34#ifdef CONFIG_FS_POSIX_ACL
78ef7da5
SF
35int posix_acl_fix_xattr_userns(struct user_namespace *to,
36 struct user_namespace *from,
37 void *value, size_t size);
2f6f0654
EB
38void posix_acl_fix_xattr_from_user(void *value, size_t size);
39void posix_acl_fix_xattr_to_user(void *value, size_t size);
40#else
78ef7da5
SF
41static inline int posix_acl_fix_xattr_userns(struct user_namespace *to,
42 struct user_namespace *from,
43 void *value, size_t size)
44{
45 return 0;
46}
2f6f0654
EB
47static inline void posix_acl_fix_xattr_from_user(void *value, size_t size)
48{
49}
50static inline void posix_acl_fix_xattr_to_user(void *value, size_t size)
51{
52}
53#endif
54
5f3a4a28
EB
55struct posix_acl *posix_acl_from_xattr(struct user_namespace *user_ns,
56 const void *value, size_t size);
57int posix_acl_to_xattr(struct user_namespace *user_ns,
58 const struct posix_acl *acl, void *buffer, size_t size);
9a59f452 59
2aeccbe9
CH
60extern const struct xattr_handler posix_acl_access_xattr_handler;
61extern const struct xattr_handler posix_acl_default_xattr_handler;
62
1da177e4 63#endif /* _POSIX_ACL_XATTR_H */