Show how much space is free on NAND itself

This commit is contained in:
Pk11 2022-01-15 02:57:45 -06:00
parent 0c0dcc3e5e
commit 8f203aa5c5
3 changed files with 49 additions and 34 deletions

View File

@ -512,15 +512,6 @@ unsigned long long getDsiSize()
return 1024 * BYTES_PER_BLOCK;
}
unsigned long long getDsiRealFree()
{
struct statvfs st;
if (statvfs(sdnandMode ? "sd:/" : "nand:/", &st) == 0)
return st.f_bsize * st.f_bavail;
return 0;
}
unsigned long long getDsiFree()
{
u32 blockSize = getDsiClusterSize();
@ -544,6 +535,24 @@ unsigned long long getDsiFree()
return (realFree < size) ? realFree : size;
}
unsigned long long getDsiRealSize()
{
struct statvfs st;
if (statvfs(sdnandMode ? "sd:/" : "nand:/", &st) == 0)
return st.f_bsize * st.f_blocks;
return 0;
}
unsigned long long getDsiRealFree()
{
struct statvfs st;
if (statvfs(sdnandMode ? "sd:/" : "nand:/", &st) == 0)
return st.f_bsize * st.f_bavail;
return 0;
}
u32 getDsiClusterSize()
{
struct statvfs st;

View File

@ -41,8 +41,9 @@ unsigned long long getSDCardFree();
//internal storage
unsigned long long getDsiSize();
unsigned long long getDsiRealFree();
unsigned long long getDsiFree();
unsigned long long getDsiRealSize();
unsigned long long getDsiRealFree();
u32 getDsiClusterSize();
#define getDsiUsed() (getDSIStorageSize() - getDSIStorageFree())

View File

@ -17,53 +17,58 @@ void testMenu()
//home menu slots
{
iprintf("Free Home Menu Slots:\n");
swiWaitForVBlank();
free = getMenuSlotsFree();
iprintf("\t%d / ", free);
swiWaitForVBlank();
size = getMenuSlots();
iprintf("%d\n", size);
swiWaitForVBlank();
}
//dsi menu
{
iprintf("\nFree DSi Menu Space:\n\t");
free = getDsiFree();
printBytes(free);
iprintf(" / ");
size = getDsiSize();
printBytes(size);
iprintf("\n");
iprintf("\t%d / %d blocks\n", free / BYTES_PER_BLOCK, size / BYTES_PER_BLOCK);
}
//nand
if (!sdnandMode)
{
iprintf("\nFree NAND Space:\n\t");
free = getDsiRealFree();
printBytes(free);
iprintf(" / ");
size = getDsiRealSize();
printBytes(size);
iprintf("\n");
}
//SD Card
{
iprintf("\nFree SD Space:\n\t");
swiWaitForVBlank();
unsigned long long sdfree = getSDCardFree();
printBytes(sdfree);
iprintf(" / ");
swiWaitForVBlank();
unsigned long long sdsize = getSDCardSize();
printBytes(sdsize);
iprintf("\n");
swiWaitForVBlank();
printf("\t%d / %d blocks\n", (unsigned int)(sdfree / BYTES_PER_BLOCK), (unsigned int)(sdsize / BYTES_PER_BLOCK));
}
//Emunand
{
iprintf("\nFree DSi Space:\n\t");
swiWaitForVBlank();
free = getDsiFree();
printBytes(free);
iprintf(" / ");
swiWaitForVBlank();
size = getDsiSize();
printBytes(size);
iprintf("\n");
swiWaitForVBlank();
iprintf("\t%d / %d blocks\n", free / BYTES_PER_BLOCK, size / BYTES_PER_BLOCK);
}
//end
iprintf("\nBack - [B]\n");
keyWait(KEY_B);