From 4e9e21b3b1854d26c5d78a702e8401d98380ddd6 Mon Sep 17 00:00:00 2001 From: Christoph Baumann Date: Tue, 22 Apr 2025 14:25:14 +0200 Subject: [PATCH] move boot_storage.h/.c to bdk/storage, check result of ensure_partition --- {bootloader => bdk}/storage/boot_storage.c | 0 {bootloader => bdk}/storage/boot_storage.h | 0 bootloader/hos/hos.c | 2 +- bootloader/l4t/l4t.c | 2 +- bootloader/libs/fatfs/diskio.c | 10 ++++++++-- bootloader/main.c | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) rename {bootloader => bdk}/storage/boot_storage.c (100%) rename {bootloader => bdk}/storage/boot_storage.h (100%) diff --git a/bootloader/storage/boot_storage.c b/bdk/storage/boot_storage.c similarity index 100% rename from bootloader/storage/boot_storage.c rename to bdk/storage/boot_storage.c diff --git a/bootloader/storage/boot_storage.h b/bdk/storage/boot_storage.h similarity index 100% rename from bootloader/storage/boot_storage.h rename to bdk/storage/boot_storage.h diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index 54017371..1466421a 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -28,7 +28,7 @@ #include "../frontend/fe_tools.h" #include "../config.h" #include "../storage/emummc.h" -#include "../storage/boot_storage.h" +#include extern hekate_config h_cfg; diff --git a/bootloader/l4t/l4t.c b/bootloader/l4t/l4t.c index f4da3b29..18161f9a 100644 --- a/bootloader/l4t/l4t.c +++ b/bootloader/l4t/l4t.c @@ -25,7 +25,7 @@ #include "../hos/pkg1.h" #include "l4t.h" #include "l4t_config.inl" -#include "../storage/boot_storage.h" +#include /* * API Revision info diff --git a/bootloader/libs/fatfs/diskio.c b/bootloader/libs/fatfs/diskio.c index d4e84537..3404bc4a 100644 --- a/bootloader/libs/fatfs/diskio.c +++ b/bootloader/libs/fatfs/diskio.c @@ -69,6 +69,10 @@ DRESULT disk_read ( UINT count /* Number of sectors to read */ ) { + if(!ensure_partition(pdrv)){ + return RES_ERROR; + } + sdmmc_storage_t *storage = &sd_storage; u32 actual_sector = sector; switch(pdrv){ @@ -87,7 +91,6 @@ DRESULT disk_read ( } - ensure_partition(pdrv); return sdmmc_storage_read(storage, actual_sector, count, buff) ? RES_OK : RES_ERROR; } @@ -102,6 +105,10 @@ DRESULT disk_write ( UINT count /* Number of sectors to write */ ) { + if(!ensure_partition(pdrv)){ + return RES_ERROR; + } + sdmmc_storage_t *storage = &sd_storage; u32 actual_sector = sector; switch(pdrv){ @@ -120,7 +127,6 @@ DRESULT disk_write ( } - ensure_partition(pdrv); return sdmmc_storage_write(storage, actual_sector, count, (void*)buff) ? RES_OK : RES_ERROR; } diff --git a/bootloader/main.c b/bootloader/main.c index 0f41cdf3..0ce15adc 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -31,7 +31,7 @@ #include #include #include "storage/emummc.h" -#include "storage/boot_storage.h" +#include #include "frontend/fe_tools.h" #include "frontend/fe_info.h"