From owner-svn-src-head@freebsd.org Mon Jun 12 07:36:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 319F3BF5E36; Mon, 12 Jun 2017 07:36:01 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F327CBE3; Mon, 12 Jun 2017 07:36:00 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5C7a0UN045538; Mon, 12 Jun 2017 07:36:00 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5C7a0tU045537; Mon, 12 Jun 2017 07:36:00 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201706120736.v5C7a0tU045537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 12 Jun 2017 07:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319849 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jun 2017 07:36:01 -0000 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,