mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
switch ext2 to inode->i_acl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
f19d4a8fa6
commit
5e78b43568
5 changed files with 11 additions and 41 deletions
|
@ -128,10 +128,10 @@ fail:
|
||||||
static inline struct posix_acl *
|
static inline struct posix_acl *
|
||||||
ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl)
|
ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl)
|
||||||
{
|
{
|
||||||
struct posix_acl *acl = EXT2_ACL_NOT_CACHED;
|
struct posix_acl *acl = ACL_NOT_CACHED;
|
||||||
|
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
if (*i_acl != EXT2_ACL_NOT_CACHED)
|
if (*i_acl != ACL_NOT_CACHED)
|
||||||
acl = posix_acl_dup(*i_acl);
|
acl = posix_acl_dup(*i_acl);
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl,
|
||||||
struct posix_acl *acl)
|
struct posix_acl *acl)
|
||||||
{
|
{
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
if (*i_acl != EXT2_ACL_NOT_CACHED)
|
if (*i_acl != ACL_NOT_CACHED)
|
||||||
posix_acl_release(*i_acl);
|
posix_acl_release(*i_acl);
|
||||||
*i_acl = posix_acl_dup(acl);
|
*i_acl = posix_acl_dup(acl);
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
|
@ -155,7 +155,6 @@ ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl,
|
||||||
static struct posix_acl *
|
static struct posix_acl *
|
||||||
ext2_get_acl(struct inode *inode, int type)
|
ext2_get_acl(struct inode *inode, int type)
|
||||||
{
|
{
|
||||||
struct ext2_inode_info *ei = EXT2_I(inode);
|
|
||||||
int name_index;
|
int name_index;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
struct posix_acl *acl;
|
struct posix_acl *acl;
|
||||||
|
@ -166,15 +165,15 @@ ext2_get_acl(struct inode *inode, int type)
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ACL_TYPE_ACCESS:
|
case ACL_TYPE_ACCESS:
|
||||||
acl = ext2_iget_acl(inode, &ei->i_acl);
|
acl = ext2_iget_acl(inode, &inode->i_acl);
|
||||||
if (acl != EXT2_ACL_NOT_CACHED)
|
if (acl != ACL_NOT_CACHED)
|
||||||
return acl;
|
return acl;
|
||||||
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
|
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_TYPE_DEFAULT:
|
case ACL_TYPE_DEFAULT:
|
||||||
acl = ext2_iget_acl(inode, &ei->i_default_acl);
|
acl = ext2_iget_acl(inode, &inode->i_default_acl);
|
||||||
if (acl != EXT2_ACL_NOT_CACHED)
|
if (acl != ACL_NOT_CACHED)
|
||||||
return acl;
|
return acl;
|
||||||
name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT;
|
name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
@ -200,11 +199,11 @@ ext2_get_acl(struct inode *inode, int type)
|
||||||
if (!IS_ERR(acl)) {
|
if (!IS_ERR(acl)) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ACL_TYPE_ACCESS:
|
case ACL_TYPE_ACCESS:
|
||||||
ext2_iset_acl(inode, &ei->i_acl, acl);
|
ext2_iset_acl(inode, &inode->i_acl, acl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_TYPE_DEFAULT:
|
case ACL_TYPE_DEFAULT:
|
||||||
ext2_iset_acl(inode, &ei->i_default_acl, acl);
|
ext2_iset_acl(inode, &inode->i_default_acl, acl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +216,6 @@ ext2_get_acl(struct inode *inode, int type)
|
||||||
static int
|
static int
|
||||||
ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
||||||
{
|
{
|
||||||
struct ext2_inode_info *ei = EXT2_I(inode);
|
|
||||||
int name_index;
|
int name_index;
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
@ -266,11 +264,11 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
||||||
if (!error) {
|
if (!error) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ACL_TYPE_ACCESS:
|
case ACL_TYPE_ACCESS:
|
||||||
ext2_iset_acl(inode, &ei->i_acl, acl);
|
ext2_iset_acl(inode, &inode->i_acl, acl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACL_TYPE_DEFAULT:
|
case ACL_TYPE_DEFAULT:
|
||||||
ext2_iset_acl(inode, &ei->i_default_acl, acl);
|
ext2_iset_acl(inode, &inode->i_default_acl, acl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,6 @@ static inline int ext2_acl_count(size_t size)
|
||||||
|
|
||||||
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
||||||
|
|
||||||
/* Value for inode->u.ext2_i.i_acl and inode->u.ext2_i.i_default_acl
|
|
||||||
if the ACL has not been cached */
|
|
||||||
#define EXT2_ACL_NOT_CACHED ((void *)-1)
|
|
||||||
|
|
||||||
/* acl.c */
|
/* acl.c */
|
||||||
extern int ext2_permission (struct inode *, int);
|
extern int ext2_permission (struct inode *, int);
|
||||||
extern int ext2_acl_chmod (struct inode *);
|
extern int ext2_acl_chmod (struct inode *);
|
||||||
|
|
|
@ -46,10 +46,6 @@ struct ext2_inode_info {
|
||||||
* EAs.
|
* EAs.
|
||||||
*/
|
*/
|
||||||
struct rw_semaphore xattr_sem;
|
struct rw_semaphore xattr_sem;
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
|
||||||
struct posix_acl *i_acl;
|
|
||||||
struct posix_acl *i_default_acl;
|
|
||||||
#endif
|
#endif
|
||||||
rwlock_t i_meta_lock;
|
rwlock_t i_meta_lock;
|
||||||
|
|
||||||
|
|
|
@ -1224,10 +1224,6 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
|
||||||
return inode;
|
return inode;
|
||||||
|
|
||||||
ei = EXT2_I(inode);
|
ei = EXT2_I(inode);
|
||||||
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
|
||||||
ei->i_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
ei->i_default_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
#endif
|
|
||||||
ei->i_block_alloc_info = NULL;
|
ei->i_block_alloc_info = NULL;
|
||||||
|
|
||||||
raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
|
raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
|
||||||
|
|
|
@ -152,10 +152,6 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
|
||||||
ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
|
ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
|
||||||
if (!ei)
|
if (!ei)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
|
||||||
ei->i_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
ei->i_default_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
#endif
|
|
||||||
ei->i_block_alloc_info = NULL;
|
ei->i_block_alloc_info = NULL;
|
||||||
ei->vfs_inode.i_version = 1;
|
ei->vfs_inode.i_version = 1;
|
||||||
return &ei->vfs_inode;
|
return &ei->vfs_inode;
|
||||||
|
@ -198,18 +194,6 @@ static void destroy_inodecache(void)
|
||||||
static void ext2_clear_inode(struct inode *inode)
|
static void ext2_clear_inode(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
|
struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
|
||||||
#ifdef CONFIG_EXT2_FS_POSIX_ACL
|
|
||||||
struct ext2_inode_info *ei = EXT2_I(inode);
|
|
||||||
|
|
||||||
if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) {
|
|
||||||
posix_acl_release(ei->i_acl);
|
|
||||||
ei->i_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
}
|
|
||||||
if (ei->i_default_acl && ei->i_default_acl != EXT2_ACL_NOT_CACHED) {
|
|
||||||
posix_acl_release(ei->i_default_acl);
|
|
||||||
ei->i_default_acl = EXT2_ACL_NOT_CACHED;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ext2_discard_reservation(inode);
|
ext2_discard_reservation(inode);
|
||||||
EXT2_I(inode)->i_block_alloc_info = NULL;
|
EXT2_I(inode)->i_block_alloc_info = NULL;
|
||||||
if (unlikely(rsv))
|
if (unlikely(rsv))
|
||||||
|
|
Loading…
Reference in a new issue