操作系統(tǒng)綜合實驗文件系統(tǒng)設(shè)計_第1頁
操作系統(tǒng)綜合實驗文件系統(tǒng)設(shè)計_第2頁
操作系統(tǒng)綜合實驗文件系統(tǒng)設(shè)計_第3頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、華北科技學院計算機學院綜合性實驗實 驗 報 告課程名稱操作系統(tǒng)實驗學期2020至2021學年第 2學 學生所在院部計算機學院年級2018專業(yè)班級網(wǎng)絡(luò)B181學生姓名梁英學號201807024122成績評定:1、工作量:A(E()2、難易度:A(E()3、報告規(guī)范度:A(E()4總評成績:指導教師:A(E()計算機學院制華北科技學院計算機學院綜合性實驗報告華北科技學院計算機學院綜合性實驗報告第 第7頁操作系統(tǒng)課程綜合性實驗報告開課實驗室:大軟機房2020 年 5 月20 日實驗題目一、實驗?zāi)康暮唵挝募到y(tǒng)設(shè)計用高級語言C+Java等)深入了解文件操作命令的內(nèi)容和執(zhí)行過程,掌握它們的實施方法,加深

2、對文件管理 內(nèi)容的理解。二、設(shè)備與環(huán)境Linux 操作系統(tǒng)環(huán)境,使用編輯器和 GCC 編譯器編寫和編譯程序。三、實驗內(nèi)容及要求設(shè)計一個簡單文件系統(tǒng),采用二級文件目錄結(jié)構(gòu)。設(shè)置主文件目錄(MFD)和用戶文件目錄UF文件目錄,即文件名、讀取權(quán)限、文件長度以及它們存放的位置等。四、實驗結(jié)果及分析關(guān)鍵代碼及分析創(chuàng)建用戶void initUser(MFD *mfd)for(int i = 1 ; i = 3 ; i+) /初始化十個不同用戶Map *m ;m = (Map*)malloc(sizeof(Map) ; if(m = NULL) exit(0) ; coutm-userName ;m-fil

3、e = NULL ; m-next = NULL if(mfd-head = NULL) mfd-head = mfd-tail = m ; elsemfd-tail-next = m ; mfd-tail = m ; create指令int createFile(Map *user , char file_name , int file_protect3 , int file_length)File *file ;file = (File*)malloc(sizeof(File) ; if(file = NULL)return false ;strcpy(file-file_name , f

4、ile_name) ; /進行文件的初始化file-file_protect0 = file_protect0 ;file-file_protect1 = file_protect1 ; file-file_protect2 = file_protect2 ; file-file_length = file_length ;file-read = file-write = file-save =0 ; file-next = NULL ;if(user-file = NULL)user-file = file ;elseFile *op , *preOp = NULL ; op = user-

5、file ;while(op) /查找是否存在同名文件if(strcmp(op-file_name , file-file_name) = 0)cout文件名 file_name 已被創(chuàng)建 ! next preOp-next = file ;展示文件內(nèi)容效果void displayOpenFile(AFD *afd , Map *user)coutThe open file of userName : head while(file)coutfile_namefile_protect0file_protect2 file_length ;coutreadcout : read writecou

6、t : write savecout : savenext ;打開文件int openFile(Map *user , char file_name , AFD *afd , int open_file_protect)File *file = NULL ; file = user-file ; while(file)if(strcmp(file-file_name , file_name) = 0)break ;file = file-next ;if(file)File *xfile ;xfile = (File*)malloc(sizeof(File) ; if(xfile = NULL

7、)return false ;*xfile = *file ;/根據(jù)文件的權(quán)限進行打開權(quán)限的賦值if(xfile-file_protect0 = open_file_protect0)xfile-open_file_protect0 = open_file_protect0 ;elsecoutno read priority ! file_protect1 = open_file_protect1)xfile-open_file_protect1 = open_file_protect1 ;elsecoutno write priority ! file_protect2 = open_fil

8、e_protect2)xfile-open_file_protect2 = open_file_protect2 ;elsecoutno excute priority ! next = NULL ; if(afd-head = NULL)afd-head = afd-tail = xfile ; afd-current_open += 1 ;else if(afd-current_open max_open)afd-tail-next = xfile ; afd-tail = xfile ;afd-current_open += 1 ;elsecoutThe open file is too many ! endl ; return false ;elsecout文件 file_name 不存在 !endl ; return false ;結(jié)果及分析注冊用戶并登錄Create建立文件功能Open打開文件功能Close 關(guān)閉文件功能、read 寫和讀文件功能Delete 刪除文件功能Exit 退出當前用戶心得體會首先在編譯之前要將代碼的txt 文件改為.c 文件,其次在終端編譯時要注意一點,編譯指令為“G+*.gcc*.C+代碼,所以

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論