namei.c 895 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0
  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. #include "qnx6.h"
  14. struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
  15. unsigned int flags)
  16. {
  17. unsigned ino;
  18. struct page *page;
  19. struct inode *foundinode = NULL;
  20. const char *name = dentry->d_name.name;
  21. int len = dentry->d_name.len;
  22. if (len > QNX6_LONG_NAME_MAX)
  23. return ERR_PTR(-ENAMETOOLONG);
  24. ino = qnx6_find_entry(len, dir, name, &page);
  25. if (ino) {
  26. foundinode = qnx6_iget(dir->i_sb, ino);
  27. qnx6_put_page(page);
  28. if (IS_ERR(foundinode))
  29. pr_debug("lookup->iget -> error %ld\n",
  30. PTR_ERR(foundinode));
  31. } else {
  32. pr_debug("%s(): not found %s\n", __func__, name);
  33. }
  34. return d_splice_alias(foundinode, dentry);
  35. }