diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 9e8297aa965f..bc21dc641cb1 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1499,6 +1499,7 @@ MLINKS+=sysctl.9 SYSCTL_DECL.9 \ sysctl.9 SYSCTL_ADD_ROOT_NODE.9 \ sysctl.9 SYSCTL_ADD_STRING.9 \ sysctl.9 SYSCTL_ADD_STRUCT.9 \ + sysctl.9 SYSCTL_ADD_UAUTO.9 \ sysctl.9 SYSCTL_ADD_UINT.9 \ sysctl.9 SYSCTL_ADD_ULONG.9 \ sysctl.9 SYSCTL_ADD_UQUAD.9 \ diff --git a/share/man/man9/sysctl.9 b/share/man/man9/sysctl.9 index e645046b34e6..cdf05921d269 100644 --- a/share/man/man9/sysctl.9 +++ b/share/man/man9/sysctl.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2014 +.Dd October 20, 2014 .Dt SYSCTL 9 .Os .Sh NAME @@ -39,6 +39,7 @@ .Nm SYSCTL_ADD_ROOT_NODE , .Nm SYSCTL_ADD_STRING , .Nm SYSCTL_ADD_STRUCT , +.Nm SYSCTL_ADD_UAUTO , .Nm SYSCTL_ADD_UINT , .Nm SYSCTL_ADD_ULONG , .Nm SYSCTL_ADD_UQUAD , @@ -82,7 +83,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -128,7 +128,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "quad_t *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -181,7 +180,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "unsigned long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -192,7 +190,16 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "u_quad_t *ptr" -.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_UAUTO +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *ptr" .Fa "const char *descr" .Fc .Ft struct sysctl_oid_list * @@ -283,13 +290,13 @@ For string type OIDs a length of zero means that will be used to get the length of the string at each access to the OID. .It Fa ptr Pointer to sysctl variable or string data. -For sysctl values the pointer can be NULL which means the OID is read-only and the returned value should be taken from the +For sysctl values the pointer can be SYSCTL_NULL_XXX_PTR which means the OID is read-only and the returned value should be taken from the .Fa val argument. .It Fa val If the .Fa ptr -argument is NULL, gives the constant value returned by this OID. +argument is SYSCTL_NULL_XXX_PTR, gives the constant value returned by this OID. Else this argument is not used. .It Fa struct_type Name of structure type. @@ -424,8 +431,9 @@ Dynamic nodes are created using one of the .Fn SYSCTL_ADD_ROOT_NODE , .Fn SYSCTL_ADD_STRING , .Fn SYSCTL_ADD_STRUCT , +.Fn SYSCTL_ADD_UAUTO , .Fn SYSCTL_ADD_UINT , -.Fn SYSCTL_ADD_ULONG +.Fn SYSCTL_ADD_ULONG , or .Fn SYSCTL_UQUAD functions. @@ -521,10 +529,10 @@ Examples of integer, opaque, string, and procedure sysctls follow: .Bd -literal -offset indent /* * Example of a constant integer value. Notice that the control - * flags are CTLFLAG_RD, the variable pointer is NULL, and the - * value is declared. + * flags are CTLFLAG_RD, the variable pointer is SYSCTL_NULL_INT_PTR, + * and the value is declared. */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, NULL, +SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct bio), "sizeof(struct bio)"); /* diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 5c61859fd902..b0f25ba244c8 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -130,7 +130,7 @@ CTASSERT(sizeof(struct pcb) % XSAVE_AREA_ALIGN == 0); static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, - NULL, 1, "Floating point instructions executed in hardware"); + SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in hardware"); int use_xsave; /* non-static for cpu_switch.S */ uint64_t xsave_mask; /* the same */ diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c index b6df3def8931..8fb1a4420b4d 100644 --- a/sys/arm/arm/busdma_machdep-v6.c +++ b/sys/arm/arm/busdma_machdep-v6.c @@ -1525,9 +1525,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 57b58fcfa75c..265292d20494 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -1346,9 +1346,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index c5284cd9b734..422e633d930a 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1487,13 +1487,13 @@ sasysctlinit(void *context, int pending) goto bailout; SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + OID_AUTO, "allow_io_split", CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &softc->allow_io_split, 0, "Allow Splitting I/O"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "maxio", CTLFLAG_RD, &softc->maxio, 0, "Maximum I/O size"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "cpi_maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "cpi_maxio", CTLFLAG_RD, &softc->cpi_maxio, 0, "Maximum Controller I/O size"); bailout: diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index c8f86b8316d4..d92597e4b0e8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -67,8 +67,8 @@ #include "zfs_comutil.h" /* Used by fstat(1). */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, 0, sizeof(znode_t), - "sizeof(znode_t)"); +SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, + SYSCTL_NULL_INT_PTR, sizeof(znode_t), "sizeof(znode_t)"); /* * Define ZNODE_STATS to turn on statistic gathering. By default, it is only diff --git a/sys/cddl/dev/dtrace/dtrace_sysctl.c b/sys/cddl/dev/dtrace/dtrace_sysctl.c index 9f8b14fd1c66..da3c02bfa323 100644 --- a/sys/cddl/dev/dtrace/dtrace_sysctl.c +++ b/sys/cddl/dev/dtrace/dtrace_sysctl.c @@ -86,8 +86,8 @@ SYSCTL_NODE(_kern, OID_AUTO, dtrace, CTLFLAG_RD, 0, "DTrace parameters"); SYSCTL_INT(_kern_dtrace, OID_AUTO, memstr_max, CTLFLAG_RW, &dtrace_memstr_max, 0, "largest allowed argument to memstr(), 0 indicates no limit"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, &dtrace_dof_maxsize, 0, "largest allowed DOF table"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions"); diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index 21e010f970e2..2ad1683a6c87 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #define NDIS_DUMMY_PATH "\\\\some\\bogus\\path" +#define NDIS_FLAG_RDONLY 1 static void ndis_status_func(ndis_handle, ndis_status, void *, uint32_t); static void ndis_statusdone_func(ndis_handle); @@ -326,48 +327,48 @@ ndis_create_sysctls(arg) * We qualify as the latter. */ ndis_add_sysctl(sc, "Environment", - "Windows environment", "1", CTLFLAG_RD); + "Windows environment", "1", NDIS_FLAG_RDONLY); /* NDIS version should be 5.1. */ ndis_add_sysctl(sc, "NdisVersion", - "NDIS API Version", "0x00050001", CTLFLAG_RD); + "NDIS API Version", "0x00050001", NDIS_FLAG_RDONLY); /* * Some miniport drivers rely on the existence of the SlotNumber, * NetCfgInstanceId and DriverDesc keys. */ - ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", CTLFLAG_RD); + ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "NetCfgInstanceId", "NetCfgInstanceId", - "{12345678-1234-5678-CAFE0-123456789ABC}", CTLFLAG_RD); + "{12345678-1234-5678-CAFE0-123456789ABC}", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "DriverDesc", "Driver Description", - "NDIS Network Adapter", CTLFLAG_RD); + "NDIS Network Adapter", NDIS_FLAG_RDONLY); /* Bus type (PCI, PCMCIA, etc...) */ sprintf(buf, "%d", (int)sc->ndis_iftype); - ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD); + ndis_add_sysctl(sc, "BusType", "Bus Type", buf, NDIS_FLAG_RDONLY); if (sc->ndis_res_io != NULL) { sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io)); ndis_add_sysctl(sc, "IOBaseAddress", - "Base I/O Address", buf, CTLFLAG_RD); + "Base I/O Address", buf, NDIS_FLAG_RDONLY); } if (sc->ndis_irq != NULL) { sprintf(buf, "%lu", rman_get_start(sc->ndis_irq)); ndis_add_sysctl(sc, "InterruptNumber", - "Interrupt Number", buf, CTLFLAG_RD); + "Interrupt Number", buf, NDIS_FLAG_RDONLY); } return (0); } int -ndis_add_sysctl(arg, key, desc, val, flag) +ndis_add_sysctl(arg, key, desc, val, flag_rdonly) void *arg; char *key; char *desc; char *val; - int flag; + int flag_rdonly; { struct ndis_softc *sc; struct ndis_cfglist *cfg; @@ -392,13 +393,21 @@ ndis_add_sysctl(arg, key, desc, val, flag) TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link); - cfg->ndis_oid = - SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), - OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag, - cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), - cfg->ndis_cfg.nc_cfgdesc); - + if (flag_rdonly != 0) { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RD, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } else { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RW, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } return (0); } diff --git a/sys/dev/acpi_support/acpi_asus.c b/sys/dev/acpi_support/acpi_asus.c index d1ae81015982..86cd8b7bf69b 100644 --- a/sys/dev/acpi_support/acpi_asus.c +++ b/sys/dev/acpi_support/acpi_asus.c @@ -465,43 +465,39 @@ static struct { char *name; char *description; int method; - int flags; + int flag_anybody; } acpi_asus_sysctls[] = { { .name = "lcd_backlight", .method = ACPI_ASUS_METHOD_LCD, .description = "state of the lcd backlight", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "lcd_brightness", .method = ACPI_ASUS_METHOD_BRN, .description = "brightness of the lcd panel", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "video_output", .method = ACPI_ASUS_METHOD_DISP, .description = "display output state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .method = ACPI_ASUS_METHOD_CAMERA, .description = "internal camera state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .method = ACPI_ASUS_METHOD_CARDRD, .description = "internal card reader state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_ASUS_METHOD_WLAN, .description = "wireless lan state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = NULL } @@ -741,12 +737,21 @@ acpi_asus_attach(device_t dev) if (!acpi_asus_sysctl_init(sc, acpi_asus_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(&sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_sysctls[i].name, - acpi_asus_sysctls[i].flags, - sc, i, acpi_asus_sysctl, "I", - acpi_asus_sysctls[i].description); + if (acpi_asus_sysctls[i].flag_anybody != 0) { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } } /* Attach leds */ diff --git a/sys/dev/acpi_support/acpi_asus_wmi.c b/sys/dev/acpi_support/acpi_asus_wmi.c index 54a2893cd0a0..d77cc7640488 100644 --- a/sys/dev/acpi_support/acpi_asus_wmi.c +++ b/sys/dev/acpi_support/acpi_asus_wmi.c @@ -119,163 +119,139 @@ static struct { char *name; int dev_id; char *description; - int access; + int flag_rdonly; } acpi_asus_wmi_sysctls[] = { { .name = "hw_switch", .dev_id = ASUS_WMI_DEVID_HW_SWITCH, .description = "hw_switch", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wireless_led", .dev_id = ASUS_WMI_DEVID_WIRELESS_LED, .description = "Wireless LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cwap", .dev_id = ASUS_WMI_DEVID_CWAP, .description = "Alt+F2 function", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .dev_id = ASUS_WMI_DEVID_WLAN, .description = "WLAN power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .dev_id = ASUS_WMI_DEVID_BLUETOOTH, .description = "Bluetooth power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "gps", .dev_id = ASUS_WMI_DEVID_GPS, .description = "GPS power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wimax", .dev_id = ASUS_WMI_DEVID_WIMAX, .description = "WiMAX power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan3g", .dev_id = ASUS_WMI_DEVID_WWAN3G, .description = "WWAN-3G power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "uwb", .dev_id = ASUS_WMI_DEVID_UWB, .description = "UWB power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led1", .dev_id = ASUS_WMI_DEVID_LED1, .description = "LED1 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led2", .dev_id = ASUS_WMI_DEVID_LED2, .description = "LED2 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led3", .dev_id = ASUS_WMI_DEVID_LED3, .description = "LED3 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led4", .dev_id = ASUS_WMI_DEVID_LED4, .description = "LED4 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led5", .dev_id = ASUS_WMI_DEVID_LED5, .description = "LED5 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led6", .dev_id = ASUS_WMI_DEVID_LED6, .description = "LED6 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "backlight", .dev_id = ASUS_WMI_DEVID_BACKLIGHT, .description = "LCD backlight on/off control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "brightness", .dev_id = ASUS_WMI_DEVID_BRIGHTNESS, .description = "LCD backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "kbd_backlight", .dev_id = ASUS_WMI_DEVID_KBD_BACKLIGHT, .description = "Keyboard backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "light_sensor", .dev_id = ASUS_WMI_DEVID_LIGHT_SENSOR, .description = "Ambient light sensor", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .dev_id = ASUS_WMI_DEVID_CAMERA, .description = "Camera power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .dev_id = ASUS_WMI_DEVID_CARDREADER, .description = "Cardreader power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad", .dev_id = ASUS_WMI_DEVID_TOUCHPAD, .description = "Touchpad control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad_led", .dev_id = ASUS_WMI_DEVID_TOUCHPAD_LED, .description = "Touchpad LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "themperature", .dev_id = ASUS_WMI_DEVID_THERMAL_CTRL, .description = "Temperature (C)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .dev_id = ASUS_WMI_DEVID_FAN_CTRL, .description = "Fan speed (0-3)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "processor_state", .dev_id = ASUS_WMI_DEVID_PROCESSOR_STATE, - .description = "Processor state", - .access = CTLTYPE_INT | CTLFLAG_RW + .flag_rdonly = 1 }, { NULL, 0, NULL, 0 } }; @@ -449,12 +425,21 @@ next: break; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_wmi_sysctls[i].name, - acpi_asus_wmi_sysctls[i].access, - sc, i, acpi_asus_wmi_sysctl, "I", - acpi_asus_wmi_sysctls[i].description); + if (acpi_asus_wmi_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } } ACPI_SERIAL_END(asus_wmi); diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c index deb01a42b273..282803814dc5 100644 --- a/sys/dev/acpi_support/acpi_hp.c +++ b/sys/dev/acpi_support/acpi_hp.c @@ -152,135 +152,123 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_hp_sysctls[] = { { .name = "wlan_enabled", .method = ACPI_HP_METHOD_WLAN_ENABLED, .description = "Enable/Disable WLAN (WiFi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_radio", .method = ACPI_HP_METHOD_WLAN_RADIO, .description = "WLAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_on_air", .method = ACPI_HP_METHOD_WLAN_ON_AIR, .description = "WLAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_enable_if_radio_on", .method = ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON, .description = "Enable WLAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_disable_if_radio_off", .method = ACPI_HP_METHOD_WLAN_DISABLE_IF_RADIO_OFF, .description = "Disable WLAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_enabled", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLED, .description = "Enable/Disable Bluetooth", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_radio", .method = ACPI_HP_METHOD_BLUETOOTH_RADIO, .description = "Bluetooth radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_on_air", .method = ACPI_HP_METHOD_BLUETOOTH_ON_AIR, .description = "Bluetooth radio ready to use" " (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_enable_if_radio_on", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON, .description = "Enable bluetooth if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_disable_if_radio_off", .method = ACPI_HP_METHOD_BLUETOOTH_DISABLE_IF_RADIO_OFF, .description = "Disable bluetooth if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_enabled", .method = ACPI_HP_METHOD_WWAN_ENABLED, .description = "Enable/Disable WWAN (UMTS)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_radio", .method = ACPI_HP_METHOD_WWAN_RADIO, .description = "WWAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_on_air", .method = ACPI_HP_METHOD_WWAN_ON_AIR, .description = "WWAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_enable_if_radio_on", .method = ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON, .description = "Enable WWAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_disable_if_radio_off", .method = ACPI_HP_METHOD_WWAN_DISABLE_IF_RADIO_OFF, .description = "Disable WWAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "als_enabled", .method = ACPI_HP_METHOD_ALS, .description = "Enable/Disable ALS (Ambient light sensor)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "display", .method = ACPI_HP_METHOD_DISPLAY, .description = "Display status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "hdd_temperature", .method = ACPI_HP_METHOD_HDDTEMP, .description = "HDD temperature", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "is_docked", .method = ACPI_HP_METHOD_DOCK, .description = "Docking station status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "cmi_detail", .method = ACPI_HP_METHOD_CMI_DETAIL, .description = "Details shown in CMI output " "(cat /dev/hpcmi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "verbose", .method = ACPI_HP_METHOD_VERBOSE, .description = "Verbosity level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -560,11 +548,19 @@ acpi_hp_attach(device_t dev) sc->was_wwan_on_air = arg; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_hp_sysctls[i].name, acpi_hp_sysctls[i].access, - sc, i, acpi_hp_sysctl, "I", - acpi_hp_sysctls[i].description); + if (acpi_hp_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } } ACPI_SERIAL_END(hp); diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 416011297e09..3f53c59f545a 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -192,79 +192,70 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_ibm_sysctls[] = { { .name = "events", .method = ACPI_IBM_METHOD_EVENTS, .description = "ACPI events enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "eventmask", .method = ACPI_IBM_METHOD_EVENTMASK, .description = "ACPI eventmask", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "hotkey", .method = ACPI_IBM_METHOD_HOTKEY, .description = "Key Status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "lcd_brightness", .method = ACPI_IBM_METHOD_BRIGHTNESS, .description = "LCD Brightness", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "volume", .method = ACPI_IBM_METHOD_VOLUME, .description = "Volume", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "mute", .method = ACPI_IBM_METHOD_MUTE, .description = "Mute", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "thinklight", .method = ACPI_IBM_METHOD_THINKLIGHT, .description = "Thinklight enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .method = ACPI_IBM_METHOD_BLUETOOTH, .description = "Bluetooth enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_IBM_METHOD_WLAN, .description = "WLAN enable", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .method = ACPI_IBM_METHOD_FANSPEED, .description = "Fan speed", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_level", .method = ACPI_IBM_METHOD_FANLEVEL, .description = "Fan level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "fan", .method = ACPI_IBM_METHOD_FANSTATUS, .description = "Fan enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -415,11 +406,19 @@ acpi_ibm_attach(device_t dev) if (!acpi_ibm_sysctl_init(sc, acpi_ibm_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_ibm_sysctls[i].name, acpi_ibm_sysctls[i].access, - sc, i, acpi_ibm_sysctl, "I", - acpi_ibm_sysctls[i].description); + if (acpi_ibm_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } } /* Hook up thermal node */ @@ -483,15 +482,10 @@ acpi_ibm_resume(device_t dev) for (int i = 0; acpi_ibm_sysctls[i].name != NULL; i++) { int val; - if ((acpi_ibm_sysctls[i].access & CTLFLAG_RD) == 0) { - continue; - } - val = acpi_ibm_sysctl_get(sc, i); - if ((acpi_ibm_sysctls[i].access & CTLFLAG_WR) == 0) { + if (acpi_ibm_sysctls[i].flag_rdonly != 0) continue; - } acpi_ibm_sysctl_set(sc, i, val); } diff --git a/sys/dev/acpi_support/acpi_rapidstart.c b/sys/dev/acpi_support/acpi_rapidstart.c index 2da93ec17127..f28414cef371 100644 --- a/sys/dev/acpi_support/acpi_rapidstart.c +++ b/sys/dev/acpi_support/acpi_rapidstart.c @@ -84,12 +84,21 @@ acpi_rapidstart_attach(device_t dev) sc->sysctl_ctx = device_get_sysctl_ctx(dev); sc->sysctl_tree = device_get_sysctl_tree(dev); for (i = 0 ; acpi_rapidstart_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_rapidstart_oids[i].nodename , CTLTYPE_INT | - ((acpi_rapidstart_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_rapidstart_gen_handler, "I", - acpi_rapidstart_oids[i].comment); + if (acpi_rapidstart_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } } return (0); } diff --git a/sys/dev/acpi_support/acpi_sony.c b/sys/dev/acpi_support/acpi_sony.c index 95e7b4f1ca28..fc5c6519e4b5 100644 --- a/sys/dev/acpi_support/acpi_sony.c +++ b/sys/dev/acpi_support/acpi_sony.c @@ -132,13 +132,22 @@ acpi_sony_attach(device_t dev) sc = device_get_softc(dev); acpi_GetInteger(acpi_get_handle(dev), ACPI_SONY_GET_PID, &sc->pid); device_printf(dev, "PID %x\n", sc->pid); - for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_sony_oids[i].nodename , CTLTYPE_INT | - ((acpi_sony_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_sony_gen_handler, "I", - acpi_sony_oids[i].comment); + for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++) { + if (acpi_sony_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } } return (0); } diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index ac20d781f608..a27b3e7a56bd 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -16216,7 +16216,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, "bootcode version"); snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", @@ -16225,7 +16225,7 @@ bxe_add_sysctls(struct bxe_softc *sc) BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, &sc->fw_ver_str, 0, + CTLFLAG_RD, sc->fw_ver_str, 0, "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", @@ -16235,7 +16235,7 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, &sc->mf_mode_str, 0, + CTLFLAG_RD, sc->mf_mode_str, 0, "multifunction mode"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", @@ -16243,7 +16243,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "multifunction vnics per port"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, &sc->mac_addr_str, 0, + CTLFLAG_RD, sc->mac_addr_str, 0, "mac address"); snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", @@ -16253,12 +16253,12 @@ bxe_add_sysctls(struct bxe_softc *sc) "???GT/s"), sc->devinfo.pcie_link_width); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", - CTLFLAG_RD, &sc->pci_link_str, 0, + CTLFLAG_RD, sc->pci_link_str, 0, "pci link status"); sc->debug = bxe_debug; - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", - CTLFLAG_RW, &sc->debug, 0, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, "debug logging mode"); sc->rx_budget = bxe_rx_budget; diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 88ee7ccd4920..a7f39a510109 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -3365,7 +3365,7 @@ t3_add_attach_sysctls(adapter_t *sc) /* random information */ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", - CTLFLAG_RD, &sc->fw_version, + CTLFLAG_RD, sc->fw_version, 0, "firmware version"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "hw_revision", @@ -3373,7 +3373,7 @@ t3_add_attach_sysctls(adapter_t *sc) 0, "chip model"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "port_types", - CTLFLAG_RD, &sc->port_types, + CTLFLAG_RD, sc->port_types, 0, "type of ports"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "enable_debug", @@ -3502,7 +3502,7 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_UINT(ctx, rspqpoidlist, OID_AUTO, "starved", CTLFLAG_RD, &qs->rspq.starved, 0, "#times starved"); - SYSCTL_ADD_ULONG(ctx, rspqpoidlist, OID_AUTO, "phys_addr", + SYSCTL_ADD_UAUTO(ctx, rspqpoidlist, OID_AUTO, "phys_addr", CTLFLAG_RD, &qs->rspq.phys_addr, "physical_address_of the queue"); SYSCTL_ADD_UINT(ctx, rspqpoidlist, OID_AUTO, "dump_start", @@ -3538,7 +3538,7 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "in_use", CTLFLAG_RD, &txq->in_use, 0, "#tunneled packet slots in use"); - SYSCTL_ADD_ULONG(ctx, txqpoidlist, OID_AUTO, "frees", + SYSCTL_ADD_UQUAD(ctx, txqpoidlist, OID_AUTO, "frees", CTLFLAG_RD, &txq->txq_frees, "#tunneled packets freed"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "skipped", @@ -3553,7 +3553,7 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "stopped_flags", CTLFLAG_RD, &qs->txq_stopped, 0, "tx queues stopped"); - SYSCTL_ADD_ULONG(ctx, txqpoidlist, OID_AUTO, "phys_addr", + SYSCTL_ADD_UAUTO(ctx, txqpoidlist, OID_AUTO, "phys_addr", CTLFLAG_RD, &txq->phys_addr, "physical_address_of the queue"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "qgen", diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 77c99b238fae..475845b27a98 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -4534,10 +4534,10 @@ t4_sysctls(struct adapter *sc) NULL, chip_rev(sc), "chip hardware revision"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", - CTLFLAG_RD, &sc->fw_version, 0, "firmware version"); + CTLFLAG_RD, sc->fw_version, 0, "firmware version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "cf", - CTLFLAG_RD, &sc->cfg_file, 0, "configuration file"); + CTLFLAG_RD, sc->cfg_file, 0, "configuration file"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cfcsum", CTLFLAG_RD, NULL, sc->cfcsum, "config file checksum"); diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 070bb5b2f3ea..252571b611c2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -5644,7 +5644,7 @@ em_set_sysctl_value(struct adapter *adapter, const char *name, *limit = value; SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLFLAG_RW, limit, value, description); } diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 0e6d16138a64..4796a915f2e0 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -5823,8 +5823,8 @@ igb_add_hw_stats(struct adapter *adapter) char namebuf[QUEUE_NAME_LEN]; /* Driver Statistics */ - SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "link_irq", - CTLFLAG_RD, &adapter->link_irq, 0, + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", + CTLFLAG_RD, &adapter->link_irq, "Link MSIX IRQ Handled"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", CTLFLAG_RD, &adapter->dropped_pkts, @@ -5873,17 +5873,17 @@ igb_add_hw_stats(struct adapter *adapter) queue_list = SYSCTL_CHILDREN(queue_node); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate", - CTLFLAG_RD, &adapter->queues[i], + CTLTYPE_UINT | CTLFLAG_RD, &adapter->queues[i], sizeof(&adapter->queues[i]), igb_sysctl_interrupt_rate_handler, "IU", "Interrupt Rate"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", - CTLFLAG_RD, adapter, E1000_TDH(txr->me), + CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_TDH(txr->me), igb_sysctl_reg_handler, "IU", "Transmit Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", - CTLFLAG_RD, adapter, E1000_TDT(txr->me), + CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_TDT(txr->me), igb_sysctl_reg_handler, "IU", "Transmit Descriptor Tail"); SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", @@ -5894,11 +5894,11 @@ igb_add_hw_stats(struct adapter *adapter) "Queue Packets Transmitted"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", - CTLFLAG_RD, adapter, E1000_RDH(rxr->me), + CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_RDH(rxr->me), igb_sysctl_reg_handler, "IU", "Receive Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", - CTLFLAG_RD, adapter, E1000_RDT(rxr->me), + CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_RDT(rxr->me), igb_sysctl_reg_handler, "IU", "Receive Descriptor Tail"); SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_packets", @@ -6272,7 +6272,7 @@ igb_set_sysctl_value(struct adapter *adapter, const char *name, *limit = value; SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLFLAG_RW, limit, value, description); } /* diff --git a/sys/dev/e1000/if_lem.c b/sys/dev/e1000/if_lem.c index d29c7f1e8d66..894a74a9db81 100644 --- a/sys/dev/e1000/if_lem.c +++ b/sys/dev/e1000/if_lem.c @@ -4861,7 +4861,7 @@ lem_set_flow_cntrl(struct adapter *adapter, const char *name, *limit = value; SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLFLAG_RW, limit, value, description); } static void @@ -4871,5 +4871,5 @@ lem_add_rx_process_limit(struct adapter *adapter, const char *name, *limit = value; SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLFLAG_RW, limit, value, description); } diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c index 0be8a3d17b83..0677a149aace 100644 --- a/sys/dev/hatm/if_hatm.c +++ b/sys/dev/hatm/if_hatm.c @@ -1312,9 +1312,17 @@ kenv_getuint(struct hatm_softc *sc, const char *var, *ptr = def; - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, var, rw ? CTLFLAG_RW : CTLFLAG_RD, ptr, 0, "") == NULL) - return (ENOMEM); + if (rw != 0) { + if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var, + CTLFLAG_RW, ptr, 0, "") == NULL) + return (ENOMEM); + } else { + if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var, + CTLFLAG_RD, ptr, 0, "") == NULL) + return (ENOMEM); + } snprintf(full, sizeof(full), "hw.%s.%s", device_get_nameunit(sc->dev), var); diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index b711b4796618..78fdb36b72ba 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -460,7 +460,7 @@ ixgbe_attach(device_t dev) SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, + OID_AUTO, "enable_aim", CTLFLAG_RW, &ixgbe_enable_aim, 1, "Interrupt Moderation"); /* diff --git a/sys/dev/ixgbe/ixv.c b/sys/dev/ixgbe/ixv.c index 296138ed2469..1d77e8b5a27a 100644 --- a/sys/dev/ixgbe/ixv.c +++ b/sys/dev/ixgbe/ixv.c @@ -322,7 +322,7 @@ ixv_attach(device_t dev) SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, + OID_AUTO, "enable_aim", CTLFLAG_RW, &ixv_enable_aim, 1, "Interrupt Moderation"); /* Set up the timer callout */ @@ -4001,6 +4001,6 @@ ixv_add_rx_process_limit(struct adapter *adapter, const char *name, *limit = value; SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLFLAG_RW, limit, value, description); } diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 8d1100c55f45..a1c14781c7e6 100755 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -400,22 +400,22 @@ ixl_attach(device_t dev) SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "rx_itr", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "rx_itr", CTLFLAG_RW, &ixl_rx_itr, IXL_ITR_8K, "RX ITR"); SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "dynamic_rx_itr", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "dynamic_rx_itr", CTLFLAG_RW, &ixl_dynamic_rx_itr, 0, "Dynamic RX ITR"); SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "tx_itr", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "tx_itr", CTLFLAG_RW, &ixl_tx_itr, IXL_ITR_4K, "TX ITR"); SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "dynamic_tx_itr", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "dynamic_tx_itr", CTLFLAG_RW, &ixl_dynamic_tx_itr, 0, "Dynamic TX ITR"); #ifdef IXL_DEBUG diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index 3656eec36864..d3fb9a0682b8 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -1447,7 +1447,7 @@ mpr_setup_sysctl(struct mpr_softc *sc) "Disable the use of MSI interrupts"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "firmware_version", CTLFLAG_RW, &sc->fw_version, + OID_AUTO, "firmware_version", CTLFLAG_RW, sc->fw_version, strlen(sc->fw_version), "firmware version"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c index 403a4d2f8493..20c7f75308d2 100644 --- a/sys/dev/mps/mps.c +++ b/sys/dev/mps/mps.c @@ -1424,7 +1424,7 @@ mps_setup_sysctl(struct mps_softc *sc) "Disable the use of MSI interrupts"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "firmware_version", CTLFLAG_RW, &sc->fw_version, + OID_AUTO, "firmware_version", CTLFLAG_RW, sc->fw_version, strlen(sc->fw_version), "firmware version"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 24738ebb7f2e..9c1caa0290d1 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -412,7 +412,7 @@ mrsas_setup_sysctl(struct mrsas_softc *sc) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "fw_outstanding", CTLFLAG_RD, - &sc->fw_outstanding, 0, "FW outstanding commands"); + &sc->fw_outstanding.val_rdonly, 0, "FW outstanding commands"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "io_cmds_highwater", CTLFLAG_RD, diff --git a/sys/dev/mrsas/mrsas.h b/sys/dev/mrsas/mrsas.h index 16dc95dfc5a6..37b6e952835c 100644 --- a/sys/dev/mrsas/mrsas.h +++ b/sys/dev/mrsas/mrsas.h @@ -511,8 +511,9 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UNION { } MPI2_REPLY_DESCRIPTORS_UNION, MPI2_POINTER PTR_MPI2_REPLY_DESCRIPTORS_UNION, Mpi2ReplyDescriptorsUnion_t, MPI2_POINTER pMpi2ReplyDescriptorsUnion_t; -typedef struct { +typedef union { volatile unsigned int val; + unsigned int val_rdonly; } mrsas_atomic_t; #define mrsas_atomic_read(v) atomic_load_acq_int(&(v)->val) @@ -2523,7 +2524,7 @@ struct mrsas_softc { void *ctlr_info_mem; bus_addr_t ctlr_info_phys_addr; u_int32_t max_sectors_per_req; - u_int8_t disableOnlineCtrlReset; + u_int32_t disableOnlineCtrlReset; mrsas_atomic_t fw_outstanding; u_int32_t mrsas_debug; u_int32_t mrsas_io_timeout; diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index 8de14857c517..e97ae5c7130e 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -1468,15 +1468,15 @@ mxge_add_sysctls(mxge_softc_t *sc) /* random information */ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", - CTLFLAG_RD, &sc->fw_version, + CTLFLAG_RD, sc->fw_version, 0, "firmware version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "serial_number", - CTLFLAG_RD, &sc->serial_number_string, + CTLFLAG_RD, sc->serial_number_string, 0, "serial number"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "product_code", - CTLFLAG_RD, &sc->product_code_string, + CTLFLAG_RD, sc->product_code_string, 0, "product_code"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "pcie_link_width", diff --git a/sys/dev/oce/oce_sysctl.c b/sys/dev/oce/oce_sysctl.c index 0cafbbd84edf..3df7d0ddbb03 100644 --- a/sys/dev/oce/oce_sysctl.c +++ b/sys/dev/oce/oce_sysctl.c @@ -84,21 +84,21 @@ oce_add_sysctls(POCE_SOFTC sc) SYSCTL_ADD_STRING(ctx, child, OID_AUTO, "component_revision", - CTLTYPE_INT | CTLFLAG_RD, - &component_revision, + CTLFLAG_RD, + component_revision, sizeof(component_revision), "EMULEX One-Connect device driver revision"); SYSCTL_ADD_STRING(ctx, child, OID_AUTO, "firmware_version", - CTLTYPE_INT | CTLFLAG_RD, - &sc->fw_version, + CTLFLAG_RD, + sc->fw_version, sizeof(sc->fw_version), "EMULEX One-Connect Firmware Version"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_rsp_handled", - CTLTYPE_INT | CTLFLAG_RW, + CTLFLAG_RW, &oce_max_rsp_handled, sizeof(oce_max_rsp_handled), "Maximum receive frames handled per interupt"); @@ -957,11 +957,11 @@ oce_add_stats_sysctls_xe201(POCE_SOFTC sc, SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_rxcp_errs", CTLFLAG_RD, &stats->rx.t_rxcp_errs, 0, "Total Receive completion errors"); - SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "pause_frames", - CTLFLAG_RD, &stats->u0.xe201.rx_pause_frames, 0, + SYSCTL_ADD_UQUAD(ctx, rx_stat_list, OID_AUTO, "pause_frames", + CTLFLAG_RD, &stats->u0.xe201.rx_pause_frames, "Pause Frames"); - SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "control_frames", - CTLFLAG_RD, &stats->u0.xe201.rx_control_frames, 0, + SYSCTL_ADD_UQUAD(ctx, rx_stat_list, OID_AUTO, "control_frames", + CTLFLAG_RD, &stats->u0.xe201.rx_control_frames, "Control Frames"); for (i = 0; i < sc->nrqs; i++) { @@ -1001,11 +1001,11 @@ oce_add_stats_sysctls_xe201(POCE_SOFTC sc, NULL, "Receive Error Stats"); rx_stat_list = SYSCTL_CHILDREN(rx_stats_node); - SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "crc_errs", - CTLFLAG_RD, &stats->u0.xe201.rx_crc_errors, 0, + SYSCTL_ADD_UQUAD(ctx, rx_stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &stats->u0.xe201.rx_crc_errors, "CRC Errors"); - SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "alignment_errors", - CTLFLAG_RD, &stats->u0.xe201.rx_alignment_errors, 0, + SYSCTL_ADD_UQUAD(ctx, rx_stat_list, OID_AUTO, "alignment_errors", + CTLFLAG_RD, &stats->u0.xe201.rx_alignment_errors, "RX Alignmnet Errors"); SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "in_range_errors", CTLFLAG_RD, &stats->u0.xe201.rx_in_range_errors, 0, @@ -1013,8 +1013,8 @@ oce_add_stats_sysctls_xe201(POCE_SOFTC sc, SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "out_range_errors", CTLFLAG_RD, &stats->u0.xe201.rx_out_of_range_errors, 0, "Out Range Errors"); - SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "frame_too_long", - CTLFLAG_RD, &stats->u0.xe201.rx_frames_too_long, 0, + SYSCTL_ADD_UQUAD(ctx, rx_stat_list, OID_AUTO, "frame_too_long", + CTLFLAG_RD, &stats->u0.xe201.rx_frames_too_long, "Frame Too Long"); SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "address_match_errors", CTLFLAG_RD, &stats->u0.xe201.rx_address_match_errors, 0, @@ -1077,11 +1077,11 @@ oce_add_stats_sysctls_xe201(POCE_SOFTC sc, "total_ipv6_ext_hdr_tx_drop", CTLFLAG_RD, &stats->tx.t_ipv6_ext_hdr_tx_drop, 0, "Total Transmit IPV6 Drops"); - SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "pauseframes", - CTLFLAG_RD, &stats->u0.xe201.tx_pause_frames, 0, + SYSCTL_ADD_UQUAD(ctx, tx_stat_list, OID_AUTO, "pauseframes", + CTLFLAG_RD, &stats->u0.xe201.tx_pause_frames, "Pause Frames"); - SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "controlframes", - CTLFLAG_RD, &stats->u0.xe201.tx_control_frames, 0, + SYSCTL_ADD_UQUAD(ctx, tx_stat_list, OID_AUTO, "controlframes", + CTLFLAG_RD, &stats->u0.xe201.tx_control_frames, "Tx Control Frames"); for (i = 0; i < sc->nwqs; i++) { diff --git a/sys/dev/qlxgb/qla_os.c b/sys/dev/qlxgb/qla_os.c index 7da4d1d55214..54619cb214f2 100644 --- a/sys/dev/qlxgb/qla_os.c +++ b/sys/dev/qlxgb/qla_os.c @@ -157,7 +157,7 @@ qla_add_sysctls(qla_host_t *ha) SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fw_version", CTLFLAG_RD, - &ha->fw_ver_str, 0, "firmware version"); + ha->fw_ver_str, 0, "firmware version"); dbg_level = 0; SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), diff --git a/sys/dev/qlxgbe/ql_os.c b/sys/dev/qlxgbe/ql_os.c index 461309cb5fe1..1684c070fcd8 100644 --- a/sys/dev/qlxgbe/ql_os.c +++ b/sys/dev/qlxgbe/ql_os.c @@ -160,7 +160,7 @@ qla_add_sysctls(qla_host_t *ha) SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fw_version", CTLFLAG_RD, - &ha->fw_ver_str, 0, "firmware version"); + ha->fw_ver_str, 0, "firmware version"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), diff --git a/sys/dev/rt/if_rt.c b/sys/dev/rt/if_rt.c index f89f6dc512a1..b10b581ecd9e 100644 --- a/sys/dev/rt/if_rt.c +++ b/sys/dev/rt/if_rt.c @@ -2339,45 +2339,45 @@ rt_sysctl_attach(struct rt_softc *sc) stats = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "stats", CTLFLAG_RD, 0, "statistic"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "interrupts", CTLFLAG_RD, &sc->interrupts, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "interrupts", CTLFLAG_RD, &sc->interrupts, "all interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_coherent_interrupts", CTLFLAG_RD, &sc->tx_coherent_interrupts, - 0, "Tx coherent interrupts"); + "Tx coherent interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "rx_coherent_interrupts", CTLFLAG_RD, &sc->rx_coherent_interrupts, - 0, "Rx coherent interrupts"); + "Rx coherent interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_interrupts", CTLFLAG_RD, &sc->rx_interrupts, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_interrupts", CTLFLAG_RD, &sc->rx_interrupts, "Rx interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_delay_interrupts", CTLFLAG_RD, &sc->rx_delay_interrupts, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_delay_interrupts", CTLFLAG_RD, &sc->rx_delay_interrupts, "Rx delay interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "TXQ3_interrupts", CTLFLAG_RD, &sc->tx_interrupts[3], 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "TXQ3_interrupts", CTLFLAG_RD, &sc->tx_interrupts[3], "Tx AC3 interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "TXQ2_interrupts", CTLFLAG_RD, &sc->tx_interrupts[2], 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "TXQ2_interrupts", CTLFLAG_RD, &sc->tx_interrupts[2], "Tx AC2 interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "TXQ1_interrupts", CTLFLAG_RD, &sc->tx_interrupts[1], 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "TXQ1_interrupts", CTLFLAG_RD, &sc->tx_interrupts[1], "Tx AC1 interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "TXQ0_interrupts", CTLFLAG_RD, &sc->tx_interrupts[0], 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "TXQ0_interrupts", CTLFLAG_RD, &sc->tx_interrupts[0], "Tx AC0 interrupts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_delay_interrupts", CTLFLAG_RD, &sc->tx_delay_interrupts, - 0, "Tx delay interrupts"); + "Tx delay interrupts"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "TXQ3_desc_queued", CTLFLAG_RD, &sc->tx_ring[3].desc_queued, @@ -2411,93 +2411,96 @@ rt_sysctl_attach(struct rt_softc *sc) "TXQ0_data_queued", CTLFLAG_RD, &sc->tx_ring[0].data_queued, 0, "Tx AC0 data queued"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "TXQ3_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[3], - 0, "Tx AC3 data queue full"); + "Tx AC3 data queue full"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "TXQ2_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[2], - 0, "Tx AC2 data queue full"); + "Tx AC2 data queue full"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "TXQ1_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[1], - 0, "Tx AC1 data queue full"); + "Tx AC1 data queue full"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "TXQ0_data_queue_full", CTLFLAG_RD, &sc->tx_data_queue_full[0], - 0, "Tx AC0 data queue full"); + "Tx AC0 data queue full"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_watchdog_timeouts", CTLFLAG_RD, &sc->tx_watchdog_timeouts, - 0, "Tx watchdog timeouts"); + "Tx watchdog timeouts"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "tx_defrag_packets", CTLFLAG_RD, &sc->tx_defrag_packets, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_defrag_packets", CTLFLAG_RD, &sc->tx_defrag_packets, "Tx defragmented packets"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "no_tx_desc_avail", CTLFLAG_RD, &sc->no_tx_desc_avail, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "no_tx_desc_avail", CTLFLAG_RD, &sc->no_tx_desc_avail, "no Tx descriptors available"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "rx_mbuf_alloc_errors", CTLFLAG_RD, &sc->rx_mbuf_alloc_errors, - 0, "Rx mbuf allocation errors"); + "Rx mbuf allocation errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "rx_mbuf_dmamap_errors", CTLFLAG_RD, &sc->rx_mbuf_dmamap_errors, - 0, "Rx mbuf DMA mapping errors"); + "Rx mbuf DMA mapping errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_queue_0_not_empty", CTLFLAG_RD, &sc->tx_queue_not_empty[0], - 0, "Tx queue 0 not empty"); + "Tx queue 0 not empty"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx_queue_1_not_empty", CTLFLAG_RD, &sc->tx_queue_not_empty[1], - 0, "Tx queue 1 not empty"); + "Tx queue 1 not empty"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_packets", CTLFLAG_RD, &sc->rx_packets, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_packets", CTLFLAG_RD, &sc->rx_packets, "Rx packets"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_crc_errors", CTLFLAG_RD, &sc->rx_crc_err, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_crc_errors", CTLFLAG_RD, &sc->rx_crc_err, "Rx CRC errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_phy_errors", CTLFLAG_RD, &sc->rx_phy_err, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_phy_errors", CTLFLAG_RD, &sc->rx_phy_err, "Rx PHY errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_dup_packets", CTLFLAG_RD, &sc->rx_dup_packets, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_dup_packets", CTLFLAG_RD, &sc->rx_dup_packets, "Rx duplicate packets"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_fifo_overflows", CTLFLAG_RD, &sc->rx_fifo_overflows, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_fifo_overflows", CTLFLAG_RD, &sc->rx_fifo_overflows, "Rx FIFO overflows"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_bytes", CTLFLAG_RD, &sc->rx_bytes, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_bytes", CTLFLAG_RD, &sc->rx_bytes, "Rx bytes"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_long_err", CTLFLAG_RD, &sc->rx_long_err, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_long_err", CTLFLAG_RD, &sc->rx_long_err, "Rx too long frame errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "rx_short_err", CTLFLAG_RD, &sc->rx_short_err, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "rx_short_err", CTLFLAG_RD, &sc->rx_short_err, "Rx too short frame errors"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "tx_bytes", CTLFLAG_RD, &sc->tx_bytes, 0, + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_bytes", CTLFLAG_RD, &sc->tx_bytes, "Tx bytes"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "tx_packets", CTLFLAG_RD, &sc->tx_packets, 0, + + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_packets", CTLFLAG_RD, &sc->tx_packets, "Tx packets"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "tx_skip", CTLFLAG_RD, &sc->tx_skip, 0, + + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_skip", CTLFLAG_RD, &sc->tx_skip, "Tx skip count for GDMA ports"); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, - "tx_collision", CTLFLAG_RD, &sc->tx_collision, 0, + + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, + "tx_collision", CTLFLAG_RD, &sc->tx_collision, "Tx collision count for GDMA ports"); } diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index 5a88d59fb74b..0d2ae4735b1d 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -7092,7 +7092,7 @@ hdaa_pcm_attach(device_t dev) "rec.autosrc", &pdevinfo->autorecsrc); SYSCTL_ADD_INT(&d->rec_sysctl_ctx, SYSCTL_CHILDREN(d->rec_sysctl_tree), OID_AUTO, - "autosrc", CTLTYPE_INT | CTLFLAG_RW, + "autosrc", CTLFLAG_RW, &pdevinfo->autorecsrc, 0, "Automatic recording source selection"); } diff --git a/sys/dev/vxge/vxge.c b/sys/dev/vxge/vxge.c index e23e701567aa..b89ba6cca51e 100644 --- a/sys/dev/vxge/vxge.c +++ b/sys/dev/vxge/vxge.c @@ -3357,100 +3357,100 @@ vxge_device_hw_info_print(vxge_dev_t *vdev) SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Driver version", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_DRV_VERSION], + vdev->config.nic_attr[VXGE_PRINT_DRV_VERSION], 0, "Driver version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Serial number", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_SERIAL_NO], + vdev->config.nic_attr[VXGE_PRINT_SERIAL_NO], 0, "Serial number"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Part number", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PART_NO], + vdev->config.nic_attr[VXGE_PRINT_PART_NO], 0, "Part number"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Firmware version", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_FW_VERSION], + vdev->config.nic_attr[VXGE_PRINT_FW_VERSION], 0, "Firmware version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Firmware date", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_FW_DATE], + vdev->config.nic_attr[VXGE_PRINT_FW_DATE], 0, "Firmware date"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Link width", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PCIE_INFO], + vdev->config.nic_attr[VXGE_PRINT_PCIE_INFO], 0, "Link width"); if (vdev->is_privilaged) { SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Function mode", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_FUNC_MODE], + vdev->config.nic_attr[VXGE_PRINT_FUNC_MODE], 0, "Function mode"); } SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Interrupt type", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_INTR_MODE], + vdev->config.nic_attr[VXGE_PRINT_INTR_MODE], 0, "Interrupt type"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "VPath(s) opened", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_VPATH_COUNT], + vdev->config.nic_attr[VXGE_PRINT_VPATH_COUNT], 0, "VPath(s) opened"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Adapter Type", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_ADAPTER_TYPE], + vdev->config.nic_attr[VXGE_PRINT_ADAPTER_TYPE], 0, "Adapter Type"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pmd port 0", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PMD_PORTS_0], + vdev->config.nic_attr[VXGE_PRINT_PMD_PORTS_0], 0, "pmd port"); if (hw_info->ports > 1) { SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pmd port 1", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PMD_PORTS_1], + vdev->config.nic_attr[VXGE_PRINT_PMD_PORTS_1], 0, "pmd port"); if (vdev->is_privilaged) { SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Port Mode", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PORT_MODE], + vdev->config.nic_attr[VXGE_PRINT_PORT_MODE], 0, "Port Mode"); if (vdev->port_mode != VXGE_HAL_DP_NP_MODE_SINGLE_PORT) SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "Port Failure", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_PORT_FAILURE], + vdev->config.nic_attr[VXGE_PRINT_PORT_FAILURE], 0, "Port Failure"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "L2 Switch", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_L2SWITCH_MODE], + vdev->config.nic_attr[VXGE_PRINT_L2SWITCH_MODE], 0, "L2 Switch"); } } SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "LRO mode", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_LRO_MODE], + vdev->config.nic_attr[VXGE_PRINT_LRO_MODE], 0, "LRO mode"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "RTH mode", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_RTH_MODE], + vdev->config.nic_attr[VXGE_PRINT_RTH_MODE], 0, "RTH mode"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "TSO mode", CTLFLAG_RD, - &vdev->config.nic_attr[VXGE_PRINT_TSO_MODE], + vdev->config.nic_attr[VXGE_PRINT_TSO_MODE], 0, "TSO mode"); } diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index a652c75f0174..c3c8d920911c 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -470,7 +470,7 @@ netfront_attach(device_t dev) #if __FreeBSD_version >= 700000 SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "enable_lro", CTLTYPE_INT|CTLFLAG_RW, + OID_AUTO, "enable_lro", CTLFLAG_RW, &xn_enable_lro, 0, "Large Receive Offload"); #endif diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index da21f97db390..a408725a604e 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -109,10 +109,10 @@ SYSCTL_PROC(_kern, OID_AUTO, devname, NULL, 0, sysctl_devname, "", "devname(3) handler"); SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD, - 0, sizeof(struct cdev), "sizeof(struct cdev)"); + SYSCTL_NULL_INT_PTR, sizeof(struct cdev), "sizeof(struct cdev)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev_priv, CTLFLAG_RD, - 0, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)"); + SYSCTL_NULL_INT_PTR, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)"); struct cdev * devfs_alloc(int flags) diff --git a/sys/fs/fuse/fuse_main.c b/sys/fs/fuse/fuse_main.c index bf73a45fb5b3..d09e1c394515 100644 --- a/sys/fs/fuse/fuse_main.c +++ b/sys/fs/fuse/fuse_main.c @@ -93,9 +93,9 @@ static struct vfsconf fuse_vfsconf = { }; SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_major, CTLFLAG_RD, - 0, FUSE_KERNEL_VERSION, "FUSE kernel abi major version"); + SYSCTL_NULL_INT_PTR, FUSE_KERNEL_VERSION, "FUSE kernel abi major version"); SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_minor, CTLFLAG_RD, - 0, FUSE_KERNEL_MINOR_VERSION, "FUSE kernel abi minor version"); + SYSCTL_NULL_INT_PTR, FUSE_KERNEL_MINOR_VERSION, "FUSE kernel abi minor version"); /****************************** * diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index 73887456b56b..c00a96cb10f6 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -114,10 +114,10 @@ struct vfsops fuse_vfsops = { }; SYSCTL_INT(_vfs_fuse, OID_AUTO, init_backgrounded, CTLFLAG_RD, - 0, 1, "indicate async handshake"); + SYSCTL_NULL_INT_PTR, 1, "indicate async handshake"); static int fuse_enforce_dev_perms = 0; -SYSCTL_LONG(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, +SYSCTL_INT(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, &fuse_enforce_dev_perms, 0, "enforce fuse device permissions for secondary mounts"); static unsigned sync_unmount = 1; diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c index 3559daf5fcab..e6021d3460fb 100644 --- a/sys/geom/geom_kern.c +++ b/sys/geom/geom_kern.c @@ -223,12 +223,12 @@ SYSCTL_INT(_kern_geom, OID_AUTO, collectstats, CTLFLAG_RW, "Control statistics collection on GEOM providers and consumers"); SYSCTL_INT(_debug_sizeof, OID_AUTO, g_class, CTLFLAG_RD, - 0, sizeof(struct g_class), "sizeof(struct g_class)"); + SYSCTL_NULL_INT_PTR, sizeof(struct g_class), "sizeof(struct g_class)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, g_geom, CTLFLAG_RD, - 0, sizeof(struct g_geom), "sizeof(struct g_geom)"); + SYSCTL_NULL_INT_PTR, sizeof(struct g_geom), "sizeof(struct g_geom)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, g_provider, CTLFLAG_RD, - 0, sizeof(struct g_provider), "sizeof(struct g_provider)"); + SYSCTL_NULL_INT_PTR, sizeof(struct g_provider), "sizeof(struct g_provider)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, g_consumer, CTLFLAG_RD, - 0, sizeof(struct g_consumer), "sizeof(struct g_consumer)"); + SYSCTL_NULL_INT_PTR, sizeof(struct g_consumer), "sizeof(struct g_consumer)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, g_bioq, CTLFLAG_RD, - 0, sizeof(struct g_bioq), "sizeof(struct g_bioq)"); + SYSCTL_NULL_INT_PTR, sizeof(struct g_bioq), "sizeof(struct g_bioq)"); diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 341f998f9292..49339db7a270 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -110,7 +110,7 @@ static struct cpuset *cpuset_zero, *cpuset_default; /* Return the size of cpuset_t at the kernel level */ SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, - 0, sizeof(cpuset_t), "sizeof(cpuset_t)"); + SYSCTL_NULL_INT_PTR, sizeof(cpuset_t), "sizeof(cpuset_t)"); cpuset_t *cpuset_root; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 43d471c00568..9896515e8bf9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3342,7 +3342,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS) } static SYSCTL_NODE(_kern_proc, KERN_PROC_OFILEDESC, ofiledesc, - CTLFLAG_RD||CTLFLAG_MPSAFE, sysctl_kern_proc_ofiledesc, + CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_ofiledesc, "Process ofiledesc entries"); #endif /* COMPAT_FREEBSD7 */ diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 9d3153b4a5bb..3bd8fca49b69 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -94,7 +94,7 @@ SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD|CTLFLAG_MPSAFE| CTLFLAG_CAPRD, osrelease, 0, "Operating system release"); SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, BSD, "Operating system revision"); + SYSCTL_NULL_INT_PTR, BSD, "Operating system revision"); SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE, version, 0, "Kernel version"); @@ -122,24 +122,24 @@ SYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &maxusers, 0, "Hint for kernel tuning"); SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, ARG_MAX, "Maximum bytes of argument to execve(2)"); + SYSCTL_NULL_INT_PTR, ARG_MAX, "Maximum bytes of argument to execve(2)"); SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, _POSIX_VERSION, "Version of POSIX attempting to comply to"); + SYSCTL_NULL_INT_PTR, _POSIX_VERSION, "Version of POSIX attempting to comply to"); SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RDTUN | CTLFLAG_NOFETCH | CTLFLAG_CAPRD, &ngroups_max, 0, "Maximum number of supplemental groups a user can belong to"); SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, 1, "Whether job control is available"); + SYSCTL_NULL_INT_PTR, 1, "Whether job control is available"); #ifdef _POSIX_SAVED_IDS SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, 1, "Whether saved set-group/user ID is available"); + SYSCTL_NULL_INT_PTR, 1, "Whether saved set-group/user ID is available"); #else SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, 0, "Whether saved set-group/user ID is available"); + SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available"); #endif char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ @@ -151,10 +151,10 @@ SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_ncpus, 0, "Number of active CPUs"); SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, BYTE_ORDER, "System byte order"); + SYSCTL_NULL_INT_PTR, BYTE_ORDER, "System byte order"); SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD|CTLFLAG_CAPRD, - 0, PAGE_SIZE, "System memory page size"); + SYSCTL_NULL_INT_PTR, PAGE_SIZE, "System memory page size"); static int sysctl_kern_arnd(SYSCTL_HANDLER_ARGS) @@ -457,50 +457,51 @@ FEATURE(compat_freebsd7, "Compatible with FreeBSD 7"); SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD, "", 0, "PATH that finds all the standard utilities"); SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD, - 0, 0, "Max ibase/obase values in bc(1)"); + SYSCTL_NULL_INT_PTR, 0, "Max ibase/obase values in bc(1)"); SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD, - 0, 0, "Max array size in bc(1)"); + SYSCTL_NULL_INT_PTR, 0, "Max array size in bc(1)"); SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD, - 0, 0, "Max scale value in bc(1)"); + SYSCTL_NULL_INT_PTR, 0, "Max scale value in bc(1)"); SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD, - 0, 0, "Max string length in bc(1)"); + SYSCTL_NULL_INT_PTR, 0, "Max string length in bc(1)"); SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD, - 0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry"); -SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, ""); + SYSCTL_NULL_INT_PTR, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry"); +SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, + SYSCTL_NULL_INT_PTR, 0, ""); SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD, - 0, 0, "Max length (bytes) of a text-processing utility's input line"); + SYSCTL_NULL_INT_PTR, 0, "Max length (bytes) of a text-processing utility's input line"); SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD, - 0, 0, "Maximum number of repeats of a regexp permitted"); + SYSCTL_NULL_INT_PTR, 0, "Maximum number of repeats of a regexp permitted"); SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD, - 0, 0, + SYSCTL_NULL_INT_PTR, 0, "The version of POSIX 1003.2 with which the system attempts to comply"); SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD, - 0, 0, "Whether C development supports the C bindings option"); + SYSCTL_NULL_INT_PTR, 0, "Whether C development supports the C bindings option"); SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD, - 0, 0, "Whether system supports the C development utilities option"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports the C development utilities option"); SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD, - 0, 0, ""); + SYSCTL_NULL_INT_PTR, 0, ""); SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD, - 0, 0, "Whether system supports FORTRAN development utilities"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports FORTRAN development utilities"); SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD, - 0, 0, "Whether system supports FORTRAN runtime utilities"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports FORTRAN runtime utilities"); SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD, - 0, 0, "Whether system supports creation of locales"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports creation of locales"); SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD, - 0, 0, "Whether system supports software development utilities"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports software development utilities"); SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD, - 0, 0, "Whether system supports the user portability utilities"); + SYSCTL_NULL_INT_PTR, 0, "Whether system supports the user portability utilities"); SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD, - 0, 0, "Min Maximum number of streams a process may have open at one time"); + SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of streams a process may have open at one time"); SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD, - 0, 0, "Min Maximum number of types supported for timezone names"); + SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of types supported for timezone names"); #include SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD, - 0, sizeof(struct vnode), "sizeof(struct vnode)"); + SYSCTL_NULL_INT_PTR, sizeof(struct vnode), "sizeof(struct vnode)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD, - 0, sizeof(struct proc), "sizeof(struct proc)"); + SYSCTL_NULL_INT_PTR, sizeof(struct proc), "sizeof(struct proc)"); static int sysctl_kern_pid_max(SYSCTL_HANDLER_ARGS) @@ -533,13 +534,13 @@ SYSCTL_PROC(_kern, OID_AUTO, pid_max, CTLTYPE_INT | #include #include SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, - 0, sizeof(struct bio), "sizeof(struct bio)"); + SYSCTL_NULL_INT_PTR, sizeof(struct bio), "sizeof(struct bio)"); SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD, - 0, sizeof(struct buf), "sizeof(struct buf)"); + SYSCTL_NULL_INT_PTR, sizeof(struct buf), "sizeof(struct buf)"); #include SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD, - 0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)"); + SYSCTL_NULL_INT_PTR, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)"); /* XXX compatibility, remove for 6.0 */ #include diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 02a8cf911e44..9501ba2ba07d 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -101,8 +101,7 @@ static fixpt_t cexp[3] = { }; /* kernel uses `FSCALE', userland (SHOULD) use kern.fscale */ -static int fscale __unused = FSCALE; -SYSCTL_INT(_kern, OID_AUTO, fscale, CTLFLAG_RD, 0, FSCALE, ""); +SYSCTL_INT(_kern, OID_AUTO, fscale, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FSCALE, ""); static void loadav(void *arg); diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index cb69669a1ae4..b026f8c3cc4e 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -575,4 +575,4 @@ devstat_free(struct devstat *dsp) } SYSCTL_INT(_debug_sizeof, OID_AUTO, devstat, CTLFLAG_RD, - NULL, sizeof(struct devstat), "sizeof(struct devstat)"); + SYSCTL_NULL_INT_PTR, sizeof(struct devstat), "sizeof(struct devstat)"); diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index c26d271663f6..d20c56b85ef4 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -108,11 +108,11 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code, kdb_sysctl_trap_code, "I", "set to cause a page fault via code access"); SYSCTL_INT(_debug_kdb, OID_AUTO, break_to_debugger, - CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_SECURE, + CTLFLAG_RWTUN | CTLFLAG_SECURE, &kdb_break_to_debugger, 0, "Enable break to debugger"); SYSCTL_INT(_debug_kdb, OID_AUTO, alt_break_to_debugger, - CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_SECURE, + CTLFLAG_RWTUN | CTLFLAG_SECURE, &kdb_alt_break_to_debugger, 0, "Enable alternative break to debugger"); /* diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c index 13c678df464e..f2e6e3275cd6 100644 --- a/sys/kern/subr_uio.c +++ b/sys/kern/subr_uio.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV, +SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, UIO_MAXIOV, "Maximum number of elements in an I/O vector; sysconf(_SC_IOV_MAX)"); static int uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 96ddbd97a8fc..55e3217b18a2 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -264,7 +264,7 @@ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, "VFS namecache enabled"); /* Export size information to userland */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, namecache, CTLFLAG_RD, 0, +SYSCTL_INT(_debug_sizeof, OID_AUTO, namecache, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct namecache), "sizeof(struct namecache)"); /* diff --git a/sys/mips/mips/busdma_machdep.c b/sys/mips/mips/busdma_machdep.c index 823ae9cb9745..083e8f534290 100644 --- a/sys/mips/mips/busdma_machdep.c +++ b/sys/mips/mips/busdma_machdep.c @@ -1262,9 +1262,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index b39f71dc24a7..a5c7d7c34fd8 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -155,7 +155,7 @@ SYSCTL_PROC(_net_wlan, OID_AUTO, addba_backoff, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_addba_backoff, 0, ieee80211_sysctl_msecs_ticks, "I", "ADDBA request backoff (ms)"); static int ieee80211_addba_maxtries = 3;/* max ADDBA requests before backoff */ -SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLFLAG_RW, &ieee80211_addba_maxtries, 0, "max ADDBA requests sent before backoff"); static int ieee80211_bar_timeout = -1; /* timeout waiting for BAR response */ diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 751f1e737731..8d5730205f6b 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -168,7 +168,7 @@ struct ieee80211_hwmp_state { static SYSCTL_NODE(_net_wlan, OID_AUTO, hwmp, CTLFLAG_RD, 0, "IEEE 802.11s HWMP parameters"); static int ieee80211_hwmp_targetonly = 0; -SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, targetonly, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, targetonly, CTLFLAG_RW, &ieee80211_hwmp_targetonly, 0, "Set TO bit on generated PREQs"); static int ieee80211_hwmp_pathtimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index e84d7f777bd7..8cd95c692fb6 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -128,11 +128,11 @@ SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, backofftimeout, CTLTYPE_INT | CTLFLAG_RW, "Backoff timeout (msec). This is to throutles peering forever when " "not receving answer or is rejected by a neighbor"); static int ieee80211_mesh_maxretries = 2; -SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxretries, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxretries, CTLFLAG_RW, &ieee80211_mesh_maxretries, 0, "Maximum retries during peer link establishment"); static int ieee80211_mesh_maxholding = 2; -SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxholding, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxholding, CTLFLAG_RW, &ieee80211_mesh_maxholding, 0, "Maximum times we are allowed to transition to HOLDING state before " "backinoff during peer link establishment"); diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c index 598c17ef7fa9..81a4b43075f3 100644 --- a/sys/net80211/ieee80211_superg.c +++ b/sys/net80211/ieee80211_superg.c @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); memcpy(dst, src, sizeof(struct ether_header)) static int ieee80211_ffppsmin = 2; /* pps threshold for ff aggregation */ -SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLFLAG_RW, &ieee80211_ffppsmin, 0, "min packet rate before fast-frame staging"); static int ieee80211_ffagemax = -1; /* max time frames held on stage q */ SYSCTL_PROC(_net_wlan, OID_AUTO, ffagemax, CTLTYPE_INT | CTLFLAG_RW, diff --git a/sys/netgraph/bluetooth/common/ng_bluetooth.c b/sys/netgraph/bluetooth/common/ng_bluetooth.c index 6cd587e04024..8f97da45c55d 100644 --- a/sys/netgraph/bluetooth/common/ng_bluetooth.c +++ b/sys/netgraph/bluetooth/common/ng_bluetooth.c @@ -57,7 +57,7 @@ static u_int32_t bluetooth_sco_rtx_timeout_value = 60; /* sec */ SYSCTL_NODE(_net, OID_AUTO, bluetooth, CTLFLAG_RW, 0, "Bluetooth family"); SYSCTL_INT(_net_bluetooth, OID_AUTO, version, - CTLFLAG_RD, 0, NG_BLUETOOTH_VERSION, "Version of the stack"); + CTLFLAG_RD, SYSCTL_NULL_INT_PTR, NG_BLUETOOTH_VERSION, "Version of the stack"); /* * HCI diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 1970965e2e25..b5e285e42c7e 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3249,8 +3249,8 @@ static moduledata_t netgraph_mod = { }; DECLARE_MODULE(netgraph, netgraph_mod, SI_SUB_NETGRAPH, SI_ORDER_FIRST); SYSCTL_NODE(_net, OID_AUTO, graph, CTLFLAG_RW, 0, "netgraph Family"); -SYSCTL_INT(_net_graph, OID_AUTO, abi_version, CTLFLAG_RD, 0, NG_ABI_VERSION,""); -SYSCTL_INT(_net_graph, OID_AUTO, msg_version, CTLFLAG_RD, 0, NG_VERSION, ""); +SYSCTL_INT(_net_graph, OID_AUTO, abi_version, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, NG_ABI_VERSION,""); +SYSCTL_INT(_net_graph, OID_AUTO, msg_version, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, NG_VERSION, ""); #ifdef NETGRAPH_DEBUG void diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 2134fee27014..38da313b836a 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -1199,9 +1199,9 @@ ngs_mod_event(module_t mod, int event, void *data) VNET_DOMAIN_SET(ng); -SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, 0, AF_NETGRAPH, ""); +SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, AF_NETGRAPH, ""); static SYSCTL_NODE(_net_graph, OID_AUTO, data, CTLFLAG_RW, 0, "DATA"); -SYSCTL_INT(_net_graph_data, OID_AUTO, proto, CTLFLAG_RD, 0, NG_DATA, ""); +SYSCTL_INT(_net_graph_data, OID_AUTO, proto, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, NG_DATA, ""); static SYSCTL_NODE(_net_graph, OID_AUTO, control, CTLFLAG_RW, 0, "CONTROL"); -SYSCTL_INT(_net_graph_control, OID_AUTO, proto, CTLFLAG_RD, 0, NG_CONTROL, ""); +SYSCTL_INT(_net_graph_control, OID_AUTO, proto, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, NG_CONTROL, ""); diff --git a/sys/netinet/cc/cc_chd.c b/sys/netinet/cc/cc_chd.c index 5f64f6ca4d8b..5168d5f6c540 100644 --- a/sys/netinet/cc/cc_chd.c +++ b/sys/netinet/cc/cc_chd.c @@ -484,11 +484,11 @@ SYSCTL_VNET_PROC(_net_inet_tcp_cc_chd, OID_AUTO, queue_threshold, "IU", "Queueing congestion threshold in ticks"); SYSCTL_VNET_UINT(_net_inet_tcp_cc_chd, OID_AUTO, queue_min, - CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_qmin), 5, + CTLFLAG_RW, &VNET_NAME(chd_qmin), 5, "Minimum queueing delay threshold in ticks"); SYSCTL_VNET_UINT(_net_inet_tcp_cc_chd, OID_AUTO, use_max, - CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_use_max), 1, + CTLFLAG_RW, &VNET_NAME(chd_use_max), 1, "Use the maximum RTT seen within the measurement period (RTT) " "as the basic delay measurement for the algorithm."); diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 3702a2e7b696..634c67602b0b 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -133,7 +133,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rexmit_drop_options, CTLFLAG_RW, static VNET_DEFINE(int, tcp_pmtud_blackhole_detect); #define V_tcp_pmtud_blackhole_detect VNET(tcp_pmtud_blackhole_detect) SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_detection, - CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_detect), 0, "Path MTU Discovery Black Hole Detection Enabled"); @@ -141,7 +141,7 @@ static VNET_DEFINE(int, tcp_pmtud_blackhole_activated); #define V_tcp_pmtud_blackhole_activated \ VNET(tcp_pmtud_blackhole_activated) SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated, - CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + CTLFLAG_RD|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_activated), 0, "Path MTU Discovery Black Hole Detection, Activation Count"); @@ -149,14 +149,14 @@ static VNET_DEFINE(int, tcp_pmtud_blackhole_activated_min_mss); #define V_tcp_pmtud_blackhole_activated_min_mss \ VNET(tcp_pmtud_blackhole_activated_min_mss) SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated_min_mss, - CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + CTLFLAG_RD|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_activated_min_mss), 0, "Path MTU Discovery Black Hole Detection, Activation Count at min MSS"); static VNET_DEFINE(int, tcp_pmtud_blackhole_failed); #define V_tcp_pmtud_blackhole_failed VNET(tcp_pmtud_blackhole_failed) SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_failed, - CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + CTLFLAG_RD|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_failed), 0, "Path MTU Discovery Black Hole Detection, Failure Count"); @@ -164,7 +164,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_failed, static VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200; #define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss, - CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_mss), 0, "Path MTU Discovery Black Hole Detection lowered MSS"); #endif @@ -173,7 +173,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss, static VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220; #define V_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss) SYSCTL_INT(_net_inet_tcp, OID_AUTO, v6pmtud_blackhole_mss, - CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_v6pmtud_blackhole_mss), 0, "Path MTU Discovery IPv6 Black Hole Detection lowered MSS"); #endif diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index 87413bd6cacf..fcb85f3bcf0a 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -86,7 +86,7 @@ struct secpolicy { u_int state; /* 0: dead, others: alive */ #define IPSEC_SPSTATE_DEAD 0 #define IPSEC_SPSTATE_ALIVE 1 - u_int16_t policy; /* policy_type per pfkeyv2.h */ + u_int policy; /* policy_type per pfkeyv2.h */ u_int16_t scangen; /* scan generation # */ struct ipsecrequest *req; /* pointer to the ipsec request tree, */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 16cd7fbfe96f..329879151cca 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -359,9 +359,9 @@ u_long pf_srchashmask; static u_long pf_hashsize; static u_long pf_srchashsize; -SYSCTL_UINT(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN, +SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN, &pf_hashsize, 0, "Size of pf(4) states hashtable"); -SYSCTL_UINT(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, +SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, &pf_srchashsize, 0, "Size of pf(4) source nodes hashtable"); VNET_DEFINE(void *, pf_swi_cookie); diff --git a/sys/ofed/drivers/net/mlx4/mlx4_en.h b/sys/ofed/drivers/net/mlx4/mlx4_en.h index 1cb19e3f77e8..30f7ead74691 100644 --- a/sys/ofed/drivers/net/mlx4/mlx4_en.h +++ b/sys/ofed/drivers/net/mlx4/mlx4_en.h @@ -555,11 +555,11 @@ struct mlx4_en_priv { u16 tx_usecs; u16 tx_frames; u32 pkt_rate_low; - u16 rx_usecs_low; + u32 rx_usecs_low; u32 pkt_rate_high; - u16 rx_usecs_high; - u16 sample_interval; - u16 adaptive_rx_coal; + u32 rx_usecs_high; + u32 sample_interval; + u32 adaptive_rx_coal; u32 msg_enable; u32 loopback_ok; u32 validate_loopback; diff --git a/sys/powerpc/powermac/fcu.c b/sys/powerpc/powermac/fcu.c index 109833dbd796..3d5e79f0ee10 100644 --- a/sys/powerpc/powermac/fcu.c +++ b/sys/powerpc/powermac/fcu.c @@ -621,13 +621,13 @@ fcu_attach_fans(device_t dev) OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "minrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].fan.min_rpm), - sizeof(int), "Minimum allowed RPM"); + "minrpm", CTLFLAG_RD, + &(sc->sc_fans[i].fan.min_rpm), 0, + "Minimum allowed RPM"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "maxrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].fan.max_rpm), - sizeof(int), "Maximum allowed RPM"); + "maxrpm", CTLFLAG_RD, + &(sc->sc_fans[i].fan.max_rpm), 0, + "Maximum allowed RPM"); /* I use i to pass the fan id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm", CTLTYPE_INT | CTLFLAG_RW, dev, i, @@ -641,13 +641,13 @@ fcu_attach_fans(device_t dev) OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "minpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].fan.min_rpm), - sizeof(int), "Minimum allowed PWM in %"); + "minpwm", CTLFLAG_RD, + &(sc->sc_fans[i].fan.min_rpm), 0, + "Minimum allowed PWM in %"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "maxpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].fan.max_rpm), - sizeof(int), "Maximum allowed PWM in %"); + "maxpwm", CTLFLAG_RD, + &(sc->sc_fans[i].fan.max_rpm), 0, + "Maximum allowed PWM in %"); /* I use i to pass the fan id or'ed with the type * of info I want to display/modify. */ diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c index 5b74da344f11..bc8ea435871d 100644 --- a/sys/powerpc/powermac/smu.c +++ b/sys/powerpc/powermac/smu.c @@ -1033,12 +1033,12 @@ smu_attach_fans(device_t dev, phandle_t fanroot) OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "minrpm", CTLTYPE_INT | CTLFLAG_RD, - &fan->fan.min_rpm, sizeof(int), + "minrpm", CTLFLAG_RD, + &fan->fan.min_rpm, 0, "Minimum allowed RPM"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "maxrpm", CTLTYPE_INT | CTLFLAG_RD, - &fan->fan.max_rpm, sizeof(int), + "maxrpm", CTLFLAG_RD, + &fan->fan.max_rpm, 0, "Maximum allowed RPM"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm",CTLTYPE_INT | CTLFLAG_RW | @@ -1054,12 +1054,12 @@ smu_attach_fans(device_t dev, phandle_t fanroot) OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "minpwm", CTLTYPE_INT | CTLFLAG_RD, - &fan->fan.min_rpm, sizeof(int), + "minpwm", CTLFLAG_RD, + &fan->fan.min_rpm, 0, "Minimum allowed PWM in %"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "maxpwm", CTLTYPE_INT | CTLFLAG_RD, - &fan->fan.max_rpm, sizeof(int), + "maxpwm", CTLFLAG_RD, + &fan->fan.max_rpm, 0, "Maximum allowed PWM in %"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "pwm",CTLTYPE_INT | CTLFLAG_RW | diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index 3a9f91326395..e0f2859549b1 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -191,7 +191,7 @@ static char model[64]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, ""); int cpu_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU; -SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features, CTLTYPE_INT | CTLFLAG_RD, +SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features, CTLFLAG_RD, &cpu_features, sizeof(cpu_features), "IX", "PowerPC CPU features"); /* Provide some user-friendly aliases for bits in cpu_features */ diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 21ad521800e6..d204b703780f 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -226,53 +226,6 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define SYSCTL_NODE_CHILDREN(parent, name) \ sysctl__##parent##_##name.oid_children -/* - * These macros provide type safety for sysctls. SYSCTL_ALLOWED_TYPES() - * defines a transparent union of the allowed types. SYSCTL_ASSERT_TYPE() - * and SYSCTL_ADD_ASSERT_TYPE() use the transparent union to assert that - * the pointer matches the allowed types. - * - * The allow_0 member allows a literal 0 to be passed for ptr. - */ -#define SYSCTL_ALLOWED_TYPES(type, decls) \ - union sysctl_##type { \ - long allow_0; \ - decls \ - } __attribute__((__transparent_union__)); \ - \ - static inline void * \ - __sysctl_assert_##type(union sysctl_##type ptr) \ - { \ - return (ptr.a); \ - } \ - struct __hack - -SYSCTL_ALLOWED_TYPES(INT, int *a; ); -SYSCTL_ALLOWED_TYPES(UINT, unsigned int *a; ); -SYSCTL_ALLOWED_TYPES(LONG, long *a; ); -SYSCTL_ALLOWED_TYPES(ULONG, unsigned long *a; ); -SYSCTL_ALLOWED_TYPES(INT64, int64_t *a; long long *b; ); -SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; ); - -#ifdef notyet -#define SYSCTL_ADD_ASSERT_TYPE(type, ptr) \ - __sysctl_assert_ ## type (ptr) -#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name) \ - _SYSCTL_ASSERT_TYPE(type, ptr, __LINE__, parent##_##name) -#else -#define SYSCTL_ADD_ASSERT_TYPE(type, ptr) ptr -#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name) -#endif -#define _SYSCTL_ASSERT_TYPE(t, p, l, id) \ - __SYSCTL_ASSERT_TYPE(t, p, l, id) -#define __SYSCTL_ASSERT_TYPE(type, ptr, line, id) \ - static inline void \ - sysctl_assert_##line##_##id(void) \ - { \ - (void)__sysctl_assert_##type(ptr); \ - } \ - struct __hack - #ifndef NO_SYSCTL_DESCR #define __DESCR(d) d #else @@ -313,173 +266,263 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; ); /* This constructs a root node from which other nodes can hang. */ #define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \ SYSCTL_OID_RAW(sysctl___##name, &sysctl__children, \ - nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ - handler, "N", descr) + nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ + handler, "N", descr); \ + CTASSERT(((access) & CTLTYPE) == 0) /* This constructs a node from which other oids can hang. */ -#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ - SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", descr) +#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ + SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \ + NULL, 0, handler, "N", descr); \ + CTASSERT(((access) & CTLTYPE) == 0) -#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", __DESCR(descr)) +#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ +({ \ + CTASSERT(((access) & CTLTYPE) == 0); \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ + NULL, 0, handler, "N", __DESCR(descr)); \ +}) #define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ +({ \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, &sysctl__children, nbr, name, \ - CTLTYPE_NODE|(access), NULL, 0, handler, "N", __DESCR(descr)) + CTLTYPE_NODE|(access), \ + NULL, 0, handler, "N", __DESCR(descr)); \ +}) /* Oid for a string. len can be 0 to indicate '\0' termination. */ -#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ - arg, len, sysctl_handle_string, "A", descr) +#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ + arg, len, sysctl_handle_string, "A", descr); \ + CTASSERT(((access) & CTLTYPE) == 0) -#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ - arg, len, sysctl_handle_string, "A", __DESCR(descr)) +#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ +({ \ + char *__arg = (arg); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ + __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \ +}) -/* Oid for an int. If ptr is NULL, val is returned. */ -#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(INT, ptr, parent, name); \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_int, "I", descr) +/* Oid for an int. If ptr is SYSCTL_NULL_INT_PTR, val is returned. */ +#define SYSCTL_NULL_INT_PTR ((int *)NULL) +#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_int, "I", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(int) == sizeof(*(ptr))) #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ +({ \ + int *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(INT, ptr), val, \ - sysctl_handle_int, "I", __DESCR(descr)) + __ptr, val, sysctl_handle_int, "I", __DESCR(descr)); \ +}) /* Oid for an unsigned int. If ptr is NULL, val is returned. */ -#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(UINT, ptr, parent, name); \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_int, "IU", descr) +#define SYSCTL_NULL_UINT_PTR ((unsigned *)NULL) +#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_int, "IU", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(unsigned) == sizeof(*(ptr))) #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ +({ \ + unsigned *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(UINT, ptr), val, \ - sysctl_handle_int, "IU", __DESCR(descr)) + __ptr, val, sysctl_handle_int, "IU", __DESCR(descr)); \ +}) /* Oid for a long. The pointer must be non NULL. */ -#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(LONG, ptr, parent, name); \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_long, "L", descr) +#define SYSCTL_NULL_LONG_PTR ((long *)NULL) +#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_long, "L", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(long) == sizeof(*(ptr))) #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + long *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(LONG, ptr), 0, \ - sysctl_handle_long, "L", __DESCR(descr)) + __ptr, 0, sysctl_handle_long, "L", __DESCR(descr)); \ +}) /* Oid for an unsigned long. The pointer must be non NULL. */ +#define SYSCTL_NULL_ULONG_PTR ((unsigned long *)NULL) #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(ULONG, ptr, parent, name); \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_long, "LU", descr) + ptr, val, sysctl_handle_long, "LU", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(unsigned long) == sizeof(*(ptr))) #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + unsigned long *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(ULONG, ptr), 0, \ - sysctl_handle_long, "LU", __DESCR(descr)) + __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)); \ +}) /* Oid for a quad. The pointer must be non NULL. */ -#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(INT64, ptr, parent, name); \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_64, "Q", descr) +#define SYSCTL_NULL_QUAD_PTR ((int64_T *)NULL) +#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_64, "Q", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(int64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + int64_t *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(INT64, ptr), 0, \ - sysctl_handle_64, "Q", __DESCR(descr)) + __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr)); \ +}) +#define SYSCTL_NULL_UQUAD_PTR ((uint64_t *)NULL) #define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name); \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_64, "QU", descr) + ptr, val, sysctl_handle_64, "QU", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(uint64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + uint64_t *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0, \ - sysctl_handle_64, "QU", __DESCR(descr)) + __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr)); \ +}) + +/* Oid for a CPU dependant variable */ +#define SYSCTL_ADD_UAUTO(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + struct sysctl_oid *__ret; \ + CTASSERT(sizeof(uint64_t) == sizeof(*(ptr)) || \ + sizeof(unsigned) == sizeof(*(ptr))); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + if (sizeof(uint64_t) == sizeof(*(ptr))) { \ + __ret = sysctl_add_oid(ctx, parent, nbr, name, \ + CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ + (ptr), 0, sysctl_handle_64, "QU", \ + __DESCR(descr)); \ + } else { \ + __ret = sysctl_add_oid(ctx, parent, nbr, name, \ + CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ + (ptr), 0, sysctl_handle_int, "IU", \ + __DESCR(descr)); \ + } \ + __ret; \ +}) /* Oid for a 64-bit unsigned counter(9). The pointer must be non NULL. */ #define SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr) \ - SYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name); \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - ptr, 0, sysctl_handle_counter_u64, "QU", descr) + (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(sizeof(counter_u64_t) == sizeof(*(ptr))); \ + CTASSERT(sizeof(uint64_t) == sizeof(**(ptr))) -#define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr)\ +#define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + counter_u64_t *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0, \ - sysctl_handle_counter_u64, "QU", __DESCR(descr)) + __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \ +}) /* Oid for an opaque object. Specified by a pointer and a length. */ -#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, descr) +#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, len, sysctl_handle_opaque, fmt, descr); \ + CTASSERT(((access) & CTLTYPE) == 0) -#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)) +#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \ +({ \ + CTASSERT(((access) & CTLTYPE) == 0); \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)); \ +}) /* Oid for a struct. Specified by a pointer and a type. */ -#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, sizeof(struct type), sysctl_handle_opaque, \ - "S," #type, descr) +#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, sizeof(struct type), sysctl_handle_opaque, \ + "S," #type, descr); \ + CTASSERT(((access) & CTLTYPE) == 0) #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr)) +({ \ + CTASSERT(((access) & CTLTYPE) == 0); \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + (ptr), sizeof(struct type), \ + sysctl_handle_opaque, "S," #type, __DESCR(descr)); \ +}) /* Oid for a procedure. Specified by a pointer and an arg. */ #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ - CTASSERT(((access) & CTLTYPE) != 0); \ - SYSCTL_OID(parent, nbr, name, (access), \ - ptr, arg, handler, fmt, descr) + SYSCTL_OID(parent, nbr, name, (access), \ + ptr, arg, handler, fmt, descr); \ + CTASSERT(((access) & CTLTYPE) != 0) #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, (access), \ - ptr, arg, handler, fmt, __DESCR(descr)) +({ \ + CTASSERT(((access) & CTLTYPE) != 0); \ + sysctl_add_oid(ctx, parent, nbr, name, (access), \ + (ptr), (arg), (handler), (fmt), __DESCR(descr)); \ +}) /* Oid to handle limits on uma(9) zone specified by pointer. */ -#define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr) \ - SYSCTL_ASSERT_TYPE(INT, ptr, parent, name); \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - ptr, 0, sysctl_handle_uma_zone_max, "I", descr) -#define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr)\ +#define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ + (ptr), 0, sysctl_handle_uma_zone_max, "I", descr); \ + CTASSERT(((access) & CTLTYPE) == 0) + +#define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + uma_zone_t __ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - SYSCTL_ADD_ASSERT_TYPE(INT, ptr), 0, \ - sysctl_handle_uma_zone_max, "I", __DESCR(descr)) + __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr)); \ +}) /* Oid to obtain current use of uma(9) zone specified by pointer. */ #define SYSCTL_UMA_CUR(parent, nbr, name, access, ptr, descr) \ - SYSCTL_ASSERT_TYPE(INT, ptr, parent, name); \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ - ptr, 0, sysctl_handle_uma_zone_cur, "I", descr) + (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr); \ + CTASSERT(((access) & CTLTYPE) == 0) + #define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr) \ +({ \ + uma_zone_t __ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ - SYSCTL_ADD_ASSERT_TYPE(INT, ptr), 0, \ - sysctl_handle_uma_zone_cur, "I", __DESCR(descr)) + __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr)); \ +}) /* * A macro to generate a read-only sysctl to indicate the presense of optional @@ -487,7 +530,7 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; ); */ #define FEATURE(name, desc) \ SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \ - NULL, 1, desc) + SYSCTL_NULL_INT_PTR, 1, desc) #endif /* _KERNEL */ diff --git a/sys/vm/memguard.c b/sys/vm/memguard.c index d502ca569bde..ec372c14f38f 100644 --- a/sys/vm/memguard.c +++ b/sys/vm/memguard.c @@ -226,9 +226,9 @@ memguard_sysinit(void) parent = SYSCTL_STATIC_CHILDREN(_vm_memguard); - SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapstart", CTLFLAG_RD, + SYSCTL_ADD_UAUTO(NULL, parent, OID_AUTO, "mapstart", CTLFLAG_RD, &memguard_base, "MemGuard KVA base"); - SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "maplimit", CTLFLAG_RD, + SYSCTL_ADD_UAUTO(NULL, parent, OID_AUTO, "maplimit", CTLFLAG_RD, &memguard_mapsize, "MemGuard KVA size"); #if 0 SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapused", CTLFLAG_RD, diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 5aa15e84bc6d..d4527b3b788e 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -95,13 +95,13 @@ const void *zero_region; CTASSERT((ZERO_REGION_SIZE & PAGE_MASK) == 0); SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, - NULL, VM_MIN_KERNEL_ADDRESS, "Min kernel address"); + SYSCTL_NULL_ULONG_PTR, VM_MIN_KERNEL_ADDRESS, "Min kernel address"); SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, #if defined(__arm__) || defined(__sparc64__) &vm_max_kernel_address, 0, #else - NULL, VM_MAX_KERNEL_ADDRESS, + SYSCTL_NULL_ULONG_PTR, VM_MAX_KERNEL_ADDRESS, #endif "Max kernel address"); diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index d1c75f8efa08..1438053ccc58 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -831,13 +831,6 @@ busdma_sysctl_tree_top(struct bounce_zone *bz) return (bz->sysctl_tree_top); } -#if defined(__amd64__) || defined(PAE) -#define SYSCTL_ADD_BUS_SIZE_T SYSCTL_ADD_UQUAD -#else -#define SYSCTL_ADD_BUS_SIZE_T(ctx, parent, nbr, name, flag, ptr, desc) \ - SYSCTL_ADD_UINT(ctx, parent, nbr, name, flag, ptr, 0, desc) -#endif - static int alloc_bounce_zone(bus_dma_tag_t dmat) { @@ -905,7 +898,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_BUS_SIZE_T(busdma_sysctl_tree(bz), + SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "alignment", CTLFLAG_RD, &bz->alignment, "");