91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4.06MB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2023-09-19
  • 語言: 其他
  • 標簽: 文件系統??

資源簡介

1.開辟100M的硬盤空間,作為設定的硬盤空間。 2.模擬Linux文件系統,功能如下: (1)info: 顯示整個系統信息 (2)cd …: 改變目錄:改變當前工作目錄,目錄不存在時給出出錯信息。 (3)dir …: 顯示目錄:顯示指定目錄下或當前目錄下的信息,包括文件名、物理地址、保護碼、文件長度、子目錄等(帶/s參數的dir命令,顯示所有子目錄)。 (4)md …: 創建目錄:在指定路徑或當前路徑下創建指定目錄。重名時給出錯信息。 (5)rd …: 刪除目錄:刪除指定目錄下所有文件和子目錄。要刪目錄不空時,要給出提示是否要刪除。 (6)newfile …: 建立文件。 (7)cat …: 打開文件。 (8)copy …: 拷貝文件,除支持模擬Linux文件系統內部的文件拷貝外,還支持host文件系統與模擬Linux文件系統間的文件拷貝。 (9)del …: 刪除文件:刪除指定文件,不存在時給出出錯信息。 (10)check:檢測并恢復文件系統。 模擬文件系統的前端操作shell: 前端的shell進程和后端的simdisk進程之間利用共享內存進行進程間通信(IPC)

資源截圖

代碼片段和文件信息

/***************************************************************************************
command.cpp
所有可執行的命令,每個命令一個函數
***************************************************************************************/
#include“fs.h“
#include
#include
#include
#include
#include
//using?namespace?std;

void?fs::info()
{
int?fileNum?=?0;?//總文件數
int?dirNum?=?0;?//總目錄數
int?i;
freeSpace?=?Super.freeBlock?*?blockSize;?//空閑磁盤空間
usedSpace?=?(blockNum?-?Super.freeBlock)?*?blockSize;?//已用空間
for?(i?=?0;?i? {
if?(Inode[i].isFile?==?0)?dirNum++;
if?(Inode[i].isFile?==?1)?fileNum++;
}
cout?< cout?< cout?< cout?< cout?<}

int?fs::md(char?*path)
{

int?parent;
parent?=?getParentIndex(path);
if?((parent?!=?-2)?&&?(parent?!=?-1))?????????????????????//父目錄存在
{
int?flag;
flag?=?find(getName(path)?parent);??????????//判斷路徑是否存在
????????if?(flag!=-1)?????????????????????????????????//重名目錄
{
cout?< return?-1;
}
else
{?
if?(dirInit(parent?getName(path))?!=?-1)?????//使用Dir_Init函數
{
return?parent;
????????????}
}
}
if?(parent?==?-1)
{
cout?< ????return?-1;
}
cout?<????return?-1;
}

int?fs::rd(char?*?path)
{
// HANDLE?shell?=?OpenSemaphore(SEMAPHORE_ALL_ACCESS?TRUE?“shell“);
// HANDLE?disk?=?OpenSemaphore(SEMAPHORE_ALL_ACCESS?TRUE?“disk“);
int?parent?=?getParentIndex(path);
int?flag?=?-1;
int?tmpIndex;
char?choice;
if?(parent?==?-1)
{
cout?< return?-1;
}
if?(parent?!=?-2)?//判斷要刪除的目錄是否存在
{
flag?=?find(getName(path)?parent);
if?((flag?!=?-1)?&&?(Inode[flag].isFile?==?0))
{
tmpIndex?=?flag;
if?(Inode[tmpIndex].childNum?>?0)?//刪除目錄非空
{
cout?<// map->flag?=?1;
// ReleaseSemaphore(shell?1?NULL);
// WaitForSingleobject(disk?INFINITE);?

cin?>>?choice;
// strcpy(choice?map->display);
}
if?(choice?==?‘Y‘?||?choice?==?‘y‘?||?Inode[tmpIndex].childNum?==?0)
{
delDir(tmpIndex?parent);
return?1;
}
}
}
cout?< return?-1;
}

int?fs::dir(char?*?path)
{
int?i?=?0?j?=?0;
int?parent;
int?flag;
if?(!strcmp(path?“/s“))???????????????????????//dir?/s命令,顯示所有文件和目錄
{
for?(i?=?1;?i? {
if?((Inode[i].isFile?==?0)?||?(Inode[i].isFile?==?1))
{
cout?< ????for?(j?=?strlen(getAbsolutePath(i));?j? {
cout?< }
if?(Inode[i].isFile?==?0)???????????//顯示是文件類型還是目錄類型
cout?<

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????11339??2009-02-24?22:17??DISK\command.cpp

?????文件????????615??2009-02-24?22:07??DISK\conf.cpp

?????文件??????45155??2009-02-24?22:17??DISK\Debug\command.obj

?????文件??????10954??2009-02-24?22:07??DISK\Debug\conf.obj

?????文件?????274476??2009-02-24?22:19??DISK\Debug\DISK.exe

?????文件?????358360??2009-02-24?22:19??DISK\Debug\DISK.ilk

?????文件????3750140??2009-02-24?22:19??DISK\Debug\DISK.pch

?????文件?????746496??2009-02-24?22:19??DISK\Debug\DISK.pdb

?????文件??????40944??2009-02-24?22:19??DISK\Debug\fs.obj

?????文件??????16814??2009-02-24?22:19??DISK\Debug\main.obj

?????文件??????22020??2009-02-24?22:17??DISK\Debug\shell.obj

?????文件?????189440??2009-02-24?22:19??DISK\Debug\vc60.idb

?????文件??????94208??2009-02-24?22:19??DISK\Debug\vc60.pdb

?????文件???????4618??2009-02-22?22:26??DISK\DISK.dsp

?????文件????????531??2009-02-08?22:42??DISK\DISK.dsw

?????文件?????107520??2009-02-24?22:20??DISK\DISK.ncb

?????文件??????55808??2009-02-24?22:20??DISK\DISK.opt

?????文件???????1346??2009-02-24?22:19??DISK\DISK.plg

?????文件??????14537??2009-02-24?22:19??DISK\fs.cpp

?????文件???????2634??2009-02-24?22:06??DISK\fs.h

?????文件???????1113??2009-02-24?22:18??DISK\main.cpp

?????文件???????3722??2009-02-24?22:17??DISK\shell.cpp

?????文件????????353??2009-02-24?22:07??DISK\struct.h

?????文件?????249902??2009-02-24?15:35??shell\Debug\shell.exe

?????文件?????376240??2009-02-24?15:35??shell\Debug\shell.ilk

?????文件??????67239??2009-02-24?15:35??shell\Debug\shell.obj

?????文件????5513468??2009-02-23?15:54??shell\Debug\shell.pch

?????文件?????582656??2009-02-24?15:35??shell\Debug\shell.pdb

?????文件?????214016??2009-02-24?15:35??shell\Debug\vc60.idb

?????文件?????143360??2009-02-24?15:35??shell\Debug\vc60.pdb

............此處省略28個文件信息

評論

共有 條評論