From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:26:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 518411065690; Tue, 10 Mar 2009 15:26:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 262138FC17; Tue, 10 Mar 2009 15:26:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFQpjV066014; Tue, 10 Mar 2009 15:26:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFQpS8066013; Tue, 10 Mar 2009 15:26:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101526.n2AFQpS8066013@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 15:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189627 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 10 Mar 2009 15:26:53 -0000 Author: jhb Date: Tue Mar 10 15:26:50 2009 New Revision: 189627 URL: http://svn.freebsd.org/changeset/base/189627 Log: Add an ABI compat shim for the vfs.bufspace sysctl for sysctl requests that try to fetch it as an int rather than a long. If the current value is greater than INT_MAX it reports a value of INT_MAX. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 10 15:25:19 2009 (r189626) +++ head/sys/kern/vfs_bio.c Tue Mar 10 15:26:50 2009 (r189627) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "opt_compat.h" #include "opt_directio.h" #include "opt_swap.h" @@ -108,6 +109,10 @@ static int vfs_bio_clcheck(struct vnode static int flushbufqueues(int, int); static void buf_daemon(void); static void bremfreel(struct buf *bp); +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); +#endif int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, @@ -116,8 +121,14 @@ long runningbufspace; SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, "Amount of presently outstanding async buffer io"); static long bufspace; +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, + &bufspace, 0, sysctl_bufspace, "L", "KVA memory used for bufs"); +#else SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, "KVA memory used for bufs"); +#endif static long maxbufspace; SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including buf_daemon)"); @@ -265,6 +276,22 @@ const char *buf_wmesg = BUF_WMESG; #define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ #define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +static int +sysctl_bufspace(SYSCTL_HANDLER_ARGS) +{ + long lvalue; + int ivalue; + + if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) + return (sysctl_handle_long(oidp, arg1, arg2, req)); + lvalue = *(long *)arg1; + ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; + return (sysctl_handle_int(oidp, &ivalue, 0, req)); +} +#endif + #ifdef DIRECTIO extern void ffs_rawread_setup(void); #endif /* DIRECTIO */