mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
blockdev: Let fetch_ioctl() return ErrorOr<void>
This commit is contained in:
parent
66a68a9523
commit
a7dafacced
1 changed files with 5 additions and 8 deletions
|
@ -8,17 +8,14 @@
|
|||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
static void fetch_ioctl(int fd, int request)
|
||||
static ErrorOr<void> fetch_ioctl(int fd, int request)
|
||||
{
|
||||
u64 value;
|
||||
if (ioctl(fd, request, &value) < 0) {
|
||||
perror("ioctl");
|
||||
exit(1);
|
||||
}
|
||||
TRY(Core::System::ioctl(fd, request, &value));
|
||||
outln("{}", value);
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
@ -46,10 +43,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (flag_get_disk_size) {
|
||||
fetch_ioctl(fd, STORAGE_DEVICE_GET_SIZE);
|
||||
TRY(fetch_ioctl(fd, STORAGE_DEVICE_GET_SIZE));
|
||||
}
|
||||
if (flag_get_block_size) {
|
||||
fetch_ioctl(fd, STORAGE_DEVICE_GET_BLOCK_SIZE);
|
||||
TRY(fetch_ioctl(fd, STORAGE_DEVICE_GET_BLOCK_SIZE));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue