sysctl: use correct types and names in sysctl_*sec_to_sbintime

The functions are intended to report kernel variables that are
stored as sbintime_t (pointed to by arg1) as human readable
nanoseconds or milliseconds (reported via sysctl_handle_64).
The variable types and names were reversed.  I guess there is
no functional change here, as all types flipped around were
signed 64.  Note that these function aren't used yet anywhere
in the kernel.

Reviewed by:		mav
Differential revision:	https://reviews.freebsd.org/D38217
This commit is contained in:
Gleb Smirnoff 2023-01-27 07:09:22 -08:00
parent cc9b2b58e2
commit f394d9c0a4

View File

@ -1889,47 +1889,41 @@ sysctl_handle_opaque(SYSCTL_HANDLER_ARGS)
}
/*
* Based on on sysctl_handle_int() convert microseconds to a sbintime.
* Based on on sysctl_handle_64() convert microseconds to a sbintime.
*/
int
sysctl_usec_to_sbintime(SYSCTL_HANDLER_ARGS)
{
int error;
int64_t tt;
sbintime_t sb;
int64_t usec;
tt = *(int64_t *)arg1;
sb = sbttous(tt);
usec = sbttous(*(sbintime_t *)arg1);
error = sysctl_handle_64(oidp, &sb, 0, req);
error = sysctl_handle_64(oidp, &usec, 0, req);
if (error || !req->newptr)
return (error);
tt = ustosbt(sb);
*(int64_t *)arg1 = tt;
*(sbintime_t *)arg1 = ustosbt(usec);
return (0);
}
/*
* Based on on sysctl_handle_int() convert milliseconds to a sbintime.
* Based on on sysctl_handle_64() convert milliseconds to a sbintime.
*/
int
sysctl_msec_to_sbintime(SYSCTL_HANDLER_ARGS)
{
int error;
int64_t tt;
sbintime_t sb;
int64_t msec;
tt = *(int64_t *)arg1;
sb = sbttoms(tt);
msec = sbttoms(*(sbintime_t *)arg1);
error = sysctl_handle_64(oidp, &sb, 0, req);
error = sysctl_handle_64(oidp, &msec, 0, req);
if (error || !req->newptr)
return (error);
tt = mstosbt(sb);
*(int64_t *)arg1 = tt;
*(sbintime_t *)arg1 = mstosbt(msec);
return (0);
}