home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / patches / posix-ext / posix-statlite-fix.patch < prev    next >
Text File  |  2008-01-07  |  4KB  |  126 lines

  1. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/stat.c vanilla-new/fs/stat.c
  2. --- vanilla/fs/stat.c    2006-05-24 16:19:07.000000000 -0500
  3. +++ vanilla-new/fs/stat.c    2006-08-29 17:58:48.000000000 -0500
  4. @@ -345,6 +345,15 @@
  5.      return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
  6.  }
  7.  
  8. +static long get_stat_lite_mask(struct stat_lite __user *statlitebuf)
  9. +{
  10. +    struct stat_lite tmp;
  11. +
  12. +    if (copy_from_user(&tmp,statlitebuf,sizeof(tmp)))
  13. +        return -EFAULT;
  14. +    return tmp.st_litemask;
  15. +}
  16. +
  17.  int cp_new_statlite(struct kstat_lite *stat_lite, struct stat_lite __user *statlitebuf)
  18.  {
  19.      struct stat_lite tmp;
  20. @@ -434,7 +443,13 @@
  21.  asmlinkage long sys_newstatlite(char __user *filename, struct stat_lite __user *statlitebuf)
  22.  {
  23.      struct kstat_lite stat_lite;
  24. -    int error = vfs_statlite_fd(AT_FDCWD, filename, &stat_lite);
  25. +    int error;
  26. +
  27. +    stat_lite.lite_mask = get_stat_lite_mask(statlitebuf);
  28. +    if (stat_lite.lite_mask < 0)
  29. +        return stat_lite.lite_mask;
  30. +
  31. +    error = vfs_statlite_fd(AT_FDCWD, filename, &stat_lite);
  32.  
  33.      if (!error)
  34.          error = cp_new_statlite(&stat_lite, statlitebuf);
  35. @@ -456,7 +471,13 @@
  36.  asmlinkage long sys_newlstatlite(char __user *filename, struct stat_lite __user *statlitebuf)
  37.  {
  38.      struct kstat_lite stat_lite;
  39. -    int error = vfs_lstatlite_fd(AT_FDCWD, filename, &stat_lite);
  40. +    int error;
  41. +    
  42. +    stat_lite.lite_mask = get_stat_lite_mask(statlitebuf);
  43. +    if (stat_lite.lite_mask < 0)
  44. +        return stat_lite.lite_mask;
  45. +
  46. +    error = vfs_lstatlite_fd(AT_FDCWD, filename, &stat_lite);
  47.  
  48.      if (!error)
  49.          error = cp_new_statlite(&stat_lite, statlitebuf);
  50. @@ -501,7 +522,13 @@
  51.  asmlinkage long sys_newfstatlite(unsigned int fd, struct stat_lite __user *statlitebuf)
  52.  {
  53.      struct kstat_lite stat_lite;
  54. -    int error = vfs_fstatlite(fd, &stat_lite);
  55. +    int error;
  56. +
  57. +    stat_lite.lite_mask = get_stat_lite_mask(statlitebuf);
  58. +    if (stat_lite.lite_mask < 0)
  59. +        return stat_lite.lite_mask;
  60. +
  61. +    error = vfs_fstatlite(fd, &stat_lite);
  62.  
  63.      if (!error)
  64.          error = cp_new_statlite(&stat_lite, statlitebuf);
  65. @@ -580,6 +607,15 @@
  66.      return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
  67.  }
  68.  
  69. +static long get_stat64_lite_mask(struct stat64_lite __user *statlitebuf)
  70. +{
  71. +    struct stat64_lite tmp;
  72. +
  73. +    if (copy_from_user(&tmp,statlitebuf,sizeof(tmp)))
  74. +        return -EFAULT;
  75. +    return tmp.st_litemask;
  76. +}
  77. +
  78.  long cp_new_stat64_lite(struct kstat_lite *stat_lite, struct stat64_lite __user *statlitebuf)
  79.  {
  80.      struct stat64_lite tmp;
  81. @@ -648,7 +684,13 @@
  82.  asmlinkage long sys_statlite64(char __user * filename, struct stat64_lite __user * statlitebuf)
  83.  {
  84.      struct kstat_lite stat_lite;
  85. -    int error = vfs_statlite(filename, &stat_lite);
  86. +    int error;
  87. +
  88. +    stat_lite.lite_mask = get_stat64_lite_mask(statlitebuf);
  89. +    if (stat_lite.lite_mask < 0)
  90. +        return stat_lite.lite_mask;
  91. +
  92. +    error = vfs_statlite(filename, &stat_lite);
  93.  
  94.      if (!error)
  95.          error = cp_new_stat64_lite(&stat_lite, statlitebuf);
  96. @@ -670,7 +712,13 @@
  97.  asmlinkage long sys_lstatlite64(char __user * filename, struct stat64_lite __user * statlitebuf)
  98.  {
  99.      struct kstat_lite stat_lite;
  100. -    int error = vfs_lstatlite(filename, &stat_lite);
  101. +    int error;
  102. +    
  103. +    stat_lite.lite_mask = get_stat64_lite_mask(statlitebuf);
  104. +    if (stat_lite.lite_mask < 0)
  105. +        return stat_lite.lite_mask;
  106. +
  107. +    error = vfs_lstatlite(filename, &stat_lite);
  108.  
  109.      if (!error)
  110.          error = cp_new_stat64_lite(&stat_lite, statlitebuf);
  111. @@ -692,7 +740,13 @@
  112.  asmlinkage long sys_fstatlite64(unsigned long fd, struct stat64_lite __user * statlitebuf)
  113.  {
  114.      struct kstat_lite stat_lite;
  115. -    int error = vfs_fstatlite(fd, &stat_lite);
  116. +    int error;
  117. +
  118. +    stat_lite.lite_mask = get_stat64_lite_mask(statlitebuf);
  119. +    if (stat_lite.lite_mask < 0)
  120. +        return stat_lite.lite_mask;
  121. +
  122. +    error = vfs_fstatlite(fd, &stat_lite);
  123.  
  124.      if (!error)
  125.          error = cp_new_stat64_lite(&stat_lite, statlitebuf);
  126.