File tree 6 files changed +13
-7
lines changed
uefi-test-runner/src/proto
6 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 73
73
runs-on : windows-latest
74
74
steps :
75
75
- name : Install QEMU
76
- run : choco install qemu
76
+ run : choco install qemu --version 2023.4.24
77
77
78
78
- name : Checkout sources
79
79
uses : actions/checkout@v3
Original file line number Diff line number Diff line change 1
1
use alloc:: string:: ToString ;
2
2
use core:: cell:: RefCell ;
3
3
use core:: ptr:: NonNull ;
4
+ use uefi:: data_types:: Align ;
4
5
use uefi:: prelude:: * ;
5
6
use uefi:: proto:: media:: block:: BlockIO ;
6
7
use uefi:: proto:: media:: disk:: { DiskIo , DiskIo2 , DiskIo2Token } ;
@@ -29,8 +30,12 @@ fn test_existing_dir(directory: &mut Directory) {
29
30
30
31
let dir = RefCell :: new ( dir) ;
31
32
33
+ assert_eq ! ( FileInfo :: alignment( ) , 8 ) ;
34
+ #[ repr( align( 8 ) ) ]
35
+ struct Buf ( [ u8 ; 200 ] ) ;
36
+
32
37
// Backing memory to read the file info data into.
33
- let mut stack_buf = [ 0 ; 200 ] ;
38
+ let mut stack_buf = Buf ( [ 0 ; 200 ] ) ;
34
39
35
40
// The file names that the test read from the directory.
36
41
let entry_names = RefCell :: new ( vec ! [ ] ) ;
@@ -44,7 +49,7 @@ fn test_existing_dir(directory: &mut Directory) {
44
49
let mut entry_names = entry_names. borrow_mut ( ) ;
45
50
loop {
46
51
let entry = dir
47
- . read_entry ( & mut stack_buf)
52
+ . read_entry ( & mut stack_buf. 0 )
48
53
. expect ( "failed to read directory" ) ;
49
54
if let Some ( entry) = entry {
50
55
entry_names. push ( entry. file_name ( ) . to_string ( ) ) ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ trait InfoInternal: Align + ptr_meta::Pointee<Metadata = usize> {
68
68
{
69
69
// Calculate the final size of the struct.
70
70
let name_length_ucs2 = name. as_slice_with_nul ( ) . len ( ) ;
71
- let name_size = name_length_ucs2 * mem:: size_of :: < Char16 > ( ) ;
71
+ let name_size = mem:: size_of_val ( name . as_slice_with_nul ( ) ) ;
72
72
let info_size = Self :: name_offset ( ) + name_size;
73
73
let info_size = Self :: round_up_to_alignment ( info_size) ;
74
74
Original file line number Diff line number Diff line change @@ -680,7 +680,7 @@ impl DiscoverInfo {
680
680
let required_size = core:: mem:: size_of :: < bool > ( ) * 4
681
681
+ core:: mem:: size_of :: < IpAddress > ( )
682
682
+ core:: mem:: size_of :: < u16 > ( )
683
- + core:: mem:: size_of :: < Server > ( ) * server_count ;
683
+ + core:: mem:: size_of_val ( srv_list ) ;
684
684
685
685
if buffer. len ( ) < required_size {
686
686
return Err ( Status :: BUFFER_TOO_SMALL . into ( ) ) ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ impl Rng {
17
17
& mut self ,
18
18
algorithm_list : & ' buf mut [ RngAlgorithmType ] ,
19
19
) -> Result < & ' buf [ RngAlgorithmType ] , Option < usize > > {
20
- let mut algorithm_list_size = algorithm_list . len ( ) * mem:: size_of :: < RngAlgorithmType > ( ) ;
20
+ let mut algorithm_list_size = mem:: size_of_val ( algorithm_list ) ;
21
21
22
22
unsafe {
23
23
( self . 0 . get_info ) (
Original file line number Diff line number Diff line change 1
- ///! Facilities for dealing with UEFI operation results.
1
+ //! Facilities for dealing with UEFI operation results.
2
+
2
3
use core:: fmt:: Debug ;
3
4
4
5
/// The error type that we use, essentially a status code + optional additional data
You can’t perform that action at this time.
0 commit comments