From: Claudio Jeker Subject: Re: knf struct declarations in sys To: tech@openbsd.org Date: Tue, 22 Oct 2024 13:27:17 +0200 OK claudio@ On Tue, Oct 22, 2024 at 11:44:18AM +1100, Jonathan Gray wrote: > diff --git sys/arch/amd64/amd64/mpbios.c sys/arch/amd64/amd64/mpbios.c > index 07df036ed84..bc9476e3d21 100644 > --- sys/arch/amd64/amd64/mpbios.c > +++ sys/arch/amd64/amd64/mpbios.c > @@ -134,8 +134,7 @@ static const char *loc_where[] = { > "bios" > }; > > -struct mp_map > -{ > +struct mp_map { > vaddr_t baseva; > int vsize; > paddr_t pa; > diff --git sys/arch/amd64/include/i82093var.h sys/arch/amd64/include/i82093var.h > index 6d5c168618b..5f0150cc146 100644 > --- sys/arch/amd64/include/i82093var.h > +++ sys/arch/amd64/include/i82093var.h > @@ -37,8 +37,7 @@ > > #include > > -struct ioapic_pin > -{ > +struct ioapic_pin { > struct ioapic_pin *ip_next; /* next pin on this vector */ > struct mp_intr_map *ip_map; > int ip_vector; /* IDT vector */ > diff --git sys/arch/amd64/include/vmmvar.h sys/arch/amd64/include/vmmvar.h > index a2c9d5db449..85a6f780472 100644 > --- sys/arch/amd64/include/vmmvar.h > +++ sys/arch/amd64/include/vmmvar.h > @@ -727,20 +727,17 @@ struct vmcs { > uint32_t vmcs_revision; > }; > > -struct vmx_invvpid_descriptor > -{ > +struct vmx_invvpid_descriptor { > uint64_t vid_vpid; > uint64_t vid_addr; > }; > > -struct vmx_invept_descriptor > -{ > +struct vmx_invept_descriptor { > uint64_t vid_eptp; > uint64_t vid_reserved; > }; > > -struct vmx_msr_store > -{ > +struct vmx_msr_store { > uint64_t vms_index; > uint64_t vms_data; > }; > @@ -752,8 +749,7 @@ struct vmx_msr_store > * Note that vmx/svm_enter_guest depend on the layout of this struct for > * field access. > */ > -struct vcpu_gueststate > -{ > +struct vcpu_gueststate { > /* %rsi should be first */ > uint64_t vg_rsi; /* 0x00 */ > uint64_t vg_rax; /* 0x08 */ > diff --git sys/arch/i386/i386/mpbios.c sys/arch/i386/i386/mpbios.c > index 1775fb8ad1a..013fbe50539 100644 > --- sys/arch/i386/i386/mpbios.c > +++ sys/arch/i386/i386/mpbios.c > @@ -141,8 +141,7 @@ static const char *loc_where[] = { > "bios" > }; > > -struct mp_map > -{ > +struct mp_map { > vaddr_t baseva; > int vsize; > paddr_t pa; > diff --git sys/arch/i386/include/i82093var.h sys/arch/i386/include/i82093var.h > index fd86a6e4bc2..ca0d66b2d65 100644 > --- sys/arch/i386/include/i82093var.h > +++ sys/arch/i386/include/i82093var.h > @@ -37,8 +37,7 @@ > > #include > > -struct ioapic_pin > -{ > +struct ioapic_pin { > struct intrhand *ip_handler; > struct ioapic_pin *ip_next; /* next pin on this vector */ > struct mp_intr_map *ip_map; > diff --git sys/arch/i386/include/mpbiosvar.h sys/arch/i386/include/mpbiosvar.h > index b22fbd823f9..29ba9edd9be 100644 > --- sys/arch/i386/include/mpbiosvar.h > +++ sys/arch/i386/include/mpbiosvar.h > @@ -43,8 +43,7 @@ > > #include > > -struct mp_bus > -{ > +struct mp_bus { > char *mb_name; /* XXX bus name */ > int mb_idx; /* XXX bus index */ > void (*mb_intr_print) (int); > @@ -53,8 +52,7 @@ struct mp_bus > u_int32_t mb_data; /* random bus-specific datum. */ > }; > > -struct mp_intr_map > -{ > +struct mp_intr_map { > struct mp_intr_map *next; > struct mp_bus *bus; > int bus_pin; > diff --git sys/arch/luna88k/luna88k/autoconf.c sys/arch/luna88k/luna88k/autoconf.c > index 5b6cef86b62..8d1bee320ce 100644 > --- sys/arch/luna88k/luna88k/autoconf.c > +++ sys/arch/luna88k/luna88k/autoconf.c > @@ -105,8 +105,7 @@ diskconf(void) > * > * XXX Right now we can not handle network boot. > */ > -struct autoboot_t > -{ > +struct autoboot_t { > char cont[16]; > int targ; > int part; > diff --git sys/arch/m88k/include/pcb.h sys/arch/m88k/include/pcb.h > index 26a81398185..21bd743217f 100644 > --- sys/arch/m88k/include/pcb.h > +++ sys/arch/m88k/include/pcb.h > @@ -73,8 +73,7 @@ struct m88100_pcb { > unsigned long pcb_fcr63; > }; > > -struct pcb > -{ > +struct pcb { > struct m88100_pcb kernel_state; > struct trapframe user_state; > int pcb_onfault; > diff --git sys/arch/macppc/dev/pm_direct.h sys/arch/macppc/dev/pm_direct.h > index 21563fc71fc..47ed95a6df4 100644 > --- sys/arch/macppc/dev/pm_direct.h > +++ sys/arch/macppc/dev/pm_direct.h > @@ -57,8 +57,7 @@ void pm_intr(void); > void pm_read_date_time(time_t *); > void pm_set_date_time(time_t); > > -struct pmu_battery_info > -{ > +struct pmu_battery_info { > unsigned int flags; > unsigned int cur_charge; > unsigned int max_charge; > diff --git sys/dev/acpi/acpicpu.c sys/dev/acpi/acpicpu.c > index f46ff68a860..699ac1cba8c 100644 > --- sys/dev/acpi/acpicpu.c > +++ sys/dev/acpi/acpicpu.c > @@ -101,8 +101,7 @@ void acpicpu_setperf_ppc_change(struct acpicpu_pss *, int); > /* Make sure throttling bits are valid,a=addr,o=offset,w=width */ > #define valid_throttle(o,w,a) (a && w && (o+w)<=31 && (o>4 || (o+w)<=4)) > > -struct acpi_cstate > -{ > +struct acpi_cstate { > SLIST_ENTRY(acpi_cstate) link; > > u_short state; > diff --git sys/dev/acpi/acpidmar.h sys/dev/acpi/acpidmar.h > index 0c8b128b3ab..775fb689b10 100644 > --- sys/dev/acpi/acpidmar.h > +++ sys/dev/acpi/acpidmar.h > @@ -408,8 +408,7 @@ context_set_user(struct context_entry *ce, int v) > * 126 = Type (0 = Read, 1 = Write) > * 127 = Fault bit > */ > -struct fault_entry > -{ > +struct fault_entry { > uint64_t lo; > uint64_t hi; > }; > diff --git sys/dev/audio.c sys/dev/audio.c > index f06eead7760..d031444a50d 100644 > --- sys/dev/audio.c > +++ sys/dev/audio.c > @@ -88,8 +88,7 @@ struct audio_buf { > }; > > #if NWSKBD > 0 > -struct wskbd_vol > -{ > +struct wskbd_vol { > int val; /* index of the value control */ > int mute; /* index of the mute control */ > int step; /* increment/decrement step */ > diff --git sys/dev/efi/efiio.h sys/dev/efi/efiio.h > index 7929b2e82bd..a554a0e022d 100644 > --- sys/dev/efi/efiio.h > +++ sys/dev/efi/efiio.h > @@ -55,16 +55,14 @@ struct efi_esrt_entry_v1 { > uint32_t last_attempt_status; > }; > > -struct efi_get_table_ioc > -{ > +struct efi_get_table_ioc { > void *buf; /* Pointer to userspace buffer */ > struct uuid uuid; /* UUID to look up */ > size_t table_len; /* Table size */ > size_t buf_len; /* Size of the buffer */ > }; > > -struct efi_var_ioc > -{ > +struct efi_var_ioc { > uint16_t *name; /* User pointer to name, in UCS2 chars */ > size_t namesize; /* Number of *bytes* in the name including > terminator */ > diff --git sys/dev/ic/aacvar.h sys/dev/ic/aacvar.h > index 2044e450b9a..df7adce5bf9 100644 > --- sys/dev/ic/aacvar.h > +++ sys/dev/ic/aacvar.h > @@ -235,8 +235,7 @@ typedef struct rwlock aac_lock_t; > /* > * Per-container data structure > */ > -struct aac_container > -{ > +struct aac_container { > struct aac_mntobj co_mntobj; > int co_found; > TAILQ_ENTRY(aac_container) co_link; > @@ -246,8 +245,7 @@ struct aac_container > * A command control block, one for each corresponding command index of the > * controller. > */ > -struct aac_command > -{ > +struct aac_command { > TAILQ_ENTRY(aac_command) cm_link; /* list linkage */ > > struct aac_softc *cm_sc; /* controller that owns us */ > @@ -311,8 +309,7 @@ struct aac_qstat { > /* > * Per-controller structure. > */ > -struct aac_softc > -{ > +struct aac_softc { > struct device aac_dev; > void *aac_ih; > > diff --git sys/dev/ic/adv.h sys/dev/ic/adv.h > index d505e5e1221..c336cc60711 100644 > --- sys/dev/ic/adv.h > +++ sys/dev/ic/adv.h > @@ -39,8 +39,7 @@ > > /******************************************************************************/ > > -struct adv_ccb > -{ > +struct adv_ccb { > ASC_SG_HEAD sghead; > ASC_SCSI_Q scsiq; > > @@ -67,8 +66,7 @@ typedef struct adv_ccb ADV_CCB; > > #define ADV_MAX_CCB 32 > > -struct adv_control > -{ > +struct adv_control { > ADV_CCB ccbs[ADV_MAX_CCB]; /* all our control blocks */ > }; > > diff --git sys/dev/ic/aic79xx.h sys/dev/ic/aic79xx.h > index 03d6af31d34..f279b31dbc4 100644 > --- sys/dev/ic/aic79xx.h > +++ sys/dev/ic/aic79xx.h > @@ -1034,8 +1034,7 @@ typedef uint8_t ahd_mode_state; > > typedef void ahd_callback_t (void *); > > -struct ahd_completion > -{ > +struct ahd_completion { > uint16_t tag; > uint8_t sg_status; > uint8_t valid_tag; > diff --git sys/dev/ic/trm.h sys/dev/ic/trm.h > index 3f0bf34d651..87dea4a271c 100644 > --- sys/dev/ic/trm.h > +++ sys/dev/ic/trm.h > @@ -41,8 +41,7 @@ > * Segment Entry > * ------------------------------------------------------------ > */ > -struct SGentry > -{ > +struct SGentry { > u_int32_t address; > u_int32_t length; > }; > @@ -68,8 +67,7 @@ struct SGentry > * SCSI Request Block > *----------------------------------------------------------------------- > */ > -struct trm_scsi_req_q > -{ > +struct trm_scsi_req_q { > TAILQ_ENTRY(trm_scsi_req_q) link; > bus_dmamap_t dmamapxfer; > u_int32_t PhysSRB; > @@ -144,8 +142,7 @@ TAILQ_HEAD(SRB_HEAD, trm_scsi_req_q); > * Device Control Block > *----------------------------------------------------------------------- > */ > -struct trm_dcb > -{ > +struct trm_dcb { > u_int32_t TagMask; > > u_int16_t DCBFlag; > @@ -180,8 +177,7 @@ struct trm_dcb > * Adapter Control Block > *----------------------------------------------------------------------- > */ > -struct trm_softc > -{ > +struct trm_softc { > struct device sc_device; > > bus_space_handle_t sc_iohandle; > @@ -226,8 +222,7 @@ struct trm_softc > /* > * The SEEPROM structure for TRM_S1040 > */ > -struct trm_target_nvram > -{ > +struct trm_target_nvram { > u_int8_t NvmTarCfg0; /* Target configuration byte 0 */ > #define TRM_WIDE 0x20 /* Wide negotiate */ > #define TRM_TAG_QUEUING 0x10 /* Enable SCSI tag queuing */ > @@ -241,8 +236,7 @@ struct trm_target_nvram > u_int8_t NvmTarCfg3; /* Target configuration byte 3 */ > }; > > -struct trm_adapter_nvram > -{ > +struct trm_adapter_nvram { > u_int8_t NvramSubVendorID[2]; /*0,1 Sub Vendor ID */ > u_int8_t NvramSubSysID[2]; /*2,3 Sub System ID */ > u_int8_t NvramSubClass; /*4 Sub Class */ > diff --git sys/dev/isa/essvar.h sys/dev/isa/essvar.h > index f20fe6cfe29..e01052e6318 100644 > --- sys/dev/isa/essvar.h > +++ sys/dev/isa/essvar.h > @@ -95,8 +95,7 @@ > #define ESS_1888_NDEVS 22 > #define ESS_MAX_NDEVS 22 > > -struct ess_audio_channel > -{ > +struct ess_audio_channel { > int drq; /* DMA channel */ > #define IS16BITDRQ(drq) ((drq) >= 4) > int irq; /* IRQ line for this DMA channel */ > @@ -118,8 +117,7 @@ struct ess_audio_channel > int blksize; /* current block size */ > }; > > -struct ess_softc > -{ > +struct ess_softc { > struct device sc_dev; /* base device */ > struct device *sc_isa; > isa_chipset_tag_t sc_ic; > diff --git sys/dev/pci/esavar.h sys/dev/pci/esavar.h > index f7e6299d8c1..b35543124bc 100644 > --- sys/dev/pci/esavar.h > +++ sys/dev/pci/esavar.h > @@ -96,8 +96,7 @@ struct esa_voice { > int index; /* 0: play, 1: record */ > }; > > -struct esa_softc > -{ > +struct esa_softc { > struct device sc_dev; > bus_space_tag_t sc_iot; > bus_space_handle_t sc_ioh; > diff --git sys/dev/pci/if_em_osdep.h sys/dev/pci/if_em_osdep.h > index 87bd6fbd8de..d04e75dfd14 100644 > --- sys/dev/pci/if_em_osdep.h > +++ sys/dev/pci/if_em_osdep.h > @@ -60,8 +60,7 @@ POSSIBILITY OF SUCH DAMAGE. > > #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ > > -struct em_osdep > -{ > +struct em_osdep { > bus_space_tag_t mem_bus_space_tag; > bus_space_handle_t mem_bus_space_handle; > bus_space_tag_t io_bus_space_tag; > diff --git sys/dev/pci/if_ixgb_osdep.h sys/dev/pci/if_ixgb_osdep.h > index 39e0618b35a..628de7f1752 100644 > --- sys/dev/pci/if_ixgb_osdep.h > +++ sys/dev/pci/if_ixgb_osdep.h > @@ -62,8 +62,7 @@ POSSIBILITY OF SUCH DAMAGE. > > #define le16_to_cpu letoh16 > > -struct ixgb_osdep > -{ > +struct ixgb_osdep { > bus_space_tag_t mem_bus_space_tag; > bus_space_handle_t mem_bus_space_handle; > struct device *dev; > diff --git sys/dev/sbus/cgtwelvereg.h sys/dev/sbus/cgtwelvereg.h > index d6d95ab8786..29c67b85694 100644 > --- sys/dev/sbus/cgtwelvereg.h > +++ sys/dev/sbus/cgtwelvereg.h > @@ -200,8 +200,7 @@ struct cgtwelve_apu { > u_int32_t test; > }; > > -struct cgtwelve_dac > -{ > +struct cgtwelve_dac { > u_int32_t addr_lo; > u_int8_t pad1[0x100 - 4]; > u_int32_t addr_hi; > diff --git sys/dev/usb/uchcom.c sys/dev/usb/uchcom.c > index c620ea9f40f..b6bb01767f4 100644 > --- sys/dev/usb/uchcom.c > +++ sys/dev/usb/uchcom.c > @@ -127,8 +127,7 @@ int uchcomdebug = 0; > > #define UCHCOM_TYPE_CH343 1 > > -struct uchcom_softc > -{ > +struct uchcom_softc { > struct device sc_dev; > struct usbd_device *sc_udev; > struct device *sc_subdev; > @@ -151,8 +150,7 @@ struct uchcom_softc > int sc_lcr2; > }; > > -struct uchcom_endpoints > -{ > +struct uchcom_endpoints { > int ep_bulkin; > int ep_bulkin_size; > int ep_bulkout; > @@ -160,15 +158,13 @@ struct uchcom_endpoints > int ep_intr_size; > }; > > -struct uchcom_divider > -{ > +struct uchcom_divider { > uint8_t dv_prescaler; > uint8_t dv_div; > uint8_t dv_mod; > }; > > -struct uchcom_divider_record > -{ > +struct uchcom_divider_record { > uint32_t dvr_high; > uint32_t dvr_low; > uint32_t dvr_base_clock; > -- :wq Claudio