fsexplorer.c
140 lines
| 4.1 KiB
| text/x-c
|
CLexer
r12 | /*------------------------------------------------------------------------------ | |||
-- This file is a part of the libuc, microcontroler library | ||||
-- Copyright (C) 2012, Alexis Jeandet | ||||
-- | ||||
-- This program is free software; you can redistribute it and/or modify | ||||
-- it under the terms of the GNU General Public License as published by | ||||
-- the Free Software Foundation; either version 3 of the License, or | ||||
-- (at your option) any later version. | ||||
-- | ||||
-- This program is distributed in the hope that it will be useful, | ||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
-- GNU General Public License for more details. | ||||
-- | ||||
-- You should have received a copy of the GNU General Public License | ||||
-- along with this program; if not, write to the Free Software | ||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
------------------------------------------------------------------------------- | ||||
-- Author : Alexis Jeandet | ||||
-- Mail : alexis.jeandet@gmail.com | ||||
-------------------------------------------------------------------------------*/ | ||||
#include "fsexplorer.h" | ||||
int fsexplprintSector(blkdevice* dev,unsigned int sectorIndex) | ||||
{ | ||||
char sector[512]; | ||||
if(dev) | ||||
{ | ||||
libucprintf("\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("============== S E C T O R V I E W E R ==============\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("Print sector N°%d\n\r",sectorIndex); | ||||
dev->read(dev,sector,sectorIndex,1); | ||||
hexviewershow(sector,512,sectorIndex*512); | ||||
libucprintf("\n\r"); | ||||
libucprintf("________________________________________________________\n\r"); | ||||
} | ||||
} | ||||
int fsexplprintPartInfos(dikpartition* part) | ||||
{ | ||||
char sector[512]; | ||||
if(part) | ||||
{ | ||||
libucprintf("\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("=== P A R T I T I O N I N F O s P R I N T E R ====\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
part->phy->read(part->phy,sector,part->LBABegin,1); | ||||
hexviewershow(sector,512,0); | ||||
libucprintf("\n\r"); | ||||
libucprintf("FAT32 PART lba begin = %d\n\r",0xFFFF & part->LBABegin); | ||||
libucprintf("________________________________________________________\n\r"); | ||||
} | ||||
} | ||||
int fsexplprintBootSector(blkdevice* dev) | ||||
{ | ||||
char sector[512]; | ||||
if(dev) | ||||
{ | ||||
libucprintf("\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("======== B O O T S E C T O R P R I N T E R =======\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
dev->read(dev,sector,0,1); | ||||
hexviewershow(sector,512,0); | ||||
libucprintf("\n\r"); | ||||
libucprintf("________________________________________________________\n\r"); | ||||
} | ||||
} | ||||
int fsexplprintDirentInfos(ucdirent* dirent) | ||||
{ | ||||
if(dirent) | ||||
{ | ||||
libucprintf("\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("======== E N T R Y I N F O P R I N T E R =======\n\r"); | ||||
libucprintf("========================================================\n\r"); | ||||
libucprintf("Entry Name:\t"); | ||||
libucprintf(dirent->DIR_Name); | ||||
libucprintf("\n\r"); | ||||
libucprintf("--------------------------------------------------------\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_READ_ONLY)libucprintf("This entry is read only\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_HIDDEN)libucprintf("This entry is hidden\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_SYSTEM)libucprintf("This entry is a system file/folder\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_VOLUME_ID)libucprintf("This entry is the root entry of the system\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_DIRECTORY)libucprintf("This entry is a directory\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_ARCHIVE)libucprintf("This entry is an archive\n\r"); | ||||
if(dirent->DIR_Attr&ATTR_LONGNAME)libucprintf("This entry is a long name entry\n\r"); | ||||
libucprintf("In sector %d\n\r",dirent->CurrentSec); | ||||
libucprintf("Entry %d\n\r",dirent->Currententry); | ||||
libucprintf("________________________________________________________\n\r"); | ||||
return 0; | ||||
} | ||||
return 1; | ||||
} | ||||