spa: Let spa_taskq_param_get()'s addition of a newline be optional
For FreeBSD sysctls, we don't want the extra newline, since the sysctl(8) utility will format strings appropriately. Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reported-by: Peter Holm <pho@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Closes #15719
This commit is contained in:
parent
3bddc4daec
commit
5a703d1368
|
@ -1392,7 +1392,7 @@ spa_taskq_param_set(zio_type_t t, char *cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spa_taskq_param_get(zio_type_t t, char *buf)
|
spa_taskq_param_get(zio_type_t t, char *buf, boolean_t add_newline)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
@ -1410,6 +1410,7 @@ spa_taskq_param_get(zio_type_t t, char *buf)
|
||||||
sep = " ";
|
sep = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (add_newline)
|
||||||
buf[pos++] = '\n';
|
buf[pos++] = '\n';
|
||||||
buf[pos] = '\0';
|
buf[pos] = '\0';
|
||||||
|
|
||||||
|
@ -1428,7 +1429,7 @@ spa_taskq_read_param_set(const char *val, zfs_kernel_param_t *kp)
|
||||||
static int
|
static int
|
||||||
spa_taskq_read_param_get(char *buf, zfs_kernel_param_t *kp)
|
spa_taskq_read_param_get(char *buf, zfs_kernel_param_t *kp)
|
||||||
{
|
{
|
||||||
return (spa_taskq_param_get(ZIO_TYPE_READ, buf));
|
return (spa_taskq_param_get(ZIO_TYPE_READ, buf, TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1442,7 +1443,7 @@ spa_taskq_write_param_set(const char *val, zfs_kernel_param_t *kp)
|
||||||
static int
|
static int
|
||||||
spa_taskq_write_param_get(char *buf, zfs_kernel_param_t *kp)
|
spa_taskq_write_param_get(char *buf, zfs_kernel_param_t *kp)
|
||||||
{
|
{
|
||||||
return (spa_taskq_param_get(ZIO_TYPE_WRITE, buf));
|
return (spa_taskq_param_get(ZIO_TYPE_WRITE, buf, TRUE));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
|
@ -1457,7 +1458,7 @@ spa_taskq_read_param(ZFS_MODULE_PARAM_ARGS)
|
||||||
char buf[SPA_TASKQ_PARAM_MAX];
|
char buf[SPA_TASKQ_PARAM_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
(void) spa_taskq_param_get(ZIO_TYPE_READ, buf);
|
(void) spa_taskq_param_get(ZIO_TYPE_READ, buf, FALSE);
|
||||||
err = sysctl_handle_string(oidp, buf, sizeof (buf), req);
|
err = sysctl_handle_string(oidp, buf, sizeof (buf), req);
|
||||||
if (err || req->newptr == NULL)
|
if (err || req->newptr == NULL)
|
||||||
return (err);
|
return (err);
|
||||||
|
@ -1470,7 +1471,7 @@ spa_taskq_write_param(ZFS_MODULE_PARAM_ARGS)
|
||||||
char buf[SPA_TASKQ_PARAM_MAX];
|
char buf[SPA_TASKQ_PARAM_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
(void) spa_taskq_param_get(ZIO_TYPE_WRITE, buf);
|
(void) spa_taskq_param_get(ZIO_TYPE_WRITE, buf, FALSE);
|
||||||
err = sysctl_handle_string(oidp, buf, sizeof (buf), req);
|
err = sysctl_handle_string(oidp, buf, sizeof (buf), req);
|
||||||
if (err || req->newptr == NULL)
|
if (err || req->newptr == NULL)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
Loading…
Reference in New Issue