Style changes:

- Move two IOCTL related defines to the top of the C-file
- Add more comments describing the recently added IOCTL small size and
small align macros
This commit is contained in:
Hans Petter Selasky 2014-11-28 09:32:07 +00:00
parent 006e24e909
commit 50ae6690fc

View File

@ -75,6 +75,20 @@ __FBSDID("$FreeBSD$");
#include <security/audit/audit.h>
/*
* The following macro defines how many bytes will be allocated from
* the stack instead of memory allocated when passing the IOCTL data
* structures from userspace and to the kernel. Some IOCTLs having
* small data structures are used very frequently and this small
* buffer on the stack gives a significant speedup improvement for
* those requests. The value of this define should be greater or equal
* to 64 bytes and should also be power of two. The data structure is
* currently hard-aligned to a 8-byte boundary on the stack. This
* should currently be sufficient for all supported platforms.
*/
#define SYS_IOCTL_SMALL_SIZE 128 /* bytes */
#define SYS_IOCTL_SMALL_ALIGN 8 /* bytes */
int iosize_max_clamp = 0;
SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW,
&iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX");
@ -646,10 +660,7 @@ struct ioctl_args {
int
sys_ioctl(struct thread *td, struct ioctl_args *uap)
{
#ifndef SYS_IOCTL_SMALL_SIZE
#define SYS_IOCTL_SMALL_SIZE 128
#endif
u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(8);
u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN);
u_long com;
int arg, error;
u_int size;