Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Kai Bankett | 5d026c7 | 2012-02-17 05:59:20 +0100 | [diff] [blame] | 2 | /* |
| 3 | * QNX6 file system, Linux implementation. |
| 4 | * |
| 5 | * Version : 1.0.0 |
| 6 | * |
| 7 | * History : |
| 8 | * |
| 9 | * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release. |
| 10 | * 16-02-2012 pagemap extension by Al Viro |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include "qnx6.h" |
| 15 | |
| 16 | struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, |
Al Viro | 00cd8dd | 2012-06-10 17:13:09 -0400 | [diff] [blame] | 17 | unsigned int flags) |
Kai Bankett | 5d026c7 | 2012-02-17 05:59:20 +0100 | [diff] [blame] | 18 | { |
| 19 | unsigned ino; |
| 20 | struct page *page; |
| 21 | struct inode *foundinode = NULL; |
| 22 | const char *name = dentry->d_name.name; |
| 23 | int len = dentry->d_name.len; |
| 24 | |
| 25 | if (len > QNX6_LONG_NAME_MAX) |
| 26 | return ERR_PTR(-ENAMETOOLONG); |
| 27 | |
| 28 | ino = qnx6_find_entry(len, dir, name, &page); |
| 29 | if (ino) { |
| 30 | foundinode = qnx6_iget(dir->i_sb, ino); |
| 31 | qnx6_put_page(page); |
Al Viro | c148170 | 2018-04-30 23:07:15 -0400 | [diff] [blame] | 32 | if (IS_ERR(foundinode)) |
Fabian Frederick | fa5a7a4 | 2014-08-08 14:23:07 -0700 | [diff] [blame] | 33 | pr_debug("lookup->iget -> error %ld\n", |
| 34 | PTR_ERR(foundinode)); |
Kai Bankett | 5d026c7 | 2012-02-17 05:59:20 +0100 | [diff] [blame] | 35 | } else { |
Fabian Frederick | fa5a7a4 | 2014-08-08 14:23:07 -0700 | [diff] [blame] | 36 | pr_debug("%s(): not found %s\n", __func__, name); |
Kai Bankett | 5d026c7 | 2012-02-17 05:59:20 +0100 | [diff] [blame] | 37 | } |
Al Viro | c148170 | 2018-04-30 23:07:15 -0400 | [diff] [blame] | 38 | return d_splice_alias(foundinode, dentry); |
Kai Bankett | 5d026c7 | 2012-02-17 05:59:20 +0100 | [diff] [blame] | 39 | } |