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-direntplus.patch < prev    next >
Text File  |  2008-01-07  |  18KB  |  556 lines

  1. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/i386/kernel/syscall_table.S vanilla-new/arch/i386/kernel/syscall_table.S
  2. --- vanilla/arch/i386/kernel/syscall_table.S    2006-05-09 18:53:48.000000000 -0500
  3. +++ vanilla-new/arch/i386/kernel/syscall_table.S    2006-05-11 14:03:04.000000000 -0500
  4. @@ -314,7 +314,9 @@
  5.      .long sys_openfh
  6.      .long sys_newstatlite
  7.      .long sys_newlstatlite
  8. -    .long sys_newfstatlite
  9. +    .long sys_newfstatlite /* 315 */
  10.      .long sys_statlite64
  11.      .long sys_lstatlite64
  12.      .long sys_fstatlite64
  13. +    .long sys_getdents_plus
  14. +    .long sys_getdents64_plus /* 320 */
  15. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/ia64/kernel/entry.S vanilla-new/arch/ia64/kernel/entry.S
  16. --- vanilla/arch/ia64/kernel/entry.S    2006-05-09 18:53:48.000000000 -0500
  17. +++ vanilla-new/arch/ia64/kernel/entry.S    2006-05-11 14:10:30.000000000 -0500
  18. @@ -1624,5 +1624,7 @@
  19.      data8 sys_newstatlite
  20.      data8 sys_newlstatlite
  21.      data8 sys_newfstatlite
  22. +    data8 sys_getdents_plus
  23. +    data8 sys_getdents64_plus
  24.  
  25.      .org sys_call_table + 8*NR_syscalls    // guard against failures to increase NR_syscalls
  26. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/powerpc/kernel/systbl.S vanilla-new/arch/powerpc/kernel/systbl.S
  27. --- vanilla/arch/powerpc/kernel/systbl.S    2006-05-09 18:53:48.000000000 -0500
  28. +++ vanilla-new/arch/powerpc/kernel/systbl.S    2006-05-11 14:12:20.000000000 -0500
  29. @@ -327,3 +327,5 @@
  30.  SYSCALL(newstatlite)
  31.  SYSCALL(newlstatlite)
  32.  SYSCALL(newfstatlite)
  33. +SYSCALL(sys_getdents_plus)
  34. +SYSCALL(sys_getdents64_plus)
  35. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/x86_64/ia32/ia32entry.S vanilla-new/arch/x86_64/ia32/ia32entry.S
  36. --- vanilla/arch/x86_64/ia32/ia32entry.S    2006-05-09 18:53:48.000000000 -0500
  37. +++ vanilla-new/arch/x86_64/ia32/ia32entry.S    2006-05-11 14:09:30.000000000 -0500
  38. @@ -696,6 +696,8 @@
  39.      .quad sys32_statlite64
  40.      .quad sys32_lstatlite64
  41.      .quad sys32_fstatlite64
  42. +    .quad sys_ni_syscall   /* getdents_plus */
  43. +    .quad sys_ni_syscall   /* getdents64_plus */
  44.  ia32_syscall_end:        
  45.      .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
  46.          .quad ni_syscall
  47. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/readdir.c vanilla-new/fs/readdir.c
  48. --- vanilla/fs/readdir.c    2006-03-19 23:53:29.000000000 -0600
  49. +++ vanilla-new/fs/readdir.c    2006-05-18 19:25:06.000000000 -0500
  50. @@ -43,6 +43,32 @@
  51.  
  52.  EXPORT_SYMBOL(vfs_readdir);
  53.  
  54. +int vfs_readdirplus(struct file *file, filldirplus_t fillerplus, void *buf)
  55. +{
  56. +    struct inode *inode = file->f_dentry->d_inode;
  57. +    int res = -ENOTDIR;
  58. +    if (!file->f_op || !file->f_op->readdirplus)
  59. +        goto out;
  60. +
  61. +    res = security_file_permission(file, MAY_READ);
  62. +    if (res)
  63. +        goto out;
  64. +
  65. +    mutex_lock(&inode->i_mutex);
  66. +    res = -ENOENT;
  67. +    if (!IS_DEADDIR(inode)) {
  68. +        res = file->f_op->readdirplus(file, buf, fillerplus);
  69. +        file_accessed(file);
  70. +    }
  71. +    mutex_unlock(&inode->i_mutex);
  72. +out:
  73. +    if (file->f_op && file->f_op->readdir && !file->f_op->readdirplus)
  74. +        res = -EOPNOTSUPP;
  75. +    return res;
  76. +}
  77. +
  78. +EXPORT_SYMBOL_GPL(vfs_readdirplus);
  79. +
  80.  /*
  81.   * Traditional linux readdir() handling..
  82.   *
  83. @@ -212,6 +238,111 @@
  84.      return error;
  85.  }
  86.  
  87. +/* getdents_plus implementation */
  88. +#define DIRENT_OFFSET(de) ((unsigned long) &((de)->dp_dirent) - (unsigned long) (char __user *) (de))
  89. +
  90. +struct linux_dirent_plus {
  91. +    struct stat          dp_stat;
  92. +    int                  dp_stat_err;
  93. +    struct linux_dirent  dp_dirent;
  94. +};
  95. +
  96. +struct getdentsplus_callback {
  97. +    struct linux_dirent_plus __user * current_dir;
  98. +    struct linux_dirent_plus __user * previous;
  99. +    int count;
  100. +    int error;
  101. +};
  102. +
  103. +static int filldirplus(void * __buf, const char * name, int namlen, loff_t offset,
  104. +           ino_t ino, unsigned int d_type, struct kstat *statp)
  105. +{
  106. +    struct linux_dirent __user *de;
  107. +    struct linux_dirent_plus __user * dirent;
  108. +    struct getdentsplus_callback * buf = (struct getdentsplus_callback *) __buf;
  109. +    int err, reclen = ROUND_UP(NAME_OFFSET(de) + namlen + DIRENT_OFFSET(dirent) + 2);
  110. +
  111. +    buf->error = -EINVAL;    /* only used if we fail.. */
  112. +    if (reclen > buf->count)
  113. +        return -EINVAL;
  114. +    dirent = buf->previous;
  115. +    if (dirent) {
  116. +        if (__put_user(offset, &dirent->dp_dirent.d_off))
  117. +            goto efault;
  118. +    }
  119. +    dirent = buf->current_dir;
  120. +    err = 0;
  121. +    if (IS_ERR(statp)) {
  122. +        err = PTR_ERR(statp);
  123. +        if (__put_user(err, &dirent->dp_stat_err))
  124. +            goto efault;
  125. +    }
  126. +    else {
  127. +        if (__put_user(err, &dirent->dp_stat_err))
  128. +            goto efault;
  129. +        if (cp_new_stat(statp, &dirent->dp_stat))
  130. +            goto efault;
  131. +    }
  132. +    if (__put_user(ino, &dirent->dp_dirent.d_ino))
  133. +        goto efault;
  134. +    if (__put_user(reclen, &dirent->dp_dirent.d_reclen))
  135. +        goto efault;
  136. +    if (copy_to_user(dirent->dp_dirent.d_name, name, namlen))
  137. +        goto efault;
  138. +    if (__put_user(0, dirent->dp_dirent.d_name + namlen))
  139. +        goto efault;
  140. +    if (__put_user(d_type, (char __user *) dirent + reclen - 1))
  141. +        goto efault;
  142. +    buf->previous = dirent;
  143. +    dirent = (void __user *)dirent + reclen;
  144. +    buf->current_dir = dirent;
  145. +    buf->count -= reclen;
  146. +    return 0;
  147. +efault:
  148. +    buf->error = -EFAULT;
  149. +    return -EFAULT;
  150. +}
  151. +
  152. +asmlinkage long sys_getdents_plus(unsigned int fd, struct linux_dirent_plus __user * dirent, unsigned int count)
  153. +{
  154. +    struct file * file;
  155. +    struct linux_dirent_plus __user * lastdirent;
  156. +    struct getdentsplus_callback buf;
  157. +    int error;
  158. +
  159. +    error = -EFAULT;
  160. +    if (!access_ok(VERIFY_WRITE, dirent, count))
  161. +        goto out;
  162. +
  163. +    error = -EBADF;
  164. +    file = fget(fd);
  165. +    if (!file)
  166. +        goto out;
  167. +
  168. +    buf.current_dir = dirent;
  169. +    buf.previous = NULL;
  170. +    buf.count = count;
  171. +    buf.error = 0;
  172. +
  173. +    error = vfs_readdirplus(file, filldirplus, &buf);
  174. +    if (error < 0)
  175. +        goto out_putf;
  176. +    error = buf.error;
  177. +    lastdirent = buf.previous;
  178. +    if (lastdirent) {
  179. +        typeof(lastdirent->dp_dirent.d_off) d_off = file->f_pos;
  180. +        error = -EFAULT;
  181. +        if (__put_user(d_off, &lastdirent->dp_dirent.d_off))
  182. +            goto out_putf;
  183. +        error = count - buf.count;
  184. +    }
  185. +
  186. +out_putf:
  187. +    fput(file);
  188. +out:
  189. +    return error;
  190. +}
  191. +
  192.  #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
  193.  
  194.  struct getdents_callback64 {
  195. @@ -298,3 +429,105 @@
  196.  out:
  197.      return error;
  198.  }
  199. +
  200. +struct getdentsplus_callback64 {
  201. +    struct linux_dirent64_plus __user * current_dir;
  202. +    struct linux_dirent64_plus __user * previous;
  203. +    int count;
  204. +    int error;
  205. +};
  206. +
  207. +static int filldir64_plus(void * __buf, const char * name, int namlen, loff_t offset,
  208. +             ino_t ino, unsigned int d_type, struct kstat *statp)
  209. +{
  210. +    struct linux_dirent64 __user *de;
  211. +    struct linux_dirent64_plus __user *dirent;
  212. +    struct getdentsplus_callback64 * buf = (struct getdentsplus_callback64 *) __buf;
  213. +    int err, reclen = ROUND_UP64(NAME_OFFSET(de) + namlen + 1 + DIRENT_OFFSET(dirent));
  214. +
  215. +    buf->error = -EINVAL;    /* only used if we fail.. */
  216. +    if (reclen > buf->count)
  217. +        return -EINVAL;
  218. +    dirent = buf->previous;
  219. +    if (dirent) {
  220. +        if (__put_user(offset, &dirent->dp_dirent.d_off))
  221. +            goto efault;
  222. +    }
  223. +    dirent = buf->current_dir;
  224. +    err = 0;
  225. +    if (IS_ERR(statp)) {
  226. +        err = PTR_ERR(statp);
  227. +        if (__put_user(err, &dirent->dp_stat_err))
  228. +            goto efault;
  229. +    }
  230. +    else {
  231. +        if (__put_user(err, &dirent->dp_stat_err))
  232. +            goto efault;
  233. +#ifdef __ARCH_WANT_STAT64
  234. +        if (cp_new_stat64(statp, &dirent->dp_stat))
  235. +#else
  236. +        if (cp_new_stat(statp, &dirent->dp_stat))
  237. +#endif
  238. +            goto efault;
  239. +    }
  240. +    if (__put_user(ino, &dirent->dp_dirent.d_ino))
  241. +        goto efault;
  242. +    if (__put_user(0, &dirent->dp_dirent.d_off))
  243. +        goto efault;
  244. +    if (__put_user(reclen, &dirent->dp_dirent.d_reclen))
  245. +        goto efault;
  246. +    if (__put_user(d_type, &dirent->dp_dirent.d_type))
  247. +        goto efault;
  248. +    if (copy_to_user(dirent->dp_dirent.d_name, name, namlen))
  249. +        goto efault;
  250. +    if (__put_user(0, dirent->dp_dirent.d_name + namlen))
  251. +        goto efault;
  252. +    buf->previous = dirent;
  253. +    dirent = (void __user *)dirent + reclen;
  254. +    buf->current_dir = dirent;
  255. +    buf->count -= reclen;
  256. +    return 0;
  257. +efault:
  258. +    buf->error = -EFAULT;
  259. +    return -EFAULT;
  260. +}
  261. +
  262. +asmlinkage long sys_getdents64_plus(unsigned int fd, struct linux_dirent64_plus __user * dirent, unsigned int count)
  263. +{
  264. +    struct file * file;
  265. +    struct linux_dirent64_plus __user * lastdirent;
  266. +    struct getdentsplus_callback64 buf;
  267. +    int error;
  268. +
  269. +    error = -EFAULT;
  270. +    if (!access_ok(VERIFY_WRITE, dirent, count))
  271. +        goto out;
  272. +
  273. +    error = -EBADF;
  274. +    file = fget(fd);
  275. +    if (!file)
  276. +        goto out;
  277. +
  278. +    buf.current_dir = dirent;
  279. +    buf.previous = NULL;
  280. +    buf.count = count;
  281. +    buf.error = 0;
  282. +
  283. +    error = vfs_readdirplus(file, filldir64_plus, &buf);
  284. +    if (error < 0)
  285. +        goto out_putf;
  286. +    error = buf.error;
  287. +    lastdirent = buf.previous;
  288. +    if (lastdirent) {
  289. +        typeof(lastdirent->dp_dirent.d_off) d_off = file->f_pos;
  290. +        error = -EFAULT;
  291. +        if (__put_user(d_off, &lastdirent->dp_dirent.d_off))
  292. +            goto out_putf;
  293. +        error = count - buf.count;
  294. +    }
  295. +
  296. +out_putf:
  297. +    fput(file);
  298. +out:
  299. +    return error;
  300. +}
  301. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/stat.c vanilla-new/fs/stat.c
  302. --- vanilla/fs/stat.c    2006-05-09 18:53:48.000000000 -0500
  303. +++ vanilla-new/fs/stat.c    2006-05-11 13:35:08.000000000 -0500
  304. @@ -297,7 +297,7 @@
  305.  
  306.  #endif /* __ARCH_WANT_OLD_STAT */
  307.  
  308. -static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
  309. +int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
  310.  {
  311.      struct stat tmp;
  312.  
  313. @@ -345,7 +345,7 @@
  314.      return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
  315.  }
  316.  
  317. -static int cp_new_statlite(struct kstat_lite *stat_lite, struct stat_lite __user *statlitebuf)
  318. +int cp_new_statlite(struct kstat_lite *stat_lite, struct stat_lite __user *statlitebuf)
  319.  {
  320.      struct stat_lite tmp;
  321.  
  322. @@ -545,7 +545,7 @@
  323.  /* ---------- LFS-64 ----------- */
  324.  #ifdef __ARCH_WANT_STAT64
  325.  
  326. -static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
  327. +long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
  328.  {
  329.      struct stat64 tmp;
  330.  
  331. @@ -580,7 +580,7 @@
  332.      return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
  333.  }
  334.  
  335. -static long cp_new_stat64_lite(struct kstat_lite *stat_lite, struct stat64_lite __user *statlitebuf)
  336. +long cp_new_stat64_lite(struct kstat_lite *stat_lite, struct stat64_lite __user *statlitebuf)
  337.  {
  338.      struct stat64_lite tmp;
  339.  
  340. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-i386/dirent.h vanilla-new/include/asm-i386/dirent.h
  341. --- vanilla/include/asm-i386/dirent.h    1969-12-31 18:00:00.000000000 -0600
  342. +++ vanilla-new/include/asm-i386/dirent.h    2006-05-18 19:25:26.000000000 -0500
  343. @@ -0,0 +1,28 @@
  344. +#ifndef _I386_DIRENT_H
  345. +#define _I386_DIRENT_H
  346. +
  347. +#include <asm/stat.h>
  348. +
  349. +struct dirent_plus {
  350. +    struct stat   dp_stat;
  351. +    int           dp_stat_err;
  352. +    struct dirent dp_dirent;
  353. +};
  354. +
  355. +struct dirent64_plus {
  356. +    struct stat64   dp_stat;
  357. +    int             dp_stat_err;
  358. +    struct dirent64 dp_dirent;
  359. +};
  360. +
  361. +#ifdef __KERNEL__
  362. +
  363. +struct linux_dirent64_plus {
  364. +    struct stat64         dp_stat;
  365. +    int                   dp_stat_err;
  366. +    struct linux_dirent64 dp_dirent;
  367. +};
  368. +
  369. +#endif
  370. +
  371. +#endif
  372. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-i386/unistd.h vanilla-new/include/asm-i386/unistd.h
  373. --- vanilla/include/asm-i386/unistd.h    2006-05-09 18:53:48.000000000 -0500
  374. +++ vanilla-new/include/asm-i386/unistd.h    2006-05-11 14:00:29.000000000 -0500
  375. @@ -324,8 +324,10 @@
  376.  #define __NR_statlite64  316
  377.  #define __NR_lstatlite64 317
  378.  #define __NR_fstatlite64 318
  379. +#define __NR_getdents_plus 319
  380. +#define __NR_getdents64_plus 320
  381.  
  382. -#define NR_syscalls 319
  383. +#define NR_syscalls 321
  384.  
  385.  /*
  386.   * user-visible error numbers are in the range -1 - -128: see
  387. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-ia64/unistd.h vanilla-new/include/asm-ia64/unistd.h
  388. --- vanilla/include/asm-ia64/unistd.h    2006-05-09 18:53:48.000000000 -0500
  389. +++ vanilla-new/include/asm-ia64/unistd.h    2006-05-11 14:05:50.000000000 -0500
  390. @@ -290,12 +290,14 @@
  391.  #define __NR_statlite      1299
  392.  #define __NR_lstatlite     1300
  393.  #define __NR_fstatlite     1301
  394. +#define __NR_getdents_plus 1302
  395. +#define __NR_getdents64_plus 1303
  396.  
  397.  #ifdef __KERNEL__
  398.  
  399.  #include <linux/config.h>
  400.  
  401. -#define NR_syscalls            278 /* length of syscall table */
  402. +#define NR_syscalls            280 /* length of syscall table */
  403.  
  404.  #define __ARCH_WANT_SYS_RT_SIGACTION
  405.  
  406. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-powerpc/unistd.h vanilla-new/include/asm-powerpc/unistd.h
  407. --- vanilla/include/asm-powerpc/unistd.h    2006-05-05 13:59:14.000000000 -0500
  408. +++ vanilla-new/include/asm-powerpc/unistd.h    2006-05-11 14:14:28.000000000 -0500
  409. @@ -303,8 +303,13 @@
  410.  #define __NR_unshare        282
  411.  #define __NR_openg        283
  412.  #define __NR_openfh        284
  413. +#define __NR_statlite      285
  414. +#define __NR_lstatlite     286
  415. +#define __NR_fstatlite     287
  416. +#define __NR_getdents_plus 288
  417. +#define __NR_getdents64_plus 289
  418.  
  419. -#define __NR_syscalls        285
  420. +#define __NR_syscalls        290
  421.  
  422.  #ifdef __KERNEL__
  423.  #define __NR__exit __NR_exit
  424. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-x86_64/dirent.h vanilla-new/include/asm-x86_64/dirent.h
  425. --- vanilla/include/asm-x86_64/dirent.h    1969-12-31 18:00:00.000000000 -0600
  426. +++ vanilla-new/include/asm-x86_64/dirent.h    2006-05-18 19:25:47.000000000 -0500
  427. @@ -0,0 +1,28 @@
  428. +#ifndef _ASM_X86_64_DIRENT_H
  429. +#define _ASM_X86_64_DIRENT_H
  430. +
  431. +#include <asm/stat.h>
  432. +
  433. +struct dirent_plus {
  434. +    struct stat   dp_stat;
  435. +    int           dp_stat_err;
  436. +    struct dirent dp_dirent;
  437. +};
  438. +
  439. +struct dirent64_plus {
  440. +    struct stat     dp_stat;
  441. +    int             dp_stat_err;
  442. +    struct dirent64 dp_dirent;
  443. +};
  444. +
  445. +#ifdef __KERNEL__
  446. +
  447. +struct linux_dirent64_plus {
  448. +    struct stat           dp_stat;
  449. +    int                   dp_stat_err;
  450. +    struct linux_dirent64 dp_dirent;
  451. +};
  452. +
  453. +#endif
  454. +
  455. +#endif
  456. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-x86_64/unistd.h vanilla-new/include/asm-x86_64/unistd.h
  457. --- vanilla/include/asm-x86_64/unistd.h    2006-05-09 18:53:48.000000000 -0500
  458. +++ vanilla-new/include/asm-x86_64/unistd.h    2006-05-11 14:04:27.000000000 -0500
  459. @@ -615,8 +615,12 @@
  460.  __SYSCALL(__NR_newlstatlite, sys_newlstatlite)
  461.  #define __NR_newfstatlite  277
  462.  __SYSCALL(__NR_newfstatlite, sys_newfstatlite)
  463. +#define __NR_getdents_plus 278
  464. +__SYSCALL(__NR_getdents_plus, sys_getdents_plus)
  465. +#define __NR_getdents64_plus 279
  466. +__SYSCALL(__NR_getdents64_plus, sys_getdents64_plus)
  467.  
  468. -#define __NR_syscall_max __NR_newfstatlite
  469. +#define __NR_syscall_max __NR_getdents64_plus
  470.  
  471.  #ifndef __NO_STUBS
  472.  
  473. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/dirent.h vanilla-new/include/linux/dirent.h
  474. --- vanilla/include/linux/dirent.h    2006-03-19 23:53:29.000000000 -0600
  475. +++ vanilla-new/include/linux/dirent.h    2006-05-18 19:29:03.000000000 -0500
  476. @@ -28,5 +28,6 @@
  477.  
  478.  #endif    /* __KERNEL__ */
  479.  
  480. +#include <asm/dirent.h>
  481.  
  482.  #endif
  483. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/fs.h vanilla-new/include/linux/fs.h
  484. --- vanilla/include/linux/fs.h    2006-05-09 18:53:48.000000000 -0500
  485. +++ vanilla-new/include/linux/fs.h    2006-05-18 19:28:16.000000000 -0500
  486. @@ -9,6 +9,7 @@
  487.  #include <linux/config.h>
  488.  #include <linux/limits.h>
  489.  #include <linux/ioctl.h>
  490. +#include <linux/unistd.h>
  491.  
  492.  /*
  493.   * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  494. @@ -951,6 +952,13 @@
  495.   */
  496.  typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned);
  497.  
  498. +/*
  499. + * This is the "filldirplus" function type, used by readdirplus() to let
  500. + * the kernel specify the kind of dirent layout and the stat information
  501. + * all in one shot
  502. + */
  503. +typedef int (*filldirplus_t)(void *, const char *, int, loff_t, ino_t, unsigned, struct kstat *);
  504. +
  505.  struct block_device_operations {
  506.      int (*open) (struct inode *, struct file *);
  507.      int (*release) (struct inode *, struct file *);
  508. @@ -1025,6 +1033,7 @@
  509.      ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
  510.      ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, loff_t);
  511.      int (*readdir) (struct file *, void *, filldir_t);
  512. +    int (*readdirplus) (struct file *, void *, filldirplus_t);
  513.      unsigned int (*poll) (struct file *, struct poll_table_struct *);
  514.      int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
  515.      long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
  516. @@ -1712,7 +1721,13 @@
  517.  void inode_set_bytes(struct inode *inode, loff_t bytes);
  518.  
  519.  extern int vfs_readdir(struct file *, filldir_t, void *);
  520. -
  521. +extern int vfs_readdirplus(struct file *, filldirplus_t, void *);
  522. +extern int cp_new_stat(struct kstat *stat, struct stat __user *statbuf);
  523. +extern int cp_new_statlite(struct kstat_lite *stat_lite, struct stat_lite __user *statlitebuf);
  524. +#ifdef __ARCH_WANT_STAT64
  525. +extern long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf);
  526. +extern long cp_new_stat64_lite(struct kstat_lite *stat_lite, struct stat64_lite __user *statlitebuf);
  527. +#endif
  528.  extern int vfs_stat(char __user *, struct kstat *);
  529.  extern int vfs_statlite(char __user *, struct kstat_lite *);
  530.  extern int vfs_lstat(char __user *, struct kstat *);
  531. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/syscalls.h vanilla-new/include/linux/syscalls.h
  532. --- vanilla/include/linux/syscalls.h    2006-05-09 18:53:48.000000000 -0500
  533. +++ vanilla-new/include/linux/syscalls.h    2006-05-11 14:01:51.000000000 -0500
  534. @@ -22,6 +22,8 @@
  535.  struct kexec_segment;
  536.  struct linux_dirent;
  537.  struct linux_dirent64;
  538. +struct linux_dirent_plus;
  539. +struct linux_dirent64_plus;
  540.  struct list_head;
  541.  struct msgbuf;
  542.  struct msghdr;
  543. @@ -418,6 +420,12 @@
  544.  asmlinkage long sys_getdents64(unsigned int fd,
  545.                  struct linux_dirent64 __user *dirent,
  546.                  unsigned int count);
  547. +asmlinkage long sys_getdents_plus(unsigned int fd,
  548. +                struct linux_dirent_plus __user *dirent,
  549. +                unsigned int count);
  550. +asmlinkage long sys_getdents64_plus(unsigned int fd,
  551. +                struct linux_dirent64_plus __user *dirent,
  552. +                unsigned int count);
  553.  
  554.  asmlinkage long sys_setsockopt(int fd, int level, int optname,
  555.                  char __user *optval, int optlen);
  556.