資源簡介
linux ext2 文件系統模擬 c語言實現
我從google上下了修改些代碼增加了一些東西
對學習ext2文件系統很有幫助

代碼片段和文件信息
/*
*?app.c
*/
#include?
#include?
#include?“sim_ext2.h“
int?main(int?argcchar?**argv)
{
????char?command[10]temp[9];
????initialize_memory();
????while(1)
????{
????????printf(“%s]#“current_path);
????????scanf(“%s“command);
????????if(!strcmp(command“cd“))
????????{
????????????scanf(“%s“temp);
????????????cd(temp);
????????}
????????else?if(!strcmp(command“mkdir“))
????????{
????????????scanf(“%s“temp);
????????????mkdir(temp2);
????????}
????????else?if(!strcmp(command“mkf“))
????????{
????????????scanf(“%s“temp);
????????????mkdir(temp1);
????????}
????????else?if(!strcmp(command“rmdir“))
????????{
????????????scanf(“%s“temp);
????????????rmdir(temp);
????????}
????????else?if(!strcmp(command“rm“))
????????{
????????????scanf(“%s“temp);
????????????del(temp);
????????}
????????else?if(!strcmp(command“open“))
????????{
????????????scanf(“%s“temp);
????????????open_file(temp);
????????}
????????else?if(!strcmp(command“close“))
????????{
????????????scanf(“%s“temp);
????????????close_file(temp);
????????}
????????else?if(!strcmp(command“read“))
????????{
????????????scanf(“%s“temp);
????????????read_file(temp);
????????}
????????else?if(!strcmp(command“write“))
????????{
????????????scanf(“%s\n“temp);
????????????write_file(temp);
????????}
????????else?if(!strcmp(command“ls“))
????????{
???????? ls();
????????}
????????else?if(!strcmp(command“format“))
????????{
????????????char?tempch;
????????????printf(“Format?will?erase?all?the?data?in?the?Disk\n“);
????????????printf(“Are?you?sure?y/n:\n“);
????????????fflush(stdin);
????????????scanf(“?%c“&tempch);
????????????if(tempch==‘Y‘||tempch==‘y‘)
????????????{
????????????????format();
????????????}
????????????else
????????????{
???????????? printf(“Format?Disk?canceled\n“);
????????????}
????????}
????????else?if(!strcmp(command“help“)||!strcmp(command“h“))
????????{
???????? help();
????????}
????????else?if(!strcmp(command“ckdisk“))
????????{
???????? check_disk();
????????}
????????else?if(!strcmp(command“quit“))
????????{
???????? break;
????????}
????????else?printf(“No?this?CommandPlease?check!\n“);
????}
????return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2266??2010-10-15?12:22??sim_ext2_fs\app.c
?????文件???????6596??2010-10-15?12:22??sim_ext2_fs\app.o
?????文件????????351??2010-10-14?16:02??sim_ext2_fs\Makefile
?????文件??????28941??2010-10-15?12:25??sim_ext2_fs\simulator.c
?????文件???????4361??2010-10-15?11:25??sim_ext2_fs\simulator.h
?????文件??????32468??2010-10-15?12:25??sim_ext2_fs\simulator.o
?????文件??????34775??2010-10-15?12:25??sim_ext2_fs\sim_ext2
?????文件????????577??2010-10-15?11:11??sim_ext2_fs\sim_ext2.h
?????文件????2361344??2010-10-15?12:24??sim_ext2_fs\sim_hd\FS_zqw_zzw.txt
?????目錄??????????0??2010-10-15?22:02??sim_ext2_fs\sim_hd
?????目錄??????????0??2010-10-15?22:02??sim_ext2_fs
-----------?---------??----------?-----??----
??????????????2471679????????????????????11
- 上一篇:拋物線法—二次插值法C++編程
- 下一篇:C語言模擬文件系統
評論
共有 條評論