Skip to content

Commit

Permalink
ext4: Cleanup whitespace and other miscellaneous style issues
Browse files Browse the repository at this point in the history
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Theodore Ts'o committed Jul 26, 2008
1 parent ec05e86 commit 2b2d6d0
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 282 deletions.
188 changes: 94 additions & 94 deletions fs/ext4/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,35 @@ ext4_acl_from_disk(const void *value, size_t size)
acl = posix_acl_alloc(count, GFP_NOFS);
if (!acl)
return ERR_PTR(-ENOMEM);
for (n=0; n < count; n++) {
for (n = 0; n < count; n++) {
ext4_acl_entry *entry =
(ext4_acl_entry *)value;
if ((char *)value + sizeof(ext4_acl_entry_short) > end)
goto fail;
acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
switch(acl->a_entries[n].e_tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
value = (char *)value +
sizeof(ext4_acl_entry_short);
acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
break;

case ACL_USER:
case ACL_GROUP:
value = (char *)value + sizeof(ext4_acl_entry);
if ((char *)value > end)
goto fail;
acl->a_entries[n].e_id =
le32_to_cpu(entry->e_id);
break;

default:

switch (acl->a_entries[n].e_tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
value = (char *)value +
sizeof(ext4_acl_entry_short);
acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
break;

case ACL_USER:
case ACL_GROUP:
value = (char *)value + sizeof(ext4_acl_entry);
if ((char *)value > end)
goto fail;
acl->a_entries[n].e_id =
le32_to_cpu(entry->e_id);
break;

default:
goto fail;
}
}
if (value != end)
Expand Down Expand Up @@ -96,27 +97,26 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
return ERR_PTR(-ENOMEM);
ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION);
e = (char *)ext_acl + sizeof(ext4_acl_header);
for (n=0; n < acl->a_count; n++) {
for (n = 0; n < acl->a_count; n++) {
ext4_acl_entry *entry = (ext4_acl_entry *)e;
entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
switch(acl->a_entries[n].e_tag) {
case ACL_USER:
case ACL_GROUP:
entry->e_id =
cpu_to_le32(acl->a_entries[n].e_id);
e += sizeof(ext4_acl_entry);
break;

case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
e += sizeof(ext4_acl_entry_short);
break;

default:
goto fail;
switch (acl->a_entries[n].e_tag) {
case ACL_USER:
case ACL_GROUP:
entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
e += sizeof(ext4_acl_entry);
break;

case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
e += sizeof(ext4_acl_entry_short);
break;

default:
goto fail;
}
}
return (char *)ext_acl;
Expand Down Expand Up @@ -167,23 +167,23 @@ ext4_get_acl(struct inode *inode, int type)
if (!test_opt(inode->i_sb, POSIX_ACL))
return NULL;

switch(type) {
case ACL_TYPE_ACCESS:
acl = ext4_iget_acl(inode, &ei->i_acl);
if (acl != EXT4_ACL_NOT_CACHED)
return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
break;

case ACL_TYPE_DEFAULT:
acl = ext4_iget_acl(inode, &ei->i_default_acl);
if (acl != EXT4_ACL_NOT_CACHED)
return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
break;

default:
return ERR_PTR(-EINVAL);
switch (type) {
case ACL_TYPE_ACCESS:
acl = ext4_iget_acl(inode, &ei->i_acl);
if (acl != EXT4_ACL_NOT_CACHED)
return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
break;

case ACL_TYPE_DEFAULT:
acl = ext4_iget_acl(inode, &ei->i_default_acl);
if (acl != EXT4_ACL_NOT_CACHED)
return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
break;

default:
return ERR_PTR(-EINVAL);
}
retval = ext4_xattr_get(inode, name_index, "", NULL, 0);
if (retval > 0) {
Expand All @@ -201,14 +201,14 @@ ext4_get_acl(struct inode *inode, int type)
kfree(value);

if (!IS_ERR(acl)) {
switch(type) {
case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl);
break;

case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl);
break;
switch (type) {
case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl);
break;

case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl);
break;
}
}
return acl;
Expand All @@ -232,31 +232,31 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;

switch(type) {
case ACL_TYPE_ACCESS:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
mode_t mode = inode->i_mode;
error = posix_acl_equiv_mode(acl, &mode);
if (error < 0)
return error;
else {
inode->i_mode = mode;
ext4_mark_inode_dirty(handle, inode);
if (error == 0)
acl = NULL;
}
switch (type) {
case ACL_TYPE_ACCESS:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
mode_t mode = inode->i_mode;
error = posix_acl_equiv_mode(acl, &mode);
if (error < 0)
return error;
else {
inode->i_mode = mode;
ext4_mark_inode_dirty(handle, inode);
if (error == 0)
acl = NULL;
}
break;
}
break;

case ACL_TYPE_DEFAULT:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
break;
case ACL_TYPE_DEFAULT:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
break;

default:
return -EINVAL;
default:
return -EINVAL;
}
if (acl) {
value = ext4_acl_to_disk(acl, &size);
Expand All @@ -269,14 +269,14 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,

kfree(value);
if (!error) {
switch(type) {
case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl);
break;

case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl);
break;
switch (type) {
case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl);
break;

case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl);
break;
}
}
return error;
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode,

/*
* get the next allocated block if the extent in the path
* is before the requested block(s)
* is before the requested block(s)
*/
if (b2 < b1) {
b2 = ext4_ext_next_allocated_block(path);
Expand Down
5 changes: 2 additions & 3 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,10 +1054,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)


/*
* The ext4_get_blocks_wrap() function try to look up the requested blocks,
* and returns if the blocks are already mapped.
*
*
* ext4_ext4 get_block() wrapper function
* It will do a look up first, and returns if the blocks already mapped.
* Otherwise it takes the write lock of the i_data_sem and allocate blocks
* and store the allocated blocks in the result buffer head and mark it
* mapped.
Expand Down
Loading

0 comments on commit 2b2d6d0

Please sign in to comment.