summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
commit06615f62b17d7de6e12d2f5ec6b88cf30af08413 (patch)
tree8766f208847d4876a6db619aebbf54d53b76eb44 /fs/ext2
parentfa9bdb574f4febb751848a685d9a9017e04e1d53 (diff)
Merge with Linux 2.4.0-test10.
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/namei.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index e4234cb45..3c981f75c 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -183,25 +183,22 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry)
return NULL;
}
+#define S_SHIFT 12
+static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
+ [S_IFREG >> S_SHIFT] EXT2_FT_REG_FILE,
+ [S_IFDIR >> S_SHIFT] EXT2_FT_DIR,
+ [S_IFCHR >> S_SHIFT] EXT2_FT_CHRDEV,
+ [S_IFBLK >> S_SHIFT] EXT2_FT_BLKDEV,
+ [S_IFIFO >> S_SHIFT] EXT2_FT_FIFO,
+ [S_IFSOCK >> S_SHIFT] EXT2_FT_SOCK,
+ [S_IFLNK >> S_SHIFT] EXT2_FT_SYMLINK,
+};
+
static inline void ext2_set_de_type(struct super_block *sb,
struct ext2_dir_entry_2 *de,
umode_t mode) {
- if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
- return;
- if (S_ISREG(mode))
- de->file_type = EXT2_FT_REG_FILE;
- else if (S_ISDIR(mode))
- de->file_type = EXT2_FT_DIR;
- else if (S_ISLNK(mode))
- de->file_type = EXT2_FT_SYMLINK;
- else if (S_ISSOCK(mode))
- de->file_type = EXT2_FT_SOCK;
- else if (S_ISFIFO(mode))
- de->file_type = EXT2_FT_FIFO;
- else if (S_ISCHR(mode))
- de->file_type = EXT2_FT_CHRDEV;
- else if (S_ISBLK(mode))
- de->file_type = EXT2_FT_BLKDEV;
+ if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
+ de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}
/*
@@ -437,7 +434,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
inode->i_nlink--; /* is this nlink == 0? */
mark_inode_dirty(inode);
iput (inode);
- return -EIO;
+ return err;
}
de = (struct ext2_dir_entry_2 *) dir_block->b_data;
de->inode = cpu_to_le32(inode->i_ino);