diff options
author | jhb <jhb@FreeBSD.org> | 2009-03-10 15:26:50 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-03-10 15:26:50 +0000 |
commit | 0372a61a28f9aeaf525a6e380278a8e1af62e03e (patch) | |
tree | 12bb6c95214b8854b89ce14bca8a9fbd99056a06 /sys | |
parent | 1d8bab3200518a31c4605c4abf86e530e7870235 (diff) | |
download | FreeBSD-src-0372a61a28f9aeaf525a6e380278a8e1af62e03e.zip FreeBSD-src-0372a61a28f9aeaf525a6e380278a8e1af62e03e.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_bio.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b2fbe93..9942934 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_extern.h> #include <vm/vm_map.h> +#include "opt_compat.h" #include "opt_directio.h" #include "opt_swap.h" @@ -108,6 +109,10 @@ static int vfs_bio_clcheck(struct vnode *vp, int size, 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 */ |