66//! - [`EFIImageHandle64Tag`]
77//! - [`EFIBootServicesNotExitedTag`]
88
9- use crate :: TagTypeId ;
9+ use crate :: tag :: TagHeader ;
1010use crate :: { Tag , TagTrait , TagType } ;
1111use core:: mem:: size_of;
1212
1313/// EFI system table in 32 bit mode tag.
1414#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1515#[ repr( C ) ]
1616pub struct EFISdt32Tag {
17- typ : TagTypeId ,
18- size : u32 ,
17+ header : TagHeader ,
1918 pointer : u32 ,
2019}
2120
2221impl EFISdt32Tag {
2322 /// Create a new tag to pass the EFI32 System Table pointer.
2423 pub fn new ( pointer : u32 ) -> Self {
2524 Self {
26- typ : Self :: ID . into ( ) ,
27- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
25+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
2826 pointer,
2927 }
3028 }
@@ -45,17 +43,15 @@ impl TagTrait for EFISdt32Tag {
4543#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
4644#[ repr( C ) ]
4745pub struct EFISdt64Tag {
48- typ : TagTypeId ,
49- size : u32 ,
46+ header : TagHeader ,
5047 pointer : u64 ,
5148}
5249
5350impl EFISdt64Tag {
5451 /// Create a new tag to pass the EFI64 System Table pointer.
5552 pub fn new ( pointer : u64 ) -> Self {
5653 Self {
57- typ : Self :: ID . into ( ) ,
58- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
54+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
5955 pointer,
6056 }
6157 }
@@ -77,17 +73,15 @@ impl TagTrait for EFISdt64Tag {
7773#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
7874#[ repr( C ) ]
7975pub struct EFIImageHandle32Tag {
80- typ : TagTypeId ,
81- size : u32 ,
76+ header : TagHeader ,
8277 pointer : u32 ,
8378}
8479
8580impl EFIImageHandle32Tag {
8681 #[ cfg( feature = "builder" ) ]
8782 pub fn new ( pointer : u32 ) -> Self {
8883 Self {
89- typ : Self :: ID . into ( ) ,
90- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
84+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
9185 pointer,
9286 }
9387 }
@@ -109,17 +103,15 @@ impl TagTrait for EFIImageHandle32Tag {
109103#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
110104#[ repr( C ) ]
111105pub struct EFIImageHandle64Tag {
112- typ : TagTypeId ,
113- size : u32 ,
106+ header : TagHeader ,
114107 pointer : u64 ,
115108}
116109
117110impl EFIImageHandle64Tag {
118111 #[ cfg( feature = "builder" ) ]
119112 pub fn new ( pointer : u64 ) -> Self {
120113 Self {
121- typ : Self :: ID . into ( ) ,
122- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
114+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
123115 pointer,
124116 }
125117 }
@@ -140,8 +132,7 @@ impl TagTrait for EFIImageHandle64Tag {
140132#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
141133#[ repr( C ) ]
142134pub struct EFIBootServicesNotExitedTag {
143- typ : TagTypeId ,
144- size : u32 ,
135+ header : TagHeader ,
145136}
146137
147138impl EFIBootServicesNotExitedTag {
@@ -155,8 +146,7 @@ impl EFIBootServicesNotExitedTag {
155146impl Default for EFIBootServicesNotExitedTag {
156147 fn default ( ) -> Self {
157148 Self {
158- typ : TagType :: EfiBs . into ( ) ,
159- size : core:: mem:: size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
149+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
160150 }
161151 }
162152}
0 commit comments