Advertisement
rzuber

279-vmblock-3.11.patch

Apr 14th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.41 KB | None | 0 0
  1. --- a/vmblock-only/linux/file.c
  2. +++ b/vmblock-only/linux/file.c
  3. @@ -38,46 +38,6 @@ typedef u64 inode_num_t;
  4.  typedef ino_t inode_num_t;
  5.  #endif
  6.  
  7. -/* Specifically for our filldir_t callback */
  8. -typedef struct FilldirInfo {
  9. -   filldir_t filldir;
  10. -   void *dirent;
  11. -} FilldirInfo;
  12. -
  13. -
  14. -/*
  15. - *----------------------------------------------------------------------------
  16. - *
  17. - * Filldir --
  18. - *
  19. - *    Callback function for readdir that we use in place of the one provided.
  20. - *    This allows us to specify that each dentry is a symlink, but pass through
  21. - *    everything else to the original filldir function.
  22. - *
  23. - * Results:
  24. - *    Original filldir's return value.
  25. - *
  26. - * Side effects:
  27. - *    Directory information gets copied to user's buffer.
  28. - *
  29. - *----------------------------------------------------------------------------
  30. - */
  31. -
  32. -static int
  33. -Filldir(void *buf,              // IN: Dirent buffer passed from FileOpReaddir
  34. -        const char *name,       // IN: Dirent name
  35. -        int namelen,            // IN: len of dirent's name
  36. -        loff_t offset,          // IN: Offset
  37. -        inode_num_t ino,        // IN: Inode number of dirent
  38. -        unsigned int d_type)    // IN: Type of file
  39. -{
  40. -   FilldirInfo *info = buf;
  41. -
  42. -   /* Specify DT_LNK regardless */
  43. -   return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
  44. -}
  45. -
  46. -
  47.  /* File operations */
  48.  
  49.  /*
  50. @@ -166,11 +126,10 @@ FileOpOpen(struct inode *inode,  // IN
  51.  
  52.  static int
  53.  FileOpReaddir(struct file *file,  // IN
  54. -              void *dirent,       // IN
  55. -              filldir_t filldir)  // IN
  56. +              struct dir_context *ctx)  // IN
  57.  {
  58.     int ret;
  59. -   FilldirInfo info;
  60. +
  61.     struct file *actualFile;
  62.  
  63.     if (!file) {
  64. @@ -184,12 +143,10 @@ FileOpReaddir(struct file *file,  // IN
  65.        return -EINVAL;
  66.     }
  67.  
  68. -   info.filldir = filldir;
  69. -   info.dirent = dirent;
  70. -
  71. -   actualFile->f_pos = file->f_pos;
  72. -   ret = vfs_readdir(actualFile, Filldir, &info);
  73. -   file->f_pos = actualFile->f_pos;
  74. +   /* Ricky Wong Yung Fei:
  75. +    * Manipulation of pos is now handled internally by iterate_dir().
  76. +    */
  77. +   ret = iterate_dir(actualFile, ctx);
  78.  
  79.     return ret;
  80.  }
  81. @@ -237,7 +194,7 @@ FileOpRelease(struct inode *inode, // IN
  82.  
  83.  
  84.  struct file_operations RootFileOps = {
  85. -   .readdir = FileOpReaddir,
  86. +   .iterate = FileOpReaddir,
  87.     .open    = FileOpOpen,
  88.     .release = FileOpRelease,
  89.  };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement