7 #include <linux/stddef.h>
8 #include <linux/kernel.h>
9 #include <linux/export.h>
10 #include <linux/time.h>
12 #include <linux/errno.h>
13 #include <linux/stat.h>
21 #include <asm/uaccess.h>
27 if (!file->
f_op || !file->
f_op->readdir)
40 res = file->
f_op->readdir(file, buf, filler);
59 #ifdef __ARCH_WANT_OLD_READDIR
61 struct old_linux_dirent {
63 unsigned long d_offset;
64 unsigned short d_namlen;
68 struct readdir_callback {
73 static int fillonedir(
void * __buf,
const char *
name,
int namlen, loff_t
offset,
74 u64 ino,
unsigned int d_type)
76 struct readdir_callback *
buf = (
struct readdir_callback *) __buf;
83 if (
sizeof(d_ino) <
sizeof(
ino) && d_ino != ino) {
90 (
unsigned long)(dirent->d_name + namlen + 1) -
106 struct old_linux_dirent __user *, dirent,
unsigned int,
count)
109 struct fd f = fdget(
fd);
110 struct readdir_callback buf;
146 static int filldir(
void * __buf,
const char * name,
int namlen, loff_t offset,
147 u64 ino,
unsigned int d_type)
156 if (reclen > buf->
count)
159 if (
sizeof(d_ino) <
sizeof(ino) && d_ino != ino) {
177 if (
__put_user(d_type, (
char __user *) dirent + reclen - 1))
180 dirent = (
void __user *)dirent + reclen;
182 buf->
count -= reclen;
230 static int filldir64(
void * __buf,
const char * name,
int namlen, loff_t offset,
231 u64 ino,
unsigned int d_type)
239 if (reclen > buf->
count)
260 dirent = (
void __user *)dirent + reclen;
262 buf->
count -= reclen;