aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-07-27 11:54:40 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-07-27 11:54:40 -0400
commit60fd4da34d55a9cc0d857fc76dc12cf8cab4ed02 (patch)
tree72c6b3d9c7680070a751da56bd9068f71e7b106f
parent90c7201b97bb7ac5a4e2605abc0efb5fdfb957f0 (diff)
ext4: Cleanup ext4_check_dir_entry so __func__ is now implicit
Also start passing the line number to ext4_check_dir since we're going to need it in upcoming patch. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/dir.c11
-rw-r--r--fs/ext4/ext4.h8
-rw-r--r--fs/ext4/namei.c14
3 files changed, 17 insertions, 16 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 2965c39d4183..af581f08fe3a 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -61,10 +61,11 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
61} 61}
62 62
63 63
64int ext4_check_dir_entry(const char *function, struct inode *dir, 64int __ext4_check_dir_entry(const char *function, unsigned int line,
65 struct ext4_dir_entry_2 *de, 65 struct inode *dir,
66 struct buffer_head *bh, 66 struct ext4_dir_entry_2 *de,
67 unsigned int offset) 67 struct buffer_head *bh,
68 unsigned int offset)
68{ 69{
69 const char *error_msg = NULL; 70 const char *error_msg = NULL;
70 const int rlen = ext4_rec_len_from_disk(de->rec_len, 71 const int rlen = ext4_rec_len_from_disk(de->rec_len,
@@ -194,7 +195,7 @@ revalidate:
194 while (!error && filp->f_pos < inode->i_size 195 while (!error && filp->f_pos < inode->i_size
195 && offset < sb->s_blocksize) { 196 && offset < sb->s_blocksize) {
196 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset); 197 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset);
197 if (!ext4_check_dir_entry("ext4_readdir", inode, de, 198 if (!ext4_check_dir_entry(inode, de,
198 bh, offset)) { 199 bh, offset)) {
199 /* 200 /*
200 * On error, skip the f_pos to the next block 201 * On error, skip the f_pos to the next block
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5a41881cafca..73465b26976d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1515,9 +1515,11 @@ extern unsigned ext4_init_block_bitmap(struct super_block *sb,
1515 ext4_init_block_bitmap(sb, NULL, group, desc) 1515 ext4_init_block_bitmap(sb, NULL, group, desc)
1516 1516
1517/* dir.c */ 1517/* dir.c */
1518extern int ext4_check_dir_entry(const char *, struct inode *, 1518extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *,
1519 struct ext4_dir_entry_2 *, 1519 struct ext4_dir_entry_2 *,
1520 struct buffer_head *, unsigned int); 1520 struct buffer_head *, unsigned int);
1521#define ext4_check_dir_entry(dir, de, bh, offset) \
1522 __ext4_check_dir_entry(__func__, __LINE__, (dir), (de), (bh), (offset))
1521extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, 1523extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
1522 __u32 minor_hash, 1524 __u32 minor_hash,
1523 struct ext4_dir_entry_2 *dirent); 1525 struct ext4_dir_entry_2 *dirent);
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 5a61f77e7d7c..ea8b59d96213 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -605,7 +605,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
605 dir->i_sb->s_blocksize - 605 dir->i_sb->s_blocksize -
606 EXT4_DIR_REC_LEN(0)); 606 EXT4_DIR_REC_LEN(0));
607 for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) { 607 for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) {
608 if (!ext4_check_dir_entry("htree_dirblock_to_tree", dir, de, bh, 608 if (!ext4_check_dir_entry(dir, de, bh,
609 (block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb)) 609 (block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
610 +((char *)de - bh->b_data))) { 610 +((char *)de - bh->b_data))) {
611 /* On error, skip the f_pos to the next block. */ 611 /* On error, skip the f_pos to the next block. */
@@ -844,8 +844,7 @@ static inline int search_dirblock(struct buffer_head *bh,
844 if ((char *) de + namelen <= dlimit && 844 if ((char *) de + namelen <= dlimit &&
845 ext4_match (namelen, name, de)) { 845 ext4_match (namelen, name, de)) {
846 /* found a match - just to be sure, do a full check */ 846 /* found a match - just to be sure, do a full check */
847 if (!ext4_check_dir_entry("ext4_find_entry", 847 if (!ext4_check_dir_entry(dir, de, bh, offset))
848 dir, de, bh, offset))
849 return -1; 848 return -1;
850 *res_dir = de; 849 *res_dir = de;
851 return 1; 850 return 1;
@@ -1019,7 +1018,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
1019 int off = (block << EXT4_BLOCK_SIZE_BITS(sb)) 1018 int off = (block << EXT4_BLOCK_SIZE_BITS(sb))
1020 + ((char *) de - bh->b_data); 1019 + ((char *) de - bh->b_data);
1021 1020
1022 if (!ext4_check_dir_entry(__func__, dir, de, bh, off)) { 1021 if (!ext4_check_dir_entry(dir, de, bh, off)) {
1023 brelse(bh); 1022 brelse(bh);
1024 *err = ERR_BAD_DX_DIR; 1023 *err = ERR_BAD_DX_DIR;
1025 goto errout; 1024 goto errout;
@@ -1303,8 +1302,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1303 de = (struct ext4_dir_entry_2 *)bh->b_data; 1302 de = (struct ext4_dir_entry_2 *)bh->b_data;
1304 top = bh->b_data + blocksize - reclen; 1303 top = bh->b_data + blocksize - reclen;
1305 while ((char *) de <= top) { 1304 while ((char *) de <= top) {
1306 if (!ext4_check_dir_entry("ext4_add_entry", dir, de, 1305 if (!ext4_check_dir_entry(dir, de, bh, offset))
1307 bh, offset))
1308 return -EIO; 1306 return -EIO;
1309 if (ext4_match(namelen, name, de)) 1307 if (ext4_match(namelen, name, de))
1310 return -EEXIST; 1308 return -EEXIST;
@@ -1671,7 +1669,7 @@ static int ext4_delete_entry(handle_t *handle,
1671 pde = NULL; 1669 pde = NULL;
1672 de = (struct ext4_dir_entry_2 *) bh->b_data; 1670 de = (struct ext4_dir_entry_2 *) bh->b_data;
1673 while (i < bh->b_size) { 1671 while (i < bh->b_size) {
1674 if (!ext4_check_dir_entry("ext4_delete_entry", dir, de, bh, i)) 1672 if (!ext4_check_dir_entry(dir, de, bh, i))
1675 return -EIO; 1673 return -EIO;
1676 if (de == de_del) { 1674 if (de == de_del) {
1677 BUFFER_TRACE(bh, "get_write_access"); 1675 BUFFER_TRACE(bh, "get_write_access");
@@ -1954,7 +1952,7 @@ static int empty_dir(struct inode *inode)
1954 } 1952 }
1955 de = (struct ext4_dir_entry_2 *) bh->b_data; 1953 de = (struct ext4_dir_entry_2 *) bh->b_data;
1956 } 1954 }
1957 if (!ext4_check_dir_entry("empty_dir", inode, de, bh, offset)) { 1955 if (!ext4_check_dir_entry(inode, de, bh, offset)) {
1958 de = (struct ext4_dir_entry_2 *)(bh->b_data + 1956 de = (struct ext4_dir_entry_2 *)(bh->b_data +
1959 sb->s_blocksize); 1957 sb->s_blocksize);
1960 offset = (offset | (sb->s_blocksize - 1)) + 1; 1958 offset = (offset | (sb->s_blocksize - 1)) + 1;