2006-10-11 04:20:50 -04:00
|
|
|
/*
|
2006-10-11 04:20:53 -04:00
|
|
|
File: fs/ext4/acl.h
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
(C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/posix_acl_xattr.h>
|
|
|
|
|
2006-10-11 04:20:53 -04:00
|
|
|
#define EXT4_ACL_VERSION 0x0001
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
__le16 e_tag;
|
|
|
|
__le16 e_perm;
|
|
|
|
__le32 e_id;
|
2006-10-11 04:20:53 -04:00
|
|
|
} ext4_acl_entry;
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
__le16 e_tag;
|
|
|
|
__le16 e_perm;
|
2006-10-11 04:20:53 -04:00
|
|
|
} ext4_acl_entry_short;
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
__le32 a_version;
|
2006-10-11 04:20:53 -04:00
|
|
|
} ext4_acl_header;
|
2006-10-11 04:20:50 -04:00
|
|
|
|
2006-10-11 04:20:53 -04:00
|
|
|
static inline size_t ext4_acl_size(int count)
|
2006-10-11 04:20:50 -04:00
|
|
|
{
|
|
|
|
if (count <= 4) {
|
2006-10-11 04:20:53 -04:00
|
|
|
return sizeof(ext4_acl_header) +
|
|
|
|
count * sizeof(ext4_acl_entry_short);
|
2006-10-11 04:20:50 -04:00
|
|
|
} else {
|
2006-10-11 04:20:53 -04:00
|
|
|
return sizeof(ext4_acl_header) +
|
|
|
|
4 * sizeof(ext4_acl_entry_short) +
|
|
|
|
(count - 4) * sizeof(ext4_acl_entry);
|
2006-10-11 04:20:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-11 04:20:53 -04:00
|
|
|
static inline int ext4_acl_count(size_t size)
|
2006-10-11 04:20:50 -04:00
|
|
|
{
|
|
|
|
ssize_t s;
|
2006-10-11 04:20:53 -04:00
|
|
|
size -= sizeof(ext4_acl_header);
|
|
|
|
s = size - 4 * sizeof(ext4_acl_entry_short);
|
2006-10-11 04:20:50 -04:00
|
|
|
if (s < 0) {
|
2006-10-11 04:20:53 -04:00
|
|
|
if (size % sizeof(ext4_acl_entry_short))
|
2006-10-11 04:20:50 -04:00
|
|
|
return -1;
|
2006-10-11 04:20:53 -04:00
|
|
|
return size / sizeof(ext4_acl_entry_short);
|
2006-10-11 04:20:50 -04:00
|
|
|
} else {
|
2006-10-11 04:20:53 -04:00
|
|
|
if (s % sizeof(ext4_acl_entry))
|
2006-10-11 04:20:50 -04:00
|
|
|
return -1;
|
2006-10-11 04:20:53 -04:00
|
|
|
return s / sizeof(ext4_acl_entry) + 4;
|
2006-10-11 04:20:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-10 20:02:48 -04:00
|
|
|
#ifdef CONFIG_EXT4_FS_POSIX_ACL
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
/* acl.c */
|
2009-08-28 15:12:24 -04:00
|
|
|
extern int ext4_check_acl(struct inode *, int);
|
2008-09-08 22:25:24 -04:00
|
|
|
extern int ext4_acl_chmod(struct inode *);
|
|
|
|
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
|
2006-10-11 04:20:50 -04:00
|
|
|
|
2008-10-10 20:02:48 -04:00
|
|
|
#else /* CONFIG_EXT4_FS_POSIX_ACL */
|
2006-10-11 04:20:50 -04:00
|
|
|
#include <linux/sched.h>
|
2009-08-28 15:12:24 -04:00
|
|
|
#define ext4_check_acl NULL
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
static inline int
|
2006-10-11 04:20:53 -04:00
|
|
|
ext4_acl_chmod(struct inode *inode)
|
2006-10-11 04:20:50 -04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
2006-10-11 04:20:53 -04:00
|
|
|
ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
|
2006-10-11 04:20:50 -04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2008-10-10 20:02:48 -04:00
|
|
|
#endif /* CONFIG_EXT4_FS_POSIX_ACL */
|
2006-10-11 04:20:50 -04:00
|
|
|
|