namei.c 910 B

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