fs/ext3/namei.c | 29 +++++++++++++++++++++++++++++ include/linux/fs.h | 1 + 2 files changed, 30 insertions(+) --- linux-2.4.20-vanilla/include/linux/fs.h~ext3-raw-lookup 2003-09-13 17:03:05.000000000 +0400 +++ linux-2.4.20-vanilla-alexey/include/linux/fs.h 2003-09-15 10:16:38.000000000 +0400 @@ -865,6 +865,7 @@ struct inode_operations { int (*create) (struct inode *,struct dentry *,int); int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *); struct dentry * (*lookup) (struct inode *,struct dentry *); + int (*lookup_raw) (struct inode *, const char *, int, ino_t *); struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags); int (*link) (struct dentry *,struct inode *,struct dentry *); int (*link_raw) (struct nameidata *,struct nameidata *); --- linux-2.4.20-vanilla/fs/ext3/namei.c~ext3-raw-lookup 2003-09-13 17:03:05.000000000 +0400 +++ linux-2.4.20-vanilla-alexey/fs/ext3/namei.c 2003-09-15 10:18:52.000000000 +0400 @@ -957,6 +957,34 @@ static struct dentry *ext3_lookup(struct return NULL; } +static int ext3_lookup_raw(struct inode *dir, const char *name, + int len, ino_t *data) +{ + struct ext3_dir_entry_2 *de; + struct buffer_head *bh; + struct dentry parent; + struct dentry dentry; + + if (len > EXT3_NAME_LEN) + return -ENAMETOOLONG; + + parent.d_inode = dir; + dentry.d_parent = &parent; + dentry.d_name.name = name; + dentry.d_name.len = len; + + bh = ext3_find_entry(&dentry, &de); + if (bh) { + unsigned long ino = le32_to_cpu(de->inode); + brelse (bh); + if (data) + *data = ino; + return 0; /* found name */ + } + + return -ENOENT; +} + #define S_SHIFT 12 static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = { [S_IFREG >> S_SHIFT] EXT3_FT_REG_FILE, @@ -2247,6 +2275,7 @@ end_rename: struct inode_operations ext3_dir_inode_operations = { create: ext3_create, /* BKL held */ lookup: ext3_lookup, /* BKL held */ + lookup_raw: ext3_lookup_raw, /* BKL held */ link: ext3_link, /* BKL held */ unlink: ext3_unlink, /* BKL held */ symlink: ext3_symlink, /* BKL held */ _