mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
fix: ensure partitions are recognized after fdisk and fix AHCI slot bug
This commit is contained in:
@@ -362,5 +362,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (ret != 0) { printf("[ERROR] Partition write failed.\n"); return 1; }
|
||||
printf("Partition table written to /dev/%s.\n", devname);
|
||||
|
||||
sys_disk_rescan(devname);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
26
src/userland/cli/rescan.c
Normal file
26
src/userland/cli/rescan.c
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2023-2026 Chris (boreddevnl)
|
||||
// This software is released under the GNU General Public License v3.0. See LICENSE file for details.
|
||||
#include "../libc/syscall.h"
|
||||
#include "../libc/stdio.h"
|
||||
#include "../libc/string.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) {
|
||||
printf("Usage: rescan /dev/DEVICE\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *devname = argv[1];
|
||||
if (devname[0] == '/' && devname[1] == 'd' && devname[2] == 'e' && devname[3] == 'v' && devname[4] == '/')
|
||||
devname += 5;
|
||||
|
||||
printf("Rescanning /dev/%s...\n", devname);
|
||||
int ret = sys_disk_rescan(devname);
|
||||
if (ret != 0) {
|
||||
printf("[ERROR] Rescan failed (ret=%d)\n", ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Done.\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user