@@ -222,14 +222,14 @@ pub(crate) fn runtime_services() -> Option<NonNull<r_efi::efi::RuntimeServices>>
222222 NonNull :: new ( runtime_services)
223223}
224224
225- pub ( crate ) struct DevicePath ( NonNull < r_efi:: protocols:: device_path:: Protocol > ) ;
225+ pub ( crate ) struct OwnedDevicePath ( NonNull < r_efi:: protocols:: device_path:: Protocol > ) ;
226226
227- impl DevicePath {
227+ impl OwnedDevicePath {
228228 pub ( crate ) fn from_text ( p : & OsStr ) -> io:: Result < Self > {
229229 fn inner (
230230 p : & OsStr ,
231231 protocol : NonNull < r_efi:: protocols:: device_path_from_text:: Protocol > ,
232- ) -> io:: Result < DevicePath > {
232+ ) -> io:: Result < OwnedDevicePath > {
233233 let path_vec = p. encode_wide ( ) . chain ( Some ( 0 ) ) . collect :: < Vec < u16 > > ( ) ;
234234 if path_vec[ ..path_vec. len ( ) - 1 ] . contains ( & 0 ) {
235235 return Err ( const_error ! (
@@ -242,7 +242,7 @@ impl DevicePath {
242242 unsafe { ( ( * protocol. as_ptr ( ) ) . convert_text_to_device_path ) ( path_vec. as_ptr ( ) ) } ;
243243
244244 NonNull :: new ( path)
245- . map ( DevicePath )
245+ . map ( OwnedDevicePath )
246246 . ok_or_else ( || const_error ! ( io:: ErrorKind :: InvalidFilename , "Invalid Device Path" ) )
247247 }
248248
@@ -275,12 +275,12 @@ impl DevicePath {
275275 ) )
276276 }
277277
278- pub ( crate ) fn as_ptr ( & self ) -> * mut r_efi:: protocols:: device_path:: Protocol {
278+ pub ( crate ) const fn as_ptr ( & self ) -> * mut r_efi:: protocols:: device_path:: Protocol {
279279 self . 0 . as_ptr ( )
280280 }
281281}
282282
283- impl Drop for DevicePath {
283+ impl Drop for OwnedDevicePath {
284284 fn drop ( & mut self ) {
285285 if let Some ( bt) = boot_services ( ) {
286286 let bt: NonNull < r_efi:: efi:: BootServices > = bt. cast ( ) ;
@@ -291,6 +291,13 @@ impl Drop for DevicePath {
291291 }
292292}
293293
294+ impl crate :: fmt:: Debug for OwnedDevicePath {
295+ fn fmt ( & self , f : & mut crate :: fmt:: Formatter < ' _ > ) -> crate :: fmt:: Result {
296+ let p = device_path_to_text ( self . 0 ) . unwrap ( ) ;
297+ p. fmt ( f)
298+ }
299+ }
300+
294301pub ( crate ) struct OwnedProtocol < T > {
295302 guid : r_efi:: efi:: Guid ,
296303 handle : NonNull < crate :: ffi:: c_void > ,
0 commit comments