blob: 6c1a323137dda33fb798c10ca3ef42ffee2460c3 [file] [log] [blame]
Kai Bankett5d026c72012-02-17 05:59:20 +01001/*
2 * QNX6 file system, Linux implementation.
3 *
4 * Version : 1.0.0
5 *
6 * History :
7 *
8 * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release.
9 * 16-02-2012 pagemap extension by Al Viro
10 *
11 */
12
13#include "qnx6.h"
14
15struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
Al Viro00cd8dd2012-06-10 17:13:09 -040016 unsigned int flags)
Kai Bankett5d026c72012-02-17 05:59:20 +010017{
18 unsigned ino;
19 struct page *page;
20 struct inode *foundinode = NULL;
21 const char *name = dentry->d_name.name;
22 int len = dentry->d_name.len;
23
24 if (len > QNX6_LONG_NAME_MAX)
25 return ERR_PTR(-ENAMETOOLONG);
26
27 ino = qnx6_find_entry(len, dir, name, &page);
28 if (ino) {
29 foundinode = qnx6_iget(dir->i_sb, ino);
30 qnx6_put_page(page);
31 if (IS_ERR(foundinode)) {
Fabian Frederickfa5a7a42014-08-08 14:23:07 -070032 pr_debug("lookup->iget -> error %ld\n",
33 PTR_ERR(foundinode));
Kai Bankett5d026c72012-02-17 05:59:20 +010034 return ERR_CAST(foundinode);
35 }
36 } else {
Fabian Frederickfa5a7a42014-08-08 14:23:07 -070037 pr_debug("%s(): not found %s\n", __func__, name);
Kai Bankett5d026c72012-02-17 05:59:20 +010038 return NULL;
39 }
40 d_add(dentry, foundinode);
41 return NULL;
42}