/** * @brief A simple command for displaying some info. * Displays some information about the currently mounted parttion. * * The accesing of the FF_PARTITION object is not recommended as this object * is subject to change in future versions. * **/ int info_cmd(int argc, char **argv, FF_ENVIRONMENT *pEv) { FF_IOMAN *pIoman = pEv->pIoman; FF_PARTITION *pPart = pEv->pIoman->pPartition; if(argc == 1) { switch(pPart->Type) { case FF_T_FAT32: cons_printf("FAT32 Formatted\n"); break; case FF_T_FAT16: cons_printf("FAT16 Formatted\n"); break; case FF_T_FAT12: cons_printf("FAT12 Formatted\n"); break; } cons_printf("FullFAT Driver Blocksize: \t%d\n", pIoman->BlkSize); cons_printf("Partition Blocksize: \t\t%d\n", pPart->BlkSize); cons_printf("Cluster Size: \t\t\t%dKb\n", (pPart->BlkSize * pPart->SectorsPerCluster) / 1024); #ifdef FF_64_NUM_SUPPORT cons_printf("Volume Size: \t\t\t%llu (%d MB)\n", FF_GetVolumeSize(pIoman), (unsigned int) (FF_GetVolumeSize(pIoman) / 1048576)); cons_printf("Volume Free: \t\t\t%llu (%d MB)\n", FF_GetFreeSize(pIoman), (unsigned int) (FF_GetFreeSize(pIoman) / 1048576)); #else cons_printf("Volume Size: \t\t\t%lu (%d MB)\n", FF_GetVolumeSize(pIoman), (unsigned int) (FF_GetVolumeSize(pIoman) / 1048576)); cons_printf("Volume Free: \t\t\t%lu (%d MB)\n", FF_GetFreeSize(pIoman), (unsigned int) (FF_GetFreeSize(pIoman) / 1048576)); #endif } else { cons_printf("Usage: %s\n", argv[0]); } return 0; }
int fsinfo_cmd(int argc, char **argv, FF_ENVIRONMENT *pEnv) { FF_IOMAN *pIoman = pEnv->pIoman; FF_PARTITION *pPart = pIoman->pPartition; char *fatType; switch(pIoman->pPartition->Type) { case FF_T_FAT32:{ fatType = "FAT32"; break; } case FF_T_FAT16:{ fatType = "FAT16"; break; } case FF_T_FAT12: { fatType = "FAT12"; break; } } printf("Media Format : %s\n", fatType); printf("FullFAT Driver Blocksize: %d\n", pIoman->BlkSize); printf("Partition Blocksize : %d\n", pPart->BlkSize); printf("Total Clusters : %lu\n", pPart->NumClusters); printf("Cluster Size : %fKb\n", (float)(pPart->BlkSize * pPart->SectorsPerCluster) / 1024.0); #ifdef FF_64_NUM_SUPPORT printf("Volume Size : %llu (%d MB)\n", FF_GetVolumeSize(pIoman), (unsigned int) (FF_GetVolumeSize(pIoman) / 1048576)); printf("Volume Free : %llu (%d MB)\n", FF_GetFreeSize(pIoman, NULL), (unsigned int) (FF_GetFreeSize(pIoman, NULL) / 1048576)); #else printf("Volume Size : %lu (%d MB)\n", FF_GetVolumeSize(pIoman), (unsigned int) (FF_GetVolumeSize(pIoman) / 1048576)); printf("Volume Free : %lu (%d MB)\n", FF_GetFreeSize(pIoman, NULL), (unsigned int) (FF_GetFreeSize(pIoman, NULL) / 1048576)); #endif return 0; }