File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,12 +201,15 @@ pub fn unique_hash(input: &str) -> String {
201201/// Represents the type of partition GUID that can be retrieved.
202202#[ derive( PartialEq , Eq ) ]
203203pub enum PartitionGuidForm {
204+ /// The partition GUID is the unique partition GUID.
204205 Partition ,
206+ /// The partition GUID is the partition type GUID.
205207 PartitionType ,
206208}
207209
208210/// Retrieve the partition / partition type GUID of the device root `path`.
209211/// This only works on GPT partitions. If the root is not a GPT partition, None is returned.
212+ /// If the GUID is all zeros, this will return None.
210213pub fn partition_guid ( path : & DevicePath , form : PartitionGuidForm ) -> Result < Option < Guid > > {
211214 // Clone the path so we can pass it to the UEFI stack.
212215 let path = path. to_boxed ( ) ;
@@ -238,7 +241,8 @@ pub fn partition_guid(path: &DevicePath, form: PartitionGuidForm) -> Result<Opti
238241 // Match the form of the partition GUID.
239242 PartitionGuidForm :: Partition => entry. unique_partition_guid ,
240243 PartitionGuidForm :: PartitionType => entry. partition_type_guid . 0 ,
241- } ) )
244+ } )
245+ . filter ( |guid| !guid. is_zero ( ) ) )
242246 } else {
243247 Ok ( None )
244248 }
You can’t perform that action at this time.
0 commit comments