]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - include/linux/posix_acl_xattr.h
mtd: nand: complain loudly when chip->bits_per_cell is not correctly initialized
[karo-tx-linux.git] / include / linux / posix_acl_xattr.h
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
12 #include <uapi/linux/xattr.h>
13 #include <uapi/linux/posix_acl_xattr.h>
14 #include <linux/posix_acl.h>
15
16 static inline size_t
17 posix_acl_xattr_size(int count)
18 {
19         return (sizeof(struct posix_acl_xattr_header) +
20                 (count * sizeof(struct posix_acl_xattr_entry)));
21 }
22
23 static inline int
24 posix_acl_xattr_count(size_t size)
25 {
26         if (size < sizeof(struct posix_acl_xattr_header))
27                 return -1;
28         size -= sizeof(struct posix_acl_xattr_header);
29         if (size % sizeof(struct posix_acl_xattr_entry))
30                 return -1;
31         return size / sizeof(struct posix_acl_xattr_entry);
32 }
33
34 #ifdef CONFIG_FS_POSIX_ACL
35 void posix_acl_fix_xattr_from_user(void *value, size_t size);
36 void posix_acl_fix_xattr_to_user(void *value, size_t size);
37 #else
38 static inline void posix_acl_fix_xattr_from_user(void *value, size_t size)
39 {
40 }
41 static inline void posix_acl_fix_xattr_to_user(void *value, size_t size)
42 {
43 }
44 #endif
45
46 struct posix_acl *posix_acl_from_xattr(struct user_namespace *user_ns, 
47                                        const void *value, size_t size);
48 int posix_acl_to_xattr(struct user_namespace *user_ns,
49                        const struct posix_acl *acl, void *buffer, size_t size);
50
51 extern const struct xattr_handler posix_acl_access_xattr_handler;
52 extern const struct xattr_handler posix_acl_default_xattr_handler;
53
54 #endif  /* _POSIX_ACL_XATTR_H */