From owner-svn-src-head@freebsd.org Wed Jul 15 09:14:08 2015 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 0052599CA84; Wed, 15 Jul 2015 09:14:08 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 CABC312E7; Wed, 15 Jul 2015 09:14:07 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svnmir.geo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6F9E7UR070052; Wed, 15 Jul 2015 09:14:07 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by svnmir.geo.freebsd.org (8.14.9/8.14.9/Submit) id t6F9E7dg070051; Wed, 15 Jul 2015 09:14:07 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507150914.t6F9E7dg070051@svnmir.geo.freebsd.org> X-Authentication-Warning: svnmir.geo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 15 Jul 2015 09:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285596 - head/sys/compat/cloudabi 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.20 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: Wed, 15 Jul 2015 09:14:08 -0000 Author: ed Date: Wed Jul 15 09:14:06 2015 New Revision: 285596 URL: https://svnweb.freebsd.org/changeset/base/285596 Log: Make posix_fallocate() and posix_fadvise() work. We can map these system calls directly to the FreeBSD counterparts. The other filesystem related system calls will be sent out for review separately, as they are a bit more complex to get right. Modified: head/sys/compat/cloudabi/cloudabi_file.c Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Wed Jul 15 06:14:04 2015 (r285595) +++ head/sys/compat/cloudabi/cloudabi_file.c Wed Jul 15 09:14:06 2015 (r285596) @@ -26,15 +26,43 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include + #include +#include int cloudabi_sys_file_advise(struct thread *td, struct cloudabi_sys_file_advise_args *uap) { + int advice; - /* Not implemented. */ - return (ENOSYS); + switch (uap->advice) { + case CLOUDABI_ADVICE_DONTNEED: + advice = POSIX_FADV_DONTNEED; + break; + case CLOUDABI_ADVICE_NOREUSE: + advice = POSIX_FADV_NOREUSE; + break; + case CLOUDABI_ADVICE_NORMAL: + advice = POSIX_FADV_NORMAL; + break; + case CLOUDABI_ADVICE_RANDOM: + advice = POSIX_FADV_RANDOM; + break; + case CLOUDABI_ADVICE_SEQUENTIAL: + advice = POSIX_FADV_SEQUENTIAL; + break; + case CLOUDABI_ADVICE_WILLNEED: + advice = POSIX_FADV_WILLNEED; + break; + default: + return (EINVAL); + } + + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, advice)); } int @@ -42,8 +70,7 @@ cloudabi_sys_file_allocate(struct thread struct cloudabi_sys_file_allocate_args *uap) { - /* Not implemented. */ - return (ENOSYS); + return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len)); } int