Advertisement
rgadsdon

VMware vmhgfs link.c patch for Kernel 3.15

Apr 23rd, 2014
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. --- vmhgfs-only/link.c.orig 2014-04-23 10:11:34.891106441 +0100
  2. +++ vmhgfs-only/link.c 2014-04-23 00:49:03.000000000 +0100
  3. @@ -151,7 +151,7 @@
  4. *
  5. *----------------------------------------------------------------------
  6. */
  7. -
  8. +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 99)
  9. static int
  10. HgfsReadlink(struct dentry *dentry, // IN: Dentry containing link
  11. char __user *buffer, // OUT: User buffer to copy link into
  12. @@ -189,7 +189,45 @@
  13. }
  14. return error;
  15. }
  16. +#else
  17. +static int
  18. +HgfsReadlink(struct dentry *dentry, // IN: Dentry containing link
  19. + char __user *buffer, // OUT: User buffer to copy link into
  20. + int buflen) // IN: Length of user buffer
  21. +
  22. +{
  23. + HgfsAttrInfo attr;
  24. + char *fileName = NULL;
  25. + int error;
  26. +
  27. + ASSERT(dentry);
  28. + ASSERT(buffer);
  29. +
  30. + if (!dentry) {
  31. + LOG(4, (KERN_DEBUG "VMware hgfs: HgfsReadlink: null input\n"));
  32. + return -EINVAL;
  33. + }
  34.  
  35. + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
  36. + "HgfsPrivateGetattr\n"));
  37. + error = HgfsPrivateGetattr(dentry, &attr, &fileName);
  38. + if (!error) {
  39. +
  40. + /* Let's make sure we got called on a symlink. */
  41. + if (attr.type != HGFS_FILE_TYPE_SYMLINK || fileName == NULL) {
  42. + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: got called "
  43. + "on something that wasn't a symlink\n"));
  44. + error = -EINVAL;
  45. + } else {
  46. + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
  47. + "readlink_copy\n"));
  48. + error = readlink_copy(buffer, buflen, fileName);
  49. + }
  50. + kfree(fileName);
  51. + }
  52. + return error;
  53. +}
  54. +#endif
  55.  
  56. /*
  57. *----------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement