Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bootloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jacob Lorentzon
bootloader
Commits
b421f3d9
Verified
Commit
b421f3d9
authored
2 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Print harddrive device path correctly
parent
d6cad7c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/os/uefi/device.rs
+28
-2
28 additions, 2 deletions
src/os/uefi/device.rs
with
28 additions
and
2 deletions
src/os/uefi/device.rs
+
28
−
2
View file @
b421f3d9
...
@@ -257,8 +257,34 @@ pub fn device_path_to_string(device_path: &DevicePath) -> String {
...
@@ -257,8 +257,34 @@ pub fn device_path_to_string(device_path: &DevicePath) -> String {
Ok
(
sub_type
)
=>
match
sub_type
{
Ok
(
sub_type
)
=>
match
sub_type
{
DevicePathMediaType
::
Harddrive
if
node_data
.len
()
==
mem
::
size_of
::
<
DevicePathHarddrive
>
()
=>
{
DevicePathMediaType
::
Harddrive
if
node_data
.len
()
==
mem
::
size_of
::
<
DevicePathHarddrive
>
()
=>
{
let
harddrive
=
unsafe
{
ptr
::
read
(
node_data
.as_ptr
()
as
*
const
DevicePathHarddrive
)
};
let
harddrive
=
unsafe
{
ptr
::
read
(
node_data
.as_ptr
()
as
*
const
DevicePathHarddrive
)
};
//TODO: print signature
match
harddrive
.signature_type
{
write!
(
s
,
"HD(0x{:X},0x{:X})"
,
harddrive
.partition_number
,
harddrive
.signature_type
)
1
=>
{
let
id
=
unsafe
{
ptr
::
read
(
harddrive
.partition_signature
.as_ptr
()
as
*
const
u32
)
};
write!
(
s
,
"HD(0x{:X},MBR,0x{:X})"
,
harddrive
.partition_number
,
id
)
},
2
=>
{
let
guid
=
unsafe
{
ptr
::
read
(
harddrive
.partition_signature
.as_ptr
()
as
*
const
Guid
)
};
write!
(
s
,
"HD(0x{:X},GPT,{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X})"
,
harddrive
.partition_number
,
guid
.0
,
guid
.1
,
guid
.2
,
guid
.3
[
0
],
guid
.3
[
1
],
guid
.3
[
2
],
guid
.3
[
3
],
guid
.3
[
4
],
guid
.3
[
5
],
guid
.3
[
6
],
guid
.3
[
7
],
)
},
_
=>
{
write!
(
s
,
"HD(0x{:X},0x{:X},{:X?})"
,
harddrive
.partition_number
,
harddrive
.signature_type
,
harddrive
.partition_signature
)
}
}
},
},
DevicePathMediaType
::
Filepath
=>
{
DevicePathMediaType
::
Filepath
=>
{
for
chunk
in
node_data
.chunks_exact
(
2
)
{
for
chunk
in
node_data
.chunks_exact
(
2
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment