@@ -103,100 +103,82 @@ impl BlockIO {
103
103
}
104
104
105
105
/// Media information structure
106
- #[ repr( C ) ]
106
+ #[ repr( transparent ) ]
107
107
#[ derive( Debug ) ]
108
- pub struct BlockIOMedia {
109
- media_id : u32 ,
110
- removable_media : bool ,
111
- media_present : bool ,
112
- logical_partition : bool ,
113
- read_only : bool ,
114
- write_caching : bool ,
115
-
116
- block_size : u32 ,
117
- io_align : u32 ,
118
- last_block : Lba ,
119
-
120
- // Revision 2
121
- lowest_aligned_lba : Lba ,
122
- logical_blocks_per_physical_block : u32 ,
123
-
124
- // Revision 3
125
- optimal_transfer_length_granularity : u32 ,
126
- }
108
+ pub struct BlockIOMedia ( uefi_raw:: protocol:: block:: BlockIoMedia ) ;
127
109
128
110
impl BlockIOMedia {
129
111
/// The current media ID.
130
112
#[ must_use]
131
113
pub const fn media_id ( & self ) -> u32 {
132
- self . media_id
114
+ self . 0 . media_id
133
115
}
134
116
135
117
/// True if the media is removable.
136
118
#[ must_use]
137
119
pub const fn is_removable_media ( & self ) -> bool {
138
- self . removable_media
120
+ self . 0 . removable_media
139
121
}
140
122
141
123
/// True if there is a media currently present in the device.
142
124
#[ must_use]
143
125
pub const fn is_media_present ( & self ) -> bool {
144
- self . media_present
126
+ self . 0 . media_present
145
127
}
146
128
147
129
/// True if block IO was produced to abstract partition structure.
148
130
#[ must_use]
149
131
pub const fn is_logical_partition ( & self ) -> bool {
150
- self . logical_partition
132
+ self . 0 . logical_partition
151
133
}
152
134
153
135
/// True if the media is marked read-only.
154
136
#[ must_use]
155
137
pub const fn is_read_only ( & self ) -> bool {
156
- self . read_only
138
+ self . 0 . read_only
157
139
}
158
140
159
141
/// True if `writeBlocks` function writes data.
160
142
#[ must_use]
161
143
pub const fn is_write_caching ( & self ) -> bool {
162
- self . write_caching
144
+ self . 0 . write_caching
163
145
}
164
146
165
147
/// The intrinsic block size of the device.
166
148
///
167
149
/// If the media changes, then this field is updated. Returns the number of bytes per logical block.
168
150
#[ must_use]
169
151
pub const fn block_size ( & self ) -> u32 {
170
- self . block_size
152
+ self . 0 . block_size
171
153
}
172
154
173
155
/// Supplies the alignment requirement for any buffer used in a data transfer.
174
156
#[ must_use]
175
157
pub const fn io_align ( & self ) -> u32 {
176
- self . io_align
158
+ self . 0 . io_align
177
159
}
178
160
179
161
/// The last LBA on the device. If the media changes, then this field is updated.
180
162
#[ must_use]
181
163
pub const fn last_block ( & self ) -> Lba {
182
- self . last_block
164
+ self . 0 . last_block
183
165
}
184
166
185
167
/// Returns the first LBA that is aligned to a physical block boundary.
186
168
#[ must_use]
187
169
pub const fn lowest_aligned_lba ( & self ) -> Lba {
188
- self . lowest_aligned_lba
170
+ self . 0 . lowest_aligned_lba
189
171
}
190
172
191
173
/// Returns the number of logical blocks per physical block.
192
174
#[ must_use]
193
175
pub const fn logical_blocks_per_physical_block ( & self ) -> u32 {
194
- self . logical_blocks_per_physical_block
176
+ self . 0 . logical_blocks_per_physical_block
195
177
}
196
178
197
179
/// Returns the optimal transfer length granularity as a number of logical blocks.
198
180
#[ must_use]
199
181
pub const fn optimal_transfer_length_granularity ( & self ) -> u32 {
200
- self . optimal_transfer_length_granularity
182
+ self . 0 . optimal_transfer_length_granularity
201
183
}
202
184
}
0 commit comments