コード例 #1
0
ファイル: rfs.c プロジェクト: karajrish/OS
//============= TESTING APPLICATION USING THESE FS CALLS ==============
// Menu driven testing application for creation of fs, 
// and all file and directory related operations
int main(int argc, char** argv){
	int fd = openDevice(0);
	init_FS(fd);
	makeDir(fd, "Folder 1", 1, 1, 1);
	makeDir(fd, "Folder 2", 1, 1, 1);
	makeDir(fd, "Folder 3", 1, 1, 1);
	removeDir(fd, "Folder 2");
	int dirhandle = openDir(fd, "Folder 1");
	closeDir(dirhandle);
	shutdownDevice(0);
}
コード例 #2
0
ファイル: single_fs.c プロジェクト: shane-Git/Sample-OS
int Console(struct FCB *InFCB,struct Sector *InSector,char *InBitMap)
{
    for(;;)
    {
        char inc[10];
        int choice=0;
        printf(">?");
        gets(inc);
        if(strcmp(inc,"format")==0)
        {
            choice=1;
        }
        if(strcmp(inc,"ls")==0)
        {
            choice=2;
        }
        if(strcmp(inc,"touch")==0)
        {
            choice=3;
        }
        if(strcmp(inc,"rm")==0)
        {
            choice=4;
        }
        if(strcmp(inc,"write")==0)
        {
            choice=5;
        }
        if(strcmp(inc,"read")==0)
        {
            choice=6;
        }
        if(strcmp(inc,"exit")==0)
        {
            choice=10;
        }
        switch(choice)
        {
            case (1):
            {
                init_FS(InFCB,InSector,InBitMap);
                break;
            }
            case (2):
            {
                List(InFCB,InSector,InBitMap);
                break;
            }
            case (3):
            {
                Create(InFCB,InSector,InBitMap);
                break;
            }
            case (4):
            {
                Delete(InFCB,InSector,InBitMap);
                break;
            }
            case (5):
            {
                Write(InFCB,InSector,InBitMap);
                break;
            }
            case (6):
            {
                Read(InFCB,InSector,InBitMap);
                break;
            }
            case (10):
            {
                return(0);
                break;
            }
            default:
            {
                printf("Can't find Console\n");
                break;
            }
        }
    }
}