Whamcloud - gitweb
land b_gns onto HEAD. If you are working on CMD, you MUST UPDATE YOUR
[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 Index: lum/include/linux/fs.h
6 ===================================================================
7 --- lum.orig/include/linux/fs.h 2004-06-07 17:25:40.000000000 -0400
8 +++ lum/include/linux/fs.h      2004-06-07 17:26:11.000000000 -0400
9 @@ -904,6 +904,7 @@
10         int (*create) (struct inode *,struct dentry *,int);
11         int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
12         struct dentry * (*lookup) (struct inode *,struct dentry *);
13 +       int (*lookup_raw) (struct inode *, const char *, int, ino_t *);
14         struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct nameidata *, struct lookup_intent *, int flags);
15         int (*link) (struct dentry *,struct inode *,struct dentry *);
16         int (*link_raw) (struct nameidata *,struct nameidata *);
17 Index: lum/fs/ext3/namei.c
18 ===================================================================
19 --- lum.orig/fs/ext3/namei.c    2004-06-07 17:25:39.000000000 -0400
20 +++ lum/fs/ext3/namei.c 2004-06-07 17:25:47.000000000 -0400
21 @@ -1128,6 +1128,34 @@
22         return iopen_connect_dentry(dentry, inode, 1);
23  }
24  
25 +static int ext3_lookup_raw(struct inode *dir, const char *name,
26 +                               int len, ino_t *data)
27 +{
28 +       struct ext3_dir_entry_2 *de;
29 +       struct buffer_head *bh;
30 +       struct dentry parent;
31 +       struct dentry dentry;
32 +
33 +       if (len > EXT3_NAME_LEN)
34 +               return -ENAMETOOLONG;
35 +
36 +       parent.d_inode = dir;
37 +       dentry.d_parent = &parent;
38 +       dentry.d_name.name = name;
39 +       dentry.d_name.len = len;
40 +
41 +       bh = ext3_find_entry(&dentry, &de);
42 +       if (bh) {
43 +               unsigned long ino = le32_to_cpu(de->inode);
44 +               brelse (bh);
45 +               if (data)
46 +                       *data = ino;
47 +               return 0; /* found name */
48 +       }
49 +
50 +       return -ENOENT;
51 +}
52 +
53  #define S_SHIFT 12
54  static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = {
55         [S_IFREG >> S_SHIFT]    EXT3_FT_REG_FILE,
56 @@ -2772,6 +2800,7 @@
57  struct inode_operations ext3_dir_inode_operations = {
58         create:         ext3_create,            /* BKL held */
59         lookup:         ext3_lookup,            /* BKL held */
60 +       lookup_raw:     ext3_lookup_raw,        /* BKL held */
61         link:           ext3_link,              /* BKL held */
62         unlink:         ext3_unlink,            /* BKL held */
63         symlink:        ext3_symlink,           /* BKL held */