aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_file.c')
-rw-r--r--sys/compat/linux/linux_file.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 4bacee37df38..f4926873136e 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -307,18 +307,6 @@ struct l_dirent64 {
roundup(offsetof(struct l_dirent64, d_name) + (namlen) + 1, \
sizeof(uint64_t))
-#define LINUX_DIRBLKSIZ 512
-
-/*
- * Linux l_dirent is bigger than FreeBSD dirent, thus the buffer size
- * passed to kern_getdirentries() must be smaller than the one passed
- * to linux_getdents() by certain factor.
- */
-#define LINUX_RECLEN_RATIO(X) X * offsetof(struct dirent, d_name) / \
- offsetof(struct l_dirent, d_name);
-#define LINUX_RECLEN64_RATIO(X) X * offsetof(struct dirent, d_name) / \
- offsetof(struct l_dirent64, d_name);
-
int
linux_getdents(struct thread *td, struct linux_getdents_args *args)
{
@@ -337,8 +325,7 @@ linux_getdents(struct thread *td, struct linux_getdents_args *args)
if (ldebug(getdents))
printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count);
#endif
- buflen = LINUX_RECLEN_RATIO(args->count);
- buflen = min(buflen, MAXBSIZE);
+ buflen = min(args->count, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
error = kern_getdirentries(td, args->fd, buf, buflen,
@@ -418,8 +405,7 @@ linux_getdents64(struct thread *td, struct linux_getdents64_args *args)
if (ldebug(getdents64))
uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count);
#endif
- buflen = LINUX_RECLEN64_RATIO(args->count);
- buflen = min(buflen, MAXBSIZE);
+ buflen = min(args->count, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
error = kern_getdirentries(td, args->fd, buf, buflen,
@@ -495,7 +481,6 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args)
printf(ARGS(readdir, "%d, *"), args->fd);
#endif
buflen = LINUX_RECLEN(LINUX_NAME_MAX);
- buflen = LINUX_RECLEN_RATIO(buflen);
buf = malloc(buflen, M_TEMP, M_WAITOK);
error = kern_getdirentries(td, args->fd, buf, buflen,