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

  • 大小: 7KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-27
  • 語言: C/C++
  • 標簽: VFS??

資源簡介

對Linux文件系統用C語言進行模擬,在Windows 下建立自己的小型二級文件系統,并在自已建立的文件系統之上進行一系列的操作,包括文件系統的建立,對索引結點和目錄文件的操作,目錄的安全性設置,目錄的檢索以及文件的共享等。

資源截圖

代碼片段和文件信息

#include
#include“head.h“
#include
#include
struct?hinode?hinode[NHINO];
struct?dir?dir;
struct?pwd?pwd[PWDNUM];
struct?user?user[USERNUM];
struct?inode?*cur_path_inode;
int?user_id;
int?user_gid;
int?login1;
int?infile;//判斷是否是查詢。
FILE?*fd;
struct?filsys?filsys;?
struct?listid?listid;
struct?inode?*iget(unsigned?int?dinodeid)
{
int?exited=0;
unsigned?int?inodeid;
long?addr;
struct?inode?*temp*newinode;
inodeid=dinodeid%NHINO;
if(hinode[inodeid].i_forw?==NULL)exited=0;
else
{
temp=hinode[inodeid].i_forw?;
while(temp)
{
if(temp->i_ino?==inodeid)
{
exited=1;
temp->i_count++;
return?temp;
}
else
temp=temp->i_forw?;
};
}
addr=DINODESTART+dinodeid*DINODESIZ;
newinode=(struct?inode*)malloc(sizeof(struct?inode));
fseek(fdaddr0);
fread(&(newinode->di_number)DINODESIZ1fd);
newinode->i_count?=1;
newinode->i_flag?=0;
newinode->i_ino?=dinodeid;
return?newinode;??
}
void?iput(struct?inode?*pinode)
{
long?addr;

if(pinode->i_count>1)
{
pinode->i_count--;
return;
}
else
if(pinode->di_number!=0)
{
addr=DINODESTART+pinode->i_ino*DINODESIZ;
fseek(fdaddr0);
fwrite(&pinode->di_numberDINODESIZ1fd);
}
}
void??format()
{
struct?inode?*inode;
struct?direct?dir_buf[BLOCKSIZ/(DIRSIZ+2)];
struct?pwd?pwd[BLOCKSIZ/(PWDSIZ+4)];
char?*buf;
int?i;
??fd=fopen(“filesystem““wb+“);
??buf=(char*)malloc((DINODEBLK+FILEBLK+2)*BLOCKSIZ*sizeof(char));
if(buf==NULL)

{printf(“\nfile?system?creat?failed!!!\n“);
exit(0);
}
fseek(fd00);
fwrite(buf1(DINODEBLK+FILEBLK+2)*BLOCKSIZ*sizeof(char)fd);
pwd[0].p_uid?=111;pwd[0].p_gid=01;
strcpy(pwd[0].password“aaa“);
pwd[1].p_uid?=222;pwd[1].p_gid=01;
strcpy(pwd[1].password“bbb“);
pwd[2].p_uid?=333;pwd[2].p_gid=02;
strcpy(pwd[2].password“ccc“);
pwd[3].p_uid?=444;pwd[3].p_gid=03;
strcpy(pwd[3].password“ddd“);
pwd[4].p_uid?=555;pwd[4].p_gid=04;
strcpy(pwd[4].password“eee“);
inode=iget(0);
inode->di_mode=DIEMPTY;
iput(inode);

inode=iget(1);
inode->di_number=1;
inode->di_mode=DIDIR|DEFAULTMODE;
inode->di_size=3*(DIRSIZ+2);
inode->di_addr[0]=0;
strcpy(dir_buf[0].d_name“..“);
dir_buf[0].d_ino=1;
strcpy(dir_buf[1].d_name“.“);
dir_buf[1].d_ino=1;
strcpy(dir_buf[2].d_name“etc“);
dir_buf[2].d_ino=2;
fseek(fdDATASTART0);
fwrite(dir_buf13*(DIRSIZ+2)fd);
iput(inode);

inode=iget(2);
inode->di_number=1;
inode->di_mode=DIDIR|DEFAULTMODE;
inode->di_size=3*(DIRSIZ+2);
inode->di_addr[0]=1;
strcpy(dir_buf[0].d_name“..“);
dir_buf[0].d_ino=1;
strcpy(dir_buf[1].d_name“.“);
dir_buf[1].d_ino=2;
strcpy(dir_buf[2].d_name“pwd“);
dir_buf[2].d_ino=3;
fseek(fdDATASTART+BLOCKSIZ*10);
fwrite(dir_buf13*(DIRSIZ+2)fd);
iput(inode);

inode=iget(3);
inode->di_number=1;
inode->di_mode=DIFILE;
inode->di_size=3*(DIRSIZ+2);
inode->di_addr[0]=2;
for(i=5;i{
pwd[i].p_gid=0;
pwd[i].p_uid=0;
strcpy(pwd[i].password“aaaaaaaaaaa

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

?????文件???????2429??2004-05-09?16:41??Linux\head.h

?????文件???????4330??2004-03-23?21:33??Linux\linux.dsp

?????文件????????535??2004-03-23?20:42??Linux\linux.dsw

?????文件??????21967??2004-05-27?21:33??Linux\main.cpp

????...D..R?????????0??2007-08-12?22:16??Linux

-----------?---------??----------?-----??----

????????????????29261????????????????????5


評論

共有 條評論

相關資源