@@ -997,12 +997,45 @@ pub struct kvm_ioapic_state {
997
997
pub redirtbl : [ kvm_ioapic_state__bindgen_ty_1 ; 24usize ] ,
998
998
}
999
999
#[ repr( C ) ]
1000
- #[ derive( Copy , Clone , Versionize ) ]
1000
+ #[ derive( Copy , Clone ) ]
1001
1001
pub union kvm_ioapic_state__bindgen_ty_1 {
1002
1002
pub bits : __u64 ,
1003
1003
pub fields : kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 ,
1004
1004
_bindgen_union_align : u64 ,
1005
1005
}
1006
+
1007
+ // Manual implementation of `Versionize` since `versionize_derive` doesn't support unions
1008
+ // anymore. What we're doing here is equivalent to the old autogenerated implementation, namely
1009
+ // we're creating a bitwise serialization of the object.
1010
+ impl Versionize for kvm_ioapic_state__bindgen_ty_1 {
1011
+ fn serialize < W : std:: io:: Write > (
1012
+ & self ,
1013
+ writer : & mut W ,
1014
+ version_map : & VersionMap ,
1015
+ app_version : u16 ,
1016
+ ) -> VersionizeResult < ( ) > {
1017
+ // Safe because this is a POD object and we're only using the read result to serialize
1018
+ // the underlying bytes.
1019
+ let bits = unsafe { self . bits } ;
1020
+ assert_eq ! ( std:: mem:: size_of_val( & bits) , std:: mem:: size_of:: <Self >( ) ) ;
1021
+ Versionize :: serialize ( & bits, writer, version_map, app_version)
1022
+ }
1023
+
1024
+ fn deserialize < R : std:: io:: Read > (
1025
+ reader : & mut R ,
1026
+ version_map : & VersionMap ,
1027
+ app_version : u16 ,
1028
+ ) -> VersionizeResult < Self > {
1029
+ let bits: __u64 = Versionize :: deserialize ( reader, version_map, app_version) ?;
1030
+ assert_eq ! ( std:: mem:: size_of_val( & bits) , std:: mem:: size_of:: <Self >( ) ) ;
1031
+ Ok ( Self { bits } )
1032
+ }
1033
+
1034
+ fn version ( ) -> u16 {
1035
+ 1
1036
+ }
1037
+ }
1038
+
1006
1039
#[ repr( C ) ]
1007
1040
#[ derive( Debug , Default , Copy , Clone , PartialEq , Versionize ) ]
1008
1041
pub struct kvm_ioapic_state__bindgen_ty_1__bindgen_ty_1 {
@@ -4221,13 +4254,61 @@ pub struct kvm_irqchip {
4221
4254
pub chip : kvm_irqchip__bindgen_ty_1 ,
4222
4255
}
4223
4256
#[ repr( C ) ]
4224
- #[ derive( Copy , Clone , Versionize ) ]
4257
+ #[ derive( Copy , Clone ) ]
4225
4258
pub union kvm_irqchip__bindgen_ty_1 {
4226
4259
pub dummy : [ :: std:: os:: raw:: c_char ; 512usize ] ,
4227
4260
pub pic : kvm_pic_state ,
4228
4261
pub ioapic : kvm_ioapic_state ,
4229
4262
_bindgen_union_align : [ u64 ; 64usize ] ,
4230
4263
}
4264
+
4265
+ // Helper struct for the manual `Versionize` implementation below. This makes things easier,
4266
+ // because there's no default way of serializing larger arrays.
4267
+ #[ repr( transparent) ]
4268
+ #[ derive( Versionize ) ]
4269
+ struct kvm_irqchip__bindgen_ty_1_dummy {
4270
+ dummy : [ :: std:: os:: raw:: c_char ; 512usize ] ,
4271
+ }
4272
+
4273
+ impl kvm_irqchip__bindgen_ty_1_dummy {
4274
+ fn new ( dummy : [ :: std:: os:: raw:: c_char ; 512usize ] ) -> Self {
4275
+ Self { dummy }
4276
+ }
4277
+ }
4278
+
4279
+ // Manual implementation of `Versionize` since `versionize_derive` doesn't support unions
4280
+ // anymore. What we're doing here is equivalent to the old autogenerated implementation, namely
4281
+ // we're creating a bitwise serialization of the object.
4282
+ impl Versionize for kvm_irqchip__bindgen_ty_1 {
4283
+ fn serialize < W : std:: io:: Write > (
4284
+ & self ,
4285
+ writer : & mut W ,
4286
+ version_map : & VersionMap ,
4287
+ app_version : u16 ,
4288
+ ) -> VersionizeResult < ( ) > {
4289
+ // Safe because this is a POD struct and we're only using the read result to serialize
4290
+ // the underlying bytes.
4291
+ let dummy = kvm_irqchip__bindgen_ty_1_dummy:: new ( unsafe { self . dummy } ) ;
4292
+ assert_eq ! ( std:: mem:: size_of_val( & dummy) , std:: mem:: size_of:: <Self >( ) ) ;
4293
+ Versionize :: serialize ( & dummy, writer, version_map, app_version)
4294
+ }
4295
+
4296
+ fn deserialize < R : std:: io:: Read > (
4297
+ reader : & mut R ,
4298
+ version_map : & VersionMap ,
4299
+ app_version : u16 ,
4300
+ ) -> VersionizeResult < Self > {
4301
+ let dummy: kvm_irqchip__bindgen_ty_1_dummy =
4302
+ Versionize :: deserialize ( reader, version_map, app_version) ?;
4303
+ assert_eq ! ( std:: mem:: size_of_val( & dummy) , std:: mem:: size_of:: <Self >( ) ) ;
4304
+ Ok ( Self { dummy : dummy. dummy } )
4305
+ }
4306
+
4307
+ fn version ( ) -> u16 {
4308
+ 1
4309
+ }
4310
+ }
4311
+
4231
4312
#[ test]
4232
4313
fn bindgen_test_layout_kvm_irqchip__bindgen_ty_1 ( ) {
4233
4314
assert_eq ! (
0 commit comments