mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
Utilities: Add way to get a storage devices block size in blockdev
This commit is contained in:
parent
b2e57f555b
commit
410d81706d
1 changed files with 5 additions and 0 deletions
|
@ -40,10 +40,12 @@ int main(int argc, char** argv)
|
|||
const char* device = nullptr;
|
||||
|
||||
bool flag_get_disk_size = false;
|
||||
bool flag_get_block_size = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Call block device ioctls");
|
||||
args_parser.add_option(flag_get_disk_size, "Get size in bytes", "size", 's');
|
||||
args_parser.add_option(flag_get_block_size, "Get block size in bytes", "block-size", 'b');
|
||||
args_parser.add_positional_argument(device, "Device to query", "device");
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
|
@ -56,6 +58,9 @@ int main(int argc, char** argv)
|
|||
if (flag_get_disk_size) {
|
||||
fetch_ioctl(fd, STORAGE_DEVICE_GET_SIZE);
|
||||
}
|
||||
if (flag_get_block_size) {
|
||||
fetch_ioctl(fd, STORAGE_DEVICE_GET_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue