Only include sysctl in kernel build

Only include sysctl in kernel builds fixing warning about implicit
declaration of function 'sysctl_handle_int'.

PR:		204140
MFC after:	1 week
X-MFC-With:	r297813
Sponsored by:	Multiplay
This commit is contained in:
smh 2016-04-11 13:17:11 +00:00
parent a0ca006b37
commit 175f9d7444

View File

@ -55,6 +55,11 @@
#include "zfs_prop.h"
#include <sys/zfeature.h>
#if defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
/*
* SPA locking
*
@ -255,35 +260,6 @@ int zfs_flags = 0;
* in leaked space, or worse.
*/
boolean_t zfs_recover = B_FALSE;
SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RWTUN, &zfs_recover, 0,
"Try to recover from otherwise-fatal errors.");
static int
sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
{
int err, val;
val = zfs_flags;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
/*
* ZFS_DEBUG_MODIFY must be enabled prior to boot so all
* arc buffers in the system have the necessary additional
* checksum data. However, it is safe to disable at any
* time.
*/
if (!(zfs_flags & ZFS_DEBUG_MODIFY))
val &= ~ZFS_DEBUG_MODIFY;
zfs_flags = val;
return (0);
}
SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
/*
* If destroy encounters an EIO while reading metadata (e.g. indirect
@ -325,26 +301,18 @@ boolean_t zfs_free_leak_on_eio = B_FALSE;
* in a system panic.
*/
uint64_t zfs_deadman_synctime_ms = 1000000ULL;
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN,
&zfs_deadman_synctime_ms, 0,
"Stalled ZFS I/O expiration time in milliseconds");
/*
* Check time in milliseconds. This defines the frequency at which we check
* for hung I/O.
*/
uint64_t zfs_deadman_checktime_ms = 5000ULL;
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN,
&zfs_deadman_checktime_ms, 0,
"Period of checks for stalled ZFS I/O in milliseconds");
/*
* Default value of -1 for zfs_deadman_enabled is resolved in
* zfs_deadman_init()
*/
int zfs_deadman_enabled = -1;
SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN,
&zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O");
/*
* The worst case is single-sector max-parity RAID-Z blocks, in which
@ -356,8 +324,50 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN,
* (VDEV_RAIDZ_MAXPARITY + 1) * SPA_DVAS_PER_BP * 2 == 24
*/
int spa_asize_inflation = 24;
#if defined(__FreeBSD__) && defined(_KERNEL)
SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RWTUN, &zfs_recover, 0,
"Try to recover from otherwise-fatal errors.");
static int
sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
{
int err, val;
val = zfs_flags;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
/*
* ZFS_DEBUG_MODIFY must be enabled prior to boot so all
* arc buffers in the system have the necessary additional
* checksum data. However, it is safe to disable at any
* time.
*/
if (!(zfs_flags & ZFS_DEBUG_MODIFY))
val &= ~ZFS_DEBUG_MODIFY;
zfs_flags = val;
return (0);
}
SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN,
&zfs_deadman_synctime_ms, 0,
"Stalled ZFS I/O expiration time in milliseconds");
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN,
&zfs_deadman_checktime_ms, 0,
"Period of checks for stalled ZFS I/O in milliseconds");
SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN,
&zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O");
SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_asize_inflation, CTLFLAG_RWTUN,
&spa_asize_inflation, 0, "Worst case inflation factor for single sector writes");
#endif
#ifndef illumos
#ifdef _KERNEL