rust-osdev / uefi-rs

Rust wrapper for UEFI.
https://rust-osdev.com/uefi-book
Mozilla Public License 2.0
1.23k stars 154 forks source link

Rename or change the function signature of `memset` in boot services table #232

Closed iankronquist closed 3 years ago

iankronquist commented 3 years ago

In boot.rs we see there is an unsafe function named memset. This function has a signature different than memset(3), but has a name different than that in the edk2 sources. This is confusing and will lead to bugs in a very unsafe function when people mix up the order of the value and the size.

We should either name the function memset and give it the libc-style signature memset(&self, buffer: *mut u8, value: u8, size: usize), or name the function set_mem and give it the signature from EFI_SET_MEM.

https://github.com/rust-osdev/uefi-rs/blob/948464c908aa4332e5ab224cc96880a512833bc9/src/table/boot.rs#L529

iankronquist commented 3 years ago

I'm happy to make the change. We can actually do both, have a function named memset with the C stdlib signature and have one named set_mem with the uefi signature. This is a breaking change and should come with a point release imo.

GabrielMajeri commented 3 years ago

@iankronquist Your help is definitely appreciated. We can make a new point release afterwards.

GabrielMajeri commented 3 years ago

Fixed by #235