@@ -402,17 +402,45 @@ impl ToOwned for DevicePathInstance {
402
402
403
403
/// Device path protocol.
404
404
///
405
- /// Can be used on any device handle to obtain generic path/location information
406
- /// concerning the physical device or logical device. If the handle does not
407
- /// logically map to a physical device, the handle may not necessarily support
408
- /// the device path protocol. The device path describes the location of the
409
- /// device the handle is for. The size of the Device Path can be determined from
410
- /// the structures that make up the Device Path.
405
+ /// A UEFI device path is a structured sequence of binary nodes that describe a
406
+ /// route from the UEFI root to a particular device, controller, or file. Each
407
+ /// node represents a step in the path: PCI device, partition, filesystem, file
408
+ /// path, etc.
409
+ ///
410
+ /// This type implements [`DevicePathProtocol`] and therefore can be used on any
411
+ /// device handle to obtain generic path/location information concerning the
412
+ /// physical device or logical device. If the handle does not logically map to a
413
+ /// physical device, the handle may not necessarily support the device path
414
+ /// protocol. The device path describes the location of the device the handle is
415
+ /// for. The size of the Device Path can be determined from the structures that
416
+ /// make up the Device Path.
411
417
///
412
418
/// See the [module-level documentation] for more details.
413
419
///
420
+ /// # Example
421
+ /// ```rust,no_run
422
+ /// use uefi::Handle;
423
+ /// use uefi::boot::{open_protocol_exclusive, ScopedProtocol};
424
+ /// use uefi::proto::device_path::DevicePath;
425
+ /// use uefi::proto::device_path::text::{AllowShortcuts, DisplayOnly};
426
+ /// use uefi::proto::loaded_image::LoadedImage;
427
+ ///
428
+ /// fn open_device_path(image_handle: Handle) {
429
+ /// let loaded_image = open_protocol_exclusive::<LoadedImage>(image_handle).unwrap();
430
+ /// let device_handle = loaded_image.device().unwrap();
431
+ /// let device_path: ScopedProtocol<DevicePath>
432
+ /// = open_protocol_exclusive::<DevicePath>(device_handle).unwrap();
433
+ /// log::debug!(
434
+ /// "Device path: {}",
435
+ /// device_path.to_string(DisplayOnly(true), AllowShortcuts(true)).unwrap()
436
+ /// );
437
+ /// }
438
+ /// ```
439
+ ///
414
440
/// [module-level documentation]: crate::proto::device_path
415
441
/// [`END_ENTIRE`]: DeviceSubType::END_ENTIRE
442
+ /// [`DevicePathProtocol`]: uefi_raw::protocol::device_path::DevicePathProtocol
443
+ /// [`Protocol`]: uefi::proto::Protocol
416
444
#[ repr( C , packed) ]
417
445
#[ unsafe_protocol( uefi_raw:: protocol:: device_path:: DevicePathProtocol :: GUID ) ]
418
446
#[ derive( Eq , Pointee ) ]
0 commit comments