Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-raw-lookup.patch
1  fs/ext3/namei.c    |   29 +++++++++++++++++++++++++++++
2  include/linux/fs.h |    1 +
3  2 files changed, 30 insertions(+)
4
5 --- linux-2.4.20-vanilla/include/linux/fs.h~ext3-raw-lookup     2003-09-13 17:03:05.000000000 +0400
6 +++ linux-2.4.20-vanilla-alexey/include/linux/fs.h      2003-09-15 10:16:38.000000000 +0400
7 @@ -865,6 +865,7 @@ struct inode_operations {
8         int (*create) (struct inode *,struct dentry *,int);
9         int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
10         struct dentry * (*lookup) (struct inode *,struct dentry *);
11 +       int (*lookup_raw) (struct inode *, const char *, int, ino_t *);
12         struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
13         int (*link) (struct dentry *,struct inode *,struct dentry *);
14         int (*link_raw) (struct nameidata *,struct nameidata *);
15 --- linux-2.4.20-vanilla/fs/ext3/namei.c~ext3-raw-lookup        2003-09-13 17:03:05.000000000 +0400
16 +++ linux-2.4.20-vanilla-alexey/fs/ext3/namei.c 2003-09-15 10:18:52.000000000 +0400
17 @@ -957,6 +957,34 @@ static struct dentry *ext3_lookup(struct
18         return NULL;
19  }
20  
21 +static int ext3_lookup_raw(struct inode *dir, const char *name,
22 +                               int len, ino_t *data)
23 +{
24 +       struct ext3_dir_entry_2 *de;
25 +       struct buffer_head *bh;
26 +       struct dentry parent;
27 +       struct dentry dentry;
28 +
29 +       if (len > EXT3_NAME_LEN)
30 +               return -ENAMETOOLONG;
31 +
32 +       parent.d_inode = dir;
33 +       dentry.d_parent = &parent;
34 +       dentry.d_name.name = name;
35 +       dentry.d_name.len = len;
36 +
37 +       bh = ext3_find_entry(&dentry, &de);
38 +       if (bh) {
39 +               unsigned long ino = le32_to_cpu(de->inode);
40 +               brelse (bh);
41 +               if (data)
42 +                       *data = ino;
43 +               return 0; /* found name */
44 +       }
45 +
46 +       return -ENOENT;
47 +}
48 +
49  #define S_SHIFT 12
50  static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = {
51         [S_IFREG >> S_SHIFT]    EXT3_FT_REG_FILE,
52 @@ -2247,6 +2275,7 @@ end_rename:
53  struct inode_operations ext3_dir_inode_operations = {
54         create:         ext3_create,            /* BKL held */
55         lookup:         ext3_lookup,            /* BKL held */
56 +       lookup_raw:     ext3_lookup_raw,        /* BKL held */
57         link:           ext3_link,              /* BKL held */
58         unlink:         ext3_unlink,            /* BKL held */
59         symlink:        ext3_symlink,           /* BKL held */
60
61 _