Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jun 2017 07:36:00 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319849 - head/sys/compat/linux
Message-ID:  <201706120736.v5C7a0tU045537@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Mon Jun 12 07:35:59 2017
New Revision: 319849
URL: https://svnweb.freebsd.org/changeset/base/319849

Log:
  Since r318735 (ino64 project) the size of the native struct dirent is
  equal or greater than the size of Linux struct dirent or struct dirent64.
  So, remove LINUX_RECLEN_RATIO magic as useless.

Modified:
  head/sys/compat/linux/linux_file.c

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Mon Jun 12 06:08:57 2017	(r319848)
+++ head/sys/compat/linux/linux_file.c	Mon Jun 12 07:35:59 2017	(r319849)
@@ -309,16 +309,6 @@ struct l_dirent64 {
 
 #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 +327,7 @@ linux_getdents(struct thread *td, struct linux_getdent
 	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 +407,7 @@ linux_getdents64(struct thread *td, struct linux_getde
 	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 +483,6 @@ linux_readdir(struct thread *td, struct linux_readdir_
 		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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706120736.v5C7a0tU045537>